From 02f6f36aeb3bf79bcc9605446fbc078e34cb2db5 Mon Sep 17 00:00:00 2001 From: Yves Delley Date: Sat, 31 Dec 2022 12:45:55 +0100 Subject: [PATCH] one more attempt at fixing the MSVC failures --- src/core-fmt/include/units/bits/fmt_hacks.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/core-fmt/include/units/bits/fmt_hacks.h b/src/core-fmt/include/units/bits/fmt_hacks.h index ae5dd822..88eba520 100644 --- a/src/core-fmt/include/units/bits/fmt_hacks.h +++ b/src/core-fmt/include/units/bits/fmt_hacks.h @@ -46,6 +46,8 @@ UNITS_DIAGNOSTIC_POP #define UNITS_FMT_TO_ARG_ID(arg) static_cast(arg) #define UNITS_FMT_FROM_ARG_ID(arg) static_cast(arg) +#if false + // just reuse FMT_THROW - we're anyway only throwing from within string formatting code #if FMT_EXCEPTIONS && (FMT_MSC_VERSION || defined(__NVCC__)) // 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) #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