Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'compiler-attributes-for-linus-v4.20' of https://github.com/ojeda/linux

Pull compiler_types.h fix from Miguel Ojeda:
"A cleanup for userspace in compiler_types.h: don't pollute userspace
with macro definitions (Xiaozhou Liu)

This is harmless for the kernel, but v4.19 was released with a few
macros exposed to userspace as the patch explains; which this removes,
so it *could* happen that we break something for someone (although
leaving inline redefined is probably worse)"

* tag 'compiler-attributes-for-linus-v4.20' of https://github.com/ojeda/linux:
include/linux/compiler_types.h: don't pollute userspace with macro definitions

+54 -54
+54 -54
include/linux/compiler_types.h
··· 104 104 unsigned long constant; 105 105 }; 106 106 107 + #ifdef CONFIG_ENABLE_MUST_CHECK 108 + #define __must_check __attribute__((__warn_unused_result__)) 109 + #else 110 + #define __must_check 111 + #endif 112 + 113 + #if defined(CC_USING_HOTPATCH) 114 + #define notrace __attribute__((hotpatch(0, 0))) 115 + #else 116 + #define notrace __attribute__((__no_instrument_function__)) 117 + #endif 118 + 119 + /* 120 + * it doesn't make sense on ARM (currently the only user of __naked) 121 + * to trace naked functions because then mcount is called without 122 + * stack and frame pointer being set up and there is no chance to 123 + * restore the lr register to the value before mcount was called. 124 + */ 125 + #define __naked __attribute__((__naked__)) notrace 126 + 127 + #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) 128 + 129 + /* 130 + * Force always-inline if the user requests it so via the .config. 131 + * GCC does not warn about unused static inline functions for 132 + * -Wunused-function. This turns out to avoid the need for complex #ifdef 133 + * directives. Suppress the warning in clang as well by using "unused" 134 + * function attribute, which is redundant but not harmful for gcc. 135 + * Prefer gnu_inline, so that extern inline functions do not emit an 136 + * externally visible function. This makes extern inline behave as per gnu89 137 + * semantics rather than c99. This prevents multiple symbol definition errors 138 + * of extern inline functions at link time. 139 + * A lot of inline functions can cause havoc with function tracing. 140 + * Do not use __always_inline here, since currently it expands to inline again 141 + * (which would break users of __always_inline). 142 + */ 143 + #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ 144 + !defined(CONFIG_OPTIMIZE_INLINING) 145 + #define inline inline __attribute__((__always_inline__)) __gnu_inline \ 146 + __maybe_unused notrace 147 + #else 148 + #define inline inline __gnu_inline \ 149 + __maybe_unused notrace 150 + #endif 151 + 152 + #define __inline__ inline 153 + #define __inline inline 154 + 155 + /* 156 + * Rather then using noinline to prevent stack consumption, use 157 + * noinline_for_stack instead. For documentation reasons. 158 + */ 159 + #define noinline_for_stack noinline 160 + 107 161 #endif /* __KERNEL__ */ 108 162 109 163 #endif /* __ASSEMBLY__ */ ··· 214 160 __diag_ ## compiler(version, warn, option) 215 161 #define __diag_error(compiler, version, option, comment) \ 216 162 __diag_ ## compiler(version, error, option) 217 - 218 - #ifdef CONFIG_ENABLE_MUST_CHECK 219 - #define __must_check __attribute__((__warn_unused_result__)) 220 - #else 221 - #define __must_check 222 - #endif 223 - 224 - #if defined(CC_USING_HOTPATCH) 225 - #define notrace __attribute__((hotpatch(0, 0))) 226 - #else 227 - #define notrace __attribute__((__no_instrument_function__)) 228 - #endif 229 - 230 - /* 231 - * it doesn't make sense on ARM (currently the only user of __naked) 232 - * to trace naked functions because then mcount is called without 233 - * stack and frame pointer being set up and there is no chance to 234 - * restore the lr register to the value before mcount was called. 235 - */ 236 - #define __naked __attribute__((__naked__)) notrace 237 - 238 - #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) 239 - 240 - /* 241 - * Force always-inline if the user requests it so via the .config. 242 - * GCC does not warn about unused static inline functions for 243 - * -Wunused-function. This turns out to avoid the need for complex #ifdef 244 - * directives. Suppress the warning in clang as well by using "unused" 245 - * function attribute, which is redundant but not harmful for gcc. 246 - * Prefer gnu_inline, so that extern inline functions do not emit an 247 - * externally visible function. This makes extern inline behave as per gnu89 248 - * semantics rather than c99. This prevents multiple symbol definition errors 249 - * of extern inline functions at link time. 250 - * A lot of inline functions can cause havoc with function tracing. 251 - * Do not use __always_inline here, since currently it expands to inline again 252 - * (which would break users of __always_inline). 253 - */ 254 - #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ 255 - !defined(CONFIG_OPTIMIZE_INLINING) 256 - #define inline inline __attribute__((__always_inline__)) __gnu_inline \ 257 - __maybe_unused notrace 258 - #else 259 - #define inline inline __gnu_inline \ 260 - __maybe_unused notrace 261 - #endif 262 - 263 - #define __inline__ inline 264 - #define __inline inline 265 - 266 - /* 267 - * Rather then using noinline to prevent stack consumption, use 268 - * noinline_for_stack instead. For documentation reasons. 269 - */ 270 - #define noinline_for_stack noinline 271 163 272 164 #endif /* __LINUX_COMPILER_TYPES_H */