public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/106424] New: __attribute__ unused confuses -Wshadow when placed on internal parameter of fn ptr
@ 2022-07-24 6:59 rusty at rustcorp dot com.au
0 siblings, 0 replies; only message in thread
From: rusty at rustcorp dot com.au @ 2022-07-24 6:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106424
Bug ID: 106424
Summary: __attribute__ unused confuses -Wshadow when placed on
internal parameter of fn ptr
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: rusty at rustcorp dot com.au
Target Milestone: ---
OK, this is a weird one. I have some automated code which adds attributes
and it (overzealously) added it to the internal parameter of a callback:
void func(char *arg,
void (*cb)(char *arg __attribute__((__unused__))))
{ }
With -Wshadow=local (and -Wshadow) this gives a spurious warning:
foo.c:2:28: warning: declaration of ‘arg’ shadows a parameter [-Wshadow]
2 | void (*cb)(char *arg __attribute__((__unused__))))
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
foo.c:1:17: note: shadowed declaration is here
1 | void func(char *arg,
| ~~~~~~^~~
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-24 6:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-24 6:59 [Bug c/106424] New: __attribute__ unused confuses -Wshadow when placed on internal parameter of fn ptr rusty at rustcorp dot com.au
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).