From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 56AFA3857341; Mon, 13 Jun 2022 01:06:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 56AFA3857341 From: "egallager at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [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 Date: Mon, 13 Jun 2022 01:06:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: egallager at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jun 2022 01:06:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105939 --- Comment #1 from Eric Gallager --- Oh, one more; I updated the testcase so it's now: $ cat icculus_twitter_thread.c #include int main(void) { int x =3D 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-ext= erns -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -fplan9-extensions icculus_twitter_thread.c icculus_twitter_thread.c:9:7: warning: duplicate 'const' declaration specif= ier [-Wduplicate-decl-specifier] 9 | const const const static const inline int xx; | ^~~~~ icculus_twitter_thread.c:9:13: warning: duplicate 'const' declaration speci= fier [-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 speci= fier [-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 stor= age class 11 | xxx(); | ^~~ icculus_twitter_thread.c:11:1: warning: type defaults to 'int' in declarati= on of 'xxx' [-Wimplicit-int] icculus_twitter_thread.c:11:1: warning: function declaration isn't a protot= ype [-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=3D] 9 | const const const static const inline int xx; | ^~ $ (the new warning without the flag attached to it is the one with the "unnam= ed struct/union that defines no instances" text)=