dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0026-gcc-8-coverity-hack.patch

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