Merge workarounds for bogus MSVC warnings

This commit is contained in:
Victor Zverovich
2025-08-24 08:18:47 -07:00
parent 72c82296d6
commit 61e0503daf
2 changed files with 16 additions and 28 deletions
+8 -22
View File
@@ -165,28 +165,14 @@ template <typename T> struct iterator_traits<fmt::basic_appender<T>> {
};
} // namespace std
#ifndef FMT_THROW
# if FMT_USE_EXCEPTIONS
# if FMT_MSC_VERSION || defined(__NVCC__)
FMT_BEGIN_NAMESPACE
namespace detail {
template <typename Exception> inline void do_throw(const Exception& x) {
// Silence unreachable code warnings in MSVC and NVCC because these
// are nearly impossible to fix in a generic code.
volatile bool b = true;
if (b) throw x;
}
} // namespace detail
FMT_END_NAMESPACE
# define FMT_THROW(x) detail::do_throw(x)
# else
# define FMT_THROW(x) throw x
# endif
# else
# define FMT_THROW(x) \
::fmt::detail::assert_fail(__FILE__, __LINE__, (x).what())
# endif // FMT_USE_EXCEPTIONS
#endif // FMT_THROW
#ifdef FMT_THROW
// Use the provided definition.
#elif FMT_USE_EXCEPTIONS
# define FMT_THROW(x) throw x
#else
# define FMT_THROW(x) \
::fmt::detail::assert_fail(__FILE__, __LINE__, (x).what())
#endif
// Defining FMT_REDUCE_INT_INSTANTIATIONS to 1, will reduce the number of
// integer formatter template instantiations to just one by only using the