lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 25 May 2017 09:14:06 -0700
From:   Matthias Kaehlcke <mka@...omium.org>
To:     Ingo Molnar <mingo@...nel.org>
Cc:     David Rientjes <rientjes@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Christoph Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...nel.org>,
        Joonsoo Kim <iamjoonsoo.kim@....com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org,
        Douglas Anderson <dianders@...omium.org>,
        Mark Brown <broonie@...nel.org>,
        David Miller <davem@...emloft.net>
Subject: Re: [patch] compiler, clang: suppress warning for unused static
 inline functions

El Thu, May 25, 2017 at 07:52:07AM +0200 Ingo Molnar ha dit:

> 
> * Matthias Kaehlcke <mka@...omium.org> wrote:
> 
> > El Wed, May 24, 2017 at 02:01:15PM -0700 David Rientjes ha dit:
> > 
> > > GCC explicitly does not warn for unused static inline functions for
> > > -Wunused-function.  The manual states:
> > > 
> > > 	Warn whenever a static function is declared but not defined or
> > > 	a non-inline static function is unused.
> > > 
> > > Clang does warn for static inline functions that are unused.
> > > 
> > > It turns out that suppressing the warnings avoids potentially complex
> > > #ifdef directives, which also reduces LOC.
> > > 
> > > Supress the warning for clang.
> > > 
> > > Signed-off-by: David Rientjes <rientjes@...gle.com>
> > > ---
> > 
> > As expressed earlier in other threads, I don't think gcc's behavior is
> > preferable in this case. The warning on static inline functions (only
> > in .c files) allows to detect truly unused code. About 50% of the
> > warnings I have looked into so far fall into this category.
> > 
> > In my opinion it is more valuable to detect dead code than not having
> > a few more __maybe_unused attributes (there aren't really that many
> > instances, at least with x86 and arm64 defconfig). In most cases it is
> > not necessary to use #ifdef, it is an option which is preferred by
> > some maintainers. The reduced LOC is arguable, since dectecting dead
> > code allows to remove it.
> 
> Static inline functions in headers are often not dead code.

Sure, there is no intention to delete these and clang doesn't raise
warnings about unused static inline functions in headers.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ