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:
Joao Paulo Magalhaes 2017-05-03 00:05:15 +01:00
parent 1735413188
commit ec6f03579e
3 changed files with 7 additions and 17 deletions

View File

@ -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()) ||

View File

@ -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

View File

@ -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 -------------------------------- //