mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 10:39:08 +00:00
bug.h: sync BUILD_BUG stuff with Linux 4.13
As commit 84b8bf6d5d
("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 <linux/build_bug.h>
by commit bc6245e5efd7. Let's follow it.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
parent
f7d6b896d6
commit
059a48096c
3 changed files with 90 additions and 51 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue