* [PATCH] Mark inline functions as __maybe_unused
@ 2015-01-28 5:26 Behan Webster
2015-01-28 10:04 ` Måns Rullgård
0 siblings, 1 reply; 2+ messages in thread
From: Behan Webster @ 2015-01-28 5:26 UTC (permalink / raw)
To: torvalds; +Cc: behanw, linux-kernel, Arnd Bergmann, Christopher Li
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 <behanw@converseincode.com>
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "Christopher Li" <sparse@chrisli.org>
---
include/linux/compiler-gcc.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 02ae99e..c7b98fb 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -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))
--
1.9.1
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] Mark inline functions as __maybe_unused
2015-01-28 5:26 [PATCH] Mark inline functions as __maybe_unused Behan Webster
@ 2015-01-28 10:04 ` Måns Rullgård
0 siblings, 0 replies; 2+ messages in thread
From: Måns Rullgård @ 2015-01-28 10:04 UTC (permalink / raw)
To: Behan Webster; +Cc: torvalds, linux-kernel, Arnd Bergmann, Christopher Li
Behan Webster <behanw@converseincode.com> writes:
> clang warns if inline functions aren't used. By making them __maybe_unused
> there 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.
--
Måns Rullgård
mans@mansr.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-28 20:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-28 5:26 [PATCH] Mark inline functions as __maybe_unused Behan Webster
2015-01-28 10:04 ` Måns Rullgård
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®