public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/111598] New: Wimplicit-fallthrough print for a code that is not compiled in
@ 2023-09-26 8:53 Hi-Angel at yandex dot ru
2023-09-26 17:30 ` [Bug c/111598] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: Hi-Angel at yandex dot ru @ 2023-09-26 8:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111598
Bug ID: 111598
Summary: Wimplicit-fallthrough print for a code that is not
compiled in
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: Hi-Angel at yandex dot ru
Target Milestone: ---
When a switch-case has a "fallthrough" case that is surrounded by an `#ifdef`
and is not compiled in, GCC does not recognize the `// fallthrough` comment and
prints a `this statement may fall through` warning.
# Steps to reproduce
$ cat test2.c
#include <stdio.h>
int main() {
enum {Field1, Field2} e = 0;
switch (e) {
case Field1:
puts("field1");
// fallthrough
#ifdef SOME_UNDEFINED_MACRO
case Field2:
puts("field2");
// fallthrough
#endif
default:
puts("default");
}
}
$ gcc test2.c -o /dev/null -Wimplicit-fallthrough
test2.c: In function ‘main’:
test2.c:7:13: warning: this statement may fall through
[-Wimplicit-fallthrough=]
7 | puts("field1");
| ^~~~~~~~~~~~~~
test2.c:14:9: note: here
14 | default:
| ^~~~~~~
## Expected
No warning, because every case ends with a fallthrough comment
## Actual
There's a warning
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c/111598] Wimplicit-fallthrough print for a code that is not compiled in
2023-09-26 8:53 [Bug c/111598] New: Wimplicit-fallthrough print for a code that is not compiled in Hi-Angel at yandex dot ru
@ 2023-09-26 17:30 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-26 17:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111598
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 77817.
*** This bug has been marked as a duplicate of bug 77817 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-26 17:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-26 8:53 [Bug c/111598] New: Wimplicit-fallthrough print for a code that is not compiled in Hi-Angel at yandex dot ru
2023-09-26 17:30 ` [Bug c/111598] " pinskia at gcc dot gnu.org
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).