aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r--include/linux/compiler.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index eca8ad75e28b..043b60de041e 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -517,7 +517,8 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
517# define __compiletime_error_fallback(condition) do { } while (0) 517# define __compiletime_error_fallback(condition) do { } while (0)
518#endif 518#endif
519 519
520#define __compiletime_assert(condition, msg, prefix, suffix) \ 520#ifdef __OPTIMIZE__
521# define __compiletime_assert(condition, msg, prefix, suffix) \
521 do { \ 522 do { \
522 bool __cond = !(condition); \ 523 bool __cond = !(condition); \
523 extern void prefix ## suffix(void) __compiletime_error(msg); \ 524 extern void prefix ## suffix(void) __compiletime_error(msg); \
@@ -525,6 +526,9 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
525 prefix ## suffix(); \ 526 prefix ## suffix(); \
526 __compiletime_error_fallback(__cond); \ 527 __compiletime_error_fallback(__cond); \
527 } while (0) 528 } while (0)
529#else
530# define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0)
531#endif
528 532
529#define _compiletime_assert(condition, msg, prefix, suffix) \ 533#define _compiletime_assert(condition, msg, prefix, suffix) \
530 __compiletime_assert(condition, msg, prefix, suffix) 534 __compiletime_assert(condition, msg, prefix, suffix)