From ec6f03579eb7fe1296d161c838f960ca993fd182 Mon Sep 17 00:00:00 2001 From: Joao Paulo Magalhaes Date: Wed, 3 May 2017 00:05:15 +0100 Subject: [PATCH] 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. --- src/benchmark.cc | 4 ++++ src/benchmark_api_internal.h | 9 ++------- test/output_test_helper.cc | 11 +---------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/benchmark.cc b/src/benchmark.cc index 53c41429..54b5e676 100644 --- a/src/benchmark.cc +++ b/src/benchmark.cc @@ -543,6 +543,10 @@ std::unique_ptr CreateReporter( } // end namespace +bool IsZero(double n) { + return std::abs(n) < std::numeric_limits::epsilon(); +} + ConsoleReporter::OutputOptions GetOutputOptions(bool force_no_color) { int output_opts = ConsoleReporter::OO_Defaults; if ((FLAGS_benchmark_color == "auto" && IsColorTerminal()) || diff --git a/src/benchmark_api_internal.h b/src/benchmark_api_internal.h index 922ed8d7..c2208737 100644 --- a/src/benchmark_api_internal.h +++ b/src/benchmark_api_internal.h @@ -36,15 +36,10 @@ bool FindBenchmarksInternal(const std::string& re, std::vector* 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::epsilon(); -} - -} // end namespace } // end namespace internal } // end namespace benchmark diff --git a/test/output_test_helper.cc b/test/output_test_helper.cc index 4e98553c..24746f6d 100644 --- a/test/output_test_helper.cc +++ b/test/output_test_helper.cc @@ -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 -------------------------------- //