summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch')
-rw-r--r--meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch128
1 files changed, 128 insertions, 0 deletions
diff --git a/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch b/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch
new file mode 100644
index 0000000000..3d9d3b9044
--- /dev/null
+++ b/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch
@@ -0,0 +1,128 @@
1From 09014233bf10900f7bd8390b3b64ff82bca45222 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Wed, 19 Apr 2017 12:04:15 -0700
4Subject: [PATCH 5/5] Add a comment to indicate valid fallthrough
5
6gcc7 warns about code with fallthroughs, this patch adds
7the comment to indicate a valid fallthrough, helps gcc7
8compiler warnings
9
10This works in cross and native compilation case
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14Upstream-Status: Submitted
15
16 Grow.c | 4 ++++
17 bitmap.c | 8 ++++++++
18 mdadm.c | 2 ++
19 super-intel.c | 1 +
20 util.c | 1 +
21 5 files changed, 16 insertions(+)
22
23diff --git a/Grow.c b/Grow.c
24index 455c5f9..27c73b1 100755
25--- a/Grow.c
26+++ b/Grow.c
27@@ -1257,6 +1257,7 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
28 switch (info->new_level) {
29 case 4:
30 delta_parity = 1;
31+ /* fallthrough */
32 case 0:
33 re->level = 4;
34 re->before.layout = 0;
35@@ -1284,10 +1285,12 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
36
37 case 4:
38 info->array.layout = ALGORITHM_PARITY_N;
39+ /* fallthrough */
40 case 5:
41 switch (info->new_level) {
42 case 0:
43 delta_parity = -1;
44+ /* fallthrough */
45 case 4:
46 re->level = info->array.level;
47 re->before.data_disks = info->array.raid_disks - 1;
48@@ -1343,6 +1346,7 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
49 case 4:
50 case 5:
51 delta_parity = -1;
52+ /* fallthrough */
53 case 6:
54 re->level = 6;
55 re->before.data_disks = info->array.raid_disks - 2;
56diff --git a/bitmap.c b/bitmap.c
57index ccedfd3..a6ff091 100644
58--- a/bitmap.c
59+++ b/bitmap.c
60@@ -82,13 +82,21 @@ static inline int count_dirty_bits_byte(char byte, int num_bits)
61
62 switch (num_bits) { /* fall through... */
63 case 8: if (byte & 128) num++;
64+ /* fallthrough */
65 case 7: if (byte & 64) num++;
66+ /* fallthrough */
67 case 6: if (byte & 32) num++;
68+ /* fallthrough */
69 case 5: if (byte & 16) num++;
70+ /* fallthrough */
71 case 4: if (byte & 8) num++;
72+ /* fallthrough */
73 case 3: if (byte & 4) num++;
74+ /* fallthrough */
75 case 2: if (byte & 2) num++;
76+ /* fallthrough */
77 case 1: if (byte & 1) num++;
78+ /* fallthrough */
79 default: break;
80 }
81
82diff --git a/mdadm.c b/mdadm.c
83index c3a265b..2d06d3b 100644
84--- a/mdadm.c
85+++ b/mdadm.c
86@@ -148,6 +148,7 @@ int main(int argc, char *argv[])
87 mode == CREATE || mode == GROW ||
88 mode == INCREMENTAL || mode == MANAGE)
89 break; /* b means bitmap */
90+ /* fallthrough */
91 case Brief:
92 c.brief = 1;
93 continue;
94@@ -828,6 +829,7 @@ int main(int argc, char *argv[])
95
96 case O(INCREMENTAL,NoDegraded):
97 pr_err("--no-degraded is deprecated in Incremental mode\n");
98+ /* fallthrough */
99 case O(ASSEMBLE,NoDegraded): /* --no-degraded */
100 c.runstop = -1; /* --stop isn't allowed for --assemble,
101 * so we overload slightly */
102diff --git a/super-intel.c b/super-intel.c
103index 4e466ff..00a2925 100644
104--- a/super-intel.c
105+++ b/super-intel.c
106@@ -3271,6 +3271,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
107 << SECT_PER_MB_SHIFT;
108 }
109 }
110+ /* fallthrough */
111 case MIGR_VERIFY:
112 /* we could emulate the checkpointing of
113 * 'sync_action=check' migrations, but for now
114diff --git a/util.c b/util.c
115index 32bd909..f2a4d19 100644
116--- a/util.c
117+++ b/util.c
118@@ -335,6 +335,7 @@ unsigned long long parse_size(char *size)
119 switch (*c) {
120 case 'K':
121 c++;
122+ /* fallthrough */
123 default:
124 s *= 2;
125 break;
126--
1272.12.2
128