aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h62
1 files changed, 0 insertions, 62 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3e140add5360..5db52d0ff1d4 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -20,7 +20,6 @@
20#include <linux/printk.h> 20#include <linux/printk.h>
21#include <linux/dynamic_debug.h> 21#include <linux/dynamic_debug.h>
22#include <asm/byteorder.h> 22#include <asm/byteorder.h>
23#include <asm/bug.h>
24 23
25#define USHRT_MAX ((u16)(~0U)) 24#define USHRT_MAX ((u16)(~0U))
26#define SHRT_MAX ((s16)(USHRT_MAX>>1)) 25#define SHRT_MAX ((s16)(USHRT_MAX>>1))
@@ -677,67 +676,6 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
677 const typeof( ((type *)0)->member ) *__mptr = (ptr); \ 676 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
678 (type *)( (char *)__mptr - offsetof(type,member) );}) 677 (type *)( (char *)__mptr - offsetof(type,member) );})
679 678
680#ifdef __CHECKER__
681#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
682#define BUILD_BUG_ON_ZERO(e) (0)
683#define BUILD_BUG_ON_NULL(e) ((void*)0)
684#define BUILD_BUG_ON(condition)
685#define BUILD_BUG() (0)
686#else /* __CHECKER__ */
687
688/* Force a compilation error if a constant expression is not a power of 2 */
689#define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
690 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
691
692/* Force a compilation error if condition is true, but also produce a
693 result (of value 0 and type size_t), so the expression can be used
694 e.g. in a structure initializer (or where-ever else comma expressions
695 aren't permitted). */
696#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
697#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
698
699/**
700 * BUILD_BUG_ON - break compile if a condition is true.
701 * @condition: the condition which the compiler should know is false.
702 *
703 * If you have some code which relies on certain constants being equal, or
704 * other compile-time-evaluated condition, you should use BUILD_BUG_ON to
705 * detect if someone changes it.
706 *
707 * The implementation uses gcc's reluctance to create a negative array, but
708 * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments
709 * to inline functions). So as a fallback we use the optimizer; if it can't
710 * prove the condition is false, it will cause a link error on the undefined
711 * "__build_bug_on_failed". This error message can be harder to track down
712 * though, hence the two different methods.
713 */
714#ifndef __OPTIMIZE__
715#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
716#else
717extern int __build_bug_on_failed;
718#define BUILD_BUG_ON(condition) \
719 do { \
720 ((void)sizeof(char[1 - 2*!!(condition)])); \
721 if (condition) __build_bug_on_failed = 1; \
722 } while(0)
723#endif
724
725/**
726 * BUILD_BUG - break compile if used.
727 *
728 * If you have some code that you expect the compiler to eliminate at
729 * build time, you should use BUILD_BUG to detect if it is
730 * unexpectedly used.
731 */
732#define BUILD_BUG() \
733 do { \
734 extern void __build_bug_failed(void) \
735 __linktime_error("BUILD_BUG failed"); \
736 __build_bug_failed(); \
737 } while (0)
738
739#endif /* __CHECKER__ */
740
741/* Trap pasters of __FUNCTION__ at compile-time */ 679/* Trap pasters of __FUNCTION__ at compile-time */
742#define __FUNCTION__ (__func__) 680#define __FUNCTION__ (__func__)
743 681