diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-03-04 00:42:35 +0100 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-03-04 00:42:35 +0100 |
commit | a8eb0ec5053205dcb7b97e046d25adc1413ab8db (patch) | |
tree | b74ab265db1d6b21599588fff443b37a6416ec00 /utils.h | |
parent | 449b8758a0a9741a663cdd98503560eeecd28a6a (diff) |
add BUILD_BUG_ON from the kernel
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -5,6 +5,17 @@ #include <libubox/avl.h> #include <libubox/blobmsg.h> +#ifndef __OPTIMIZE__ +#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) +#else +extern int __build_bug_on_failed; +#define BUILD_BUG_ON(condition) \ + do { \ + ((void)sizeof(char[1 - 2*!!(condition)])); \ + if (condition) __build_bug_on_failed = 1; \ + } while(0) +#endif + static inline bool blobmsg_get_bool_default(struct blob_attr *attr, bool val) { if (!attr) |