Fix namespace issue around exceptions marcos for MSVC

This commit is contained in:
vsol 2020-05-04 12:40:48 +03:00
parent efbcb27d9b
commit e46c0a45b8

View File

@ -117,42 +117,6 @@
# endif
#endif
#ifndef FMT_THROW
# if FMT_EXCEPTIONS
# if FMT_MSC_VER || FMT_NVCC
FMT_BEGIN_NAMESPACE
namespace internal {
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 internal
FMT_END_NAMESPACE
# define FMT_THROW(x) internal::do_throw(x)
# else
# define FMT_THROW(x) throw x
# endif
# define FMT_RETHROW() throw
# else
# define FMT_THROW(x) \
do { \
static_cast<void>(sizeof(x)); \
FMT_ASSERT(false, ""); \
} while (false)
# define FMT_RETHROW() FMT_ASSERT(false, "")
# 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
// Define FMT_USE_NOEXCEPT to make fmt use noexcept (C++11 feature).
#ifndef FMT_USE_NOEXCEPT
# define FMT_USE_NOEXCEPT 0
@ -240,6 +204,42 @@ FMT_END_NAMESPACE
FMT_INLINE_NAMESPACE v6 {
#endif
#ifndef FMT_THROW
# if FMT_EXCEPTIONS
# if FMT_MSC_VER || FMT_NVCC
FMT_BEGIN_NAMESPACE
namespace internal {
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 internal
FMT_END_NAMESPACE
# define FMT_THROW(x) internal::do_throw(x)
# else
# define FMT_THROW(x) throw x
# endif
# define FMT_RETHROW() throw
# else
# define FMT_THROW(x) \
do { \
static_cast<void>(sizeof(x)); \
FMT_ASSERT(false, ""); \
} while (false)
# define FMT_RETHROW() FMT_ASSERT(false, "")
# 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
#if !defined(FMT_HEADER_ONLY) && defined(_WIN32)
# define FMT_CLASS_API FMT_SUPPRESS_MSC_WARNING(4275)
# ifdef FMT_EXPORT