[llvm] 2e6657b - llvm/Support/Debug.h: Suppress warnings with -Asserts. [-Wunused-variable]

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 05:05:56 PDT 2022


Author: NAKAMURA Takumi
Date: 2022-04-29T21:01:47+09:00
New Revision: 2e6657b340f0f33414a97c79b3d1e37ad947ec7a

URL: https://github.com/llvm/llvm-project/commit/2e6657b340f0f33414a97c79b3d1e37ad947ec7a
DIFF: https://github.com/llvm/llvm-project/commit/2e6657b340f0f33414a97c79b3d1e37ad947ec7a.diff

LOG: llvm/Support/Debug.h: Suppress warnings with -Asserts. [-Wunused-variable]

Re. setCurrentDebugTypes(X,N), the only user is llvm-ml.cpp (exc. DebugTests)
since llvmorg-15-init-8355-g82ecf9a0b1b3.

FIXME: X and N are evaluated regardless of NDEBUG.
Could we avoid evaluating (but w/o warnings) with NDEBUG?

Added: 
    

Modified: 
    llvm/include/llvm/Support/Debug.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Support/Debug.h b/llvm/include/llvm/Support/Debug.h
index 2ff978476c79f..5788ab3b21380 100644
--- a/llvm/include/llvm/Support/Debug.h
+++ b/llvm/include/llvm/Support/Debug.h
@@ -67,8 +67,8 @@ void setCurrentDebugTypes(const char **Types, unsigned Count);
 
 #else
 #define isCurrentDebugType(X) (false)
-#define setCurrentDebugType(X)
-#define setCurrentDebugTypes(X, N)
+#define setCurrentDebugType(X) do { (void)(X); } while (false)
+#define setCurrentDebugTypes(X, N) do { (void)(X); (void)(N); } while (false)
 #define DEBUG_WITH_TYPE(TYPE, X) do { } while (false)
 #endif
 


        


More information about the llvm-commits mailing list