This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53479] Control flow analysis reports warnings in switch over an enum class even if all possible values have their branches
- From: "egall at gwmail dot gwu.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 12 Sep 2016 01:11:42 +0000
- Subject: [Bug c++/53479] Control flow analysis reports warnings in switch over an enum class even if all possible values have their branches
- Auto-submitted: auto-generated
- References: <bug-53479-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53479
--- Comment #14 from Eric Gallager <egall at gwmail dot gwu.edu> ---
(In reply to Manuel López-Ibáñez from comment #9)
> In summary, neither adding 'default' or 'return' are recommended to silence
> this warning if you think the warning is wrong. If you think the warning
> will always be wrong, use __builtin_unreachable(). If you think it is wrong
> now, but you would like to notice if it stops being wrong, then use
> assert(false).
This is probably an issue for a separate bug, but speaking of
__builtin_unreachable(), now that GCC is going to start recognizing the
lint-style comment of:
/* FALLTHROUGH */
for the benefit of -Wimplicit-fallthrough, could it also start recognizing the
lint-style comment of:
/* NOTREACHED */
as a synonym for __builtin_unreachable()? I've seen comments like that in a lot
of code, actually, and it'd be a more portable solution than
__builtin_unreachable().