dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone
59ea72
From 28156667e5c7dc3c7b978f2d58c2a427038fedda Mon Sep 17 00:00:00 2001
59ea72
From: Jes Sorensen <jsorensen@fb.com>
59ea72
Date: Mon, 4 Jun 2018 14:49:59 -0400
59ea72
Subject: [RHEL7.5 PATCH 26/26] gcc-8 coverity hack
59ea72
59ea72
Coverity still has issues with gcc-7, not to mention gcc-8. Hack around
59ea72
it, until they fix it.
59ea72
59ea72
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
59ea72
---
59ea72
 Makefile            | 15 +++++++++++----
59ea72
 coverity-gcc-hack.h | 10 ++++++++++
59ea72
 2 files changed, 21 insertions(+), 4 deletions(-)
59ea72
 create mode 100644 coverity-gcc-hack.h
59ea72
59ea72
diff --git a/Makefile b/Makefile
59ea72
index 188a218..2767ac6 100644
59ea72
--- a/Makefile
59ea72
+++ b/Makefile
59ea72
@@ -42,6 +42,10 @@ KLIBC=/home/src/klibc/klibc-0.77
59ea72
 
59ea72
 KLIBC_GCC = gcc -nostdinc -iwithprefix include -I$(KLIBC)/klibc/include -I$(KLIBC)/linux/include -I$(KLIBC)/klibc/arch/i386/include -I$(KLIBC)/klibc/include/bits32
59ea72
 
59ea72
+ifdef COVERITY
59ea72
+COVERITY_FLAGS=-include coverity-gcc-hack.h
59ea72
+endif
59ea72
+
59ea72
 CC ?= $(CROSS_COMPILE)gcc
59ea72
 CXFLAGS ?= -ggdb
59ea72
 CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter
59ea72
@@ -177,6 +181,9 @@ everything-test: all mdadm.static swap_super test_stripe \
59ea72
 # mdadm.uclibc doesn't work on x86-64
59ea72
 # mdadm.tcc doesn't work..
59ea72
 
59ea72
+%.o: %.c
59ea72
+	$(CC) $(CFLAGS) $(CPPFLAGS) $(COVERITY_FLAGS) -o $@ -c $<
59ea72
+
59ea72
 mdadm : $(OBJS) | check_rundir
59ea72
 	$(CC) $(CFLAGS) $(LDFLAGS) -o mdadm $(OBJS) $(LDLIBS)
59ea72
 
59ea72
@@ -291,10 +298,10 @@ test: mdadm mdmon test_stripe swap_super raid6check
59ea72
 
59ea72
 clean :
59ea72
 	rm -f mdadm mdmon $(OBJS) $(MON_OBJS) $(STATICOBJS) core *.man \
59ea72
-	mdadm.tcc mdadm.uclibc mdadm.static *.orig *.porig *.rej *.alt .merge_file_* \
59ea72
-	mdadm.Os mdadm.O2 mdmon.O2 swap_super \
59ea72
-	init.cpio.gz mdadm.uclibc.static test_stripe raid6check raid6check.o mdmon \
59ea72
-	mdadm.8
59ea72
+	mdadm.tcc mdadm.uclibc mdadm.static *.orig *.porig *.rej *.alt \
59ea72
+	.merge_file_* mdadm.Os mdadm.O2 mdmon.O2 swap_super init.cpio.gz \
59ea72
+	mdadm.uclibc.static test_stripe raid6check raid6check.o mdmon mdadm.8
59ea72
+	rm -rf cov-int
59ea72
 
59ea72
 dist : clean
59ea72
 	./makedist
59ea72
diff --git a/coverity-gcc-hack.h b/coverity-gcc-hack.h
59ea72
new file mode 100644
59ea72
index 0000000..2d94a8b
59ea72
--- /dev/null
59ea72
+++ b/coverity-gcc-hack.h
59ea72
@@ -0,0 +1,10 @@
59ea72
+#if !defined(__KERNEL__) && defined(__x86_64__) && defined(__COVERITY_GCC_VERSION_AT_LEAST)
59ea72
+#if __COVERITY_GCC_VERSION_AT_LEAST(7, 0)
59ea72
+typedef float _Float128 __attribute__((__vector_size__(128)));
59ea72
+typedef float _Float64 __attribute__((__vector_size__(64)));
59ea72
+typedef float _Float32 __attribute__((__vector_size__(32)));
59ea72
+typedef float _Float128x __attribute__((__vector_size__(128)));
59ea72
+typedef float _Float64x __attribute__((__vector_size__(64)));
59ea72
+typedef float _Float32x __attribute__((__vector_size__(32)));
59ea72
+#endif
59ea72
+#endif
59ea72
-- 
59ea72
2.7.4
59ea72