aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Gringauze <annagrin@microsoft.com>2018-07-31 17:30:43 -0700
committerGitHub <noreply@github.com>2018-07-31 17:30:43 -0700
commit1f76fbd168a9db5ffee39e33b751da81704bbc8d (patch)
tree0934768e6ad6708ba52c5627877707b796520124
parent5778149583e69b34ab375039ffcc5d51a4dd7b37 (diff)
downloadMicrosoft-GSL-1f76fbd168a9db5ffee39e33b751da81704bbc8d.tar.gz
Dev/annagrin/failfast in noexcept mode windows (#710)
made terminate call __fastfail in noexcept mode when using msvc
-rw-r--r--include/gsl/gsl_assert9
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;
}