Skip to content

Commit

Permalink
even more clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
dmah42 committed Jan 13, 2025
1 parent 4e76959 commit b1d31e1
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 12 deletions.
5 changes: 2 additions & 3 deletions src/benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -595,16 +595,15 @@ size_t RunSpecifiedBenchmarks(BenchmarkReporter* display_reporter,
std::string const& fname = FLAGS_benchmark_out;
if (fname.empty() && file_reporter) {
Err << "A custom file reporter was provided but "
"--benchmark_out=<file> was not specified."
<< std::endl;
"--benchmark_out=<file> was not specified.\n";
Out.flush();
Err.flush();
std::exit(1);
}
if (!fname.empty()) {
output_file.open(fname);
if (!output_file.is_open()) {
Err << "invalid file name: '" << fname << "'" << std::endl;
Err << "invalid file name: '" << fname << "'\n";
Out.flush();
Err.flush();
std::exit(1);
Expand Down
2 changes: 1 addition & 1 deletion src/benchmark_register.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ bool BenchmarkFamilies::FindBenchmarks(
is_negative_filter = true;
}
if (!re.Init(spec, &error_msg)) {
Err << "Could not compile benchmark re: " << error_msg << std::endl;
Err << "Could not compile benchmark re: " << error_msg << '\n';
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/benchmark_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct RunResults {
};

struct BENCHMARK_EXPORT BenchTimeType {
enum { ITERS, TIME } tag;
enum : uint8_t { ITERS, TIME } tag;
union {
IterationCount iters;
double time;
Expand Down
5 changes: 2 additions & 3 deletions src/sysinfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
namespace benchmark {
namespace {

void PrintImp(std::ostream& out) { out << std::endl; }
void PrintImp(std::ostream& out) { out << '\n'; }

template <class First, class... Rest>
void PrintImp(std::ostream& out, First&& f, Rest&&... rest) {
Expand Down Expand Up @@ -528,8 +528,7 @@ class ThreadAffinityGuard final {
ThreadAffinityGuard() : reset_affinity(SetAffinity()) {
if (!reset_affinity)
std::cerr << "***WARNING*** Failed to set thread affinity. Estimated CPU "
"frequency may be incorrect."
<< std::endl;
"frequency may be incorrect.\n";
}

~ThreadAffinityGuard() {
Expand Down
2 changes: 1 addition & 1 deletion src/timers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ double MakeTime(struct timespec const& ts) {
#endif

BENCHMARK_NORETURN static void DiagnoseAndExit(const char* msg) {
std::cerr << "ERROR: " << msg << std::endl;
std::cerr << "ERROR: " << msg << '\n';
std::exit(EXIT_FAILURE);
}

Expand Down
4 changes: 2 additions & 2 deletions test/filter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ int main(int argc, char** argv) {
if (reports_count != expected_reports) {
std::cerr << "ERROR: Expected " << expected_reports
<< " tests to be run but reported_count = " << reports_count
<< std::endl;
<< '\n';
return -1;
}

Expand All @@ -108,7 +108,7 @@ int main(int argc, char** argv) {
if (num_families != expected_reports) {
std::cerr << "ERROR: Expected " << expected_reports
<< " test families to be run but num_families = "
<< num_families << std::endl;
<< num_families << '\n';
return -1;
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/output_test_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ static std::string GetTempFileName() {
std::string name = GetRandomFileName();
if (!FileExists(name)) return name;
}
std::cerr << "Failed to create unique temporary file name" << std::endl;
std::cerr << "Failed to create unique temporary file name\n";
std::abort();
}

Expand Down

0 comments on commit b1d31e1

Please sign in to comment.