Skip to content

Commit de4d669

Browse files
committed
hal: keep BENCHMARK_END valid on a build with printf compiled out
1 parent aa38f6c commit de4d669

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎include/hal.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,13 @@ uint64_t hal_get_timer_us(void);
7171
#ifdef BOOT_BENCHMARK
7272
#define BENCHMARK_DECLARE() uint64_t _boot_bench_start
7373
#define BENCHMARK_START() (_boot_bench_start = hal_get_timer_us())
74+
/* wolfBoot_printf compiles to nothing on a build without printf, which
75+
* leaves _elapsed_ms unreferenced; keep it used so the macro is valid
76+
* there too. */
7477
#define BENCHMARK_END(msg) do { \
7578
uint64_t _elapsed_ms = (hal_get_timer_us() - _boot_bench_start) / 1000; \
7679
wolfBoot_printf(msg " (%lu ms)\r\n", (unsigned long)_elapsed_ms); \
80+
(void)_elapsed_ms; \
7781
} while(0)
7882
#else
7983
#define BENCHMARK_DECLARE() do {} while(0)

0 commit comments

Comments
 (0)