summaryrefslogtreecommitdiff
path: root/include/linux/compiler.h
diff options
context:
space:
mode:
authorMaxime Ripard <mripard@kernel.org>2024-12-02 14:44:18 +0300
committerMaxime Ripard <mripard@kernel.org>2024-12-02 14:44:18 +0300
commit3aba2eba84e0219fb66061359052be81bd883d53 (patch)
tree36da31539acaa6c360d0b606103d90926ac04e50 /include/linux/compiler.h
parent44cff6c5b0b17a78bc0b30372bcd816cf6dd282a (diff)
parent40384c840ea1944d7c5a392e8975ed088ecf0b37 (diff)
downloadlinux-3aba2eba84e0219fb66061359052be81bd883d53.tar.xz
Merge drm/drm-next into drm-misc-next
Kickstart 6.14 cycle. Signed-off-by: Maxime Ripard <mripard@kernel.org>
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r--include/linux/compiler.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 4d4e23b6e3e7..469a64dd6495 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -239,11 +239,18 @@ static inline void *offset_to_ptr(const int *off)
#endif /* __ASSEMBLY__ */
+#ifdef __CHECKER__
+#define __BUILD_BUG_ON_ZERO_MSG(e, msg) (0)
+#else /* __CHECKER__ */
+#define __BUILD_BUG_ON_ZERO_MSG(e, msg) ((int)sizeof(struct {_Static_assert(!(e), msg);}))
+#endif /* __CHECKER__ */
+
/* &a[0] degrades to a pointer: a different type from an array */
-#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
+#define __must_be_array(a) __BUILD_BUG_ON_ZERO_MSG(__same_type((a), &(a)[0]), "must be array")
/* Require C Strings (i.e. NUL-terminated) lack the "nonstring" attribute. */
-#define __must_be_cstr(p) BUILD_BUG_ON_ZERO(__annotated(p, nonstring))
+#define __must_be_cstr(p) \
+ __BUILD_BUG_ON_ZERO_MSG(__annotated(p, nonstring), "must be cstr (NUL-terminated)")
/*
* This returns a constant expression while determining if an argument is