This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Implement -Wswitch-fallthrough: rs6000
On Mon, Jul 11, 2016 at 01:36:02PM -0700, Bruce Korb wrote:
> I'm curious about this. In the process of developing a code analysis
> tool, I found some GCC code that was, basically:
>
> switch (v) {
> case 0:
> if (e) {
> do_something();
> } else {
> case 1:
> do_something_else();
> }
> }
Yeah, I saw this too, somewhere in the C++ FE.
> Does this patch mean that the above got fixed? I mean, if you're
> going to fret over linguistic tags to make falling through explicit,
> it would seem the above code is pretty sore-thumby, yes?
My current implementation warns here, but the warning can be suppressed
by adding /* FALLTHRU */ or __builtin_fallthrough(); before the
do_something_else() line.
Does that answer your question?
Marek