4646#include " commandlineflags.h"
4747#include " complexity.h"
4848#include " counter.h"
49- #include " internal_macros.h"
5049#include " log.h"
5150#include " mutex.h"
5251#include " perf_counters.h"
@@ -198,7 +197,7 @@ State::State(std::string name, IterationCount max_iters,
198197 // `PauseTiming`, a new `Counter` will be inserted the first time, which
199198 // won't have the flag. Inserting them now also reduces the allocations
200199 // during the benchmark.
201- if (perf_counters_measurement_) {
200+ if (perf_counters_measurement_ != nullptr ) {
202201 for (const std::string& counter_name :
203202 perf_counters_measurement_->names ()) {
204203 counters[counter_name] = Counter (0.0 , Counter::kAvgIterations );
@@ -247,7 +246,7 @@ void State::PauseTiming() {
247246 // Add in time accumulated so far
248247 BM_CHECK (started_ && !finished_ && !skipped ());
249248 timer_->StopTimer ();
250- if (perf_counters_measurement_) {
249+ if (perf_counters_measurement_ != nullptr ) {
251250 std::vector<std::pair<std::string, double >> measurements;
252251 if (!perf_counters_measurement_->Stop (measurements)) {
253252 BM_CHECK (false ) << " Perf counters read the value failed." ;
@@ -265,7 +264,7 @@ void State::PauseTiming() {
265264void State::ResumeTiming () {
266265 BM_CHECK (started_ && !finished_ && !skipped ());
267266 timer_->StartTimer ();
268- if (perf_counters_measurement_) {
267+ if (perf_counters_measurement_ != nullptr ) {
269268 perf_counters_measurement_->Start ();
270269 }
271270}
@@ -342,7 +341,7 @@ namespace {
342341// Flushes streams after invoking reporter methods that write to them. This
343342// ensures users get timely updates even when streams are not line-buffered.
344343void FlushStreams (BenchmarkReporter* reporter) {
345- if (! reporter) {
344+ if (reporter == nullptr ) {
346345 return ;
347346 }
348347 std::flush (reporter->GetOutputStream ());
@@ -367,7 +366,7 @@ void Report(BenchmarkReporter* display_reporter,
367366
368367 report_one (display_reporter, run_results.display_report_aggregates_only ,
369368 run_results);
370- if (file_reporter) {
369+ if (file_reporter != nullptr ) {
371370 report_one (file_reporter, run_results.file_report_aggregates_only ,
372371 run_results);
373372 }
@@ -408,7 +407,7 @@ void RunBenchmarks(const std::vector<BenchmarkInstance>& benchmarks,
408407 per_family_reports;
409408
410409 if (display_reporter->ReportContext (context) &&
411- (! file_reporter || file_reporter->ReportContext (context))) {
410+ (( file_reporter == nullptr ) || file_reporter->ReportContext (context))) {
412411 FlushStreams (display_reporter);
413412 FlushStreams (file_reporter);
414413
@@ -433,12 +432,12 @@ void RunBenchmarks(const std::vector<BenchmarkInstance>& benchmarks,
433432 if (benchmark.complexity () != oNone) {
434433 reports_for_family = &per_family_reports[benchmark.family_index ()];
435434 }
436- benchmarks_with_threads += (benchmark.threads () > 1 );
435+ benchmarks_with_threads += static_cast < int > (benchmark.threads () > 1 );
437436 runners.emplace_back (benchmark, &perfcounters, reports_for_family);
438437 int num_repeats_of_this_instance = runners.back ().GetNumRepeats ();
439438 num_repetitions_total +=
440439 static_cast <size_t >(num_repeats_of_this_instance);
441- if (reports_for_family) {
440+ if (reports_for_family != nullptr ) {
442441 reports_for_family->num_runs_total += num_repeats_of_this_instance;
443442 }
444443 }
@@ -482,7 +481,7 @@ void RunBenchmarks(const std::vector<BenchmarkInstance>& benchmarks,
482481
483482 display_reporter->ReportRunsConfig (
484483 runner.GetMinTime (), runner.HasExplicitIters (), runner.GetIters ());
485- if (file_reporter) {
484+ if (file_reporter != nullptr ) {
486485 file_reporter->ReportRunsConfig (
487486 runner.GetMinTime (), runner.HasExplicitIters (), runner.GetIters ());
488487 }
@@ -506,7 +505,7 @@ void RunBenchmarks(const std::vector<BenchmarkInstance>& benchmarks,
506505 }
507506 }
508507 display_reporter->Finalize ();
509- if (file_reporter) {
508+ if (file_reporter != nullptr ) {
510509 file_reporter->Finalize ();
511510 }
512511 FlushStreams (display_reporter);
@@ -569,7 +568,7 @@ ConsoleReporter::OutputOptions GetOutputOptions(bool force_no_color) {
569568} // end namespace internal
570569
571570BenchmarkReporter* CreateDefaultDisplayReporter () {
572- static auto default_display_reporter =
571+ static auto * default_display_reporter =
573572 internal::CreateReporter (FLAGS_benchmark_format,
574573 internal::GetOutputOptions ())
575574 .release ();
@@ -611,15 +610,15 @@ size_t RunSpecifiedBenchmarks(BenchmarkReporter* display_reporter,
611610 std::ofstream output_file;
612611 std::unique_ptr<BenchmarkReporter> default_display_reporter;
613612 std::unique_ptr<BenchmarkReporter> default_file_reporter;
614- if (! display_reporter) {
613+ if (display_reporter == nullptr ) {
615614 default_display_reporter.reset (CreateDefaultDisplayReporter ());
616615 display_reporter = default_display_reporter.get ();
617616 }
618617 auto & Out = display_reporter->GetOutputStream ();
619618 auto & Err = display_reporter->GetErrorStream ();
620619
621620 std::string const & fname = FLAGS_benchmark_out;
622- if (fname.empty () && file_reporter) {
621+ if (fname.empty () && ( file_reporter != nullptr ) ) {
623622 Err << " A custom file reporter was provided but "
624623 " --benchmark_out=<file> was not specified.\n " ;
625624 Out.flush ();
@@ -634,7 +633,7 @@ size_t RunSpecifiedBenchmarks(BenchmarkReporter* display_reporter,
634633 Err.flush ();
635634 std::exit (1 );
636635 }
637- if (! file_reporter) {
636+ if (file_reporter == nullptr ) {
638637 default_file_reporter = internal::CreateReporter (
639638 FLAGS_benchmark_out_format, FLAGS_benchmark_counters_tabular
640639 ? ConsoleReporter::OO_Tabular
@@ -743,8 +742,8 @@ void SetDefaultTimeUnitFromFlag(const std::string& time_unit_flag) {
743742void ParseCommandLineFlags (int * argc, char ** argv) {
744743 using namespace benchmark ;
745744 BenchmarkReporter::Context::executable_name =
746- (argc && *argc > 0 ) ? argv[0 ] : " unknown" ;
747- for (int i = 1 ; argc && i < *argc; ++i) {
745+ (( argc != nullptr ) && *argc > 0 ) ? argv[0 ] : " unknown" ;
746+ for (int i = 1 ; ( argc != nullptr ) && i < *argc; ++i) {
748747 if (ParseBoolFlag (argv[i], " benchmark_list_tests" ,
749748 &FLAGS_benchmark_list_tests) ||
750749 ParseStringFlag (argv[i], " benchmark_filter" , &FLAGS_benchmark_filter) ||
0 commit comments