From: "Andi Kleen" Force a compiler error instead of a link error, because they are easier to track down. Idea stolen from code by Jan Beulich If the argument to BUILD_BUG_ON evaluates to non-zero the compiler will do: t.c:6: error: size of array `type name' is negative (surprised that gcc doesn't have an extension for this) Signed-off-by: "Andi Kleen" Signed-off-by: Andrew Morton --- include/linux/kernel.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff -puN include/linux/kernel.h~make-build_bug_on-fail-at-compile-time include/linux/kernel.h --- devel/include/linux/kernel.h~make-build_bug_on-fail-at-compile-time 2005-09-10 14:37:46.000000000 -0700 +++ devel-akpm/include/linux/kernel.h 2005-09-10 14:37:46.000000000 -0700 @@ -307,8 +307,8 @@ struct sysinfo { char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */ }; -extern void BUILD_BUG(void); -#define BUILD_BUG_ON(condition) do { if (condition) BUILD_BUG(); } while(0) +/* Force a compilation error if condition is false */ +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) #ifdef CONFIG_SYSCTL extern int randomize_va_space; _