mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Matthias Kaehlcke <mka@chromium.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Christoph Hellwig <hch@lst.de>,
	Steven Rostedt <rostedt@goodmis.org>,
	David Rientjes <rientjes@google.com>,
	Douglas Anderson <dianders@chromium.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Mark Brown <broonie@kernel.org>,
	David Miller <davem@davemloft.net>
Subject: Re: [RFC] clang: 'unused-function' warning on static inline functions
Date: Tue, 6 Jun 2017 15:29:07 -0600	[thread overview]
Message-ID: <eb3f47af-b622-f898-44b8-3174ca871ab1@kernel.dk> (raw)
In-Reply-To: <20170606212354.GZ141096@google.com>

On 06/06/2017 03:23 PM, Matthias Kaehlcke wrote:
> El Tue, Jun 06, 2017 at 09:32:35AM -0700 Linus Torvalds ha dit:
> 
>> On Tue, Jun 6, 2017 at 4:16 AM, Arnd Bergmann <arnd@arndb.de> wrote:
>>>
>>> Those should all be fairly easy to address, I'd vote for leaving the
>>> warning enabled
>>> in clang, and possibly asking the gcc maintainers to add a similar feature for
>>> warning about it.
>>
>> Hell no. That warning is pointless shit.
> 
> I tend to disagree, the warning is useful to detect truly unused
> static inline functions, which should be removed, rather than be
> carried around/maintained for often long periods of time.

One example is the patch sent for CFQ, which has macros for define
functions for setting/clearing bits on the queue:

#define CFQ_CFQQ_FNS(name)

for one bit, we never clear the bit after we set it, we only set it and
later test for it. Hence the clear variant of that function is unused.

Now I get a warning. The fix to that would be to define a new variant of
CFQ_CFQQ_FNS() that only declares the exact one I need for the version
that is never cleared.

Or the fix is to just ignore the bogus warning on an unused inline.  I
greatly prefer the latter.

The counter example is this one:

http://git.kernel.dk/cgit/linux-block/commit/?id=03ea8ad78cfb2910862c8dfcd2a627fc04097db2

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.

-- 
Jens Axboe

  parent reply	other threads:[~2017-06-06 21:29 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30 18:13 Matthias Kaehlcke
2017-05-31 23:55 ` Matthias Kaehlcke
2017-06-06 11:16   ` Arnd Bergmann
2017-06-06 16:32     ` Linus Torvalds
2017-06-06 21:23       ` Matthias Kaehlcke
2017-06-06 21:28         ` Linus Torvalds
2017-06-07  0:28           ` Matthias Kaehlcke
2017-06-07  5:59             ` David Rientjes
2017-06-07 19:43           ` Arnd Bergmann
2017-06-07 20:36             ` Linus Torvalds
2017-06-07 21:24               ` Steven Rostedt
2017-06-08  8:59             ` Arnd Bergmann
2017-06-06 21:29         ` Jens Axboe [this message]
2017-06-07  8:17           ` Arnd Bergmann
2017-06-07 12:58             ` Steven Rostedt
2017-06-07 13:12               ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eb3f47af-b622-f898-44b8-3174ca871ab1@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dianders@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mingo@kernel.org \
    --cc=mka@chromium.org \
    --cc=rientjes@google.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®