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