Commit 6a9dc5fd authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Linus Torvalds
Browse files

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: default avatarNathan Chancellor <natechancellor@gmail.com>
Fixes: df561f66 ("treewide: Use fallthrough pseudo-keyword")
Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-and-tested-by: default avatarNathan Chancellor <natechancellor@gmail.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9907ab37
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -381,7 +381,7 @@ next_op:
	case ASN1_OP_END_SET_ACT:
		if (unlikely(!(flags & FLAG_MATCHED)))
			goto tag_mismatch;
		fallthrough;
		/* fall through */

	case ASN1_OP_END_SEQ:
	case ASN1_OP_END_SET_OF:
@@ -448,7 +448,7 @@ next_op:
			pc += asn1_op_lengths[op];
			goto next_op;
		}
		fallthrough;
		/* fall through */

	case ASN1_OP_ACT:
		ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
+1 −1
Original line number Diff line number Diff line
@@ -1113,7 +1113,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
						index_key))
				goto found_leaf;
		}
		fallthrough;
		/* fall through */
	case assoc_array_walk_tree_empty:
	case assoc_array_walk_found_wrong_shortcut:
	default:
+2 −2
Original line number Diff line number Diff line
@@ -817,7 +817,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
							q - 2);
				break;
			}
			fallthrough;
			/* fall through */
		case '=':
			ret = xbc_parse_kv(&p, q, c);
			break;
@@ -826,7 +826,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
			break;
		case '#':
			q = skip_comment(q);
			fallthrough;
			/* fall through */
		case ';':
		case '\n':
			ret = xbc_parse_key(&p, q);
+5 −5
Original line number Diff line number Diff line
@@ -132,23 +132,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
	case 'E':
	case 'e':
		ret <<= 10;
		fallthrough;
		/* fall through */
	case 'P':
	case 'p':
		ret <<= 10;
		fallthrough;
		/* fall through */
	case 'T':
	case 't':
		ret <<= 10;
		fallthrough;
		/* fall through */
	case 'G':
	case 'g':
		ret <<= 10;
		fallthrough;
		/* fall through */
	case 'M':
	case 'm':
		ret <<= 10;
		fallthrough;
		/* fall through */
	case 'K':
	case 'k':
		ret <<= 10;
+1 −1
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ void net_dim(struct dim *dim, struct dim_sample end_sample)
			schedule_work(&dim->work);
			break;
		}
		fallthrough;
		/* fall through */
	case DIM_START_MEASURE:
		dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
				  end_sample.byte_ctr, &dim->start_sample);
Loading