From b1fc92c1cad08f9b8162eef3907f1d733ec0ef6c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 18 Sep 2021 21:55:29 -0400 Subject: Fix warnings in release builds on MacOS Why only MacOS? Good question! --- benchmark/dict_bench.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'benchmark/dict_bench.c') diff --git a/benchmark/dict_bench.c b/benchmark/dict_bench.c index fe89d66..4dbbe62 100644 --- a/benchmark/dict_bench.c +++ b/benchmark/dict_bench.c @@ -126,6 +126,7 @@ run(FILE* const fd) for (size_t i = 0; i < n; ++i) { ZixStatus st = zix_hash_insert(zhash, &chunks[i]); assert(!st || st == ZIX_STATUS_EXISTS); + (void)st; } fprintf(insert_dat, "\t%lf\n", bench_end(&insert_start)); @@ -135,8 +136,11 @@ run(FILE* const fd) struct timespec search_start = bench_start(); for (size_t i = 0; i < n; ++i) { const size_t index = (size_t)(lcg64(seed + i) % n); - char* match = (char*)g_hash_table_lookup(hash, chunks[index].buf); + char* volatile match = + (char*)g_hash_table_lookup(hash, chunks[index].buf); + assert(!strcmp(match, chunks[index].buf)); + (void)match; } fprintf(search_dat, "\t%lf", bench_end(&search_start)); @@ -144,11 +148,12 @@ run(FILE* const fd) search_start = bench_start(); for (size_t i = 0; i < n; ++i) { const size_t index = (size_t)(lcg64(seed + i) % n); - const ZixChunk* match = + const ZixChunk* volatile match = (const ZixChunk*)zix_hash_find_record(zhash, &chunks[index]); assert(match); assert(!strcmp(match->buf, chunks[index].buf)); + (void)match; } fprintf(search_dat, "\t%lf\n", bench_end(&search_start)); -- cgit v1.2.1