dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/mdadm-Add-Wimplicit-fallthrough-0-in-Makefile.patch

2c1b57
From 8268821b434d1308d083454fb681d80176cf352b Mon Sep 17 00:00:00 2001
2c1b57
From: Xiao Ni <xni@redhat.com>
2c1b57
Date: Fri, 17 Mar 2017 19:55:42 +0800
2c1b57
Subject: [RHEL7.5 PATCH 009/169] mdadm: Add Wimplicit-fallthrough=0 in
2c1b57
 Makefile
2c1b57
2c1b57
There are many errors like 'error: this statement may fall through'.
2c1b57
But the logic is right. So add the flag Wimplicit-fallthrough=0
2c1b57
to disable the error messages. The method I use is from
2c1b57
https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
2c1b57
#index-Wimplicit-fallthrough-375
2c1b57
2c1b57
Signed-off-by: Xiao Ni <xni@redhat.com>
2c1b57
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
2c1b57
---
2c1b57
 Makefile | 5 +++++
2c1b57
 1 file changed, 5 insertions(+)
2c1b57
2c1b57
diff --git a/Makefile b/Makefile
2c1b57
index a6f464c..d1a6ac4 100644
2c1b57
--- a/Makefile
2c1b57
+++ b/Makefile
2c1b57
@@ -48,6 +48,11 @@ ifdef WARN_UNUSED
2c1b57
 CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3
2c1b57
 endif
2c1b57
 
2c1b57
+FALLTHROUGH := $(shell gcc -v --help 2>&1 | grep "implicit-fallthrough" | wc -l)
2c1b57
+ifneq "$(FALLTHROUGH)"  "0"
2c1b57
+CWFLAGS += -Wimplicit-fallthrough=0
2c1b57
+endif
2c1b57
+
2c1b57
 ifdef DEBIAN
2c1b57
 CPPFLAGS += -DDEBIAN
2c1b57
 endif
2c1b57
-- 
2c1b57
2.7.4
2c1b57