Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/benchmark_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ BenchmarkReporter::Run CreateRunReport(
report.repetition_index = repetition_index;
report.repetitions = repeats;

if (report.skipped == 0u) {
if (report.skipped == 0U) {
if (b.use_manual_time()) {
report.real_accumulated_time = results.manual_time_used;
} else {
Expand Down Expand Up @@ -152,7 +152,7 @@ void RunInThread(const BenchmarkInstance* b, IterationCount iters,

State st = b->Run(iters, thread_id, &timer, manager,
perf_counters_measurement, profiler_manager_);
if (!(st.skipped() || st.iterations() >= st.max_iterations)) {
if (!st.skipped() && st.iterations() < st.max_iterations) {
st.SkipWithError(
"The benchmark didn't run, nor was it explicitly skipped. Please call "
"'SkipWithXXX` in your benchmark as appropriate.");
Expand Down Expand Up @@ -321,10 +321,10 @@ BenchmarkRunner::BenchmarkRunner(
if (b.aggregation_report_mode() != internal::ARM_Unspecified) {
run_results.display_report_aggregates_only =
((b.aggregation_report_mode() &
internal::ARM_DisplayReportAggregatesOnly) != 0u);
internal::ARM_DisplayReportAggregatesOnly) != 0U);
run_results.file_report_aggregates_only =
((b.aggregation_report_mode() &
internal::ARM_FileReportAggregatesOnly) != 0u);
internal::ARM_FileReportAggregatesOnly) != 0U);
BM_CHECK(FLAGS_benchmark_perf_counters.empty() ||
(perf_counters_measurement_ptr->num_counters() == 0))
<< "Perf counters were requested but could not be set up.";
Expand Down Expand Up @@ -399,7 +399,7 @@ bool BenchmarkRunner::ShouldReportIterationResults(
// Determine if this run should be reported;
// Either it has run for a sufficient amount of time
// or because an error was reported.
return (i.results.skipped_ != 0u) || FLAGS_benchmark_dry_run ||
return (i.results.skipped_ != 0U) || FLAGS_benchmark_dry_run ||
i.iters >= kMaxIterations || // Too many iterations already.
i.seconds >=
GetMinTimeToApply() || // The elapsed time is large enough.
Expand Down Expand Up @@ -560,7 +560,7 @@ void BenchmarkRunner::DoOneRepetition() {

if (reports_for_family != nullptr) {
++reports_for_family->num_runs_done;
if (report.skipped == 0u) {
if (report.skipped == 0U) {
reports_for_family->Runs.push_back(report);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/commandlineflags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ BENCHMARK_EXPORT
bool IsTruthyFlagValue(const std::string& value) {
if (value.size() == 1) {
char v = value[0];
return isalnum(v) &&
!(v == '0' || v == 'f' || v == 'F' || v == 'n' || v == 'N');
return isalnum(v) && v != '0' && v != 'f' && v != 'F' && v != 'n' &&
v != 'N';
}
if (!value.empty()) {
std::string value_lower(value);
Expand Down
10 changes: 7 additions & 3 deletions src/console_reporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,18 @@ void ConsoleReporter::ReportRuns(const std::vector<Run>& reports) {
}
}

namespace {

PRINTF_FORMAT_STRING_FUNC(3, 4)
static void IgnoreColorPrint(std::ostream& out, LogColor /*unused*/,
const char* fmt, ...) {
void IgnoreColorPrint(std::ostream& out, LogColor /*unused*/, const char* fmt,
...) {
va_list args;
va_start(args, fmt);
out << FormatString(fmt, args);
va_end(args);
}

static std::string FormatTime(double time) {
std::string FormatTime(double time) {
// For the time columns of the console printer 13 digits are reserved. One of
// them is a space and max two of them are the time unit (e.g ns). That puts
// us at 10 digits usable for the number.
Expand All @@ -130,6 +132,8 @@ static std::string FormatTime(double time) {
return FormatString("%10.0f", time);
}

} // namespace

BENCHMARK_EXPORT
void ConsoleReporter::PrintRunData(const Run& result) {
typedef void(PrinterFn)(std::ostream&, LogColor, const char*, ...);
Expand Down
2 changes: 1 addition & 1 deletion src/csv_reporter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ BENCHMARK_EXPORT
void CSVReporter::PrintRunData(const Run& run) {
std::ostream& Out = GetOutputStream();
Out << CsvEscape(run.benchmark_name()) << ",";
if (run.skipped != 0u) {
if (run.skipped != 0U) {
Out << std::string(elements.size() - 3, ',');
Out << std::boolalpha << (internal::SkippedWithError == run.skipped) << ",";
Out << CsvEscape(run.skip_message) << "\n";
Expand Down