lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Tue, 6 Jun 2017 22:56:49 -0700 (PDT) From: David Rientjes <rientjes@...gle.com> To: Matthias Kaehlcke <mka@...omium.org>, Linus Torvalds <torvalds@...ux-foundation.org> cc: Arnd Bergmann <arnd@...db.de>, Linux Kernel Mailing List <linux-kernel@...r.kernel.org>, Andrew Morton <akpm@...ux-foundation.org>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Ingo Molnar <mingo@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Christoph Hellwig <hch@....de>, Jens Axboe <axboe@...nel.dk>, Steven Rostedt <rostedt@...dmis.org>, Douglas Anderson <dianders@...omium.org>, Guenter Roeck <linux@...ck-us.net>, Mark Brown <broonie@...nel.org>, David Miller <davem@...emloft.net> Subject: [patch] compiler, clang: move inline definition to compiler-gcc.h The motivation of commit abb2ea7dfd82 ("compiler, clang: suppress warning for unused static inline functions") is to suppress clang's warnings about unused static inline functions. Clang defines __GNUC__ so it inherits all of compiler-gcc.h as well, so the redefinition of `inline' ends up overriding the definition in compiler-gcc.h. Simply annotate all inline functions as __attribute__((unused)). It's necessary to suppress the warning for clang and is implicit with gcc. Reported-by: Matthias Kaehlcke <mka@...omium.org> Signed-off-by: David Rientjes <rientjes@...gle.com> --- Matthias, please add your Tested-by if this works for you, thanks! include/linux/compiler-clang.h | 7 ------- include/linux/compiler-gcc.h | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -15,10 +15,3 @@ * with any version that can compile the kernel */ #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) - -/* - * 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. - */ -#define inline inline __attribute__((unused)) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 0efef9cf014f..1264f0688b10 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -65,19 +65,21 @@ #endif /* - * Force always-inline if the user requests it so via the .config, - * or if gcc is too old: + * Force always_inline if the user requests it via the .config, or if gcc is + * version 3 or earlier. Also disable unused static inline function warnings + * to avoid the need for complex #ifdef directives: this is implicit with gcc + * but is needed for clang, which also sets __GNUC__. */ #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) -#define inline inline __attribute__((always_inline)) notrace -#define __inline__ __inline__ __attribute__((always_inline)) notrace -#define __inline __inline __attribute__((always_inline)) notrace +#define inline inline __attribute__((always_inline,unused)) notrace +#define __inline__ __inline__ __attribute__((always_inline,unused)) notrace +#define __inline __inline __attribute__((always_inline,unused)) notrace #else /* A lot of inline functions can cause havoc with function tracing */ -#define inline inline notrace -#define __inline__ __inline__ notrace -#define __inline __inline notrace +#define inline inline __attribute__((unused)) notrace +#define __inline__ __inline__ __attribute__((unused)) notrace +#define __inline __inline __attribute__((unused)) notrace #endif #define __always_inline inline __attribute__((always_inline))
Powered by blists - more mailing lists