Message ID | 20160711195821.GA13963@redhat.com |
---|---|
State | New |
Headers | show |
On Mon, Jul 11, 2016 at 9:58 PM, Marek Polacek <polacek@redhat.com> wrote: > 2016-07-11 Marek Polacek <polacek@redhat.com> > > PR c/7652 > * lto-plugin.c (lto_fallthrough): Define. > (parse_table_entry): Use it. > > diff --git gcc/lto-plugin/lto-plugin.c gcc/lto-plugin/lto-plugin.c > index 51afc52..ffdf54a 100644 > --- gcc/lto-plugin/lto-plugin.c > +++ gcc/lto-plugin/lto-plugin.c > @@ -77,6 +77,12 @@ along with this program; see the file COPYING3. If not see > # define O_BINARY 0 > #endif > > +#if __GNUC__ >= 7 > +# define lto_fallthrough() __builtin_fallthrough () > +#else > +# define lto_fallthrough() > +#endif > + > /* Segment name for LTO sections. This is only used for Mach-O. > FIXME: This needs to be kept in sync with darwin.c. */ > > @@ -254,6 +260,7 @@ parse_table_entry (char *p, struct ld_plugin_symbol *entry, > break; > } > /* FALL-THROUGH. */ > + lto_fallthrough (); This shows me that it would be nice to simply get this correct by parsing comments... I don't like __builtin_fallthrough () too much. Richard. > case ss_uscore: > entry->name = concat ("_", p, NULL); > break;
On Tue, Jul 12, 2016 at 12:22:55PM +0200, Richard Biener wrote: > > @@ -254,6 +260,7 @@ parse_table_entry (char *p, struct ld_plugin_symbol *entry, > > break; > > } > > /* FALL-THROUGH. */ > > + lto_fallthrough (); > > This shows me that it would be nice to simply get this correct by > parsing comments... Yea, seems that became a prerequisite for moving this forward. Not sure if I'll be able to manage that, but let me try what Jakub and David suggested (turn the commend into a pragma). > I don't like __builtin_fallthrough () too much. Understood. Marek
diff --git gcc/lto-plugin/lto-plugin.c gcc/lto-plugin/lto-plugin.c index 51afc52..ffdf54a 100644 --- gcc/lto-plugin/lto-plugin.c +++ gcc/lto-plugin/lto-plugin.c @@ -77,6 +77,12 @@ along with this program; see the file COPYING3. If not see # define O_BINARY 0 #endif +#if __GNUC__ >= 7 +# define lto_fallthrough() __builtin_fallthrough () +#else +# define lto_fallthrough() +#endif + /* Segment name for LTO sections. This is only used for Mach-O. FIXME: This needs to be kept in sync with darwin.c. */ @@ -254,6 +260,7 @@ parse_table_entry (char *p, struct ld_plugin_symbol *entry, break; } /* FALL-THROUGH. */ + lto_fallthrough (); case ss_uscore: entry->name = concat ("_", p, NULL); break;