aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 55723afa097b..63dcaece1ac5 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -678,13 +678,17 @@ struct sysinfo {
678}; 678};
679 679
680/* Force a compilation error if condition is true */ 680/* Force a compilation error if condition is true */
681#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 681#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
682
683/* Force a compilation error if condition is constant and true */
684#define MAYBE_BUILD_BUG_ON(cond) ((void)sizeof(char[1 - 2 * !!(cond)]))
682 685
683/* Force a compilation error if condition is true, but also produce a 686/* Force a compilation error if condition is true, but also produce a
684 result (of value 0 and type size_t), so the expression can be used 687 result (of value 0 and type size_t), so the expression can be used
685 e.g. in a structure initializer (or where-ever else comma expressions 688 e.g. in a structure initializer (or where-ever else comma expressions
686 aren't permitted). */ 689 aren't permitted). */
687#define BUILD_BUG_ON_ZERO(e) (sizeof(char[1 - 2 * !!(e)]) - 1) 690#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
691#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
688 692
689/* Trap pasters of __FUNCTION__ at compile-time */ 693/* Trap pasters of __FUNCTION__ at compile-time */
690#define __FUNCTION__ (__func__) 694#define __FUNCTION__ (__func__)