diff options
-rw-r--r-- | include/linux/bug.h | 2 | ||||
-rw-r--r-- | include/linux/compiler.h | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/bug.h b/include/linux/bug.h index 73af37ca..dc11dc7 100644 --- a/include/linux/bug.h +++ b/include/linux/bug.h @@ -67,7 +67,7 @@ struct pt_regs; __compiletime_error("BUILD_BUG_ON failed"); \ if (__cond) \ __build_bug_on_failed(); \ - ((void)sizeof(char[1 - 2 * __cond])); \ + __compiletime_error_fallback(__cond); \ } while (0) #endif diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 4c638be..423bb6b 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -307,7 +307,12 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect); #endif #ifndef __compiletime_error # define __compiletime_error(message) +# define __compiletime_error_fallback(condition) \ + do { ((void)sizeof(char[1 - 2*!!(condition)])); } while (0) +#else +# define __compiletime_error_fallback(condition) do { } while (0) #endif + /* * Prevent the compiler from merging or refetching accesses. The compiler * is also forbidden from reordering successive instances of ACCESS_ONCE(), |