Compiler Attributes: Clean the new GCC 9 -Wmissing-attributes warnings
The upcoming GCC 9 release extends the -Wmissing-attributes warnings (enabled by -Wall) to C and aliases: it warns when particular function attributes are missing in the aliases but not in their target, e.g.: void __cold f(void) {} void __alias("f") g(void); diagnoses: warning: 'g' specifies less restrictive attribute than its target 'f': 'cold' [-Wmissing-attributes] These patch series clean these new warnings. Most of them are caused by the module_init/exit macros. Link: https://lore.kernel.org/lkml/20190125104353.2791-1-labbott@redhat.com/ -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEPjU5OPd5QIZ9jqqOGXyLc2htIW0FAlxnDBQACgkQGXyLc2ht IW18eg//ePgieGRY9v4lGRs0pCQkdMmyjNJ5ChAbWdjoLwL45eiUpSt2sJNcSv8f 4JzgnpN9bB9G18b10kPCtIUT4/A8M6eV5IxkUwJsutyhVJ7xLfER6BihMa0PRxbR qnqZX9MDSxL2nShL5y40zbT1uAwfCB7x7cNkgXn/Gh1mZxWPONBrsxaRlBLu3oUE C1uqocgJKMIxczRUhaID11Zl4u0qrro8i6uqCzqX7g9dyH7CkNheQb7gxUvnOTi2 9rBxdCQfUVGma5zxEqc5ow9lprVoiumLbwdW+Hx0HamNp/V5DjH4cV2CKgu1q/hN 5UzaHQKgQ78VDQe5R+T8k5tt1xq0dEf6jGrHDWBnRGCf+P0tDa0ygIX83rnTUkwL agoVg3Ikfa7hsoYI3FovxqryrsgmR6wpJpZGrdpGLe/rnFuJ2mRvuCuKoRHiW5pk 2is5DUgdbU7bH6QZhXuPpK7ZfCLBwVb873cfLNBAywofFTh3B4FnsbV/UCw4iw3t IpGbLC3JLCPrmf2Wivd/gYpwA+UuqLnk/mMTpB2pt/Zjgq5TeNThzhozOpW6qEHK 42V/30mLztdXr6lQYSY4o6/H4vWgs8tWtD/vfbOHVrM3AV4ErVYFk42PlqrNP6KE LOLBngiYsuTyWNe9vwS+IDaTBwng9Z4KWqFwyZDMFrlRDE8VsJs= =FCFQ -----END PGP SIGNATURE----- Merge tag 'compiler-attributes-for-linus-v5.0-rc7' of git://github.com/ojeda/linux Pull compiler attributes fixes from Miguel Ojeda: "Clean the new GCC 9 -Wmissing-attributes warnings The upcoming GCC 9 release extends the -Wmissing-attributes warnings (enabled by -Wall) to C and aliases: it warns when particular function attributes are missing in the aliases but not in their target, e.g.: void __cold f(void) {} void __alias("f") g(void); diagnoses: warning: 'g' specifies less restrictive attribute than its target 'f': 'cold' [-Wmissing-attributes] These patch series clean these new warnings. Most of them are caused by the module_init/exit macros" Link: https://lore.kernel.org/lkml/20190125104353.2791-1-labbott@redhat.com/ * tag 'compiler-attributes-for-linus-v5.0-rc7' of git://github.com/ojeda/linux: include/linux/module.h: copy __init/__exit attrs to init/cleanup_module Compiler Attributes: add support for __copy (gcc >= 9) lib/crc32.c: mark crc32_le_base/__crc32c_le_base aliases as __pure
This commit is contained in:
Коммит
0b999ae361
|
@ -34,6 +34,7 @@
|
|||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) __GCC4_has_attribute_##x
|
||||
# define __GCC4_has_attribute___assume_aligned__ (__GNUC_MINOR__ >= 9)
|
||||
# define __GCC4_has_attribute___copy__ 0
|
||||
# define __GCC4_has_attribute___designated_init__ 0
|
||||
# define __GCC4_has_attribute___externally_visible__ 1
|
||||
# define __GCC4_has_attribute___noclone__ 1
|
||||
|
@ -100,6 +101,19 @@
|
|||
*/
|
||||
#define __attribute_const__ __attribute__((__const__))
|
||||
|
||||
/*
|
||||
* Optional: only supported since gcc >= 9
|
||||
* Optional: not supported by clang
|
||||
* Optional: not supported by icc
|
||||
*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-copy-function-attribute
|
||||
*/
|
||||
#if __has_attribute(__copy__)
|
||||
# define __copy(symbol) __attribute__((__copy__(symbol)))
|
||||
#else
|
||||
# define __copy(symbol)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Don't. Just don't. See commit 771c035372a0 ("deprecate the '__deprecated'
|
||||
* attribute warnings entirely and for good") for more information.
|
||||
|
|
|
@ -129,13 +129,13 @@ extern void cleanup_module(void);
|
|||
#define module_init(initfn) \
|
||||
static inline initcall_t __maybe_unused __inittest(void) \
|
||||
{ return initfn; } \
|
||||
int init_module(void) __attribute__((alias(#initfn)));
|
||||
int init_module(void) __copy(initfn) __attribute__((alias(#initfn)));
|
||||
|
||||
/* This is only required if you want to be unloadable. */
|
||||
#define module_exit(exitfn) \
|
||||
static inline exitcall_t __maybe_unused __exittest(void) \
|
||||
{ return exitfn; } \
|
||||
void cleanup_module(void) __attribute__((alias(#exitfn)));
|
||||
void cleanup_module(void) __copy(exitfn) __attribute__((alias(#exitfn)));
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -206,8 +206,8 @@ u32 __pure __weak __crc32c_le(u32 crc, unsigned char const *p, size_t len)
|
|||
EXPORT_SYMBOL(crc32_le);
|
||||
EXPORT_SYMBOL(__crc32c_le);
|
||||
|
||||
u32 crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
|
||||
u32 __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
|
||||
u32 __pure crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le);
|
||||
u32 __pure __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le);
|
||||
|
||||
/*
|
||||
* This multiplies the polynomials x and y modulo the given modulus.
|
||||
|
|
Загрузка…
Ссылка в новой задаче