Implement -Wswitch-fallthrough: rs6000

Marek Polacek polacek@redhat.com
Wed Jul 13 18:40:00 GMT 2016


On Wed, Jul 13, 2016 at 11:30:34AM -0700, Bruce Korb wrote:
> > On Mon, Jul 11, 2016 at 01:36:02PM -0700, Bruce Korb wrote:
> > [[putrid code deleted]]
> >> 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?
> 
> Not in a satisfying way. :)  I understand that syntactically, you can

Ah, sorry.

> drop a "case" in wherever you can drop a statement label.  That
> doesn't mean you should.  Since I wasn't fixing GCC code, I just
> rolled my eyes and moved on.  However, if the code is going to be
> changed, then contortions like that ought to be addressed.  Both for
> aesthetics and for code clarity.

Most likely what you saw was in cxx_pretty_printer::declaration_specifiers.
I will have to do something about this, either add /* FALLTHRU */ or rewrite
the code slightly, as you suggest.  But that will involve duplicating the
c_pretty_printer::declaration_specifiers (t);
line, so some people might be against it.

	Marek



More information about the Gcc-patches mailing list