summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2021-11-19 22:37:01 +0100
committerAlejandro Colomar <alx.manpages@gmail.com>2021-11-20 13:22:21 +0100
commit80de74fa4fabd81922ad05c25ec9545c78a4a937 (patch)
tree9c51d75036eb61318167f2c7245e5fe4b1778b54
parentcd025a02d17c353f5a5f9545a1bfa2df3c8974ef (diff)
Move BUILD_BUG_ON_ZERO to <linux/must_be.h>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rw-r--r--include/linux/build_bug.h13
-rw-r--r--include/linux/must_be.h12
2 files changed, 14 insertions, 11 deletions
diff --git a/include/linux/build_bug.h b/include/linux/build_bug.h
index e3a0be2c90ad..539e3d5df027 100644
--- a/include/linux/build_bug.h
+++ b/include/linux/build_bug.h
@@ -2,19 +2,10 @@
#ifndef _LINUX_BUILD_BUG_H
#define _LINUX_BUILD_BUG_H
+
#include <linux/compiler.h>
+#include <linux/must_be.h>
-#ifdef __CHECKER__
-#define BUILD_BUG_ON_ZERO(e) (0)
-#else /* __CHECKER__ */
-/*
- * Force a compilation error if condition is true, but also produce a
- * result (of value 0 and type int), so the expression can be used
- * e.g. in a structure initializer (or where-ever else comma expressions
- * aren't permitted).
- */
-#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
-#endif /* __CHECKER__ */
/* Force a compilation error if a constant expression is not a power of 2 */
#define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \
diff --git a/include/linux/must_be.h b/include/linux/must_be.h
index a2e0b0c890a6..d1ebeaca9cf8 100644
--- a/include/linux/must_be.h
+++ b/include/linux/must_be.h
@@ -3,6 +3,18 @@
#define _LINUX_MUST_BE_H
+#ifdef __CHECKER__
+#define BUILD_BUG_ON_ZERO(e) (0)
+#else /* __CHECKER__ */
+/*
+ * Force a compilation error if condition is true, but also produce a
+ * result (of value 0 and type int), so the expression can be used
+ * e.g. in a structure initializer (or where-ever else comma expressions
+ * aren't permitted).
+ */
+#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
+#endif /* __CHECKER__ */
+
#define __must_be(e) BUILD_BUG_ON_ZERO(!(e))