diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /include/linux/bug.h | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'include/linux/bug.h')
-rw-r--r-- | include/linux/bug.h | 69 |
1 files changed, 0 insertions, 69 deletions
diff --git a/include/linux/bug.h b/include/linux/bug.h index b1cf40de847..d276b5510c8 100644 --- a/include/linux/bug.h +++ b/include/linux/bug.h | |||
@@ -11,75 +11,6 @@ enum bug_trap_type { | |||
11 | 11 | ||
12 | struct pt_regs; | 12 | struct pt_regs; |
13 | 13 | ||
14 | #ifdef __CHECKER__ | ||
15 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) | ||
16 | #define BUILD_BUG_ON_ZERO(e) (0) | ||
17 | #define BUILD_BUG_ON_NULL(e) ((void*)0) | ||
18 | #define BUILD_BUG_ON_INVALID(e) (0) | ||
19 | #define BUILD_BUG_ON(condition) | ||
20 | #define BUILD_BUG() (0) | ||
21 | #else /* __CHECKER__ */ | ||
22 | |||
23 | /* Force a compilation error if a constant expression is not a power of 2 */ | ||
24 | #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \ | ||
25 | BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0)) | ||
26 | |||
27 | /* Force a compilation error if condition is true, but also produce a | ||
28 | result (of value 0 and type size_t), so the expression can be used | ||
29 | e.g. in a structure initializer (or where-ever else comma expressions | ||
30 | aren't permitted). */ | ||
31 | #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) | ||
32 | #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); })) | ||
33 | |||
34 | /* | ||
35 | * BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the | ||
36 | * expression but avoids the generation of any code, even if that expression | ||
37 | * has side-effects. | ||
38 | */ | ||
39 | #define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e)))) | ||
40 | |||
41 | /** | ||
42 | * BUILD_BUG_ON - break compile if a condition is true. | ||
43 | * @condition: the condition which the compiler should know is false. | ||
44 | * | ||
45 | * If you have some code which relies on certain constants being equal, or | ||
46 | * other compile-time-evaluated condition, you should use BUILD_BUG_ON to | ||
47 | * detect if someone changes it. | ||
48 | * | ||
49 | * The implementation uses gcc's reluctance to create a negative array, but | ||
50 | * gcc (as of 4.4) only emits that error for obvious cases (eg. not arguments | ||
51 | * to inline functions). So as a fallback we use the optimizer; if it can't | ||
52 | * prove the condition is false, it will cause a link error on the undefined | ||
53 | * "__build_bug_on_failed". This error message can be harder to track down | ||
54 | * though, hence the two different methods. | ||
55 | */ | ||
56 | #ifndef __OPTIMIZE__ | ||
57 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) | ||
58 | #else | ||
59 | extern int __build_bug_on_failed; | ||
60 | #define BUILD_BUG_ON(condition) \ | ||
61 | do { \ | ||
62 | ((void)sizeof(char[1 - 2*!!(condition)])); \ | ||
63 | if (condition) __build_bug_on_failed = 1; \ | ||
64 | } while(0) | ||
65 | #endif | ||
66 | |||
67 | /** | ||
68 | * BUILD_BUG - break compile if used. | ||
69 | * | ||
70 | * If you have some code that you expect the compiler to eliminate at | ||
71 | * build time, you should use BUILD_BUG to detect if it is | ||
72 | * unexpectedly used. | ||
73 | */ | ||
74 | #define BUILD_BUG() \ | ||
75 | do { \ | ||
76 | extern void __build_bug_failed(void) \ | ||
77 | __linktime_error("BUILD_BUG failed"); \ | ||
78 | __build_bug_failed(); \ | ||
79 | } while (0) | ||
80 | |||
81 | #endif /* __CHECKER__ */ | ||
82 | |||
83 | #ifdef CONFIG_GENERIC_BUG | 14 | #ifdef CONFIG_GENERIC_BUG |
84 | #include <asm-generic/bug.h> | 15 | #include <asm-generic/bug.h> |
85 | 16 | ||