mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 10:47:35 +02:00
Simplify exception detection
This commit is contained in:
@ -54,6 +54,24 @@
|
|||||||
# define FMT_LIBCPP_VERSION 0
|
# define FMT_LIBCPP_VERSION 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Check if exceptions are disabled.
|
||||||
|
#ifdef FMT_EXCEPTIONS
|
||||||
|
// Use the provided definition.
|
||||||
|
#elif defined(__GNUC__) && !defined(__EXCEPTIONS)
|
||||||
|
# define FMT_EXCEPTIONS 0
|
||||||
|
#elif FMT_MSC_VERSION && !_HAS_EXCEPTIONS
|
||||||
|
# define FMT_EXCEPTIONS 0
|
||||||
|
#else
|
||||||
|
# define FMT_EXCEPTIONS 1
|
||||||
|
#endif
|
||||||
|
#if FMT_EXCEPTIONS
|
||||||
|
# define FMT_TRY try
|
||||||
|
# define FMT_CATCH(x) catch (x)
|
||||||
|
#else
|
||||||
|
# define FMT_TRY if (true)
|
||||||
|
# define FMT_CATCH(x) if (false)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef _MSVC_LANG
|
#ifdef _MSVC_LANG
|
||||||
# define FMT_CPLUSPLUS _MSVC_LANG
|
# define FMT_CPLUSPLUS _MSVC_LANG
|
||||||
#else
|
#else
|
||||||
@ -119,23 +137,6 @@
|
|||||||
# define FMT_CONSTEXPR20
|
# define FMT_CONSTEXPR20
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Check if exceptions are disabled.
|
|
||||||
#ifndef FMT_EXCEPTIONS
|
|
||||||
# if (defined(__GNUC__) && !defined(__EXCEPTIONS)) || \
|
|
||||||
(FMT_MSC_VERSION && !_HAS_EXCEPTIONS)
|
|
||||||
# define FMT_EXCEPTIONS 0
|
|
||||||
# else
|
|
||||||
# define FMT_EXCEPTIONS 1
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#if FMT_EXCEPTIONS
|
|
||||||
# define FMT_TRY try
|
|
||||||
# define FMT_CATCH(x) catch (x)
|
|
||||||
#else
|
|
||||||
# define FMT_TRY if (true)
|
|
||||||
# define FMT_CATCH(x) if (false)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Disable [[noreturn]] on MSVC/NVCC because of bogus unreachable code warnings.
|
// Disable [[noreturn]] on MSVC/NVCC because of bogus unreachable code warnings.
|
||||||
#if FMT_EXCEPTIONS && FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VERSION && \
|
#if FMT_EXCEPTIONS && FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VERSION && \
|
||||||
!defined(__NVCC__)
|
!defined(__NVCC__)
|
||||||
|
Reference in New Issue
Block a user