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: "trippels 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:21:39 +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 #10 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
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:
bar(2);
default:
break;
}
}
markus@x4 /tmp % gcc -Wimplicit-fallthrough=1 -c fall.c
fall.c: In function ‘foo’:
fall.c:6:5: warning: this statement may fall through [-Wimplicit-fallthrough=]
bar(1);
^~~~~~
fall.c:9:3: note: here
case 2:
^~~~
Two issues; the first is the bogus warning, the second that we don't
warn for the case 2 fall-through.