This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Implement -Wswitch-fallthrough
- From: Marek Polacek <polacek at redhat dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 12 Aug 2016 16:42:35 +0200
- Subject: Re: Implement -Wswitch-fallthrough
- Authentication-results: sourceware.org; auth=none
- References: <20160711194340.GI13963@redhat.com> <CAF1jjLtzJT2wMFJEZeX+r3vNT6sH=Sf-34yS+8UjPgXy7kntjQ@mail.gmail.com> <20160713181633.GD2746@redhat.com> <alpine.DEB.2.20.1607132029190.23839@laptop-mg.saclay.inria.fr> <20160713184711.GH2746@redhat.com> <alpine.DEB.2.20.1607132052070.23839@laptop-mg.saclay.inria.fr>
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
--- 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
so it seems this warning really doesn't have any effect whatsoever on code generation.
Marek