[compiler-rt] d9b2641 - [scudo] Avoid empty statement warnings

Roland McGrath via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 21 12:39:18 PDT 2021


Author: Roland McGrath
Date: 2021-04-21T12:39:09-07:00
New Revision: d9b2641aa5f350f3aafcb61782ef372712159be9

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

LOG: [scudo] Avoid empty statement warnings

An empty macro that expands to just `... else ;` can get
warnings from some compilers (e.g. GCC's -Wempty-body).

Reviewed By: cryptoad, vitalybuka

Differential Revision: https://reviews.llvm.org/D100693

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/internal_defs.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/internal_defs.h b/compiler-rt/lib/scudo/standalone/internal_defs.h
index 0babbbe3c11b5..e12a5804bacb5 100644
--- a/compiler-rt/lib/scudo/standalone/internal_defs.h
+++ b/compiler-rt/lib/scudo/standalone/internal_defs.h
@@ -106,13 +106,27 @@ void NORETURN reportCheckFailed(const char *File, int Line,
 #define DCHECK_GT(A, B) CHECK_GT(A, B)
 #define DCHECK_GE(A, B) CHECK_GE(A, B)
 #else
-#define DCHECK(A)
-#define DCHECK_EQ(A, B)
-#define DCHECK_NE(A, B)
-#define DCHECK_LT(A, B)
-#define DCHECK_LE(A, B)
-#define DCHECK_GT(A, B)
-#define DCHECK_GE(A, B)
+#define DCHECK(A)                                                              \
+  do {                                                                         \
+  } while (false)
+#define DCHECK_EQ(A, B)                                                        \
+  do {                                                                         \
+  } while (false)
+#define DCHECK_NE(A, B)                                                        \
+  do {                                                                         \
+  } while (false)
+#define DCHECK_LT(A, B)                                                        \
+  do {                                                                         \
+  } while (false)
+#define DCHECK_LE(A, B)                                                        \
+  do {                                                                         \
+  } while (false)
+#define DCHECK_GT(A, B)                                                        \
+  do {                                                                         \
+  } while (false)
+#define DCHECK_GE(A, B)                                                        \
+  do {                                                                         \
+  } while (false)
 #endif
 
 // The superfluous die() call effectively makes this macro NORETURN.


        


More information about the llvm-commits mailing list