This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/77817] -Wimplicit-fallthrough: cpp directive renders FALLTHRU comment ineffective
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 12 Oct 2016 16:28:26 +0000
- Subject: [Bug c/77817] -Wimplicit-fallthrough: cpp directive renders FALLTHRU comment ineffective
- Auto-submitted: auto-generated
- References: <bug-77817-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77817
--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Markus Trippelsdorf from comment #10)
> The testcase from PR77955:
>
> markus@x4 /tmp % cat fall.c
> void bar(int);
>
> void foo(int i) {
> switch (i) {
> case 1: {
> bar(1);
> // fall-through
> }
> case 2:
Well, this one is even much harder than the preprocessor issue, it isn't
solvable by preserving CPP_COMMENT tokens and ignoring them, there are tokens
in between the fallthru comment and case keyword even after preprocessing here.
I'm afraid this is a clear WONTFIX, move the comment or better use
__attribute__((fallthrough))/[[fallthrough]] instead.
> bar(2);
> default:
> break;
Not warning here is completely intentional, it is a fallthru into break;