one more attempt at fixing the MSVC failures

This commit is contained in:
Yves Delley
2022-12-31 12:45:55 +01:00
parent b6da63b2f0
commit 02f6f36aeb

View File

@@ -46,6 +46,8 @@ UNITS_DIAGNOSTIC_POP
#define UNITS_FMT_TO_ARG_ID(arg) static_cast<int>(arg) #define UNITS_FMT_TO_ARG_ID(arg) static_cast<int>(arg)
#define UNITS_FMT_FROM_ARG_ID(arg) static_cast<size_t>(arg) #define UNITS_FMT_FROM_ARG_ID(arg) static_cast<size_t>(arg)
#if false
// just reuse FMT_THROW - we're anyway only throwing from within string formatting code // just reuse FMT_THROW - we're anyway only throwing from within string formatting code
#if FMT_EXCEPTIONS && (FMT_MSC_VERSION || defined(__NVCC__)) #if FMT_EXCEPTIONS && (FMT_MSC_VERSION || defined(__NVCC__))
// work around FMT_THROW being defined without a fully qualified namespace // work around FMT_THROW being defined without a fully qualified namespace
@@ -54,6 +56,22 @@ UNITS_DIAGNOSTIC_POP
#define UNITS_THROW(x) FMT_THROW(x) #define UNITS_THROW(x) FMT_THROW(x)
#endif #endif
#else
# if FMT_EXCEPTIONS
# if FMT_MSC_VERSION || defined(__NVCC__)
# define UNITS_THROW(x) ::fmt::detail::do_throw(x)
# else
# define UNITS_THROW(x) throw x
# endif
# else
# define UNITS_THROW(x) \
do { \
FMT_ASSERT(false, (x).what()); \
} while (false)
# endif
#endif
#else #else