[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK8P3a22M5hJG=9uzN6fRMffsGfkt9sWeOYVy8ENN+dB13A1yg@mail.gmail.com>
Date: Wed, 7 Jun 2017 15:12:21 +0200
From: Arnd Bergmann <arnd@...db.de>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Jens Axboe <axboe@...nel.dk>, Matthias Kaehlcke <mka@...omium.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
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>,
David Rientjes <rientjes@...gle.com>,
Douglas Anderson <dianders@...omium.org>,
Guenter Roeck <linux@...ck-us.net>,
Mark Brown <broonie@...nel.org>,
David Miller <davem@...emloft.net>
Subject: Re: [RFC] clang: 'unused-function' warning on static inline functions
On Wed, Jun 7, 2017 at 2:58 PM, Steven Rostedt <rostedt@...dmis.org> wrote:
> On Wed, 7 Jun 2017 10:17:18 +0200
> Arnd Bergmann <arnd@...db.de> wrote:
>> > where it is truly just dead junk. I'd rather just leave the dead junk
>> > than have pointless warnings, if I have to choose one of the two
>> > outcomes.
>>
>> This is a relatively rare case, with an inline function defined by a macro, and
>> I sent a patch for a similar one in 1f318a8bafcf ("modules: mark
>> __inittest/__exittest
>> as __maybe_unused"). I think this is a case where the __maybe_unused
>> annotation is reasonable, though for the other instances of unused inline
>> functions in .c files, there is often a better way: typically the only caller
>> of a function is inside of an #ifdef and moving the inline function definition
>> into the same #ifdef block makes it clearer what is going on.
>>
>
> How many warnings does the TRACE_EVENT() macros produce? That macro
> creates a lot of static inline functions for every event. For example,
> it will create an rcuidle() version of a tracepoint for those locations
> that need to be called where RCU is not watching. It also adds a
> trace_#tracepoint#_enabled() function for those that want to test if
> the tracepoint is enabled or not.
>
> That is, every tracepoint creates static inlined functions for cases
> that are used by only a few. I'm sure they will cause lots of warnings
> because there will be a lot of unused static inlined functions.
The TRACE_EVENT() macro is always invoked from header files, so
clang does not warn about unused instances. The only other header
I found that defines macros that cause unused inline functions is
include/linux/interval_tree_generic.h, but I only saw two warnings
from that in the whole allmodconfig build.
Arnd
Powered by blists - more mailing lists