mirror of
https://github.com/google/benchmark.git
synced 2024-12-26 04:20:14 +08:00
Fix float comparaison and add float comparison warning (#1368)
GCC warns about comparison with zero, clang does not.
This commit is contained in:
parent
705202d22a
commit
4f77cf9e62
@ -181,6 +181,7 @@ else()
|
||||
add_cxx_compiler_flag(-Wall)
|
||||
add_cxx_compiler_flag(-Wextra)
|
||||
add_cxx_compiler_flag(-Wshadow)
|
||||
add_cxx_compiler_flag(-Wfloat-equal)
|
||||
if(BENCHMARK_ENABLE_WERROR)
|
||||
add_cxx_compiler_flag(-Werror RELEASE)
|
||||
add_cxx_compiler_flag(-Werror RELWITHDEBINFO)
|
||||
|
@ -195,7 +195,7 @@ void State::PauseTiming() {
|
||||
for (const auto& name_and_measurement : measurements) {
|
||||
auto name = name_and_measurement.first;
|
||||
auto measurement = name_and_measurement.second;
|
||||
BM_CHECK_EQ(counters[name], 0.0);
|
||||
BM_CHECK_EQ(std::fpclassify((double)counters[name]), FP_ZERO);
|
||||
counters[name] = Counter(measurement, Counter::kAvgIterations);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user