https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53479
--- Comment #16 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Eric Gallager from comment #14) > (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(). No No No No :-) Recognising comments like "FALLTHROUGH" and "fall-through" is a pragmatic solution to avoid introducing new false-positive warnings for old code that works as designed. (New code C++ should use [[attributes]] not comments, and C code can use GNU __attributes__, and [[attributes]] have been proposed for C too). Comments should not alter codegen, which __builtin_unreachable does. Also, NOTREACHED is IME just one of countless variations on comments such as "We should never get here" and "If we get here it's a bug" etc. and matching such arbitrary comments in infeasible.