From: David Laight <David.Laight@ACULAB.COM>
To: 'Arnd Bergmann' <arnd@kernel.org>, Arnd Bergmann <arnd@arndb.de>
Cc: "linux-arch@vger.kernel.org" <linux-arch@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] asm-generic: fix ffs -Wshadow warning
Date: Mon, 26 Oct 2020 16:44:18 +0000 [thread overview]
Message-ID: <086e45b325074fc89f51354901aa5af6@AcuMS.aculab.com> (raw)
In-Reply-To: <20201026160006.3704027-1-arnd@kernel.org>
From: Arnd Bergmann
> Sent: 26 October 2020 16:00
>
> From: Arnd Bergmann <arnd@arndb.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@arndb.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)
next prev parent reply other threads:[~2020-10-26 16:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-26 15:59 [PATCH] asm-generic: fix ffs -Wshadow warning Arnd Bergmann
2020-10-26 16:44 ` David Laight [this message]
2020-10-26 18:57 ` 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=086e45b325074fc89f51354901aa5af6@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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