public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/105939] New: "warning: anonymous struct declared inside parameter list will not be visible outside of this definition or declaration" should have a warning flag attached to it
@ 2022-06-13 0:37 egallager at gcc dot gnu.org
2022-06-13 1:06 ` [Bug c/105939] " egallager at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: egallager at gcc dot gnu.org @ 2022-06-13 0:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105939
Bug ID: 105939
Summary: "warning: anonymous struct declared inside parameter
list will not be visible outside of this definition or
declaration" should have a warning flag attached to it
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: egallager at gcc dot gnu.org
Blocks: 44209
Target Milestone: ---
This is a more specific example of bug 44209. Code taken from here:
https://twitter.com/icculus/status/1536140541200584710
$ cat icculus_twitter_thread.c
#include <stdio.h>
int main(void) {
int x = 0;
do printf("%d\n", x++); while (x < 10);
return 0;
}
const const const static const inline int xx;
xxx();
int xxxx(struct { int a; int b; } x) {}
$ /usr/local/bin/gcc -c -Wall -Wextra -Wshadow -pedantic -Wconversion
-Wold-style-definition -Wold-style-declaration -Wduplicated-branches
-Wduplicated-cond -Wlogical-op -Wnull-dereference -Wc++-compat -Wnested-externs
-Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes
icculus_twitter_thread.c
icculus_twitter_thread.c:9:7: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
9 | const const const static const inline int xx;
| ^~~~~
icculus_twitter_thread.c:9:13: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
9 | const const const static const inline int xx;
| ^~~~~
icculus_twitter_thread.c:9:1: warning: 'static' is not at beginning of
declaration [-Wold-style-declaration]
9 | const const const static const inline int xx;
| ^~~~~
icculus_twitter_thread.c:9:26: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
9 | const const const static const inline int xx;
| ^~~~~
icculus_twitter_thread.c:9:1: warning: 'inline' is not at beginning of
declaration [-Wold-style-declaration]
9 | const const const static const inline int xx;
| ^~~~~
icculus_twitter_thread.c:9:43: warning: variable 'xx' declared 'inline'
9 | const const const static const inline int xx;
| ^~
icculus_twitter_thread.c:9:43: warning: uninitialized 'const xx' is invalid in
C++ [-Wc++-compat]
icculus_twitter_thread.c:11:1: warning: data definition has no type or storage
class
11 | xxx();
| ^~~
icculus_twitter_thread.c:11:1: warning: type defaults to 'int' in declaration
of 'xxx' [-Wimplicit-int]
icculus_twitter_thread.c:11:1: warning: function declaration isn't a prototype
[-Wstrict-prototypes]
icculus_twitter_thread.c:13:10: warning: anonymous struct declared inside
parameter list will not be visible outside of this definition or declaration
13 | int xxxx(struct { int a; int b; } x) {}
| ^~~~~~
icculus_twitter_thread.c:13:5: warning: no previous prototype for 'xxxx'
[-Wmissing-prototypes]
13 | int xxxx(struct { int a; int b; } x) {}
| ^~~~
icculus_twitter_thread.c: In function 'xxxx':
icculus_twitter_thread.c:13:35: warning: unused parameter 'x'
[-Wunused-parameter]
13 | int xxxx(struct { int a; int b; } x) {}
| ~~~~~~~~~~~~~~~~~~~~~~~~~^
icculus_twitter_thread.c:13:39: warning: control reaches end of non-void
function [-Wreturn-type]
13 | int xxxx(struct { int a; int b; } x) {}
| ^
icculus_twitter_thread.c: At top level:
icculus_twitter_thread.c:9:43: warning: 'xx' defined but not used
[-Wunused-const-variable=]
9 | const const const static const inline int xx;
| ^~
$
Should I open separate bugs for how the warnings that say "warning: variable
'xx' declared 'inline'" and "warning: data definition has no type or storage
class" don't have flags linked to them as well? Or can we track those here,
too?
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44209
[Bug 44209] [meta-bug] Some warnings are not linked to diagnostics options
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/105939] "warning: anonymous struct declared inside parameter list will not be visible outside of this definition or declaration" should have a warning flag attached to it
2022-06-13 0:37 [Bug c/105939] New: "warning: anonymous struct declared inside parameter list will not be visible outside of this definition or declaration" should have a warning flag attached to it egallager at gcc dot gnu.org
@ 2022-06-13 1:06 ` egallager at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: egallager at gcc dot gnu.org @ 2022-06-13 1:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105939
--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
Oh, one more; I updated the testcase so it's now:
$ cat icculus_twitter_thread.c
#include <stdio.h>
int main(void) {
int x = 0;
do printf("%d\n", x++); while (x < 10);
return 0;
}
const const const static const inline int xx;
xxx();
int xxxx(struct { int a; int b; } x) {
for (struct { int a; int b; } ; ; ) {
printf("this doesn't have a warning flag either, fwiw\n");
}
return (x.a + x.b);
}
$ /usr/local/bin/gcc -c -Wall -Wextra -Wshadow -pedantic -Wconversion
-Wold-style-definition -Wold-style-declaration -Wduplicated-branches
-Wduplicated-cond -Wlogical-op -Wnull-dereference -Wc++-compat -Wnested-externs
-Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes
-fplan9-extensions icculus_twitter_thread.c
icculus_twitter_thread.c:9:7: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
9 | const const const static const inline int xx;
| ^~~~~
icculus_twitter_thread.c:9:13: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
9 | const const const static const inline int xx;
| ^~~~~
icculus_twitter_thread.c:9:1: warning: 'static' is not at beginning of
declaration [-Wold-style-declaration]
9 | const const const static const inline int xx;
| ^~~~~
icculus_twitter_thread.c:9:26: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
9 | const const const static const inline int xx;
| ^~~~~
icculus_twitter_thread.c:9:1: warning: 'inline' is not at beginning of
declaration [-Wold-style-declaration]
9 | const const const static const inline int xx;
| ^~~~~
icculus_twitter_thread.c:9:43: warning: variable 'xx' declared 'inline'
9 | const const const static const inline int xx;
| ^~
icculus_twitter_thread.c:9:43: warning: uninitialized 'const xx' is invalid in
C++ [-Wc++-compat]
icculus_twitter_thread.c:11:1: warning: data definition has no type or storage
class
11 | xxx();
| ^~~
icculus_twitter_thread.c:11:1: warning: type defaults to 'int' in declaration
of 'xxx' [-Wimplicit-int]
icculus_twitter_thread.c:11:1: warning: function declaration isn't a prototype
[-Wstrict-prototypes]
icculus_twitter_thread.c:13:10: warning: anonymous struct declared inside
parameter list will not be visible outside of this definition or declaration
13 | int xxxx(struct { int a; int b; } x) {
| ^~~~~~
icculus_twitter_thread.c:13:5: warning: no previous prototype for 'xxxx'
[-Wmissing-prototypes]
13 | int xxxx(struct { int a; int b; } x) {
| ^~~~
icculus_twitter_thread.c: In function 'xxxx':
icculus_twitter_thread.c:14:17: warning: unnamed struct/union that defines no
instances
14 | for (struct { int a; int b; } ; ; ) {
| ^
icculus_twitter_thread.c: At top level:
icculus_twitter_thread.c:9:43: warning: 'xx' defined but not used
[-Wunused-const-variable=]
9 | const const const static const inline int xx;
| ^~
$
(the new warning without the flag attached to it is the one with the "unnamed
struct/union that defines no instances" text)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-13 1:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-13 0:37 [Bug c/105939] New: "warning: anonymous struct declared inside parameter list will not be visible outside of this definition or declaration" should have a warning flag attached to it egallager at gcc dot gnu.org
2022-06-13 1:06 ` [Bug c/105939] " egallager at gcc dot gnu.org
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).