pw_tokenizer: Add attributes on unused variables
Appends [[maybe_unused]] to variables that are unused.
Change-Id: Id469b4723c505956bf23666ccd164f56bffe84cd
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/31762
Commit-Queue: Prashanth Swaminathan <prashanthsw@google.com>
Pigweed-Auto-Submit: Prashanth Swaminathan <prashanthsw@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
diff --git a/pw_tokenizer/token_database_fuzzer.cc b/pw_tokenizer/token_database_fuzzer.cc
index 3e243c8..9391f87 100644
--- a/pw_tokenizer/token_database_fuzzer.cc
+++ b/pw_tokenizer/token_database_fuzzer.cc
@@ -54,10 +54,8 @@
// Since we don't "use" the contents of the entry, we exercise
// the entry by extracting its contents into volatile variables
// to prevent it from being optimized out during compilation.
- volatile const char* entry_string = entry.string;
- volatile uint32_t entry_token = entry.token;
- PW_UNUSED(entry_string);
- PW_UNUSED(entry_token);
+ [[maybe_unused]] volatile const char* entry_string = entry.string;
+ [[maybe_unused]] volatile uint32_t entry_token = entry.token;
}
}
@@ -121,8 +119,7 @@
// specified in the API.
std::span<uint8_t> data_span(buffer, data_size);
auto token_database = TokenDatabase::Create<std::span<uint8_t>>(data_span);
- volatile auto match = token_database.Find(random_token);
- PW_UNUSED(match);
+ [[maybe_unused]] volatile auto match = token_database.Find(random_token);
IterateOverDatabase(&token_database);