]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
mdadm: Add Wimplicit-fallthrough=0 in Makefile
authorXiao Ni <xni@redhat.com>
Fri, 17 Mar 2017 11:55:42 +0000 (19:55 +0800)
committerJes Sorensen <Jes.Sorensen@gmail.com>
Fri, 17 Mar 2017 19:56:50 +0000 (15:56 -0400)
There are many errors like 'error: this statement may fall through'.
But the logic is right. So add the flag Wimplicit-fallthrough=0
to disable the error messages. The method I use is from
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
#index-Wimplicit-fallthrough-375

Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Makefile

index a6f464c3162681e4ea82d8ad1bac332a54b84b14..d1a6ac46eea0c038e8efd3382bec761447fff9c8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,11 @@ ifdef WARN_UNUSED
 CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3
 endif
 
+FALLTHROUGH := $(shell gcc -v --help 2>&1 | grep "implicit-fallthrough" | wc -l)
+ifneq "$(FALLTHROUGH)"  "0"
+CWFLAGS += -Wimplicit-fallthrough=0
+endif
+
 ifdef DEBIAN
 CPPFLAGS += -DDEBIAN
 endif