diff mbox

Implement -Wswitch-fallthrough

Message ID 20160812144235.GA7007@redhat.com
State New
Headers show

Commit Message

Marek Polacek Aug. 12, 2016, 2:42 p.m. UTC
On Wed, Jul 13, 2016 at 09:05:26PM +0200, Marc Glisse wrote:
> > > Unrelated question: are there cases where __builtin_fallthrough() has any
> > > impact on code generation?
> > 
> > It should not -- my implementation gets rid of all __builtin_fallthrough()
> > during gimple-low, before most of the optimizations kick in, so it shouldn't
> > make any real difference.
> 
> "should", "most", "real"... This is a bit like compare-debug, as a user I
> expect it to only affect warnings, and if it can affect code generation,
> even in small ways, I would like the doc to tell me.

Dunno if this really proves anything, but I took dwarf2out.ii (it's huge),
and compiled it with
./cc1plus -quiet -g -O2
and then with
./cc1plus -quiet -g -O2 -Wimplicit-fallthrough
and compared the final .s files.  The result is just this:

$ diff -u dwarf2out-v.s dwarf2out.s

so it seems this warning really doesn't have any effect whatsoever on code generation.

	Marek
diff mbox

Patch

--- dwarf2out-v.s	2016-08-12 16:37:11.479918482 +0200
+++ dwarf2out.s	2016-08-12 16:38:06.825929792 +0200
@@ -116459,6 +116459,7 @@ 
 .LBB35755:
 .LBB35748:
 .LBB35742:
+	.loc 1 17164 0
 	jmp	.L11208
 .LVL13482:
 	.p2align 4,,10