Skip to content

Commit abb2ea7

Browse files
rientjestorvalds
authored andcommitted
compiler, clang: suppress warning for unused static inline functions
GCC explicitly does not warn for unused static inline functions for -Wunused-function. The manual states: Warn whenever a static function is declared but not defined or a non-inline static function is unused. Clang does warn for static inline functions that are unused. It turns out that suppressing the warnings avoids potentially complex #ifdef directives, which also reduces LOC. Suppress the warning for clang. Signed-off-by: David Rientjes <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 84c6c30 commit abb2ea7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

include/linux/compiler-clang.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,10 @@
1515
* with any version that can compile the kernel
1616
*/
1717
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
18+
19+
/*
20+
* GCC does not warn about unused static inline functions for
21+
* -Wunused-function. This turns out to avoid the need for complex #ifdef
22+
* directives. Suppress the warning in clang as well.
23+
*/
24+
#define inline inline __attribute__((unused))

0 commit comments

Comments
 (0)