Skip to content

Commit d342a80

Browse files
authored
Merge 4024b29 into c9311a4
2 parents c9311a4 + 4024b29 commit d342a80

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/benchmark_register.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ bool BenchmarkFamilies::FindBenchmarks(
182182
}
183183
}
184184

185-
instance.name += StrFormat("%d", arg);
185+
instance.name += StrFormat("%ld", arg);
186186
++arg_i;
187187
}
188188

189189
if (!IsZero(family->min_time_))
190190
instance.name += StrFormat("/min_time:%0.3f", family->min_time_);
191191
if (family->iterations_ != 0)
192-
instance.name += StrFormat("/iterations:%d", family->iterations_);
192+
instance.name += StrFormat("/iterations:%zu", family->iterations_);
193193
if (family->repetitions_ != 0)
194194
instance.name += StrFormat("/repeats:%d", family->repetitions_);
195195

src/string_util.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ void AppendHumanReadable(int n, std::string* str);
1212

1313
std::string HumanReadableNumber(double n, double one_k = 1024.0);
1414

15-
std::string StrFormat(const char* format, ...);
15+
#ifdef __GNUC__
16+
__attribute__((format(printf, 1, 2)))
17+
#endif
18+
std::string
19+
StrFormat(const char* format, ...);
1620

1721
inline std::ostream& StrCatImp(std::ostream& out) BENCHMARK_NOEXCEPT {
1822
return out;

test/reporter_output_test.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,20 @@ ADD_CASES(TC_JSONOut,
219219
{"\"run_type\": \"iteration\",$", MR_Next}});
220220
ADD_CASES(TC_CSVOut, {{"^\"BM_arg_names/first:2/5/third:4\",%csv_report$"}});
221221

222+
// ========================================================================= //
223+
// ------------------------ Testing Big Args Output ------------------------ //
224+
// ========================================================================= //
225+
226+
void BM_BigArgs(benchmark::State& state) {
227+
for (auto _ : state) {
228+
}
229+
}
230+
BENCHMARK(BM_BigArgs)->RangeMultiplier(2)->Range(1UL << 30UL, 1UL << 33UL);
231+
ADD_CASES(TC_ConsoleOut, {{"^BM_BigArgs/1073741824 %console_report$"},
232+
{"^BM_BigArgs/2147483648 %console_report$"},
233+
{"^BM_BigArgs/4294967296 %console_report$"},
234+
{"^BM_BigArgs/8589934592 %console_report$"}});
235+
222236
// ========================================================================= //
223237
// ----------------------- Testing Complexity Output ----------------------- //
224238
// ========================================================================= //

0 commit comments

Comments
 (0)