From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CD82D394480A; Fri, 14 May 2021 15:31:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CD82D394480A From: "tuliom at ascii dot art.br" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/100605] New: -Wimplicit-fallthrough=5 still recognizes comments Date: Fri, 14 May 2021 15:31:32 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tuliom at ascii dot art.br 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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: Fri, 14 May 2021 15:31:32 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100605 Bug ID: 100605 Summary: -Wimplicit-fallthrough=3D5 still recognizes comments Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: tuliom at ascii dot art.br Target Milestone: --- According to the GCC manual: "-Wimplicit-fallthrough=3D5 doesn=E2=80=99t recognize any comments as fallt= hrough comments, only attributes disable the warning." However, comments are still being recognized and are disabling the warning. In the following example, there are 3 fall-throughs: $ cat t.c #include #include uint32_t foo(size_t in) { uint32_t out =3D 0; uint32_t k =3D 0; switch (in & 3) { case 3: k =3D 3; // FALLTHROUGH case 2: k =3D 8; case 1: k =3D 16; case 0: default: out =3D k; break; } return out; } However, GCC 11 reports only 2 when using -Wimplicit-fallthrough=3D5: $ gcc-11 -c -Wimplicit-fallthrough=3D5 -Werror=3Dimplicit-fallthrough t.c t.c: In function =E2=80=98foo=E2=80=99: t.c:15:9: error: this statement may fall through [-Werror=3Dimplicit-fallthrough=3D] 15 | k =3D 8; | ~~^~~ t.c:16:5: note: here 16 | case 1: | ^~~~ t.c:17:9: error: this statement may fall through [-Werror=3Dimplicit-fallthrough=3D] 17 | k =3D 16; | ~~^~~~ t.c:18:5: note: here 18 | case 0: | ^~~~ cc1: some warnings being treated as errors=