Commit Graph

18 Commits

Author SHA1 Message Date
Herb Sutter
c78ad8661c Added "vestigial" comments for downlevel feature test workarounds 2020-12-18 12:18:23 -08:00
Herb Sutter
0c5a66b666 Added workaround for non-constexpr std::exchange 2020-12-18 12:02:42 -08:00
Herb Sutter
248a7cbdce Add feature test for literal constructor in downlevel compilers 2020-12-18 11:56:36 -08:00
Herb Sutter
b77eaa87ee Make contract_group a literal type 2020-12-18 11:40:50 -08:00
Herb Sutter
9033021831 Removed stray .exchange 2020-12-18 11:34:25 -08:00
Herb Sutter
a45265a75e Handler shouldn't be internally synchronized 2020-12-18 11:30:17 -08:00
Herb Sutter
8bd828744f Remove constexpr again to see what the failures were 2020-12-18 11:25:04 -08:00
Herb Sutter
1c37688ccd Replaced some of the previous workarounds with feature tests
As always with feature tests, they can only be used to aggressively adopt new features even before all compilers we need have the features -- the test lets us write a vestigial workaround for downllevel compilers, to be removed as soon as all compilers support the feature.
2020-12-18 11:20:03 -08:00
Herb Sutter
8dfd03feeb Remove constexpr from contract_group constructor 2020-12-17 13:19:29 -08:00
Herb Sutter
d83e9ea05f Add workarounds for Android compiler and constexpr test 2020-12-17 12:11:42 -08:00
Herb Sutter
59f38376b9 Change auto to void to satisfy some compilers about definition ordering 2020-12-17 12:03:59 -08:00
Herb Sutter
dd45e5cfbd Went back to old-style declaration for older compilers that don't do C++17 guaranteed copy elision
A concession to older compilers.
2020-12-17 11:58:53 -08:00
Herb Sutter
0cbb9e221d Removed double .load
Require `chandler` to be never null by installing `[]()noexcept{}` as the handler if given a null pointer.
This lets us remove the double test in `assertion`.
2020-12-17 11:36:23 -08:00
Herb Sutter
cbfd8cd734 Parameterize Expects1 and Ensures` by contract group
Allows independently controlling handling of different categories of bugs, such as bounds checks vs. null checks.
User-extensible: Companies can instantiate their own `contract_group` objects for their own categories of contract checks, including for distinguishing contract "levels" like `Normal` vs. `Audit` by just creating those two groups that can then be controlled independently or in combination.
2020-11-27 17:06:01 -08:00
Herb Sutter
c16e4ce59f Replace GSL_CONTRACT_CHECK with contract_group 2020-11-27 16:33:12 -08:00
Herb Sutter
b34dc221a1 Remove GSL_ASSUME (unused code)
This is not specified in the C++ Core Guidelines as part of GSL, so it should not be documented or supported with a GSL name. And since we don't use it in the GSL repo either, we should just remove it directly. For more about why assumptions are a dangerous blunt instrument, including that they actively eliminate contracts checks including GSL's `Expects` and `Ensures`, see [P2064](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2064r0.pdf).
2020-11-27 11:10:53 -08:00
Herb Sutter
c20a54c8e7 Remove __builtin_expect prediction assistance
In microbenchmarks I tried, using `__builtin_expect` to indicate which branch was likely/unlikely was never faster, and often slower, than just omitting. In GSL, this is used only for `Expects` and `Ensures` which are nearly always true, and all processors have long been great at predicting such branches well.
2020-11-27 11:07:55 -08:00
Jordan Maples [MSFT]
a150aaa4ed
renaming main logic files. Added warning message of the removal and include passthrough. Renamed includes in the source files. Ran Clang-Format (#946)
Header rename
2020-10-29 17:38:48 -07:00