Changed default to per-TU violation handlers

And removed the feature test macro to instead tgest for a specific C++ version.
This commit is contained in:
Herb Sutter 2021-01-27 16:36:59 -08:00
parent 81c10b8017
commit 882720bd73

View File

@ -117,7 +117,10 @@ private:
handler chandler; 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 #define GSL_CONTRACT_VIOLATION_GRANULARITY inline
#else #else
#define GSL_CONTRACT_VIOLATION_GRANULARITY static #define GSL_CONTRACT_VIOLATION_GRANULARITY static