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-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

+18 -4
+14
include/linux/compiler_attributes.h
··· 34 34 #ifndef __has_attribute 35 35 # define __has_attribute(x) __GCC4_has_attribute_##x 36 36 # define __GCC4_has_attribute___assume_aligned__ (__GNUC_MINOR__ >= 9) 37 + # define __GCC4_has_attribute___copy__ 0 37 38 # define __GCC4_has_attribute___designated_init__ 0 38 39 # define __GCC4_has_attribute___externally_visible__ 1 39 40 # define __GCC4_has_attribute___noclone__ 1 ··· 100 99 * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute 101 100 */ 102 101 #define __attribute_const__ __attribute__((__const__)) 102 + 103 + /* 104 + * Optional: only supported since gcc >= 9 105 + * Optional: not supported by clang 106 + * Optional: not supported by icc 107 + * 108 + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-copy-function-attribute 109 + */ 110 + #if __has_attribute(__copy__) 111 + # define __copy(symbol) __attribute__((__copy__(symbol))) 112 + #else 113 + # define __copy(symbol) 114 + #endif 103 115 104 116 /* 105 117 * Don't. Just don't. See commit 771c035372a0 ("deprecate the '__deprecated'
+2 -2
include/linux/module.h
··· 129 129 #define module_init(initfn) \ 130 130 static inline initcall_t __maybe_unused __inittest(void) \ 131 131 { return initfn; } \ 132 - int init_module(void) __attribute__((alias(#initfn))); 132 + int init_module(void) __copy(initfn) __attribute__((alias(#initfn))); 133 133 134 134 /* This is only required if you want to be unloadable. */ 135 135 #define module_exit(exitfn) \ 136 136 static inline exitcall_t __maybe_unused __exittest(void) \ 137 137 { return exitfn; } \ 138 - void cleanup_module(void) __attribute__((alias(#exitfn))); 138 + void cleanup_module(void) __copy(exitfn) __attribute__((alias(#exitfn))); 139 139 140 140 #endif 141 141
+2 -2
lib/crc32.c
··· 206 206 EXPORT_SYMBOL(crc32_le); 207 207 EXPORT_SYMBOL(__crc32c_le); 208 208 209 - u32 crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le); 210 - u32 __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le); 209 + u32 __pure crc32_le_base(u32, unsigned char const *, size_t) __alias(crc32_le); 210 + u32 __pure __crc32c_le_base(u32, unsigned char const *, size_t) __alias(__crc32c_le); 211 211 212 212 /* 213 213 * This multiplies the polynomials x and y modulo the given modulus.