<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi, All<br>
</p>
<p>When we building our qemu with GCC 7, we hit this error:</p>
<pre id="log_space">[ 528s] drivers/net/igbvf/igbvf_vf.c: In function 'igbvf_promisc_set_vf':
[ 528s] drivers/net/igbvf/igbvf_vf.c:359:10: error: this statement may fall through [-Werror=implicit-fallthrough=]
[ 528s] msgbuf |= E1000_VF_SET_PROMISC_MULTICAST;
[ 528s] drivers/net/igbvf/igbvf_vf.c:360:2: note: here
[ 528s] case e1000_promisc_unicast:
[ 528s] ^~~~
[ 528s] [BUILD] bin/phantom.o
[ 528s] [BUILD] bin/rtl8180_grf5101.o
[ 528s] cc1: all warnings being treated as errors
[ 528s] make[1]: *** [Makefile.housekeeping:856: bin/igbvf_vf.o] Error 1
[ 528s] make[1]: *** Waiting for unfinished jobs....
[ 528s] make[1]: Leaving directory '/home/abuild/rpmbuild/BUILD/qemu-2.7.0/roms/ipxe/src'
[ 528s] make: *** [Makefile:133: build-pxe-roms] Error 2
</pre>
<pre id="log_space">(<a class="moz-txt-link-freetext" href="https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:Gcc7/qemu/standard/x86_64">https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:Gcc7/qemu/standard/x86_64</a>)
Source code(v1.0.0):
switch (type) {
case e1000_promisc_multicast:
msgbuf |= E1000_VF_SET_PROMISC_MULTICAST;
break;
case e1000_promisc_enabled:
msgbuf |= E1000_VF_SET_PROMISC_MULTICAST;
case e1000_promisc_unicast:
msgbuf |= E1000_VF_SET_PROMISC_UNICAST;
case e1000_promisc_disabled:
break;
default:
return -E1000_ERR_MAC_INIT;
}
That is because GCC7 enables -Wimplicit-fallthrough now.
According to <a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html">https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html</a>
-Wimplicit-fallthrough
-Wimplicit-fallthrough is the same as -Wimplicit-fallthrough=3 and -Wno-implicit-fallthrough is the same as -Wimplicit-fallthrough=0.
Looks there are two options to fix it:
1. add /* fall through*/ comment in source code, which follows level 3 rule.
2. add -Wno-implicit-fallthrough in Makefile cflags
Could anyone give me some opinions about which fix should be better or is there other options to handle it?
Thanks.
Also found a pending patch followed option 2 above,
<a href="https://www.mail-archive.com/ipxe-devel@lists.ipxe.org/msg05329.html">https://www.mail-archive.com/ipxe-devel@lists.ipxe.org/msg05329.html</a>
Best,
Liang
</pre>
</body>
</html>