This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Implement -Wswitch-fallthrough: lto
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 12 Jul 2016 12:22:55 +0200
- Subject: Re: Implement -Wswitch-fallthrough: lto
- Authentication-results: sourceware.org; auth=none
- References: <20160711194340.GI13963@redhat.com> <20160711195821.GA13963@redhat.com>
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;