mirror of https://github.com/google/benchmark.git
Enable zero as NULL warnings and fix all occurences
This commit is contained in:
parent
19464f7dab
commit
64ba272911
|
@ -38,8 +38,7 @@ add_cxx_compiler_flag(-Wextra)
|
|||
add_cxx_compiler_flag(-Wshadow)
|
||||
add_cxx_compiler_flag(-Werror)
|
||||
add_cxx_compiler_flag(-pedantic-errors)
|
||||
# TODO(ericwf): enable this for g++
|
||||
#add_cxx_compiler_flag(-Wzero-as-null-pointer-constant)
|
||||
add_cxx_compiler_flag(-Wzero-as-null-pointer-constant)
|
||||
# Release flags
|
||||
add_cxx_compiler_flag(-fno-strict-aliasing RELEASE)
|
||||
|
||||
|
|
|
@ -152,7 +152,8 @@ void Initialize(int* argc, const char** argv);
|
|||
|
||||
// Otherwise, run all benchmarks specified by the --benchmark_filter flag,
|
||||
// and exit after running the benchmarks.
|
||||
void RunSpecifiedBenchmarks(const BenchmarkReporter* reporter = NULL);
|
||||
void RunSpecifiedBenchmarks();
|
||||
void RunSpecifiedBenchmarks(const BenchmarkReporter* reporter);
|
||||
|
||||
// If this routine is called, peak memory allocation past this point in the
|
||||
// benchmark is reported at the end of the benchmark report line. (It is
|
||||
|
@ -164,6 +165,19 @@ void RunSpecifiedBenchmarks(const BenchmarkReporter* reporter = NULL);
|
|||
namespace internal {
|
||||
class Benchmark;
|
||||
class BenchmarkFamilies;
|
||||
|
||||
template <class T> struct Voider {
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template <class T, class = void>
|
||||
struct EnableIfString {};
|
||||
|
||||
template <class T>
|
||||
struct EnableIfString<T, typename Voider<typename T::basic_string>::type> {
|
||||
typedef int type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// State is passed to a running Benchmark and contains state for the
|
||||
|
@ -279,7 +293,7 @@ public:
|
|||
// as an injected class name in the case of std::string.
|
||||
template <class StringType>
|
||||
void SetLabel(StringType const & str,
|
||||
typename StringType::basic_string* = 0) {
|
||||
typename internal::EnableIfString<StringType>::type = 1) {
|
||||
this->SetLabel(str.c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -898,6 +898,9 @@ void RunMatchingBenchmarks(const std::string& spec,
|
|||
|
||||
} // end namespace internal
|
||||
|
||||
void RunSpecifiedBenchmarks() {
|
||||
RunSpecifiedBenchmarks(nullptr);
|
||||
}
|
||||
|
||||
void RunSpecifiedBenchmarks(const BenchmarkReporter* reporter) {
|
||||
std::string spec = FLAGS_benchmark_filter;
|
||||
|
|
|
@ -303,7 +303,7 @@ static bool MyCPUUsageCPUTimeNsLocked(double* cputime) {
|
|||
cputime_fd = -1;
|
||||
return false;
|
||||
}
|
||||
unsigned long long result = strtoull(buff, NULL, 0);
|
||||
unsigned long long result = strtoull(buff, nullptr, 0);
|
||||
if (result == (std::numeric_limits<unsigned long long>::max)()) {
|
||||
close(cputime_fd);
|
||||
cputime_fd = -1;
|
||||
|
|
|
@ -89,7 +89,7 @@ private:
|
|||
|
||||
WallTime Slow() const {
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
gettimeofday(&tv, nullptr);
|
||||
return tv.tv_sec + tv.tv_usec * 1e-6;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue