This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Implement -Wswitch-fallthrough: lto


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]