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]
Message-ID: <086e45b325074fc89f51354901aa5af6@AcuMS.aculab.com>
Date:   Mon, 26 Oct 2020 16:44:18 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Arnd Bergmann' <arnd@...nel.org>, Arnd Bergmann <arnd@...db.de>
CC:     "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] asm-generic: fix ffs -Wshadow warning

From: Arnd Bergmann
> Sent: 26 October 2020 16:00
> 
> From: Arnd Bergmann <arnd@...db.de>
> 
> gcc -Wshadow warns about the ffs() definition that has the
> same name as the global ffs() built-in:
> 
> include/asm-generic/bitops/builtin-ffs.h:13:28: warning: declaration of 'ffs' shadows a built-in
> function [-Wshadow]
> 
> This is annoying because 'make W=2' warns every time this
> header gets included.
> 
> Change it to use a #define instead, making callers directly
> reference the builtin.
> 
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  include/asm-generic/bitops/builtin-ffs.h | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/include/asm-generic/bitops/builtin-ffs.h b/include/asm-generic/bitops/builtin-ffs.h
> index 458c85ebcd15..1dacfdb4247e 100644
> --- a/include/asm-generic/bitops/builtin-ffs.h
> +++ b/include/asm-generic/bitops/builtin-ffs.h
> @@ -10,9 +10,6 @@
>   * the libc and compiler builtin ffs routines, therefore
>   * differs in spirit from the above ffz (man ffs).
>   */
> -static __always_inline int ffs(int x)
> -{
> -	return __builtin_ffs(x);
> -}
> +#define ffs(x) __builtin_ffs(x)
> 
>  #endif
> --
> 2.27.0

An alternative would be to add #define ffs(x) our_inline_ffs(x)
before the inline function definition.

I though the idea of the __builtin_ prefix was that you could
have a function with the same name :-(

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ