mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
Dev/annagrin/failfast in noexcept mode windows (#710)
made terminate call __fastfail in noexcept mode when using msvc
This commit is contained in:
parent
5778149583
commit
1f76fbd168
@ -26,6 +26,8 @@
|
||||
//
|
||||
#if defined(_MSC_VER) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS
|
||||
#define GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND
|
||||
#include <intrin.h>
|
||||
#define RANGE_CHECKS_FAILURE 0
|
||||
#endif
|
||||
|
||||
//
|
||||
@ -83,9 +85,14 @@ namespace details
|
||||
|
||||
typedef void (__cdecl *terminate_handler)();
|
||||
|
||||
[[noreturn]] inline void __cdecl default_terminate_handler()
|
||||
{
|
||||
__fastfail(RANGE_CHECKS_FAILURE);
|
||||
}
|
||||
|
||||
inline gsl::details::terminate_handler& get_terminate_handler() noexcept
|
||||
{
|
||||
static terminate_handler handler = &abort;
|
||||
static terminate_handler handler = &default_terminate_handler;
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user