-Wunsafe-buffer-usage: fix build when -DLLVM_ENABLE_ASSERTIONS=off
authorFangrui Song <i@maskray.me>
Fri, 16 Dec 2022 23:43:32 +0000 (23:43 +0000)
committerFangrui Song <i@maskray.me>
Fri, 16 Dec 2022 23:43:32 +0000 (23:43 +0000)
clang/lib/Analysis/UnsafeBufferUsage.cpp

index 4282435..d2a3c49 100644 (file)
@@ -146,7 +146,7 @@ static GadgetList findGadgets(const Decl *D) {
 #if NDEBUG
 #define NEXT return
 #else
-      int numFound = 0;
+      [[maybe_unused]] int numFound = 0;
 #define NEXT ++numFound
 #endif
 
@@ -162,7 +162,6 @@ static GadgetList findGadgets(const Decl *D) {
 
       assert(numFound >= 1 && "Gadgets not found in match result!");
       assert(numFound <= 1 && "Conflicting bind tags in gadgets!");
-      (void)numFound;
     }
   };