mirror of
https://github.com/google/benchmark.git
synced 2025-03-14 03:10:22 +08:00
Trying again to fix error caused by -Wunused-function.
This thing with the pragma ignore was getting out of hand: now MinGW (and probably GCC) was erroring too. So I chose to move the definition of IsZero() out of the anonymous namespace into benchmark.cc.
This commit is contained in:
parent
1735413188
commit
ec6f03579e
@ -543,6 +543,10 @@ std::unique_ptr<BenchmarkReporter> CreateReporter(
|
||||
|
||||
} // end namespace
|
||||
|
||||
bool IsZero(double n) {
|
||||
return std::abs(n) < std::numeric_limits<double>::epsilon();
|
||||
}
|
||||
|
||||
ConsoleReporter::OutputOptions GetOutputOptions(bool force_no_color) {
|
||||
int output_opts = ConsoleReporter::OO_Defaults;
|
||||
if ((FLAGS_benchmark_color == "auto" && IsColorTerminal()) ||
|
||||
|
@ -36,15 +36,10 @@ bool FindBenchmarksInternal(const std::string& re,
|
||||
std::vector<Benchmark::Instance>* benchmarks,
|
||||
std::ostream* Err);
|
||||
|
||||
bool IsZero(double n);
|
||||
|
||||
ConsoleReporter::OutputOptions GetOutputOptions(bool force_no_color = false);
|
||||
|
||||
namespace {
|
||||
|
||||
bool IsZero(double n) {
|
||||
return std::abs(n) < std::numeric_limits<double>::epsilon();
|
||||
}
|
||||
|
||||
} // end namespace
|
||||
} // end namespace internal
|
||||
} // end namespace benchmark
|
||||
|
||||
|
@ -7,16 +7,7 @@
|
||||
#include "../src/check.h" // NOTE: check.h is for internal use only!
|
||||
#include "../src/re.h" // NOTE: re.h is for internal use only
|
||||
#include "output_test.h"
|
||||
|
||||
// clang fails with -Werror because IsZero() is not used in this library
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wunused-function"
|
||||
#endif
|
||||
#include "../src/benchmark_api_internal.h" // IsZero() is provided here
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
#include "../src/benchmark_api_internal.h"
|
||||
|
||||
// ========================================================================= //
|
||||
// ------------------------------ Internals -------------------------------- //
|
||||
|
Loading…
Reference in New Issue
Block a user