diff --git a/CMakeLists.txt b/CMakeLists.txt index dc2d8c38ef..81f5cf096b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,8 @@ endif() if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") add_definitions(-DNDEBUG) +elseif(NOT MSVC) + add_definitions(-D_DEBUG) endif() if(NOT CMAKE_SIZEOF_VOID_P EQUAL 8) diff --git a/Utilities/StrFmt.h b/Utilities/StrFmt.h index a46f676dd4..ae9e0a2739 100644 --- a/Utilities/StrFmt.h +++ b/Utilities/StrFmt.h @@ -297,7 +297,18 @@ namespace fmt raw_throw_exception({line, col, file, func}, reinterpret_cast(fmt), type_list, fmt_args_t{fmt_unveil::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