|
75 | 75 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) |
76 | 76 | #endif |
77 | 77 |
|
78 | | -/* |
79 | | - * Feature detection for gnu_inline (gnu89 extern inline semantics). Either |
80 | | - * __GNUC_STDC_INLINE__ is defined (not using gnu89 extern inline semantics, |
81 | | - * and we opt in to the gnu89 semantics), or __GNUC_STDC_INLINE__ is not |
82 | | - * defined so the gnu89 semantics are the default. |
83 | | - */ |
84 | | -#ifdef __GNUC_STDC_INLINE__ |
85 | | -# define __gnu_inline __attribute__((gnu_inline)) |
86 | | -#else |
87 | | -# define __gnu_inline |
88 | | -#endif |
89 | | - |
90 | | -/* |
91 | | - * Force always-inline if the user requests it so via the .config, |
92 | | - * or if gcc is too old. |
93 | | - * GCC does not warn about unused static inline functions for |
94 | | - * -Wunused-function. This turns out to avoid the need for complex #ifdef |
95 | | - * directives. Suppress the warning in clang as well by using "unused" |
96 | | - * function attribute, which is redundant but not harmful for gcc. |
97 | | - * Prefer gnu_inline, so that extern inline functions do not emit an |
98 | | - * externally visible function. This makes extern inline behave as per gnu89 |
99 | | - * semantics rather than c99. This prevents multiple symbol definition errors |
100 | | - * of extern inline functions at link time. |
101 | | - * A lot of inline functions can cause havoc with function tracing. |
102 | | - */ |
103 | | -#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ |
104 | | - !defined(CONFIG_OPTIMIZE_INLINING) |
105 | | -#define inline \ |
106 | | - inline __attribute__((always_inline, unused)) notrace __gnu_inline |
107 | | -#else |
108 | | -#define inline inline __attribute__((unused)) notrace __gnu_inline |
109 | | -#endif |
110 | | - |
111 | | -#define __inline__ inline |
112 | | -#define __inline inline |
113 | | -#define __always_inline inline __attribute__((always_inline)) |
114 | | -#define noinline __attribute__((noinline)) |
115 | | - |
116 | | -#define __packed __attribute__((packed)) |
117 | | -#define __weak __attribute__((weak)) |
118 | | -#define __alias(symbol) __attribute__((alias(#symbol))) |
119 | | - |
120 | 78 | #ifdef RETPOLINE |
121 | 79 | #define __noretpoline __attribute__((indirect_branch("keep"))) |
122 | 80 | #endif |
|
135 | 93 | */ |
136 | 94 | #define __naked __attribute__((naked)) noinline __noclone notrace |
137 | 95 |
|
138 | | -#define __noreturn __attribute__((noreturn)) |
139 | | - |
140 | | -/* |
141 | | - * From the GCC manual: |
142 | | - * |
143 | | - * Many functions have no effects except the return value and their |
144 | | - * return value depends only on the parameters and/or global |
145 | | - * variables. Such a function can be subject to common subexpression |
146 | | - * elimination and loop optimization just as an arithmetic operator |
147 | | - * would be. |
148 | | - * [...] |
149 | | - */ |
150 | | -#define __pure __attribute__((pure)) |
151 | | -#define __aligned(x) __attribute__((aligned(x))) |
152 | | -#define __aligned_largest __attribute__((aligned)) |
153 | | -#define __printf(a, b) __attribute__((format(printf, a, b))) |
154 | | -#define __scanf(a, b) __attribute__((format(scanf, a, b))) |
155 | | -#define __attribute_const__ __attribute__((__const__)) |
156 | | -#define __maybe_unused __attribute__((unused)) |
157 | | -#define __always_unused __attribute__((unused)) |
158 | | -#define __mode(x) __attribute__((mode(x))) |
159 | | - |
160 | | -#define __must_check __attribute__((warn_unused_result)) |
161 | | -#define __malloc __attribute__((__malloc__)) |
162 | | - |
163 | | -#define __used __attribute__((__used__)) |
164 | | -#define __compiler_offsetof(a, b) \ |
165 | | - __builtin_offsetof(a, b) |
166 | | - |
167 | | -/* Mark functions as cold. gcc will assume any path leading to a call |
168 | | - * to them will be unlikely. This means a lot of manual unlikely()s |
169 | | - * are unnecessary now for any paths leading to the usual suspects |
170 | | - * like BUG(), printk(), panic() etc. [but let's keep them for now for |
171 | | - * older compilers] |
172 | | - * |
173 | | - * Early snapshots of gcc 4.3 don't support this and we can't detect this |
174 | | - * in the preprocessor, but we can live with this because they're unreleased. |
175 | | - * Maketime probing would be overkill here. |
176 | | - * |
177 | | - * gcc also has a __attribute__((__hot__)) to move hot functions into |
178 | | - * a special section, but I don't see any sense in this right now in |
179 | | - * the kernel context |
180 | | - */ |
181 | | -#define __cold __attribute__((__cold__)) |
182 | | - |
183 | 96 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) |
184 | 97 |
|
185 | 98 | #define __optimize(level) __attribute__((__optimize__(level))) |
186 | | -#define __nostackprotector __optimize("no-stack-protector") |
187 | 99 |
|
188 | 100 | #define __compiletime_object_size(obj) __builtin_object_size(obj, 0) |
189 | 101 |
|
|
0 commit comments