mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 21:05:39 +02:00
Rework how warning suppression in macros is done
Previously, each warning suppression was self-contained, with its own pair of `SUPPRESS_X_WARNING` and `UNSUPPRESS_X_WARNING` macros. This had the obvious advantage of being self-containing, but it also meant that if we needed to suppress more than one warning in a single place, then we would manipulate the compiler's warning state multiple times, even though logically we would only need one layer. The new way of suppressing warnings in macros is to push compiler's warning state with `CATCH_INTERNAL_START_WARNINGS_SUPPRESSION` macro, then disable whatever macros we need with the `CATCH_INTERNAL_SUPPRESS_X_WARNINGS` macro, and then return to the previous state using `CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION`.
This commit is contained in:
@@ -176,9 +176,10 @@ namespace Catch {
|
||||
|
||||
|
||||
bootstrap_analysis analyse_samples(double confidence_level, int n_resamples, std::vector<double>::iterator first, std::vector<double>::iterator last) {
|
||||
CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
|
||||
CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
|
||||
static std::random_device entropy;
|
||||
CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS
|
||||
CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
|
||||
|
||||
auto n = static_cast<int>(last - first); // seriously, one can't use integral types without hell in C++
|
||||
|
||||
|
Reference in New Issue
Block a user