Skip to content

Commit 1dffc6e

Browse files
committed
even more clang-tidy
1 parent f3beadf commit 1dffc6e

File tree

7 files changed

+10
-12
lines changed

7 files changed

+10
-12
lines changed

src/benchmark.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,16 +595,15 @@ size_t RunSpecifiedBenchmarks(BenchmarkReporter* display_reporter,
595595
std::string const& fname = FLAGS_benchmark_out;
596596
if (fname.empty() && file_reporter) {
597597
Err << "A custom file reporter was provided but "
598-
"--benchmark_out=<file> was not specified."
599-
<< std::endl;
598+
"--benchmark_out=<file> was not specified.\n";
600599
Out.flush();
601600
Err.flush();
602601
std::exit(1);
603602
}
604603
if (!fname.empty()) {
605604
output_file.open(fname);
606605
if (!output_file.is_open()) {
607-
Err << "invalid file name: '" << fname << "'" << std::endl;
606+
Err << "invalid file name: '" << fname << "'\n";
608607
Out.flush();
609608
Err.flush();
610609
std::exit(1);

src/benchmark_register.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ bool BenchmarkFamilies::FindBenchmarks(
125125
is_negative_filter = true;
126126
}
127127
if (!re.Init(spec, &error_msg)) {
128-
Err << "Could not compile benchmark re: " << error_msg << std::endl;
128+
Err << "Could not compile benchmark re: " << error_msg << '\n';
129129
return false;
130130
}
131131

src/benchmark_runner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct RunResults {
3939
};
4040

4141
struct BENCHMARK_EXPORT BenchTimeType {
42-
enum { ITERS, TIME } tag;
42+
enum : uint8_t { ITERS, TIME } tag;
4343
union {
4444
IterationCount iters;
4545
double time;

src/sysinfo.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
namespace benchmark {
8585
namespace {
8686

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

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

535534
~ThreadAffinityGuard() {

src/timers.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ double MakeTime(struct timespec const& ts) {
108108
#endif
109109

110110
BENCHMARK_NORETURN static void DiagnoseAndExit(const char* msg) {
111-
std::cerr << "ERROR: " << msg << std::endl;
111+
std::cerr << "ERROR: " << msg << '\n';
112112
std::exit(EXIT_FAILURE);
113113
}
114114

test/filter_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int main(int argc, char** argv) {
9999
if (reports_count != expected_reports) {
100100
std::cerr << "ERROR: Expected " << expected_reports
101101
<< " tests to be run but reported_count = " << reports_count
102-
<< std::endl;
102+
<< '\n';
103103
return -1;
104104
}
105105

@@ -108,7 +108,7 @@ int main(int argc, char** argv) {
108108
if (num_families != expected_reports) {
109109
std::cerr << "ERROR: Expected " << expected_reports
110110
<< " test families to be run but num_families = "
111-
<< num_families << std::endl;
111+
<< num_families << '\n';
112112
return -1;
113113
}
114114
}

test/output_test_helper.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ static std::string GetTempFileName() {
490490
std::string name = GetRandomFileName();
491491
if (!FileExists(name)) return name;
492492
}
493-
std::cerr << "Failed to create unique temporary file name" << std::endl;
493+
std::cerr << "Failed to create unique temporary file name\n";
494494
std::abort();
495495
}
496496

0 commit comments

Comments
 (0)