From 6e8fefe1ea13346f8908075d1f35b23317cfcc0f Mon Sep 17 00:00:00 2001 From: Thomas Lively Date: Wed, 13 Mar 2024 18:00:48 -0700 Subject: Fix a build error when assertions are disabled (#6397) Add `[[maybe_unused]]` to variables that are only used in assertions. In builds without assertions enabled, these were causing compiler errors about unused variables. --- src/tools/fuzzing/fuzzing.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/tools/fuzzing/fuzzing.cpp') diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp index 9a44119f5..ed9eb15e2 100644 --- a/src/tools/fuzzing/fuzzing.cpp +++ b/src/tools/fuzzing/fuzzing.cpp @@ -464,7 +464,8 @@ void TranslateToFuzzReader::finalizeMemory() { // unless GC is enabled. This can occur due to us adding a local // definition to what used to be an imported global in initial contents. // To fix that, replace such invalid offsets with a constant. - for (auto* get : FindAll(segment->offset).list) { + for ([[maybe_unused]] auto* get : + FindAll(segment->offset).list) { // No imported globals should remain. assert(!wasm.getGlobal(get->name)->imported()); // TODO: It would be better to avoid segment overlap so that @@ -508,7 +509,8 @@ void TranslateToFuzzReader::finalizeTable() { // no longer is (not ok unless GC is enabled), we may need to change // that. if (!wasm.features.hasGC()) { - for (auto* get : FindAll(segment->offset).list) { + for ([[maybe_unused]] auto* get : + FindAll(segment->offset).list) { // No imported globals should remain. assert(!wasm.getGlobal(get->name)->imported()); // TODO: the segments must not overlap... -- cgit v1.2.3