public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "tuliom at ascii dot art.br" <gcc-bugzilla@gcc.gnu.org> 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 [thread overview] Message-ID: <bug-100605-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100605 Bug ID: 100605 Summary: -Wimplicit-fallthrough=5 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=5 doesn’t recognize any comments as fallthrough 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 <stddef.h> #include <inttypes.h> uint32_t foo(size_t in) { uint32_t out = 0; uint32_t k = 0; switch (in & 3) { case 3: k = 3; // FALLTHROUGH case 2: k = 8; case 1: k = 16; case 0: default: out = k; break; } return out; } However, GCC 11 reports only 2 when using -Wimplicit-fallthrough=5: $ gcc-11 -c -Wimplicit-fallthrough=5 -Werror=implicit-fallthrough t.c t.c: In function ‘foo’: t.c:15:9: error: this statement may fall through [-Werror=implicit-fallthrough=] 15 | k = 8; | ~~^~~ t.c:16:5: note: here 16 | case 1: | ^~~~ t.c:17:9: error: this statement may fall through [-Werror=implicit-fallthrough=] 17 | k = 16; | ~~^~~~ t.c:18:5: note: here 18 | case 0: | ^~~~ cc1: some warnings being treated as errors
next reply other threads:[~2021-05-14 15:31 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-14 15:31 tuliom at ascii dot art.br [this message] 2021-05-14 15:55 ` [Bug c/100605] " tuliom at ascii dot art.br 2021-05-17 7:58 ` marxin at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-100605-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).