[ipxe-devel] [PATCH] [build] Ignore GCC 7 implicit-fallthrough errors.

Vinson Lee vlee at freedesktop.org
Tue Feb 14 00:42:48 UTC 2017


GCC 7 -Wextra now enables -Wimplicit-fallthrough.

https://gcc.gnu.org/gcc-7/changes.html

$ make
[...]
  [BUILD] bin/igbvf_vf.o
drivers/net/igbvf/igbvf_vf.c: In function ‘igbvf_promisc_set_vf’:
drivers/net/igbvf/igbvf_vf.c:359:10: error: this statement may fall through [-Werror=implicit-fallthrough=]
   msgbuf |= E1000_VF_SET_PROMISC_MULTICAST;
drivers/net/igbvf/igbvf_vf.c:360:2: note: here
  case e1000_promisc_unicast:
  ^~~~

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 src/Makefile.housekeeping | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping
index f09db37289e3..5e67fbc3bc24 100644
--- a/src/Makefile.housekeeping
+++ b/src/Makefile.housekeeping
@@ -179,6 +179,13 @@ WNA_FLAGS := $(shell $(WNA_TEST) && $(ECHO) '-Wno-address')
 WORKAROUND_CFLAGS += $(WNA_FLAGS)
 endif
 
+# gcc 7.0 -Wextra enables -Wimplicit-fallthrough.
+ifeq ($(CCTYPE),gcc)
+WNIF_TEST = $(CC) -Wno-implicit-fallthrough -x c -c /dev/null -o /dev/null >/dev/null 2>&1
+WNIF_FLAGS := $(shell $(WNIF_TEST) && $(ECHO) '-Wno-implicit-fallthrough')
+WORKAROUND_CFLAGS += $(WNIF_FLAGS)
+endif
+
 # Some versions of gas choke on division operators, treating them as
 # comment markers.  Specifying --divide will work around this problem,
 # but isn't available on older gas versions.
-- 
2.11.1




More information about the ipxe-devel mailing list