blob: 739652cd5592a6fc16bdb6deebb5f96e52dc8be9 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001From b83218de2623c0bbe9af355a81ae8385d7f30cfc Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 9 May 2018 12:56:41 -0700
4Subject: [PATCH] Disable gcc8 warnings
5
6This is needed until
7https://bugzilla.redhat.com/show_bug.cgi?id=1553958
8
9Fix super0.c issue which is triggered only in DEBUG_BUILD with -O1 (or any
10configuration without -ftree-vrp or with -fno-tree-vrp)
11
12super0.c: In function 'examine_super0':
13super0.c:238:32: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=]
14 snprintf(nb, sizeof(nb), "%4d", d);
15 ^
16
17Upstream-Status: Inappropriate [Workaround]
18
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20
21---
22 Monitor.c | 4 +++-
23 mdopen.c | 4 ++++
24 super-ddf.c | 4 ++++
25 super-intel.c | 6 ++++++
26 super1.c | 5 +++++
27 super0.c | 2 +-
28 6 files changed, 22 insertions(+), 1 deletion(-)
29
30diff --git a/super0.c b/super0.c
31index f5b4507..264b598 100644
32--- a/super0.c
33+++ b/super0.c
34@@ -231,7 +231,7 @@
35 d++) {
36 mdp_disk_t *dp;
37 char *dv;
38- char nb[11];
39+ char nb[12];
40 int wonly, failfast;
41 if (d>=0) dp = &sb->disks[d];
42 else dp = &sb->this_disk;
43diff --git a/Monitor.c b/Monitor.c
44index 802a9d9..23b246b 100644
45--- a/Monitor.c
46+++ b/Monitor.c
47@@ -441,7 +441,8 @@ static void alert(char *event, char *dev, char *disc, struct alert_info *info)
48 event, dev);
49 }
50 }
51-
52+#pragma GCC diagnostic push
53+#pragma GCC diagnostic ignored "-Wformat-truncation"
54 static int check_array(struct state *st, struct mdstat_ent *mdstat,
55 int test, struct alert_info *ainfo,
56 int increments, char *prefer)
57@@ -683,6 +684,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
58 return 1;
59 return 0;
60 }
61+#pragma GCC diagnostic pop
62
63 static int add_new_arrays(struct mdstat_ent *mdstat, struct state **statelist,
64 int test, struct alert_info *info)
65diff --git a/mdopen.c b/mdopen.c
66index 685ca32..406aba4 100644
67--- a/mdopen.c
68+++ b/mdopen.c
69@@ -26,6 +26,9 @@
70 #include "md_p.h"
71 #include <ctype.h>
72
73+#pragma GCC diagnostic push
74+#pragma GCC diagnostic ignored "-Wformat-truncation"
75+
76 void make_parts(char *dev, int cnt)
77 {
78 /* make 'cnt' partition devices for 'dev'
79@@ -99,6 +102,7 @@ void make_parts(char *dev, int cnt)
80 }
81 free(name);
82 }
83+#pragma GCC diagnostic pop
84
85 /*
86 * We need a new md device to assemble/build/create an array.
87diff --git a/super-ddf.c b/super-ddf.c
88index 1707ad1..e08d289 100644
89--- a/super-ddf.c
90+++ b/super-ddf.c
91@@ -2846,6 +2846,9 @@ static void _set_config_size(struct phys_disk_entry *pde, const struct dl *dl)
92 (unsigned long long)cfs, (unsigned long long)(dl->size-cfs));
93 }
94
95+#pragma GCC diagnostic push
96+#pragma GCC diagnostic ignored "-Wformat-overflow"
97+
98 /* Add a device to a container, either while creating it or while
99 * expanding a pre-existing container
100 */
101@@ -2981,6 +2984,7 @@ static int add_to_super_ddf(struct supertype *st,
102
103 return 0;
104 }
105+#pragma GCC diagnostic pop
106
107 static int remove_from_super_ddf(struct supertype *st, mdu_disk_info_t *dk)
108 {
109diff --git a/super-intel.c b/super-intel.c
110index 00a2925..44fbead 100644
111--- a/super-intel.c
112+++ b/super-intel.c
113@@ -298,6 +298,11 @@ struct md_list {
114 };
115
116 #define pr_vrb(fmt, arg...) (void) (verbose && pr_err(fmt, ##arg))
117+#pragma GCC diagnostic push
118+# if __GNUC__ == 8
119+# pragma GCC diagnostic ignored "-Wstringop-truncation"
120+# endif
121+#pragma GCC diagnostic ignored "-Wformat-truncation"
122
123 static __u8 migr_type(struct imsm_dev *dev)
124 {
125@@ -11618,3 +11623,4 @@ struct superswitch super_imsm = {
126 .get_bad_blocks = imsm_get_badblocks,
127 #endif /* MDASSEMBLE */
128 };
129+#pragma GCC diagnostic pop
130diff --git a/super1.c b/super1.c
131index 87a74cb..71c515f 100644
132--- a/super1.c
133+++ b/super1.c
134@@ -1091,6 +1091,10 @@ static struct mdinfo *container_content1(struct supertype *st, char *subarray)
135 return info;
136 }
137
138+#pragma GCC diagnostic push
139+# if __GNUC__ == 8
140+# pragma GCC diagnostic ignored "-Wstringop-truncation"
141+#endif
142 static int update_super1(struct supertype *st, struct mdinfo *info,
143 char *update,
144 char *devname, int verbose,
145@@ -1473,6 +1477,7 @@ static int init_super1(struct supertype *st, mdu_array_info_t *info,
146
147 return 1;
148 }
149+#pragma GCC diagnostic pop
150
151 struct devinfo {
152 int fd;