From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751507AbdFGNMX (ORCPT ); Wed, 7 Jun 2017 09:12:23 -0400 Received: from mail-oi0-f41.google.com ([209.85.218.41]:34470 "EHLO mail-oi0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751403AbdFGNMW (ORCPT ); Wed, 7 Jun 2017 09:12:22 -0400 MIME-Version: 1.0 In-Reply-To: <20170607085803.04829eb5@gandalf.local.home> References: <20170530181306.GV141096@google.com> <20170531235519.GX141096@google.com> <20170606212354.GZ141096@google.com> <20170607085803.04829eb5@gandalf.local.home> From: Arnd Bergmann Date: Wed, 7 Jun 2017 15:12:21 +0200 X-Google-Sender-Auth: FKbjkms-hnzbFSYNuBQqAoVNnQ8 Message-ID: Subject: Re: [RFC] clang: 'unused-function' warning on static inline functions To: Steven Rostedt Cc: Jens Axboe , Matthias Kaehlcke , Linus Torvalds , Linux Kernel Mailing List , Andrew Morton , Greg Kroah-Hartman , Ingo Molnar , Thomas Gleixner , Christoph Hellwig , David Rientjes , Douglas Anderson , Guenter Roeck , Mark Brown , David Miller Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 7, 2017 at 2:58 PM, Steven Rostedt wrote: > On Wed, 7 Jun 2017 10:17:18 +0200 > Arnd Bergmann 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