summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/mdadm/files/0005-Add-a-comment-to-indicate-valid-fallthrough.patch
blob: d279fddfb6afc867bb3f3600a3bbf0366df6617f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
From 0c2c8ae6b3a1fb0f611f9795953a7a6ed06be38d Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 19 Apr 2017 12:04:15 -0700
Subject: [PATCH] Add a comment to indicate valid fallthrough

gcc7 warns about code with fallthroughs, this patch adds
the comment to indicate a valid fallthrough, helps gcc7
compiler warnings

This works in cross and native compilation case

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 Grow.c        | 4 ++++
 bitmap.c      | 8 ++++++++
 mdadm.c       | 2 ++
 super-intel.c | 1 +
 util.c        | 1 +
 5 files changed, 16 insertions(+)

diff --git a/Grow.c b/Grow.c
index 4436a4d..b3116e2 100644
--- a/Grow.c
+++ b/Grow.c
@@ -1447,6 +1447,7 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
 		switch (info->new_level) {
 		case 4:
 			delta_parity = 1;
+			/* fallthrough */
 		case 0:
 			re->level = 4;
 			re->before.layout = 0;
@@ -1474,10 +1475,12 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
 
 	case 4:
 		info->array.layout = ALGORITHM_PARITY_N;
+		/* fallthrough */
 	case 5:
 		switch (info->new_level) {
 		case 0:
 			delta_parity = -1;
+			/* fallthrough */
 		case 4:
 			re->level = info->array.level;
 			re->before.data_disks = info->array.raid_disks - 1;
@@ -1533,6 +1536,7 @@ char *analyse_change(char *devname, struct mdinfo *info, struct reshape *re)
 		case 4:
 		case 5:
 			delta_parity = -1;
+			/* fallthrough */
 		case 6:
 			re->level = 6;
 			re->before.data_disks = info->array.raid_disks - 2;
diff --git a/bitmap.c b/bitmap.c
index e38cb96..10af328 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -82,13 +82,21 @@ static inline int count_dirty_bits_byte(char byte, int num_bits)
 
 	switch (num_bits) { /* fall through... */
 		case 8:	if (byte & 128) num++;
+		/* fallthrough */
 		case 7:	if (byte &  64) num++;
+		/* fallthrough */
 		case 6:	if (byte &  32) num++;
+		/* fallthrough */
 		case 5:	if (byte &  16) num++;
+		/* fallthrough */
 		case 4:	if (byte &   8) num++;
+		/* fallthrough */
 		case 3: if (byte &   4) num++;
+		/* fallthrough */
 		case 2:	if (byte &   2) num++;
+		/* fallthrough */
 		case 1:	if (byte &   1) num++;
+		/* fallthrough */
 		default: break;
 	}
 
diff --git a/mdadm.c b/mdadm.c
index 25a1abd..9843bc5 100644
--- a/mdadm.c
+++ b/mdadm.c
@@ -155,6 +155,7 @@ int main(int argc, char *argv[])
 			    mode == CREATE || mode == GROW ||
 			    mode == INCREMENTAL || mode == MANAGE)
 				break; /* b means bitmap */
+		/* fallthrough */
 		case Brief:
 			c.brief = 1;
 			continue;
@@ -839,6 +840,7 @@ int main(int argc, char *argv[])
 
 		case O(INCREMENTAL,NoDegraded):
 			pr_err("--no-degraded is deprecated in Incremental mode\n");
+			/* fallthrough */
 		case O(ASSEMBLE,NoDegraded): /* --no-degraded */
 			c.runstop = -1; /* --stop isn't allowed for --assemble,
 					 * so we overload slightly */
diff --git a/super-intel.c b/super-intel.c
index e726987..1bc4b80 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -3425,6 +3425,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
 
 			}
 		}
+		/* fallthrough */
 		case MIGR_VERIFY:
 			/* we could emulate the checkpointing of
 			 * 'sync_action=check' migrations, but for now
diff --git a/util.c b/util.c
index c26cf5f..61cbe23 100644
--- a/util.c
+++ b/util.c
@@ -400,6 +400,7 @@ unsigned long long parse_size(char *size)
 		switch (*c) {
 		case 'K':
 			c++;
+		/* fallthrough */
 		default:
 			s *= 2;
 			break;