Rewrite fmt::throw_exception destructor
Add _DEBUG in debug mode for consistency with MSVC.
This commit is contained in:
@@ -36,6 +36,8 @@ endif()
|
|||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
add_definitions(-DNDEBUG)
|
add_definitions(-DNDEBUG)
|
||||||
|
elseif(NOT MSVC)
|
||||||
|
add_definitions(-D_DEBUG)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
|||||||
+12
-1
@@ -297,7 +297,18 @@ namespace fmt
|
|||||||
raw_throw_exception({line, col, file, func}, reinterpret_cast<const char*>(fmt), type_list, fmt_args_t<Args...>{fmt_unveil<Args>::get(args)...});
|
raw_throw_exception({line, col, file, func}, reinterpret_cast<const char*>(fmt), type_list, fmt_args_t<Args...>{fmt_unveil<Args>::get(args)...});
|
||||||
}
|
}
|
||||||
|
|
||||||
[[noreturn]] ~throw_exception() { std::abort(); } // Unreachable
|
#ifdef _DEBUG
|
||||||
|
[[noreturn]] ~throw_exception()
|
||||||
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
__assume(false);
|
||||||
|
#else
|
||||||
|
__builtin_unreachable();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
[[noreturn]] ~throw_exception();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename CharT, usz N, typename... Args>
|
template <typename CharT, usz N, typename... Args>
|
||||||
|
|||||||
Reference in New Issue
Block a user