Skip to content

Commit a81fb7c

Browse files
committed
hal: keep BENCHMARK_END valid on a build with printf compiled out
1 parent 94bcb81 commit a81fb7c

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
@@ -77,9 +77,13 @@ uint64_t hal_get_timer_us(void);
7777
#ifdef BOOT_BENCHMARK
7878
#define BENCHMARK_DECLARE() uint64_t _boot_bench_start
7979
#define BENCHMARK_START() (_boot_bench_start = hal_get_timer_us())
80+
/* wolfBoot_printf compiles to nothing on a build without printf, which
81+
* leaves _elapsed_ms unreferenced; keep it used so the macro is valid
82+
* there too. */
8083
#define BENCHMARK_END(msg) do { \
8184
uint64_t _elapsed_ms = (hal_get_timer_us() - _boot_bench_start) / 1000; \
8285
wolfBoot_printf(msg " (%lu ms)\r\n", (unsigned long)_elapsed_ms); \
86+
(void)_elapsed_ms; \
8387
} while(0)
8488
#else
8589
#define BENCHMARK_DECLARE() do {} while(0)

0 commit comments

Comments
 (0)