mirror of https://github.com/google/benchmark.git
Fix error with Fix Werror=old-style-cast (#1272)
* Fix Werror=old-style-cast
Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
* Fix Werror=old-style-cast
Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
* Fix Werror=old-style-cast
Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
* Fix typo
Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
* Fix build error with MacOS
Signed-off-by: Bensuperpc <bensuperpc@gmail.com>
* Revert "Fix build error with MacOS"
This reverts commit cee213bb95
.
This commit is contained in:
parent
8826ef792f
commit
329fb06d99
|
@ -363,7 +363,7 @@ void RunBenchmarks(const std::vector<BenchmarkInstance>& benchmarks,
|
|||
additional_run_stats.begin(),
|
||||
additional_run_stats.end());
|
||||
per_family_reports.erase(
|
||||
(int)reports_for_family->Runs.front().family_index);
|
||||
static_cast<int>(reports_for_family->Runs.front().family_index));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,10 +102,10 @@ std::string FormatString(const char* msg, va_list args) {
|
|||
return local_buff;
|
||||
else {
|
||||
// we did not provide a long enough buffer on our first attempt.
|
||||
size = (size_t)ret + 1; // + 1 for the null byte
|
||||
size = static_cast<size_t>(ret) + 1; // + 1 for the null byte
|
||||
std::unique_ptr<char[]> buff(new char[size]);
|
||||
ret = vsnprintf(buff.get(), size, msg, args);
|
||||
BM_CHECK(ret > 0 && ((size_t)ret) < size);
|
||||
BM_CHECK(ret > 0 && (static_cast<size_t>(ret)) < size);
|
||||
return buff.get();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ void ConsoleReporter::PrintRunData(const Run& result) {
|
|||
typedef void(PrinterFn)(std::ostream&, LogColor, const char*, ...);
|
||||
auto& Out = GetOutputStream();
|
||||
PrinterFn* printer = (output_options_ & OO_Color) ?
|
||||
(PrinterFn*)ColorPrintf : IgnoreColorPrint;
|
||||
static_cast<PrinterFn*>(ColorPrintf) : IgnoreColorPrint;
|
||||
auto name_color =
|
||||
(result.report_big_o || result.report_rms) ? COLOR_BLUE : COLOR_GREEN;
|
||||
printer(Out, name_color, "%-*s ", name_field_width_,
|
||||
|
|
|
@ -26,7 +26,7 @@ void BM_Counters_Simple(benchmark::State& state) {
|
|||
for (auto _ : state) {
|
||||
}
|
||||
state.counters["foo"] = 1;
|
||||
state.counters["bar"] = 2 * (double)state.iterations();
|
||||
state.counters["bar"] = 2 * static_cast<double>(state.iterations());
|
||||
}
|
||||
BENCHMARK(BM_Counters_Simple);
|
||||
ADD_CASES(TC_ConsoleOut,
|
||||
|
|
Loading…
Reference in New Issue