[libFuzzer] Fix -Wunused-variable when building with NDEBUG (#188301)

The variable `FuzzerInitIsRunning` is only used within `assert()`.
Follow up to #178342.
This commit is contained in:
Vitaly Buka 2026-03-24 11:23:37 -07:00 committed by GitHub
parent 68edb9f3c0
commit 9fd8bc0f0e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -48,7 +48,9 @@ static void *getFuncAddr(const char *name, uintptr_t wrapper_addr) {
}
static int FuzzerInited = 0;
#ifndef NDEBUG
static bool FuzzerInitIsRunning;
#endif
static void fuzzerInit();
@ -226,7 +228,9 @@ static void fuzzerInit() {
assert(!FuzzerInitIsRunning);
if (FuzzerInited)
return;
#ifndef NDEBUG
FuzzerInitIsRunning = true;
#endif
REAL(bcmp) = reinterpret_cast<memcmp_type>(
getFuncAddr("bcmp", reinterpret_cast<uintptr_t>(&bcmp)));
@ -247,7 +251,9 @@ static void fuzzerInit() {
REAL(memmem) = reinterpret_cast<memmem_type>(
getFuncAddr("memmem", reinterpret_cast<uintptr_t>(&memmem)));
#ifndef NDEBUG
FuzzerInitIsRunning = false;
#endif
FuzzerInited = 1;
}