A cleanup for userspace in compiler_types.h
- don't pollute userspace with macro definitions From Xiaozhou Liu -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPjU5OPd5QIZ9jqqOGXyLc2htIW0FAlwdVEQACgkQGXyLc2ht IW0RSxAAo3yZBrkMxN6FIrBeEfENFs8TL3iDq5GoCPShJNWHRpRbEBhi06/k6dnA ePFmgXL/FEio+f47aUj/pEh2NQv5QcwkLRpizREmGtHjVBngJNARFyHxveZyqE52 ArySpu5/WPswQdu73cQLAwqtk505Gi8jNLRKVqr4CiBJZB/WO7rsINWDOhUulpwG 9b8Kmct4al/3mhDOhnn1ppgAIauzj2xoyXxYMLZx95h7oycfssUvbNfJtALnxCJs eIWAxGebr3ni85q9J69gMfIOwiSn6HtaLAuv8Q7AOKuCBd1+/ymX79gCwH68dQVl tdDhIE7vEAWZHbVHy7fdnNIUbPfAMk/QonLStbdd2nYVeblD/luSe91NShCo7Jg5 ZVJHdA+eD9IjypGz4mMzjOlvhCWZBGtOdnby4tD6YxV+S9fDQPvE+9Ws1JaAIzpH kpnj1tmi5YwqN6T5pLWQwVs/HCuoCXI89pv0tSQwip2/txxorAIhhJvzo94lLdv/ nOABNb6/eszVj7IGOxKLXW/djFluwt/0SzlaD3A8pIjQWNXolfpmBu/9xMcJVZuj 070Vfn60bjH9q2qitBvlYLCX4eXaGBcfybRi7oe5WnOlKVCl1idQSPcn+2dhiaOO JpInO/XLQUrieHT4f/AW6prWJ4AiQJd1lpKw76acOjcm/iXMJGM= =e9gb -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
1104bd96eb
|
@ -104,6 +104,60 @@ struct ftrace_likely_data {
|
|||
unsigned long constant;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ENABLE_MUST_CHECK
|
||||
#define __must_check __attribute__((__warn_unused_result__))
|
||||
#else
|
||||
#define __must_check
|
||||
#endif
|
||||
|
||||
#if defined(CC_USING_HOTPATCH)
|
||||
#define notrace __attribute__((hotpatch(0, 0)))
|
||||
#else
|
||||
#define notrace __attribute__((__no_instrument_function__))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* it doesn't make sense on ARM (currently the only user of __naked)
|
||||
* to trace naked functions because then mcount is called without
|
||||
* stack and frame pointer being set up and there is no chance to
|
||||
* restore the lr register to the value before mcount was called.
|
||||
*/
|
||||
#define __naked __attribute__((__naked__)) notrace
|
||||
|
||||
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
|
||||
|
||||
/*
|
||||
* Force always-inline if the user requests it so via the .config.
|
||||
* GCC does not warn about unused static inline functions for
|
||||
* -Wunused-function. This turns out to avoid the need for complex #ifdef
|
||||
* directives. Suppress the warning in clang as well by using "unused"
|
||||
* function attribute, which is redundant but not harmful for gcc.
|
||||
* Prefer gnu_inline, so that extern inline functions do not emit an
|
||||
* externally visible function. This makes extern inline behave as per gnu89
|
||||
* semantics rather than c99. This prevents multiple symbol definition errors
|
||||
* of extern inline functions at link time.
|
||||
* A lot of inline functions can cause havoc with function tracing.
|
||||
* Do not use __always_inline here, since currently it expands to inline again
|
||||
* (which would break users of __always_inline).
|
||||
*/
|
||||
#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
|
||||
!defined(CONFIG_OPTIMIZE_INLINING)
|
||||
#define inline inline __attribute__((__always_inline__)) __gnu_inline \
|
||||
__maybe_unused notrace
|
||||
#else
|
||||
#define inline inline __gnu_inline \
|
||||
__maybe_unused notrace
|
||||
#endif
|
||||
|
||||
#define __inline__ inline
|
||||
#define __inline inline
|
||||
|
||||
/*
|
||||
* Rather then using noinline to prevent stack consumption, use
|
||||
* noinline_for_stack instead. For documentation reasons.
|
||||
*/
|
||||
#define noinline_for_stack noinline
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
@ -161,58 +215,4 @@ struct ftrace_likely_data {
|
|||
#define __diag_error(compiler, version, option, comment) \
|
||||
__diag_ ## compiler(version, error, option)
|
||||
|
||||
#ifdef CONFIG_ENABLE_MUST_CHECK
|
||||
#define __must_check __attribute__((__warn_unused_result__))
|
||||
#else
|
||||
#define __must_check
|
||||
#endif
|
||||
|
||||
#if defined(CC_USING_HOTPATCH)
|
||||
#define notrace __attribute__((hotpatch(0, 0)))
|
||||
#else
|
||||
#define notrace __attribute__((__no_instrument_function__))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* it doesn't make sense on ARM (currently the only user of __naked)
|
||||
* to trace naked functions because then mcount is called without
|
||||
* stack and frame pointer being set up and there is no chance to
|
||||
* restore the lr register to the value before mcount was called.
|
||||
*/
|
||||
#define __naked __attribute__((__naked__)) notrace
|
||||
|
||||
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
|
||||
|
||||
/*
|
||||
* Force always-inline if the user requests it so via the .config.
|
||||
* GCC does not warn about unused static inline functions for
|
||||
* -Wunused-function. This turns out to avoid the need for complex #ifdef
|
||||
* directives. Suppress the warning in clang as well by using "unused"
|
||||
* function attribute, which is redundant but not harmful for gcc.
|
||||
* Prefer gnu_inline, so that extern inline functions do not emit an
|
||||
* externally visible function. This makes extern inline behave as per gnu89
|
||||
* semantics rather than c99. This prevents multiple symbol definition errors
|
||||
* of extern inline functions at link time.
|
||||
* A lot of inline functions can cause havoc with function tracing.
|
||||
* Do not use __always_inline here, since currently it expands to inline again
|
||||
* (which would break users of __always_inline).
|
||||
*/
|
||||
#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
|
||||
!defined(CONFIG_OPTIMIZE_INLINING)
|
||||
#define inline inline __attribute__((__always_inline__)) __gnu_inline \
|
||||
__maybe_unused notrace
|
||||
#else
|
||||
#define inline inline __gnu_inline \
|
||||
__maybe_unused notrace
|
||||
#endif
|
||||
|
||||
#define __inline__ inline
|
||||
#define __inline inline
|
||||
|
||||
/*
|
||||
* Rather then using noinline to prevent stack consumption, use
|
||||
* noinline_for_stack instead. For documentation reasons.
|
||||
*/
|
||||
#define noinline_for_stack noinline
|
||||
|
||||
#endif /* __LINUX_COMPILER_TYPES_H */
|
||||
|
|
Loading…
Reference in New Issue