From 059a48096c883e98bc1a4a561abc0069f44cbfea Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Sat, 16 Sep 2017 14:10:44 +0900 Subject: bug.h: sync BUILD_BUG stuff with Linux 4.13 As commit 84b8bf6d5d2a ("bug.h: move BUILD_BUG_* defines to include/linux/bug.h") noted, include/linux/bug.h was locally modified for U-Boot because the name conflict of error() caused build errors at that time. Now error() is gone, so we can fully sync BUILD_BUG* with Linux. These macros are just compile-time utilities. Nothing depends on platform code, so it should make sense to simply copy Linux's ones. Please note Linux split BUILD_BUG stuff out into by commit bc6245e5efd7. Let's follow it. Signed-off-by: Masahiro Yamada --- include/linux/compiler.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include/linux/compiler.h') diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 020ad16a049..0ea6c8fccaa 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -476,7 +476,8 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s # define __compiletime_error_fallback(condition) do { } while (0) #endif -#define __compiletime_assert(condition, msg, prefix, suffix) \ +#ifdef __OPTIMIZE__ +# define __compiletime_assert(condition, msg, prefix, suffix) \ do { \ bool __cond = !(condition); \ extern void prefix ## suffix(void) __compiletime_error(msg); \ @@ -484,6 +485,9 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s prefix ## suffix(); \ __compiletime_error_fallback(__cond); \ } while (0) +#else +# define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0) +#endif #define _compiletime_assert(condition, msg, prefix, suffix) \ __compiletime_assert(condition, msg, prefix, suffix) -- cgit v1.2.3