lib: Revert use of fallthrough pseudo-keyword in lib/
The following build error for powerpc64 was reported by Nathan Chancellor:
"$ scripts/config --file arch/powerpc/configs/powernv_defconfig -e KERNEL_XZ
$ make -skj"$(nproc)" ARCH=powerpc CROSS_COMPILE=powerpc64le-linux- distclean powernv_defconfig zImage
...
In file included from arch/powerpc/boot/../../../lib/decompress_unxz.c:234,
from arch/powerpc/boot/decompress.c:38:
arch/powerpc/boot/../../../lib/xz/xz_dec_stream.c: In function 'dec_main':
arch/powerpc/boot/../../../lib/xz/xz_dec_stream.c:586:4: error: 'fallthrough' undeclared (first use in this function)
586 | fallthrough;
| ^~~~~~~~~~~
This will end up affecting distribution configurations such as Debian
and OpenSUSE according to my testing. I am not sure what the solution
is, the PowerPC wrapper does not set -D__KERNEL__ so I am not sure
that compiler_attributes.h can be safely included."
In order to avoid these sort of problems, it seems that the best
solution is to use /* fall through */ comments instead of the
fallthrough pseudo-keyword macro in lib/, for now.
Reported-by: Nathan Chancellor <natechancellor@gmail.com>
Fixes: df561f6688fe ("treewide: Use fallthrough pseudo-keyword")
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-and-tested-by: Nathan Chancellor <natechancellor@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 19ebe1b..afb9521 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1265,7 +1265,7 @@
case 'R':
reversed = true;
- fallthrough;
+ /* fall through */
default:
separator = ':';
@@ -1682,7 +1682,7 @@
switch (*(++fmt)) {
case 'L':
uc = true;
- fallthrough;
+ /* fall through */
case 'l':
index = guid_index;
break;
@@ -2219,7 +2219,7 @@
case 'S':
case 's':
ptr = dereference_symbol_descriptor(ptr);
- fallthrough;
+ /* fall through */
case 'B':
return symbol_string(buf, end, ptr, spec, fmt);
case 'R':
@@ -2450,7 +2450,7 @@
case 'x':
spec->flags |= SMALL;
- fallthrough;
+ /* fall through */
case 'X':
spec->base = 16;
@@ -2468,7 +2468,7 @@
* utility, treat it as any other invalid or
* unsupported format specifier.
*/
- fallthrough;
+ /* fall through */
default:
WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
@@ -3411,10 +3411,10 @@
break;
case 'i':
base = 0;
- fallthrough;
+ /* fall through */
case 'd':
is_sign = true;
- fallthrough;
+ /* fall through */
case 'u':
break;
case '%':