[Bug c/78927] New: implicit-fallthrough is very picky about FALLTHROUGH comment location
coypu at sdf dot org
gcc-bugzilla@gcc.gnu.org
Sun Dec 25 18:07:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78927
Bug ID: 78927
Summary: implicit-fallthrough is very picky about FALLTHROUGH
comment location
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: coypu at sdf dot org
Target Milestone: ---
This is the (currently latest) 20161218 snapshot.
int main() {
int num = 3;
int a;
switch (num) {
case 1:
{
a = 3;
/* FALLTHROUGH */
}
case 2:
{
a = 2;
break;
}
default:
a = 3;
}
return 0;
}
% /home/pkg2/pkg/gcc7snapshot/bin/gcc -Werror=implicit-fallthrough test16.c
test16.c: In function ‘main’:
test16.c:7:6: error: this statement may fall through
[-Werror=implicit-fallthrough=]
a = 3;
~~^~~
test16.c:10:3: note: here
case 2:
^~~~
cc1: some warnings being treated as errors
% /home/pkg2/pkg/gcc7snapshot/bin/gcc --version
gcc (GCC) 7.0.0 20161218 (experimental)
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
There are some more warnings I get while compiling netbsd's kernel regarding
FALLTHRU location, but perhaps more "controversial" than this.
Moving the FALLTHROUGH comment one line below works.
More information about the Gcc-bugs
mailing list