Disable deprecated warnings when touching CSVReporter internally.

The CSVReporter is deprecated, but we still need to reference it in
a few places. To avoid breaking the build when warnings are errors,
we need to disable the warning when we do so.
This commit is contained in:
Eric Fiselier 2019-08-07 15:55:40 -04:00
parent 140fc22ab2
commit c408461983
2 changed files with 22 additions and 0 deletions

View File

@ -289,6 +289,13 @@ void RunBenchmarks(const std::vector<BenchmarkInstance>& benchmarks,
flushStreams(file_reporter);
}
// Disable deprecated warnings temporarily because we need to reference
// CSVReporter but don't want to trigger -Werror=-Wdeprecated
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif
std::unique_ptr<BenchmarkReporter> CreateReporter(
std::string const& name, ConsoleReporter::OutputOptions output_opts) {
typedef std::unique_ptr<BenchmarkReporter> PtrType;
@ -304,6 +311,11 @@ std::unique_ptr<BenchmarkReporter> CreateReporter(
}
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
} // end namespace
bool IsZero(double n) {

View File

@ -373,6 +373,12 @@ int SetSubstitutions(
return 0;
}
// Disable deprecated warnings temporarily because we need to reference
// CSVReporter but don't want to trigger -Werror=-Wdeprecated
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated"
#endif
void RunOutputTests(int argc, char* argv[]) {
using internal::GetTestCaseList;
benchmark::Initialize(&argc, argv);
@ -431,6 +437,10 @@ void RunOutputTests(int argc, char* argv[]) {
internal::GetResultsChecker().CheckResults(csv.out_stream);
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
int SubstrCnt(const std::string& haystack, const std::string& pat) {
if (pat.length() == 0) return 0;
int count = 0;