[Bug c/77817] -Wimplicit-fallthrough: cpp directive renders FALLTHRU comment ineffective
trippels at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Oct 12 16:28:00 GMT 2016
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.
More information about the Gcc-bugs
mailing list