From 77cd9803ce6bcf1b1e2167e7c115cbaad01af8bb Mon Sep 17 00:00:00 2001 From: Dominic Hamon Date: Fri, 10 Jan 2014 15:07:04 -0800 Subject: [PATCH] add pedantic errors and fix them --- CMakeLists.txt | 2 +- include/benchmark/benchmark.h | 6 +++--- src/benchmark.cc | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f363a476..512073bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib) -set(CMAKE_CXX_FLAGS "-Wall -Werror --std=c++0x") +set(CMAKE_CXX_FLAGS "-Wall -Werror -pedantic-errors --std=c++0x") set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -DDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-fno-strict-aliasing -O3 -DNDEBUG") diff --git a/include/benchmark/benchmark.h b/include/benchmark/benchmark.h index 293678c5..fe845b56 100644 --- a/include/benchmark/benchmark.h +++ b/include/benchmark/benchmark.h @@ -250,7 +250,7 @@ class State { STATE_STARTING, // KeepRunning called, waiting for other threads STATE_RUNNING, // Running and being timed STATE_STOPPING, // Not being timed but waiting for other threads - STATE_STOPPED, // Stopped + STATE_STOPPED // Stopped }; EState state_; @@ -290,7 +290,7 @@ class State { std::unique_ptr stats_; friend class internal::Benchmark; - DISALLOW_COPY_AND_ASSIGN(State); + DISALLOW_COPY_AND_ASSIGN(State) }; // Interface for custom benchmark result printers. @@ -475,7 +475,7 @@ class Benchmark { friend struct ::benchmark::internal::Benchmark::Instance; friend void ::benchmark::internal::RunMatchingBenchmarks( const std::string&, const BenchmarkReporter*); - DISALLOW_COPY_AND_ASSIGN(Benchmark); + DISALLOW_COPY_AND_ASSIGN(Benchmark) }; // ------------------------------------------------------ diff --git a/src/benchmark.cc b/src/benchmark.cc index e24b34b9..05265e5e 100644 --- a/src/benchmark.cc +++ b/src/benchmark.cc @@ -507,7 +507,7 @@ class State::FastClock { } while (done == 0); } - DISALLOW_COPY_AND_ASSIGN(FastClock); + DISALLOW_COPY_AND_ASSIGN(FastClock) }; struct State::ThreadStats { @@ -572,7 +572,7 @@ struct State::SharedState { } ~SharedState() { pthread_mutex_destroy(&mu); } - DISALLOW_COPY_AND_ASSIGN(SharedState); + DISALLOW_COPY_AND_ASSIGN(SharedState) }; namespace internal { @@ -793,9 +793,9 @@ void Benchmark::RunInstance(const Instance& b, const BenchmarkReporter* br) { // Initialize the test runners. State::SharedState state(&b); { - std::unique_ptr runners[b.threads]; + std::vector> runners; for (int i = 0; i < b.threads; ++i) - runners[i].reset(new State(&clock, &state, i)); + runners.push_back(std::unique_ptr(new State(&clock, &state, i))); // Run them all. for (int i = 0; i < b.threads; ++i) {