From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751535AbdFFV3S (ORCPT ); Tue, 6 Jun 2017 17:29:18 -0400 Received: from mail-pg0-f48.google.com ([74.125.83.48]:34675 "EHLO mail-pg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751247AbdFFV3Q (ORCPT ); Tue, 6 Jun 2017 17:29:16 -0400 Subject: Re: [RFC] clang: 'unused-function' warning on static inline functions To: Matthias Kaehlcke , Linus Torvalds Cc: Arnd Bergmann , Linux Kernel Mailing List , Andrew Morton , Greg Kroah-Hartman , Ingo Molnar , Thomas Gleixner , Christoph Hellwig , Steven Rostedt , David Rientjes , Douglas Anderson , Guenter Roeck , Mark Brown , David Miller References: <20170530181306.GV141096@google.com> <20170531235519.GX141096@google.com> <20170606212354.GZ141096@google.com> From: Jens Axboe Message-ID: Date: Tue, 6 Jun 2017 15:29:07 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170606212354.GZ141096@google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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