Mark inline functions as __maybe_unused
PATCH 1/1 Mark inline functions as __maybe_unused
clang warns if inline functions aren't used. By making them __maybe_unused there is no warning for either gcc nor clang.
Signed-off-by Behan Webster <[email protected]>
Suggested-by Arnd Bergmann <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc "Christopher Li" <[email protected]>
--- include/linux/compiler-gcc.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
include/linux/compiler-gcc.h +6 -6
@@ -53,14 +53,14 @@*/ #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)) notrace __maybe_unused +# define __inline__ __inline__ __attribute__((always_inline)) notrace __maybe_unused +# define __inline __inline __attribute__((always_inline)) notrace __maybe_unused#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 notrace __maybe_unused +# define __inline__ __inline__ notrace __maybe_unused +# define __inline __inline notrace __maybe_unused#endif #define __deprecated __attribute__((deprecated))
Signature · 1 line
1.9.1
Quoted 2 lines · Behan Webster
clang warns if inline functions aren't used. By making them
__maybe_unusedthere is no warning for either gcc nor clang.
Are you sure about that? I've never seen such behaviour from clang (or any other compiler), and it would truly be idiotic. If clang has taken to warning about unused inline functions, that's a regression that needs to be addressed in clang, not the kernel.
Signature · 2 lines
Måns Rullgård [email protected]