Skip to contentSkip to conversation

microblaze: add 'fallthrough' to memcpy/memset/memmove

PATCH Applied Randy Dunlap 2 participants 2 messages Apr 21, 2021 – Apr 22, 2021 Microblaze architecture

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 microblaze: add 'fallthrough' to memcpy/memset/memmove

Fix "fallthrough" warnings in microblaze memcpy/memset/memmove library functions.

CC arch/microblaze/lib/memcpy.o
../arch/microblaze/lib/memcpy.c: In function 'memcpy':
../arch/microblaze/lib/memcpy.c:70:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
70 | --c;
../arch/microblaze/lib/memcpy.c:71:3: note: here
71 | case 2:
../arch/microblaze/lib/memcpy.c:73:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
73 | --c;
../arch/microblaze/lib/memcpy.c:74:3: note: here
74 | case 3:
../arch/microblaze/lib/memcpy.c:178:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
178 | *dst++ = *src++;
../arch/microblaze/lib/memcpy.c:179:2: note: here
179 | case 2:
../arch/microblaze/lib/memcpy.c:180:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
180 | *dst++ = *src++;
../arch/microblaze/lib/memcpy.c:181:2: note: here
181 | case 1:
CC arch/microblaze/lib/memset.o
../arch/microblaze/lib/memset.c: In function 'memset':
../arch/microblaze/lib/memset.c:71:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
71 | --n;
../arch/microblaze/lib/memset.c:72:3: note: here
72 | case 2:
../arch/microblaze/lib/memset.c:74:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
74 | --n;
../arch/microblaze/lib/memset.c:75:3: note: here
75 | case 3:
CC arch/microblaze/lib/memmove.o
../arch/microblaze/lib/memmove.c: In function 'memmove':
../arch/microblaze/lib/memmove.c:92:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
92 | --c;
../arch/microblaze/lib/memmove.c:93:3: note: here
93 | case 2:
../arch/microblaze/lib/memmove.c:95:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
95 | --c;
../arch/microblaze/lib/memmove.c:96:3: note: here
96 | case 1:
../arch/microblaze/lib/memmove.c:203:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
203 | *--dst = *--src;
../arch/microblaze/lib/memmove.c:204:2: note: here
204 | case 3:
../arch/microblaze/lib/memmove.c:205:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
205 | *--dst = *--src;
../arch/microblaze/lib/memmove.c:206:2: note: here
206 | case 2:
../arch/microblaze/lib/memmove.c:207:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
207 | *--dst = *--src;
../arch/microblaze/lib/memmove.c:208:2: note: here
208 | case 1:

---
 arch/microblaze/lib/memcpy.c  |    4 ++++
 arch/microblaze/lib/memmove.c |    5 +++++
 arch/microblaze/lib/memset.c  |    2 ++
 3 files changed, 11 insertions(+)
arch/microblaze/lib/memcpy.c +4 -0
@@ -68,9 +68,11 @@ void *memcpy(void *v_dst, const void *v_
 		case 1:
 			*dst++ = *src++;
 			--c;
+			fallthrough;
 		case 2:
 			*dst++ = *src++;
 			--c;
+			fallthrough;
 		case 3:
 			*dst++ = *src++;
 			--c;
@@ -176,8 +178,10 @@ void *memcpy(void *v_dst, const void *v_
 	switch (c) {
 	case 3:
 		*dst++ = *src++;
+		fallthrough;
 	case 2:
 		*dst++ = *src++;
+		fallthrough;
 	case 1:
 		*dst++ = *src++;
 	}
arch/microblaze/lib/memmove.c +5 -0
@@ -90,9 +90,11 @@ void *memmove(void *v_dst, const void *v
 		case 3:
 			*--dst = *--src;
 			--c;
+			fallthrough;
 		case 2:
 			*--dst = *--src;
 			--c;
+			fallthrough;
 		case 1:
 			*--dst = *--src;
 			--c;
@@ -201,10 +203,13 @@ void *memmove(void *v_dst, const void *v
 	switch (c) {
 	case 4:
 		*--dst = *--src;
+		fallthrough;
 	case 3:
 		*--dst = *--src;
+		fallthrough;
 	case 2:
 		*--dst = *--src;
+		fallthrough;
 	case 1:
 		*--dst = *--src;
 	}
arch/microblaze/lib/memset.c +2 -0
@@ -69,9 +69,11 @@ void *memset(void *v_src, int c, __kerne
 		case 1:
 			*src++ = c;
 			--n;
+			fallthrough;
 		case 2:
 			*src++ = c;
 			--n;
+			fallthrough;
 		case 3:
 			*src++ = c;
 			--n;
maintainer Applied
#1 lore raw
Quoted 121 lines · Randy Dunlap

Fix "fallthrough" warnings in microblaze memcpy/memset/memmove library functions.

CC arch/microblaze/lib/memcpy.o
../arch/microblaze/lib/memcpy.c: In function 'memcpy':
../arch/microblaze/lib/memcpy.c:70:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
70 | --c;
../arch/microblaze/lib/memcpy.c:71:3: note: here
71 | case 2:
../arch/microblaze/lib/memcpy.c:73:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
73 | --c;
../arch/microblaze/lib/memcpy.c:74:3: note: here
74 | case 3:
../arch/microblaze/lib/memcpy.c:178:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
178 | *dst++ = *src++;
../arch/microblaze/lib/memcpy.c:179:2: note: here
179 | case 2:
../arch/microblaze/lib/memcpy.c:180:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
180 | *dst++ = *src++;
../arch/microblaze/lib/memcpy.c:181:2: note: here
181 | case 1:
CC arch/microblaze/lib/memset.o
../arch/microblaze/lib/memset.c: In function 'memset':
../arch/microblaze/lib/memset.c:71:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
71 | --n;
../arch/microblaze/lib/memset.c:72:3: note: here
72 | case 2:
../arch/microblaze/lib/memset.c:74:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
74 | --n;
../arch/microblaze/lib/memset.c:75:3: note: here
75 | case 3:
CC arch/microblaze/lib/memmove.o
../arch/microblaze/lib/memmove.c: In function 'memmove':
../arch/microblaze/lib/memmove.c:92:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
92 | --c;
../arch/microblaze/lib/memmove.c:93:3: note: here
93 | case 2:
../arch/microblaze/lib/memmove.c:95:4: warning: this statement may fall through [-Wimplicit-fallthrough=]
95 | --c;
../arch/microblaze/lib/memmove.c:96:3: note: here
96 | case 1:
../arch/microblaze/lib/memmove.c:203:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
203 | *--dst = *--src;
../arch/microblaze/lib/memmove.c:204:2: note: here
204 | case 3:
../arch/microblaze/lib/memmove.c:205:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
205 | *--dst = *--src;
../arch/microblaze/lib/memmove.c:206:2: note: here
206 | case 2:
../arch/microblaze/lib/memmove.c:207:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
207 | *--dst = *--src;
../arch/microblaze/lib/memmove.c:208:2: note: here
208 | case 1:

---
 arch/microblaze/lib/memcpy.c  |    4 ++++
 arch/microblaze/lib/memmove.c |    5 +++++
 arch/microblaze/lib/memset.c  |    2 ++
 3 files changed, 11 insertions(+)
arch/microblaze/lib/memcpy.c +4 -0
@@ -68,9 +68,11 @@ void *memcpy(void *v_dst, const void *v_
 		case 1:
 			*dst++ = *src++;
 			--c;
+			fallthrough;
 		case 2:
 			*dst++ = *src++;
 			--c;
+			fallthrough;
 		case 3:
 			*dst++ = *src++;
 			--c;
@@ -176,8 +178,10 @@ void *memcpy(void *v_dst, const void *v_
 	switch (c) {
 	case 3:
 		*dst++ = *src++;
+		fallthrough;
 	case 2:
 		*dst++ = *src++;
+		fallthrough;
 	case 1:
 		*dst++ = *src++;
 	}
arch/microblaze/lib/memmove.c +5 -0
@@ -90,9 +90,11 @@ void *memmove(void *v_dst, const void *v
 		case 3:
 			*--dst = *--src;
 			--c;
+			fallthrough;
 		case 2:
 			*--dst = *--src;
 			--c;
+			fallthrough;
 		case 1:
 			*--dst = *--src;
 			--c;
@@ -201,10 +203,13 @@ void *memmove(void *v_dst, const void *v
 	switch (c) {
 	case 4:
 		*--dst = *--src;
+		fallthrough;
 	case 3:
 		*--dst = *--src;
+		fallthrough;
 	case 2:
 		*--dst = *--src;
+		fallthrough;
 	case 1:
 		*--dst = *--src;
 	}
arch/microblaze/lib/memset.c +0 -0
@@ -69,9 +69,11 @@ void *memset(void *v_src, int c, __kerne
 		case 1:

arch/microblaze/lib/memset.c void *memset(void *v_src, int c, __kerne · line 79

Quoted 10 lines
arch/microblaze/lib/memset.c +2 -0
 			*src++ = c;
 			--n;
+			fallthrough;
 		case 2:
 			*src++ = c;
 			--n;
+			fallthrough;
 		case 3:
 			*src++ = c;
 			--n;

Applied.

Thanks,
Michal

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs