From 882720bd7352316acfe374d5001d56d94c878f9a Mon Sep 17 00:00:00 2001 From: Herb Sutter Date: Wed, 27 Jan 2021 16:36:59 -0800 Subject: [PATCH] Changed default to per-TU violation handlers And removed the feature test macro to instead tgest for a specific C++ version. --- include/gsl/assert | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/gsl/assert b/include/gsl/assert index 86671f0..efa17f6 100644 --- a/include/gsl/assert +++ b/include/gsl/assert @@ -117,7 +117,10 @@ private: handler chandler; }; -#if !defined GSL_PER_CPP_CONTRACT_VIOLATION && defined __cpp_inline_variables +// By default, there is one violation handler per translation unit. +// Defining GSL_GLOBAL_CONTRACT_VIOLATION_HANDLERS and compiling as +// C++17 (or later) opts into using a global violation handler. +#if defined GSL_GLOBAL_CONTRACT_VIOLATION_HANDLERS && __cplusplus >= 201703L #define GSL_CONTRACT_VIOLATION_GRANULARITY inline #else #define GSL_CONTRACT_VIOLATION_GRANULARITY static