Implement -Wswitch-fallthrough: lto

Marek Polacek polacek@redhat.com
Mon Jul 11 19:58:00 GMT 2016


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 ();
     case ss_uscore:
       entry->name = concat ("_", p, NULL);
       break;



More information about the Gcc-patches mailing list