diff options
author | Anna Gringauze <annagrin@microsoft.com> | 2018-07-31 17:30:43 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-31 17:30:43 -0700 |
commit | 1f76fbd168a9db5ffee39e33b751da81704bbc8d (patch) | |
tree | 0934768e6ad6708ba52c5627877707b796520124 /include | |
parent | 5778149583e69b34ab375039ffcc5d51a4dd7b37 (diff) | |
download | platform_external_Microsoft-GSL-1f76fbd168a9db5ffee39e33b751da81704bbc8d.tar.gz platform_external_Microsoft-GSL-1f76fbd168a9db5ffee39e33b751da81704bbc8d.tar.bz2 platform_external_Microsoft-GSL-1f76fbd168a9db5ffee39e33b751da81704bbc8d.zip |
Dev/annagrin/failfast in noexcept mode windows (#710)
made terminate call __fastfail in noexcept mode when using msvc
Diffstat (limited to 'include')
-rw-r--r-- | include/gsl/gsl_assert | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/gsl/gsl_assert b/include/gsl/gsl_assert index 131fa8b..be4676b 100644 --- a/include/gsl/gsl_assert +++ b/include/gsl/gsl_assert @@ -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 // @@ -82,10 +84,15 @@ namespace details #if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND) 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; } |