All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] PPC: Fix -Wimplicit-fallthrough for clang
@ 2020-11-16  4:35 ` Nick Desaulniers
  0 siblings, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 2020-11-16  4:35 UTC (permalink / raw)
  To: Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda, Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel, Nick Desaulniers

While cleaning up the last few -Wimplicit-fallthrough warnings in tree
for Clang, I noticed
commit 6a9dc5fd6170d ("lib: Revert use of fallthrough pseudo-keyword in lib/")
which seemed to undo a bunch of fixes in lib/ due to breakage in
arch/powerpc/boot/ not including compiler_types.h.  We don't need
compiler_types.h for the definition of `fallthrough`, simply
compiler_attributes.h.  Include that, revert the revert to lib/, and fix
the last remaining cases I observed for powernv_defconfig.

Nick Desaulniers (3):
  powerpc: boot: include compiler_attributes.h
  Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  powerpc: fix -Wimplicit-fallthrough

 arch/powerpc/boot/Makefile     |  1 +
 arch/powerpc/boot/decompress.c |  1 -
 arch/powerpc/kernel/uprobes.c  |  1 +
 arch/powerpc/perf/imc-pmu.c    |  1 +
 lib/asn1_decoder.c             |  4 ++--
 lib/assoc_array.c              |  2 +-
 lib/bootconfig.c               |  4 ++--
 lib/cmdline.c                  | 10 +++++-----
 lib/dim/net_dim.c              |  2 +-
 lib/dim/rdma_dim.c             |  4 ++--
 lib/glob.c                     |  2 +-
 lib/siphash.c                  | 36 +++++++++++++++++-----------------
 lib/ts_fsm.c                   |  2 +-
 lib/vsprintf.c                 | 14 ++++++-------
 lib/xz/xz_dec_lzma2.c          |  4 ++--
 lib/xz/xz_dec_stream.c         | 16 +++++++--------
 lib/zstd/bitstream.h           | 10 +++++-----
 lib/zstd/compress.c            |  2 +-
 lib/zstd/decompress.c          | 12 ++++++------
 lib/zstd/huf_compress.c        |  4 ++--
 20 files changed, 67 insertions(+), 65 deletions(-)

-- 
2.29.2.299.gdc1121823c-goog


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 0/3] PPC: Fix -Wimplicit-fallthrough for clang
@ 2020-11-16  4:35 ` Nick Desaulniers
  0 siblings, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 2020-11-16  4:35 UTC (permalink / raw)
  To: Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda, Michael Ellerman
  Cc: Nick Desaulniers, linux-kernel, clang-built-linux,
	Paul Mackerras, linuxppc-dev

While cleaning up the last few -Wimplicit-fallthrough warnings in tree
for Clang, I noticed
commit 6a9dc5fd6170d ("lib: Revert use of fallthrough pseudo-keyword in lib/")
which seemed to undo a bunch of fixes in lib/ due to breakage in
arch/powerpc/boot/ not including compiler_types.h.  We don't need
compiler_types.h for the definition of `fallthrough`, simply
compiler_attributes.h.  Include that, revert the revert to lib/, and fix
the last remaining cases I observed for powernv_defconfig.

Nick Desaulniers (3):
  powerpc: boot: include compiler_attributes.h
  Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  powerpc: fix -Wimplicit-fallthrough

 arch/powerpc/boot/Makefile     |  1 +
 arch/powerpc/boot/decompress.c |  1 -
 arch/powerpc/kernel/uprobes.c  |  1 +
 arch/powerpc/perf/imc-pmu.c    |  1 +
 lib/asn1_decoder.c             |  4 ++--
 lib/assoc_array.c              |  2 +-
 lib/bootconfig.c               |  4 ++--
 lib/cmdline.c                  | 10 +++++-----
 lib/dim/net_dim.c              |  2 +-
 lib/dim/rdma_dim.c             |  4 ++--
 lib/glob.c                     |  2 +-
 lib/siphash.c                  | 36 +++++++++++++++++-----------------
 lib/ts_fsm.c                   |  2 +-
 lib/vsprintf.c                 | 14 ++++++-------
 lib/xz/xz_dec_lzma2.c          |  4 ++--
 lib/xz/xz_dec_stream.c         | 16 +++++++--------
 lib/zstd/bitstream.h           | 10 +++++-----
 lib/zstd/compress.c            |  2 +-
 lib/zstd/decompress.c          | 12 ++++++------
 lib/zstd/huf_compress.c        |  4 ++--
 20 files changed, 67 insertions(+), 65 deletions(-)

-- 
2.29.2.299.gdc1121823c-goog


^ permalink raw reply	[flat|nested] 47+ messages in thread

* [PATCH 1/3] powerpc: boot: include compiler_attributes.h
  2020-11-16  4:35 ` Nick Desaulniers
@ 2020-11-16  4:35   ` Nick Desaulniers
  -1 siblings, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 2020-11-16  4:35 UTC (permalink / raw)
  To: Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda, Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel, Nick Desaulniers

The kernel uses `-include` to include include/linux/compiler_types.h
into all translation units (see scripts/Makefile.lib), which #includes
compiler_attributes.h.

arch/powerpc/boot/ uses different compiler flags from the rest of the
kernel. As such, it doesn't contain the definitions from these headers,
and redefines a few that it needs.

For the purpose of enabling -Wimplicit-fallthrough for ppc, include
compiler_types.h via `-include`.

Link: https://github.com/ClangBuiltLinux/linux/issues/236
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
We could just `#include "include/linux/compiler_types.h"` in the few .c
sources used from lib/ (there are proper header guards in
compiler_types.h).

It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
-include compiler_types.h like the main kernel does, though testing that
produces a whole sea of warnings to cleanup. This approach is minimally
invasive.

 arch/powerpc/boot/Makefile     | 1 +
 arch/powerpc/boot/decompress.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index f8ce6d2dde7b..1659963a8f1d 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -31,6 +31,7 @@ endif
 BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
 		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
+		 -include $(srctree)/include/linux/compiler_attributes.h \
 		 $(LINUXINCLUDE)
 
 ifdef CONFIG_PPC64_BOOT_WRAPPER
diff --git a/arch/powerpc/boot/decompress.c b/arch/powerpc/boot/decompress.c
index 8bf39ef7d2df..6098b879ac97 100644
--- a/arch/powerpc/boot/decompress.c
+++ b/arch/powerpc/boot/decompress.c
@@ -21,7 +21,6 @@
 
 #define STATIC static
 #define INIT
-#define __always_inline inline
 
 /*
  * The build process will copy the required zlib source files and headers
-- 
2.29.2.299.gdc1121823c-goog


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 1/3] powerpc: boot: include compiler_attributes.h
@ 2020-11-16  4:35   ` Nick Desaulniers
  0 siblings, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 2020-11-16  4:35 UTC (permalink / raw)
  To: Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda, Michael Ellerman
  Cc: Nick Desaulniers, linux-kernel, clang-built-linux,
	Paul Mackerras, linuxppc-dev

The kernel uses `-include` to include include/linux/compiler_types.h
into all translation units (see scripts/Makefile.lib), which #includes
compiler_attributes.h.

arch/powerpc/boot/ uses different compiler flags from the rest of the
kernel. As such, it doesn't contain the definitions from these headers,
and redefines a few that it needs.

For the purpose of enabling -Wimplicit-fallthrough for ppc, include
compiler_types.h via `-include`.

Link: https://github.com/ClangBuiltLinux/linux/issues/236
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
We could just `#include "include/linux/compiler_types.h"` in the few .c
sources used from lib/ (there are proper header guards in
compiler_types.h).

It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
-include compiler_types.h like the main kernel does, though testing that
produces a whole sea of warnings to cleanup. This approach is minimally
invasive.

 arch/powerpc/boot/Makefile     | 1 +
 arch/powerpc/boot/decompress.c | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index f8ce6d2dde7b..1659963a8f1d 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -31,6 +31,7 @@ endif
 BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
 		 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
 		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
+		 -include $(srctree)/include/linux/compiler_attributes.h \
 		 $(LINUXINCLUDE)
 
 ifdef CONFIG_PPC64_BOOT_WRAPPER
diff --git a/arch/powerpc/boot/decompress.c b/arch/powerpc/boot/decompress.c
index 8bf39ef7d2df..6098b879ac97 100644
--- a/arch/powerpc/boot/decompress.c
+++ b/arch/powerpc/boot/decompress.c
@@ -21,7 +21,6 @@
 
 #define STATIC static
 #define INIT
-#define __always_inline inline
 
 /*
  * The build process will copy the required zlib source files and headers
-- 
2.29.2.299.gdc1121823c-goog


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  2020-11-16  4:35 ` Nick Desaulniers
@ 2020-11-16  4:35   ` Nick Desaulniers
  -1 siblings, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 2020-11-16  4:35 UTC (permalink / raw)
  To: Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda, Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel, Nick Desaulniers

This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
pseudo-keyword in lib/")

Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
re-enable these fixes for lib/.

Link: https://github.com/ClangBuiltLinux/linux/issues/236
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 lib/asn1_decoder.c      |  4 ++--
 lib/assoc_array.c       |  2 +-
 lib/bootconfig.c        |  4 ++--
 lib/cmdline.c           | 10 +++++-----
 lib/dim/net_dim.c       |  2 +-
 lib/dim/rdma_dim.c      |  4 ++--
 lib/glob.c              |  2 +-
 lib/siphash.c           | 36 ++++++++++++++++++------------------
 lib/ts_fsm.c            |  2 +-
 lib/vsprintf.c          | 14 +++++++-------
 lib/xz/xz_dec_lzma2.c   |  4 ++--
 lib/xz/xz_dec_stream.c  | 16 ++++++++--------
 lib/zstd/bitstream.h    | 10 +++++-----
 lib/zstd/compress.c     |  2 +-
 lib/zstd/decompress.c   | 12 ++++++------
 lib/zstd/huf_compress.c |  4 ++--
 16 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
index 58f72b25f8e9..13da529e2e72 100644
--- a/lib/asn1_decoder.c
+++ b/lib/asn1_decoder.c
@@ -381,7 +381,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
 	case ASN1_OP_END_SET_ACT:
 		if (unlikely(!(flags & FLAG_MATCHED)))
 			goto tag_mismatch;
-		/* fall through */
+		fallthrough;
 
 	case ASN1_OP_END_SEQ:
 	case ASN1_OP_END_SET_OF:
@@ -448,7 +448,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
 			pc += asn1_op_lengths[op];
 			goto next_op;
 		}
-		/* fall through */
+		fallthrough;
 
 	case ASN1_OP_ACT:
 		ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
diff --git a/lib/assoc_array.c b/lib/assoc_array.c
index 6f4bcf524554..04c98799c3ba 100644
--- a/lib/assoc_array.c
+++ b/lib/assoc_array.c
@@ -1113,7 +1113,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
 						index_key))
 				goto found_leaf;
 		}
-		/* fall through */
+		fallthrough;
 	case assoc_array_walk_tree_empty:
 	case assoc_array_walk_found_wrong_shortcut:
 	default:
diff --git a/lib/bootconfig.c b/lib/bootconfig.c
index 649ed44f199c..9f8c70a98fcf 100644
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -827,7 +827,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
 							q - 2);
 				break;
 			}
-			/* fall through */
+			fallthrough;
 		case '=':
 			ret = xbc_parse_kv(&p, q, c);
 			break;
@@ -836,7 +836,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
 			break;
 		case '#':
 			q = skip_comment(q);
-			/* fall through */
+			fallthrough;
 		case ';':
 		case '\n':
 			ret = xbc_parse_key(&p, q);
diff --git a/lib/cmdline.c b/lib/cmdline.c
index 9e186234edc0..46f2cb4ce6d1 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -144,23 +144,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
 	case 'E':
 	case 'e':
 		ret <<= 10;
-		/* fall through */
+		fallthrough;
 	case 'P':
 	case 'p':
 		ret <<= 10;
-		/* fall through */
+		fallthrough;
 	case 'T':
 	case 't':
 		ret <<= 10;
-		/* fall through */
+		fallthrough;
 	case 'G':
 	case 'g':
 		ret <<= 10;
-		/* fall through */
+		fallthrough;
 	case 'M':
 	case 'm':
 		ret <<= 10;
-		/* fall through */
+		fallthrough;
 	case 'K':
 	case 'k':
 		ret <<= 10;
diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
index a4db51c21266..06811d866775 100644
--- a/lib/dim/net_dim.c
+++ b/lib/dim/net_dim.c
@@ -233,7 +233,7 @@ void net_dim(struct dim *dim, struct dim_sample end_sample)
 			schedule_work(&dim->work);
 			break;
 		}
-		/* fall through */
+		fallthrough;
 	case DIM_START_MEASURE:
 		dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
 				  end_sample.byte_ctr, &dim->start_sample);
diff --git a/lib/dim/rdma_dim.c b/lib/dim/rdma_dim.c
index f7e26c7b4749..15462d54758d 100644
--- a/lib/dim/rdma_dim.c
+++ b/lib/dim/rdma_dim.c
@@ -59,7 +59,7 @@ static bool rdma_dim_decision(struct dim_stats *curr_stats, struct dim *dim)
 			break;
 		case DIM_STATS_WORSE:
 			dim_turn(dim);
-			/* fall through */
+			fallthrough;
 		case DIM_STATS_BETTER:
 			step_res = rdma_dim_step(dim);
 			if (step_res == DIM_ON_EDGE)
@@ -94,7 +94,7 @@ void rdma_dim(struct dim *dim, u64 completions)
 			schedule_work(&dim->work);
 			break;
 		}
-		/* fall through */
+		fallthrough;
 	case DIM_START_MEASURE:
 		dim->state = DIM_MEASURE_IN_PROGRESS;
 		dim_update_sample_with_comps(curr_sample->event_ctr, 0, 0,
diff --git a/lib/glob.c b/lib/glob.c
index 52e3ed7e4a9b..85ecbda45cd8 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -102,7 +102,7 @@ bool __pure glob_match(char const *pat, char const *str)
 			break;
 		case '\\':
 			d = *pat++;
-			/* fall through */
+			fallthrough;
 		default:	/* Literal character */
 literal:
 			if (c == d) {
diff --git a/lib/siphash.c b/lib/siphash.c
index c47bb6ff2149..a90112ee72a1 100644
--- a/lib/siphash.c
+++ b/lib/siphash.c
@@ -68,11 +68,11 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key)
 						  bytemask_from_count(left)));
 #else
 	switch (left) {
-	case 7: b |= ((u64)end[6]) << 48; /* fall through */
-	case 6: b |= ((u64)end[5]) << 40; /* fall through */
-	case 5: b |= ((u64)end[4]) << 32; /* fall through */
+	case 7: b |= ((u64)end[6]) << 48; fallthrough;
+	case 6: b |= ((u64)end[5]) << 40; fallthrough;
+	case 5: b |= ((u64)end[4]) << 32; fallthrough;
 	case 4: b |= le32_to_cpup(data); break;
-	case 3: b |= ((u64)end[2]) << 16; /* fall through */
+	case 3: b |= ((u64)end[2]) << 16; fallthrough;
 	case 2: b |= le16_to_cpup(data); break;
 	case 1: b |= end[0];
 	}
@@ -101,11 +101,11 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key)
 						  bytemask_from_count(left)));
 #else
 	switch (left) {
-	case 7: b |= ((u64)end[6]) << 48; /* fall through */
-	case 6: b |= ((u64)end[5]) << 40; /* fall through */
-	case 5: b |= ((u64)end[4]) << 32; /* fall through */
+	case 7: b |= ((u64)end[6]) << 48; fallthrough;
+	case 6: b |= ((u64)end[5]) << 40; fallthrough;
+	case 5: b |= ((u64)end[4]) << 32; fallthrough;
 	case 4: b |= get_unaligned_le32(end); break;
-	case 3: b |= ((u64)end[2]) << 16; /* fall through */
+	case 3: b |= ((u64)end[2]) << 16; fallthrough;
 	case 2: b |= get_unaligned_le16(end); break;
 	case 1: b |= end[0];
 	}
@@ -268,11 +268,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
 						  bytemask_from_count(left)));
 #else
 	switch (left) {
-	case 7: b |= ((u64)end[6]) << 48; /* fall through */
-	case 6: b |= ((u64)end[5]) << 40; /* fall through */
-	case 5: b |= ((u64)end[4]) << 32; /* fall through */
+	case 7: b |= ((u64)end[6]) << 48; fallthrough;
+	case 6: b |= ((u64)end[5]) << 40; fallthrough;
+	case 5: b |= ((u64)end[4]) << 32; fallthrough;
 	case 4: b |= le32_to_cpup(data); break;
-	case 3: b |= ((u64)end[2]) << 16; /* fall through */
+	case 3: b |= ((u64)end[2]) << 16; fallthrough;
 	case 2: b |= le16_to_cpup(data); break;
 	case 1: b |= end[0];
 	}
@@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
 						  bytemask_from_count(left)));
 #else
 	switch (left) {
-	case 7: b |= ((u64)end[6]) << 48; /* fall through */
-	case 6: b |= ((u64)end[5]) << 40; /* fall through */
-	case 5: b |= ((u64)end[4]) << 32; /* fall through */
+	case 7: b |= ((u64)end[6]) << 48; fallthrough;
+	case 6: b |= ((u64)end[5]) << 40; fallthrough;
+	case 5: b |= ((u64)end[4]) << 32; fallthrough;
 	case 4: b |= get_unaligned_le32(end); break;
-	case 3: b |= ((u64)end[2]) << 16; /* fall through */
+	case 3: b |= ((u64)end[2]) << 16; fallthrough;
 	case 2: b |= get_unaligned_le16(end); break;
 	case 1: b |= end[0];
 	}
@@ -431,7 +431,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
 		v0 ^= m;
 	}
 	switch (left) {
-	case 3: b |= ((u32)end[2]) << 16; /* fall through */
+	case 3: b |= ((u32)end[2]) << 16; fallthrough;
 	case 2: b |= le16_to_cpup(data); break;
 	case 1: b |= end[0];
 	}
@@ -454,7 +454,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
 		v0 ^= m;
 	}
 	switch (left) {
-	case 3: b |= ((u32)end[2]) << 16; /* fall through */
+	case 3: b |= ((u32)end[2]) << 16; fallthrough;
 	case 2: b |= get_unaligned_le16(end); break;
 	case 1: b |= end[0];
 	}
diff --git a/lib/ts_fsm.c b/lib/ts_fsm.c
index ab749ec10ab5..64fd9015ad80 100644
--- a/lib/ts_fsm.c
+++ b/lib/ts_fsm.c
@@ -193,7 +193,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state)
 				TOKEN_MISMATCH();
 
 			block_idx++;
-			/* fall through */
+			fallthrough;
 
 		case TS_FSM_ANY:
 			if (next == NULL)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 14c9a6af1b23..d3c5c16f391c 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1265,7 +1265,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
 
 	case 'R':
 		reversed = true;
-		/* fall through */
+		fallthrough;
 
 	default:
 		separator = ':';
@@ -1682,7 +1682,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 	switch (*(++fmt)) {
 	case 'L':
 		uc = true;
-		/* fall through */
+		fallthrough;
 	case 'l':
 		index = guid_index;
 		break;
@@ -2219,7 +2219,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
 	case 'S':
 	case 's':
 		ptr = dereference_symbol_descriptor(ptr);
-		/* fall through */
+		fallthrough;
 	case 'B':
 		return symbol_string(buf, end, ptr, spec, fmt);
 	case 'R':
@@ -2450,7 +2450,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
 
 	case 'x':
 		spec->flags |= SMALL;
-		/* fall through */
+		fallthrough;
 
 	case 'X':
 		spec->base = 16;
@@ -2468,7 +2468,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
 		 * utility, treat it as any other invalid or
 		 * unsupported format specifier.
 		 */
-		/* fall through */
+		fallthrough;
 
 	default:
 		WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
@@ -3411,10 +3411,10 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
 			break;
 		case 'i':
 			base = 0;
-			/* fall through */
+			fallthrough;
 		case 'd':
 			is_sign = true;
-			/* fall through */
+			fallthrough;
 		case 'u':
 			break;
 		case '%':
diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
index 65a1aad8c223..ca2603abee08 100644
--- a/lib/xz/xz_dec_lzma2.c
+++ b/lib/xz/xz_dec_lzma2.c
@@ -1043,7 +1043,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
 
 			s->lzma2.sequence = SEQ_LZMA_PREPARE;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_LZMA_PREPARE:
 			if (s->lzma2.compressed < RC_INIT_BYTES)
@@ -1055,7 +1055,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
 			s->lzma2.compressed -= RC_INIT_BYTES;
 			s->lzma2.sequence = SEQ_LZMA_RUN;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_LZMA_RUN:
 			/*
diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
index 32ab2a08b7cb..fea86deaaa01 100644
--- a/lib/xz/xz_dec_stream.c
+++ b/lib/xz/xz_dec_stream.c
@@ -583,7 +583,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 			if (ret != XZ_OK)
 				return ret;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_BLOCK_START:
 			/* We need one byte of input to continue. */
@@ -608,7 +608,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 			s->temp.pos = 0;
 			s->sequence = SEQ_BLOCK_HEADER;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_BLOCK_HEADER:
 			if (!fill_temp(s, b))
@@ -620,7 +620,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
 			s->sequence = SEQ_BLOCK_UNCOMPRESS;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_BLOCK_UNCOMPRESS:
 			ret = dec_block(s, b);
@@ -629,7 +629,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
 			s->sequence = SEQ_BLOCK_PADDING;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_BLOCK_PADDING:
 			/*
@@ -651,7 +651,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
 			s->sequence = SEQ_BLOCK_CHECK;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_BLOCK_CHECK:
 			if (s->check_type == XZ_CHECK_CRC32) {
@@ -675,7 +675,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
 			s->sequence = SEQ_INDEX_PADDING;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_INDEX_PADDING:
 			while ((s->index.size + (b->in_pos - s->in_start))
@@ -699,7 +699,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
 			s->sequence = SEQ_INDEX_CRC32;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_INDEX_CRC32:
 			ret = crc32_validate(s, b);
@@ -709,7 +709,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 			s->temp.size = STREAM_HEADER_SIZE;
 			s->sequence = SEQ_STREAM_FOOTER;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_STREAM_FOOTER:
 			if (!fill_temp(s, b))
diff --git a/lib/zstd/bitstream.h b/lib/zstd/bitstream.h
index 3a49784d5c61..7c65c66e41fd 100644
--- a/lib/zstd/bitstream.h
+++ b/lib/zstd/bitstream.h
@@ -259,15 +259,15 @@ ZSTD_STATIC size_t BIT_initDStream(BIT_DStream_t *bitD, const void *srcBuffer, s
 		bitD->bitContainer = *(const BYTE *)(bitD->start);
 		switch (srcSize) {
 		case 7: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[6]) << (sizeof(bitD->bitContainer) * 8 - 16);
-			/* fall through */
+			fallthrough;
 		case 6: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[5]) << (sizeof(bitD->bitContainer) * 8 - 24);
-			/* fall through */
+			fallthrough;
 		case 5: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[4]) << (sizeof(bitD->bitContainer) * 8 - 32);
-			/* fall through */
+			fallthrough;
 		case 4: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[3]) << 24;
-			/* fall through */
+			fallthrough;
 		case 3: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[2]) << 16;
-			/* fall through */
+			fallthrough;
 		case 2: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[1]) << 8;
 		default:;
 		}
diff --git a/lib/zstd/compress.c b/lib/zstd/compress.c
index 5e0b67003e55..b080264ed3ad 100644
--- a/lib/zstd/compress.c
+++ b/lib/zstd/compress.c
@@ -3182,7 +3182,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t *
 				zcs->outBuffFlushedSize = 0;
 				zcs->stage = zcss_flush; /* pass-through to flush stage */
 			}
-			/* fall through */
+			fallthrough;
 
 		case zcss_flush: {
 			size_t const toFlush = zcs->outBuffContentSize - zcs->outBuffFlushedSize;
diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
index db6761ea4deb..66cd487a326a 100644
--- a/lib/zstd/decompress.c
+++ b/lib/zstd/decompress.c
@@ -442,7 +442,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize
 		case set_repeat:
 			if (dctx->litEntropy == 0)
 				return ERROR(dictionary_corrupted);
-			/* fall through */
+			fallthrough;
 		case set_compressed:
 			if (srcSize < 5)
 				return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
@@ -1768,7 +1768,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, c
 			return 0;
 		}
 		dctx->expected = 0; /* not necessary to copy more */
-		/* fall through */
+		fallthrough;
 
 	case ZSTDds_decodeFrameHeader:
 		memcpy(dctx->headerBuffer + ZSTD_frameHeaderSize_prefix, src, dctx->expected);
@@ -2309,7 +2309,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
 		switch (zds->stage) {
 		case zdss_init:
 			ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
-			/* fall through */
+			fallthrough;
 
 		case zdss_loadHeader: {
 			size_t const hSize = ZSTD_getFrameParams(&zds->fParams, zds->headerBuffer, zds->lhSize);
@@ -2376,7 +2376,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
 			}
 			zds->stage = zdss_read;
 		}
-			/* fall through */
+			fallthrough;
 
 		case zdss_read: {
 			size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
@@ -2405,7 +2405,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
 			zds->stage = zdss_load;
 			/* pass-through */
 		}
-			/* fall through */
+			fallthrough;
 
 		case zdss_load: {
 			size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
@@ -2438,7 +2438,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
 				/* pass-through */
 			}
 		}
-			/* fall through */
+			fallthrough;
 
 		case zdss_flush: {
 			size_t const toFlushSize = zds->outEnd - zds->outStart;
diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
index e727812d12aa..08b4ae80aed4 100644
--- a/lib/zstd/huf_compress.c
+++ b/lib/zstd/huf_compress.c
@@ -556,9 +556,9 @@ size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, si
 	n = srcSize & ~3; /* join to mod 4 */
 	switch (srcSize & 3) {
 	case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
-		/* fall through */
+		fallthrough;
 	case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
-		/* fall through */
+		fallthrough;
 	case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
 	case 0:
 	default:;
-- 
2.29.2.299.gdc1121823c-goog


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
@ 2020-11-16  4:35   ` Nick Desaulniers
  0 siblings, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 2020-11-16  4:35 UTC (permalink / raw)
  To: Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda, Michael Ellerman
  Cc: Nick Desaulniers, linux-kernel, clang-built-linux,
	Paul Mackerras, linuxppc-dev

This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
pseudo-keyword in lib/")

Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
re-enable these fixes for lib/.

Link: https://github.com/ClangBuiltLinux/linux/issues/236
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 lib/asn1_decoder.c      |  4 ++--
 lib/assoc_array.c       |  2 +-
 lib/bootconfig.c        |  4 ++--
 lib/cmdline.c           | 10 +++++-----
 lib/dim/net_dim.c       |  2 +-
 lib/dim/rdma_dim.c      |  4 ++--
 lib/glob.c              |  2 +-
 lib/siphash.c           | 36 ++++++++++++++++++------------------
 lib/ts_fsm.c            |  2 +-
 lib/vsprintf.c          | 14 +++++++-------
 lib/xz/xz_dec_lzma2.c   |  4 ++--
 lib/xz/xz_dec_stream.c  | 16 ++++++++--------
 lib/zstd/bitstream.h    | 10 +++++-----
 lib/zstd/compress.c     |  2 +-
 lib/zstd/decompress.c   | 12 ++++++------
 lib/zstd/huf_compress.c |  4 ++--
 16 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
index 58f72b25f8e9..13da529e2e72 100644
--- a/lib/asn1_decoder.c
+++ b/lib/asn1_decoder.c
@@ -381,7 +381,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
 	case ASN1_OP_END_SET_ACT:
 		if (unlikely(!(flags & FLAG_MATCHED)))
 			goto tag_mismatch;
-		/* fall through */
+		fallthrough;
 
 	case ASN1_OP_END_SEQ:
 	case ASN1_OP_END_SET_OF:
@@ -448,7 +448,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
 			pc += asn1_op_lengths[op];
 			goto next_op;
 		}
-		/* fall through */
+		fallthrough;
 
 	case ASN1_OP_ACT:
 		ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
diff --git a/lib/assoc_array.c b/lib/assoc_array.c
index 6f4bcf524554..04c98799c3ba 100644
--- a/lib/assoc_array.c
+++ b/lib/assoc_array.c
@@ -1113,7 +1113,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
 						index_key))
 				goto found_leaf;
 		}
-		/* fall through */
+		fallthrough;
 	case assoc_array_walk_tree_empty:
 	case assoc_array_walk_found_wrong_shortcut:
 	default:
diff --git a/lib/bootconfig.c b/lib/bootconfig.c
index 649ed44f199c..9f8c70a98fcf 100644
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -827,7 +827,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
 							q - 2);
 				break;
 			}
-			/* fall through */
+			fallthrough;
 		case '=':
 			ret = xbc_parse_kv(&p, q, c);
 			break;
@@ -836,7 +836,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
 			break;
 		case '#':
 			q = skip_comment(q);
-			/* fall through */
+			fallthrough;
 		case ';':
 		case '\n':
 			ret = xbc_parse_key(&p, q);
diff --git a/lib/cmdline.c b/lib/cmdline.c
index 9e186234edc0..46f2cb4ce6d1 100644
--- a/lib/cmdline.c
+++ b/lib/cmdline.c
@@ -144,23 +144,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
 	case 'E':
 	case 'e':
 		ret <<= 10;
-		/* fall through */
+		fallthrough;
 	case 'P':
 	case 'p':
 		ret <<= 10;
-		/* fall through */
+		fallthrough;
 	case 'T':
 	case 't':
 		ret <<= 10;
-		/* fall through */
+		fallthrough;
 	case 'G':
 	case 'g':
 		ret <<= 10;
-		/* fall through */
+		fallthrough;
 	case 'M':
 	case 'm':
 		ret <<= 10;
-		/* fall through */
+		fallthrough;
 	case 'K':
 	case 'k':
 		ret <<= 10;
diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
index a4db51c21266..06811d866775 100644
--- a/lib/dim/net_dim.c
+++ b/lib/dim/net_dim.c
@@ -233,7 +233,7 @@ void net_dim(struct dim *dim, struct dim_sample end_sample)
 			schedule_work(&dim->work);
 			break;
 		}
-		/* fall through */
+		fallthrough;
 	case DIM_START_MEASURE:
 		dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
 				  end_sample.byte_ctr, &dim->start_sample);
diff --git a/lib/dim/rdma_dim.c b/lib/dim/rdma_dim.c
index f7e26c7b4749..15462d54758d 100644
--- a/lib/dim/rdma_dim.c
+++ b/lib/dim/rdma_dim.c
@@ -59,7 +59,7 @@ static bool rdma_dim_decision(struct dim_stats *curr_stats, struct dim *dim)
 			break;
 		case DIM_STATS_WORSE:
 			dim_turn(dim);
-			/* fall through */
+			fallthrough;
 		case DIM_STATS_BETTER:
 			step_res = rdma_dim_step(dim);
 			if (step_res == DIM_ON_EDGE)
@@ -94,7 +94,7 @@ void rdma_dim(struct dim *dim, u64 completions)
 			schedule_work(&dim->work);
 			break;
 		}
-		/* fall through */
+		fallthrough;
 	case DIM_START_MEASURE:
 		dim->state = DIM_MEASURE_IN_PROGRESS;
 		dim_update_sample_with_comps(curr_sample->event_ctr, 0, 0,
diff --git a/lib/glob.c b/lib/glob.c
index 52e3ed7e4a9b..85ecbda45cd8 100644
--- a/lib/glob.c
+++ b/lib/glob.c
@@ -102,7 +102,7 @@ bool __pure glob_match(char const *pat, char const *str)
 			break;
 		case '\\':
 			d = *pat++;
-			/* fall through */
+			fallthrough;
 		default:	/* Literal character */
 literal:
 			if (c == d) {
diff --git a/lib/siphash.c b/lib/siphash.c
index c47bb6ff2149..a90112ee72a1 100644
--- a/lib/siphash.c
+++ b/lib/siphash.c
@@ -68,11 +68,11 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key)
 						  bytemask_from_count(left)));
 #else
 	switch (left) {
-	case 7: b |= ((u64)end[6]) << 48; /* fall through */
-	case 6: b |= ((u64)end[5]) << 40; /* fall through */
-	case 5: b |= ((u64)end[4]) << 32; /* fall through */
+	case 7: b |= ((u64)end[6]) << 48; fallthrough;
+	case 6: b |= ((u64)end[5]) << 40; fallthrough;
+	case 5: b |= ((u64)end[4]) << 32; fallthrough;
 	case 4: b |= le32_to_cpup(data); break;
-	case 3: b |= ((u64)end[2]) << 16; /* fall through */
+	case 3: b |= ((u64)end[2]) << 16; fallthrough;
 	case 2: b |= le16_to_cpup(data); break;
 	case 1: b |= end[0];
 	}
@@ -101,11 +101,11 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key)
 						  bytemask_from_count(left)));
 #else
 	switch (left) {
-	case 7: b |= ((u64)end[6]) << 48; /* fall through */
-	case 6: b |= ((u64)end[5]) << 40; /* fall through */
-	case 5: b |= ((u64)end[4]) << 32; /* fall through */
+	case 7: b |= ((u64)end[6]) << 48; fallthrough;
+	case 6: b |= ((u64)end[5]) << 40; fallthrough;
+	case 5: b |= ((u64)end[4]) << 32; fallthrough;
 	case 4: b |= get_unaligned_le32(end); break;
-	case 3: b |= ((u64)end[2]) << 16; /* fall through */
+	case 3: b |= ((u64)end[2]) << 16; fallthrough;
 	case 2: b |= get_unaligned_le16(end); break;
 	case 1: b |= end[0];
 	}
@@ -268,11 +268,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
 						  bytemask_from_count(left)));
 #else
 	switch (left) {
-	case 7: b |= ((u64)end[6]) << 48; /* fall through */
-	case 6: b |= ((u64)end[5]) << 40; /* fall through */
-	case 5: b |= ((u64)end[4]) << 32; /* fall through */
+	case 7: b |= ((u64)end[6]) << 48; fallthrough;
+	case 6: b |= ((u64)end[5]) << 40; fallthrough;
+	case 5: b |= ((u64)end[4]) << 32; fallthrough;
 	case 4: b |= le32_to_cpup(data); break;
-	case 3: b |= ((u64)end[2]) << 16; /* fall through */
+	case 3: b |= ((u64)end[2]) << 16; fallthrough;
 	case 2: b |= le16_to_cpup(data); break;
 	case 1: b |= end[0];
 	}
@@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
 						  bytemask_from_count(left)));
 #else
 	switch (left) {
-	case 7: b |= ((u64)end[6]) << 48; /* fall through */
-	case 6: b |= ((u64)end[5]) << 40; /* fall through */
-	case 5: b |= ((u64)end[4]) << 32; /* fall through */
+	case 7: b |= ((u64)end[6]) << 48; fallthrough;
+	case 6: b |= ((u64)end[5]) << 40; fallthrough;
+	case 5: b |= ((u64)end[4]) << 32; fallthrough;
 	case 4: b |= get_unaligned_le32(end); break;
-	case 3: b |= ((u64)end[2]) << 16; /* fall through */
+	case 3: b |= ((u64)end[2]) << 16; fallthrough;
 	case 2: b |= get_unaligned_le16(end); break;
 	case 1: b |= end[0];
 	}
@@ -431,7 +431,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
 		v0 ^= m;
 	}
 	switch (left) {
-	case 3: b |= ((u32)end[2]) << 16; /* fall through */
+	case 3: b |= ((u32)end[2]) << 16; fallthrough;
 	case 2: b |= le16_to_cpup(data); break;
 	case 1: b |= end[0];
 	}
@@ -454,7 +454,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
 		v0 ^= m;
 	}
 	switch (left) {
-	case 3: b |= ((u32)end[2]) << 16; /* fall through */
+	case 3: b |= ((u32)end[2]) << 16; fallthrough;
 	case 2: b |= get_unaligned_le16(end); break;
 	case 1: b |= end[0];
 	}
diff --git a/lib/ts_fsm.c b/lib/ts_fsm.c
index ab749ec10ab5..64fd9015ad80 100644
--- a/lib/ts_fsm.c
+++ b/lib/ts_fsm.c
@@ -193,7 +193,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state)
 				TOKEN_MISMATCH();
 
 			block_idx++;
-			/* fall through */
+			fallthrough;
 
 		case TS_FSM_ANY:
 			if (next == NULL)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 14c9a6af1b23..d3c5c16f391c 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1265,7 +1265,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
 
 	case 'R':
 		reversed = true;
-		/* fall through */
+		fallthrough;
 
 	default:
 		separator = ':';
@@ -1682,7 +1682,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
 	switch (*(++fmt)) {
 	case 'L':
 		uc = true;
-		/* fall through */
+		fallthrough;
 	case 'l':
 		index = guid_index;
 		break;
@@ -2219,7 +2219,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
 	case 'S':
 	case 's':
 		ptr = dereference_symbol_descriptor(ptr);
-		/* fall through */
+		fallthrough;
 	case 'B':
 		return symbol_string(buf, end, ptr, spec, fmt);
 	case 'R':
@@ -2450,7 +2450,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
 
 	case 'x':
 		spec->flags |= SMALL;
-		/* fall through */
+		fallthrough;
 
 	case 'X':
 		spec->base = 16;
@@ -2468,7 +2468,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
 		 * utility, treat it as any other invalid or
 		 * unsupported format specifier.
 		 */
-		/* fall through */
+		fallthrough;
 
 	default:
 		WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
@@ -3411,10 +3411,10 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
 			break;
 		case 'i':
 			base = 0;
-			/* fall through */
+			fallthrough;
 		case 'd':
 			is_sign = true;
-			/* fall through */
+			fallthrough;
 		case 'u':
 			break;
 		case '%':
diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
index 65a1aad8c223..ca2603abee08 100644
--- a/lib/xz/xz_dec_lzma2.c
+++ b/lib/xz/xz_dec_lzma2.c
@@ -1043,7 +1043,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
 
 			s->lzma2.sequence = SEQ_LZMA_PREPARE;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_LZMA_PREPARE:
 			if (s->lzma2.compressed < RC_INIT_BYTES)
@@ -1055,7 +1055,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
 			s->lzma2.compressed -= RC_INIT_BYTES;
 			s->lzma2.sequence = SEQ_LZMA_RUN;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_LZMA_RUN:
 			/*
diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
index 32ab2a08b7cb..fea86deaaa01 100644
--- a/lib/xz/xz_dec_stream.c
+++ b/lib/xz/xz_dec_stream.c
@@ -583,7 +583,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 			if (ret != XZ_OK)
 				return ret;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_BLOCK_START:
 			/* We need one byte of input to continue. */
@@ -608,7 +608,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 			s->temp.pos = 0;
 			s->sequence = SEQ_BLOCK_HEADER;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_BLOCK_HEADER:
 			if (!fill_temp(s, b))
@@ -620,7 +620,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
 			s->sequence = SEQ_BLOCK_UNCOMPRESS;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_BLOCK_UNCOMPRESS:
 			ret = dec_block(s, b);
@@ -629,7 +629,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
 			s->sequence = SEQ_BLOCK_PADDING;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_BLOCK_PADDING:
 			/*
@@ -651,7 +651,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
 			s->sequence = SEQ_BLOCK_CHECK;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_BLOCK_CHECK:
 			if (s->check_type == XZ_CHECK_CRC32) {
@@ -675,7 +675,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
 			s->sequence = SEQ_INDEX_PADDING;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_INDEX_PADDING:
 			while ((s->index.size + (b->in_pos - s->in_start))
@@ -699,7 +699,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 
 			s->sequence = SEQ_INDEX_CRC32;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_INDEX_CRC32:
 			ret = crc32_validate(s, b);
@@ -709,7 +709,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
 			s->temp.size = STREAM_HEADER_SIZE;
 			s->sequence = SEQ_STREAM_FOOTER;
 
-			/* fall through */
+			fallthrough;
 
 		case SEQ_STREAM_FOOTER:
 			if (!fill_temp(s, b))
diff --git a/lib/zstd/bitstream.h b/lib/zstd/bitstream.h
index 3a49784d5c61..7c65c66e41fd 100644
--- a/lib/zstd/bitstream.h
+++ b/lib/zstd/bitstream.h
@@ -259,15 +259,15 @@ ZSTD_STATIC size_t BIT_initDStream(BIT_DStream_t *bitD, const void *srcBuffer, s
 		bitD->bitContainer = *(const BYTE *)(bitD->start);
 		switch (srcSize) {
 		case 7: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[6]) << (sizeof(bitD->bitContainer) * 8 - 16);
-			/* fall through */
+			fallthrough;
 		case 6: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[5]) << (sizeof(bitD->bitContainer) * 8 - 24);
-			/* fall through */
+			fallthrough;
 		case 5: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[4]) << (sizeof(bitD->bitContainer) * 8 - 32);
-			/* fall through */
+			fallthrough;
 		case 4: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[3]) << 24;
-			/* fall through */
+			fallthrough;
 		case 3: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[2]) << 16;
-			/* fall through */
+			fallthrough;
 		case 2: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[1]) << 8;
 		default:;
 		}
diff --git a/lib/zstd/compress.c b/lib/zstd/compress.c
index 5e0b67003e55..b080264ed3ad 100644
--- a/lib/zstd/compress.c
+++ b/lib/zstd/compress.c
@@ -3182,7 +3182,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t *
 				zcs->outBuffFlushedSize = 0;
 				zcs->stage = zcss_flush; /* pass-through to flush stage */
 			}
-			/* fall through */
+			fallthrough;
 
 		case zcss_flush: {
 			size_t const toFlush = zcs->outBuffContentSize - zcs->outBuffFlushedSize;
diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
index db6761ea4deb..66cd487a326a 100644
--- a/lib/zstd/decompress.c
+++ b/lib/zstd/decompress.c
@@ -442,7 +442,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize
 		case set_repeat:
 			if (dctx->litEntropy == 0)
 				return ERROR(dictionary_corrupted);
-			/* fall through */
+			fallthrough;
 		case set_compressed:
 			if (srcSize < 5)
 				return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
@@ -1768,7 +1768,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, c
 			return 0;
 		}
 		dctx->expected = 0; /* not necessary to copy more */
-		/* fall through */
+		fallthrough;
 
 	case ZSTDds_decodeFrameHeader:
 		memcpy(dctx->headerBuffer + ZSTD_frameHeaderSize_prefix, src, dctx->expected);
@@ -2309,7 +2309,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
 		switch (zds->stage) {
 		case zdss_init:
 			ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
-			/* fall through */
+			fallthrough;
 
 		case zdss_loadHeader: {
 			size_t const hSize = ZSTD_getFrameParams(&zds->fParams, zds->headerBuffer, zds->lhSize);
@@ -2376,7 +2376,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
 			}
 			zds->stage = zdss_read;
 		}
-			/* fall through */
+			fallthrough;
 
 		case zdss_read: {
 			size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
@@ -2405,7 +2405,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
 			zds->stage = zdss_load;
 			/* pass-through */
 		}
-			/* fall through */
+			fallthrough;
 
 		case zdss_load: {
 			size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
@@ -2438,7 +2438,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
 				/* pass-through */
 			}
 		}
-			/* fall through */
+			fallthrough;
 
 		case zdss_flush: {
 			size_t const toFlushSize = zds->outEnd - zds->outStart;
diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
index e727812d12aa..08b4ae80aed4 100644
--- a/lib/zstd/huf_compress.c
+++ b/lib/zstd/huf_compress.c
@@ -556,9 +556,9 @@ size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, si
 	n = srcSize & ~3; /* join to mod 4 */
 	switch (srcSize & 3) {
 	case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
-		/* fall through */
+		fallthrough;
 	case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
-		/* fall through */
+		fallthrough;
 	case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
 	case 0:
 	default:;
-- 
2.29.2.299.gdc1121823c-goog


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough
  2020-11-16  4:35 ` Nick Desaulniers
@ 2020-11-16  4:35   ` Nick Desaulniers
  -1 siblings, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 2020-11-16  4:35 UTC (permalink / raw)
  To: Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda, Michael Ellerman
  Cc: Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel, Nick Desaulniers

The "fallthrough" pseudo-keyword was added as a portable way to denote
intentional fallthrough. Clang will still warn on cases where there is a
fallthrough to an immediate break. Add explicit breaks for those cases.

Link: https://github.com/ClangBuiltLinux/linux/issues/236
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 arch/powerpc/kernel/prom_init.c | 1 +
 arch/powerpc/kernel/uprobes.c   | 1 +
 arch/powerpc/perf/imc-pmu.c     | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 38ae5933d917..e9d4eb6144e1 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -355,6 +355,7 @@ static int __init prom_strtobool(const char *s, bool *res)
 		default:
 			break;
 		}
+		break;
 	default:
 		break;
 	}
diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
index d200e7df7167..e8a63713e655 100644
--- a/arch/powerpc/kernel/uprobes.c
+++ b/arch/powerpc/kernel/uprobes.c
@@ -141,6 +141,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self,
 	case DIE_SSTEP:
 		if (uprobe_post_sstep_notifier(regs))
 			return NOTIFY_STOP;
+		break;
 	default:
 		break;
 	}
diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
index 7b25548ec42b..e106909ff9c3 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -1500,6 +1500,7 @@ static int update_pmu_ops(struct imc_pmu *pmu)
 		pmu->pmu.stop = trace_imc_event_stop;
 		pmu->pmu.read = trace_imc_event_read;
 		pmu->attr_groups[IMC_FORMAT_ATTR] = &trace_imc_format_group;
+		break;
 	default:
 		break;
 	}
-- 
2.29.2.299.gdc1121823c-goog


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough
@ 2020-11-16  4:35   ` Nick Desaulniers
  0 siblings, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 2020-11-16  4:35 UTC (permalink / raw)
  To: Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda, Michael Ellerman
  Cc: Nick Desaulniers, linux-kernel, clang-built-linux,
	Paul Mackerras, linuxppc-dev

The "fallthrough" pseudo-keyword was added as a portable way to denote
intentional fallthrough. Clang will still warn on cases where there is a
fallthrough to an immediate break. Add explicit breaks for those cases.

Link: https://github.com/ClangBuiltLinux/linux/issues/236
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 arch/powerpc/kernel/prom_init.c | 1 +
 arch/powerpc/kernel/uprobes.c   | 1 +
 arch/powerpc/perf/imc-pmu.c     | 1 +
 3 files changed, 3 insertions(+)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 38ae5933d917..e9d4eb6144e1 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -355,6 +355,7 @@ static int __init prom_strtobool(const char *s, bool *res)
 		default:
 			break;
 		}
+		break;
 	default:
 		break;
 	}
diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
index d200e7df7167..e8a63713e655 100644
--- a/arch/powerpc/kernel/uprobes.c
+++ b/arch/powerpc/kernel/uprobes.c
@@ -141,6 +141,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self,
 	case DIE_SSTEP:
 		if (uprobe_post_sstep_notifier(regs))
 			return NOTIFY_STOP;
+		break;
 	default:
 		break;
 	}
diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
index 7b25548ec42b..e106909ff9c3 100644
--- a/arch/powerpc/perf/imc-pmu.c
+++ b/arch/powerpc/perf/imc-pmu.c
@@ -1500,6 +1500,7 @@ static int update_pmu_ops(struct imc_pmu *pmu)
 		pmu->pmu.stop = trace_imc_event_stop;
 		pmu->pmu.read = trace_imc_event_read;
 		pmu->attr_groups[IMC_FORMAT_ATTR] = &trace_imc_format_group;
+		break;
 	default:
 		break;
 	}
-- 
2.29.2.299.gdc1121823c-goog


^ permalink raw reply related	[flat|nested] 47+ messages in thread

* Re: [PATCH 1/3] powerpc: boot: include compiler_attributes.h
  2020-11-16  4:35   ` Nick Desaulniers
@ 2020-11-16  6:25     ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-16  6:25 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Nathan Chancellor, Miguel Ojeda, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel

On Sun, Nov 15, 2020 at 08:35:30PM -0800, Nick Desaulniers wrote:
> The kernel uses `-include` to include include/linux/compiler_types.h
> into all translation units (see scripts/Makefile.lib), which #includes
> compiler_attributes.h.
> 
> arch/powerpc/boot/ uses different compiler flags from the rest of the
> kernel. As such, it doesn't contain the definitions from these headers,
> and redefines a few that it needs.
> 
> For the purpose of enabling -Wimplicit-fallthrough for ppc, include
> compiler_types.h via `-include`.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Acked-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks, Nick.
--
Gustavo

> ---
> We could just `#include "include/linux/compiler_types.h"` in the few .c
> sources used from lib/ (there are proper header guards in
> compiler_types.h).
> 
> It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
> -include compiler_types.h like the main kernel does, though testing that
> produces a whole sea of warnings to cleanup. This approach is minimally
> invasive.
> 
>  arch/powerpc/boot/Makefile     | 1 +
>  arch/powerpc/boot/decompress.c | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index f8ce6d2dde7b..1659963a8f1d 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -31,6 +31,7 @@ endif
>  BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
>  		 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
>  		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
> +		 -include $(srctree)/include/linux/compiler_attributes.h \
>  		 $(LINUXINCLUDE)
>  
>  ifdef CONFIG_PPC64_BOOT_WRAPPER
> diff --git a/arch/powerpc/boot/decompress.c b/arch/powerpc/boot/decompress.c
> index 8bf39ef7d2df..6098b879ac97 100644
> --- a/arch/powerpc/boot/decompress.c
> +++ b/arch/powerpc/boot/decompress.c
> @@ -21,7 +21,6 @@
>  
>  #define STATIC static
>  #define INIT
> -#define __always_inline inline
>  
>  /*
>   * The build process will copy the required zlib source files and headers
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 1/3] powerpc: boot: include compiler_attributes.h
@ 2020-11-16  6:25     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-16  6:25 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: clang-built-linux, linux-kernel, Miguel Ojeda, Paul Mackerras,
	Nathan Chancellor, linuxppc-dev

On Sun, Nov 15, 2020 at 08:35:30PM -0800, Nick Desaulniers wrote:
> The kernel uses `-include` to include include/linux/compiler_types.h
> into all translation units (see scripts/Makefile.lib), which #includes
> compiler_attributes.h.
> 
> arch/powerpc/boot/ uses different compiler flags from the rest of the
> kernel. As such, it doesn't contain the definitions from these headers,
> and redefines a few that it needs.
> 
> For the purpose of enabling -Wimplicit-fallthrough for ppc, include
> compiler_types.h via `-include`.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Acked-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks, Nick.
--
Gustavo

> ---
> We could just `#include "include/linux/compiler_types.h"` in the few .c
> sources used from lib/ (there are proper header guards in
> compiler_types.h).
> 
> It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
> -include compiler_types.h like the main kernel does, though testing that
> produces a whole sea of warnings to cleanup. This approach is minimally
> invasive.
> 
>  arch/powerpc/boot/Makefile     | 1 +
>  arch/powerpc/boot/decompress.c | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index f8ce6d2dde7b..1659963a8f1d 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -31,6 +31,7 @@ endif
>  BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
>  		 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
>  		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
> +		 -include $(srctree)/include/linux/compiler_attributes.h \
>  		 $(LINUXINCLUDE)
>  
>  ifdef CONFIG_PPC64_BOOT_WRAPPER
> diff --git a/arch/powerpc/boot/decompress.c b/arch/powerpc/boot/decompress.c
> index 8bf39ef7d2df..6098b879ac97 100644
> --- a/arch/powerpc/boot/decompress.c
> +++ b/arch/powerpc/boot/decompress.c
> @@ -21,7 +21,6 @@
>  
>  #define STATIC static
>  #define INIT
> -#define __always_inline inline
>  
>  /*
>   * The build process will copy the required zlib source files and headers
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  2020-11-16  4:35   ` Nick Desaulniers
@ 2020-11-16  6:26     ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-16  6:26 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Nathan Chancellor, Miguel Ojeda, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel

On Sun, Nov 15, 2020 at 08:35:31PM -0800, Nick Desaulniers wrote:
> This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
> pseudo-keyword in lib/")
> 
> Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
> re-enable these fixes for lib/.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.com>

Thanks
--
Gustavo

> ---
>  lib/asn1_decoder.c      |  4 ++--
>  lib/assoc_array.c       |  2 +-
>  lib/bootconfig.c        |  4 ++--
>  lib/cmdline.c           | 10 +++++-----
>  lib/dim/net_dim.c       |  2 +-
>  lib/dim/rdma_dim.c      |  4 ++--
>  lib/glob.c              |  2 +-
>  lib/siphash.c           | 36 ++++++++++++++++++------------------
>  lib/ts_fsm.c            |  2 +-
>  lib/vsprintf.c          | 14 +++++++-------
>  lib/xz/xz_dec_lzma2.c   |  4 ++--
>  lib/xz/xz_dec_stream.c  | 16 ++++++++--------
>  lib/zstd/bitstream.h    | 10 +++++-----
>  lib/zstd/compress.c     |  2 +-
>  lib/zstd/decompress.c   | 12 ++++++------
>  lib/zstd/huf_compress.c |  4 ++--
>  16 files changed, 64 insertions(+), 64 deletions(-)
> 
> diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
> index 58f72b25f8e9..13da529e2e72 100644
> --- a/lib/asn1_decoder.c
> +++ b/lib/asn1_decoder.c
> @@ -381,7 +381,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
>  	case ASN1_OP_END_SET_ACT:
>  		if (unlikely(!(flags & FLAG_MATCHED)))
>  			goto tag_mismatch;
> -		/* fall through */
> +		fallthrough;
>  
>  	case ASN1_OP_END_SEQ:
>  	case ASN1_OP_END_SET_OF:
> @@ -448,7 +448,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
>  			pc += asn1_op_lengths[op];
>  			goto next_op;
>  		}
> -		/* fall through */
> +		fallthrough;
>  
>  	case ASN1_OP_ACT:
>  		ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
> diff --git a/lib/assoc_array.c b/lib/assoc_array.c
> index 6f4bcf524554..04c98799c3ba 100644
> --- a/lib/assoc_array.c
> +++ b/lib/assoc_array.c
> @@ -1113,7 +1113,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
>  						index_key))
>  				goto found_leaf;
>  		}
> -		/* fall through */
> +		fallthrough;
>  	case assoc_array_walk_tree_empty:
>  	case assoc_array_walk_found_wrong_shortcut:
>  	default:
> diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> index 649ed44f199c..9f8c70a98fcf 100644
> --- a/lib/bootconfig.c
> +++ b/lib/bootconfig.c
> @@ -827,7 +827,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
>  							q - 2);
>  				break;
>  			}
> -			/* fall through */
> +			fallthrough;
>  		case '=':
>  			ret = xbc_parse_kv(&p, q, c);
>  			break;
> @@ -836,7 +836,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
>  			break;
>  		case '#':
>  			q = skip_comment(q);
> -			/* fall through */
> +			fallthrough;
>  		case ';':
>  		case '\n':
>  			ret = xbc_parse_key(&p, q);
> diff --git a/lib/cmdline.c b/lib/cmdline.c
> index 9e186234edc0..46f2cb4ce6d1 100644
> --- a/lib/cmdline.c
> +++ b/lib/cmdline.c
> @@ -144,23 +144,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
>  	case 'E':
>  	case 'e':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'P':
>  	case 'p':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'T':
>  	case 't':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'G':
>  	case 'g':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'M':
>  	case 'm':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'K':
>  	case 'k':
>  		ret <<= 10;
> diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
> index a4db51c21266..06811d866775 100644
> --- a/lib/dim/net_dim.c
> +++ b/lib/dim/net_dim.c
> @@ -233,7 +233,7 @@ void net_dim(struct dim *dim, struct dim_sample end_sample)
>  			schedule_work(&dim->work);
>  			break;
>  		}
> -		/* fall through */
> +		fallthrough;
>  	case DIM_START_MEASURE:
>  		dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
>  				  end_sample.byte_ctr, &dim->start_sample);
> diff --git a/lib/dim/rdma_dim.c b/lib/dim/rdma_dim.c
> index f7e26c7b4749..15462d54758d 100644
> --- a/lib/dim/rdma_dim.c
> +++ b/lib/dim/rdma_dim.c
> @@ -59,7 +59,7 @@ static bool rdma_dim_decision(struct dim_stats *curr_stats, struct dim *dim)
>  			break;
>  		case DIM_STATS_WORSE:
>  			dim_turn(dim);
> -			/* fall through */
> +			fallthrough;
>  		case DIM_STATS_BETTER:
>  			step_res = rdma_dim_step(dim);
>  			if (step_res == DIM_ON_EDGE)
> @@ -94,7 +94,7 @@ void rdma_dim(struct dim *dim, u64 completions)
>  			schedule_work(&dim->work);
>  			break;
>  		}
> -		/* fall through */
> +		fallthrough;
>  	case DIM_START_MEASURE:
>  		dim->state = DIM_MEASURE_IN_PROGRESS;
>  		dim_update_sample_with_comps(curr_sample->event_ctr, 0, 0,
> diff --git a/lib/glob.c b/lib/glob.c
> index 52e3ed7e4a9b..85ecbda45cd8 100644
> --- a/lib/glob.c
> +++ b/lib/glob.c
> @@ -102,7 +102,7 @@ bool __pure glob_match(char const *pat, char const *str)
>  			break;
>  		case '\\':
>  			d = *pat++;
> -			/* fall through */
> +			fallthrough;
>  		default:	/* Literal character */
>  literal:
>  			if (c == d) {
> diff --git a/lib/siphash.c b/lib/siphash.c
> index c47bb6ff2149..a90112ee72a1 100644
> --- a/lib/siphash.c
> +++ b/lib/siphash.c
> @@ -68,11 +68,11 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key)
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= le32_to_cpup(data); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= le16_to_cpup(data); break;
>  	case 1: b |= end[0];
>  	}
> @@ -101,11 +101,11 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key)
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= get_unaligned_le32(end); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= get_unaligned_le16(end); break;
>  	case 1: b |= end[0];
>  	}
> @@ -268,11 +268,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= le32_to_cpup(data); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= le16_to_cpup(data); break;
>  	case 1: b |= end[0];
>  	}
> @@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= get_unaligned_le32(end); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= get_unaligned_le16(end); break;
>  	case 1: b |= end[0];
>  	}
> @@ -431,7 +431,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
>  		v0 ^= m;
>  	}
>  	switch (left) {
> -	case 3: b |= ((u32)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u32)end[2]) << 16; fallthrough;
>  	case 2: b |= le16_to_cpup(data); break;
>  	case 1: b |= end[0];
>  	}
> @@ -454,7 +454,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
>  		v0 ^= m;
>  	}
>  	switch (left) {
> -	case 3: b |= ((u32)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u32)end[2]) << 16; fallthrough;
>  	case 2: b |= get_unaligned_le16(end); break;
>  	case 1: b |= end[0];
>  	}
> diff --git a/lib/ts_fsm.c b/lib/ts_fsm.c
> index ab749ec10ab5..64fd9015ad80 100644
> --- a/lib/ts_fsm.c
> +++ b/lib/ts_fsm.c
> @@ -193,7 +193,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state)
>  				TOKEN_MISMATCH();
>  
>  			block_idx++;
> -			/* fall through */
> +			fallthrough;
>  
>  		case TS_FSM_ANY:
>  			if (next == NULL)
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 14c9a6af1b23..d3c5c16f391c 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1265,7 +1265,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
>  
>  	case 'R':
>  		reversed = true;
> -		/* fall through */
> +		fallthrough;
>  
>  	default:
>  		separator = ':';
> @@ -1682,7 +1682,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
>  	switch (*(++fmt)) {
>  	case 'L':
>  		uc = true;
> -		/* fall through */
> +		fallthrough;
>  	case 'l':
>  		index = guid_index;
>  		break;
> @@ -2219,7 +2219,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
>  	case 'S':
>  	case 's':
>  		ptr = dereference_symbol_descriptor(ptr);
> -		/* fall through */
> +		fallthrough;
>  	case 'B':
>  		return symbol_string(buf, end, ptr, spec, fmt);
>  	case 'R':
> @@ -2450,7 +2450,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
>  
>  	case 'x':
>  		spec->flags |= SMALL;
> -		/* fall through */
> +		fallthrough;
>  
>  	case 'X':
>  		spec->base = 16;
> @@ -2468,7 +2468,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
>  		 * utility, treat it as any other invalid or
>  		 * unsupported format specifier.
>  		 */
> -		/* fall through */
> +		fallthrough;
>  
>  	default:
>  		WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
> @@ -3411,10 +3411,10 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
>  			break;
>  		case 'i':
>  			base = 0;
> -			/* fall through */
> +			fallthrough;
>  		case 'd':
>  			is_sign = true;
> -			/* fall through */
> +			fallthrough;
>  		case 'u':
>  			break;
>  		case '%':
> diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
> index 65a1aad8c223..ca2603abee08 100644
> --- a/lib/xz/xz_dec_lzma2.c
> +++ b/lib/xz/xz_dec_lzma2.c
> @@ -1043,7 +1043,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
>  
>  			s->lzma2.sequence = SEQ_LZMA_PREPARE;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_LZMA_PREPARE:
>  			if (s->lzma2.compressed < RC_INIT_BYTES)
> @@ -1055,7 +1055,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
>  			s->lzma2.compressed -= RC_INIT_BYTES;
>  			s->lzma2.sequence = SEQ_LZMA_RUN;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_LZMA_RUN:
>  			/*
> diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
> index 32ab2a08b7cb..fea86deaaa01 100644
> --- a/lib/xz/xz_dec_stream.c
> +++ b/lib/xz/xz_dec_stream.c
> @@ -583,7 +583,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  			if (ret != XZ_OK)
>  				return ret;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_START:
>  			/* We need one byte of input to continue. */
> @@ -608,7 +608,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  			s->temp.pos = 0;
>  			s->sequence = SEQ_BLOCK_HEADER;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_HEADER:
>  			if (!fill_temp(s, b))
> @@ -620,7 +620,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_BLOCK_UNCOMPRESS;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_UNCOMPRESS:
>  			ret = dec_block(s, b);
> @@ -629,7 +629,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_BLOCK_PADDING;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_PADDING:
>  			/*
> @@ -651,7 +651,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_BLOCK_CHECK;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_CHECK:
>  			if (s->check_type == XZ_CHECK_CRC32) {
> @@ -675,7 +675,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_INDEX_PADDING;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_INDEX_PADDING:
>  			while ((s->index.size + (b->in_pos - s->in_start))
> @@ -699,7 +699,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_INDEX_CRC32;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_INDEX_CRC32:
>  			ret = crc32_validate(s, b);
> @@ -709,7 +709,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  			s->temp.size = STREAM_HEADER_SIZE;
>  			s->sequence = SEQ_STREAM_FOOTER;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_STREAM_FOOTER:
>  			if (!fill_temp(s, b))
> diff --git a/lib/zstd/bitstream.h b/lib/zstd/bitstream.h
> index 3a49784d5c61..7c65c66e41fd 100644
> --- a/lib/zstd/bitstream.h
> +++ b/lib/zstd/bitstream.h
> @@ -259,15 +259,15 @@ ZSTD_STATIC size_t BIT_initDStream(BIT_DStream_t *bitD, const void *srcBuffer, s
>  		bitD->bitContainer = *(const BYTE *)(bitD->start);
>  		switch (srcSize) {
>  		case 7: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[6]) << (sizeof(bitD->bitContainer) * 8 - 16);
> -			/* fall through */
> +			fallthrough;
>  		case 6: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[5]) << (sizeof(bitD->bitContainer) * 8 - 24);
> -			/* fall through */
> +			fallthrough;
>  		case 5: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[4]) << (sizeof(bitD->bitContainer) * 8 - 32);
> -			/* fall through */
> +			fallthrough;
>  		case 4: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[3]) << 24;
> -			/* fall through */
> +			fallthrough;
>  		case 3: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[2]) << 16;
> -			/* fall through */
> +			fallthrough;
>  		case 2: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[1]) << 8;
>  		default:;
>  		}
> diff --git a/lib/zstd/compress.c b/lib/zstd/compress.c
> index 5e0b67003e55..b080264ed3ad 100644
> --- a/lib/zstd/compress.c
> +++ b/lib/zstd/compress.c
> @@ -3182,7 +3182,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t *
>  				zcs->outBuffFlushedSize = 0;
>  				zcs->stage = zcss_flush; /* pass-through to flush stage */
>  			}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zcss_flush: {
>  			size_t const toFlush = zcs->outBuffContentSize - zcs->outBuffFlushedSize;
> diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
> index db6761ea4deb..66cd487a326a 100644
> --- a/lib/zstd/decompress.c
> +++ b/lib/zstd/decompress.c
> @@ -442,7 +442,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize
>  		case set_repeat:
>  			if (dctx->litEntropy == 0)
>  				return ERROR(dictionary_corrupted);
> -			/* fall through */
> +			fallthrough;
>  		case set_compressed:
>  			if (srcSize < 5)
>  				return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
> @@ -1768,7 +1768,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, c
>  			return 0;
>  		}
>  		dctx->expected = 0; /* not necessary to copy more */
> -		/* fall through */
> +		fallthrough;
>  
>  	case ZSTDds_decodeFrameHeader:
>  		memcpy(dctx->headerBuffer + ZSTD_frameHeaderSize_prefix, src, dctx->expected);
> @@ -2309,7 +2309,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  		switch (zds->stage) {
>  		case zdss_init:
>  			ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_loadHeader: {
>  			size_t const hSize = ZSTD_getFrameParams(&zds->fParams, zds->headerBuffer, zds->lhSize);
> @@ -2376,7 +2376,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  			}
>  			zds->stage = zdss_read;
>  		}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_read: {
>  			size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> @@ -2405,7 +2405,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  			zds->stage = zdss_load;
>  			/* pass-through */
>  		}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_load: {
>  			size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> @@ -2438,7 +2438,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  				/* pass-through */
>  			}
>  		}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_flush: {
>  			size_t const toFlushSize = zds->outEnd - zds->outStart;
> diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
> index e727812d12aa..08b4ae80aed4 100644
> --- a/lib/zstd/huf_compress.c
> +++ b/lib/zstd/huf_compress.c
> @@ -556,9 +556,9 @@ size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, si
>  	n = srcSize & ~3; /* join to mod 4 */
>  	switch (srcSize & 3) {
>  	case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
> -		/* fall through */
> +		fallthrough;
>  	case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
> -		/* fall through */
> +		fallthrough;
>  	case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
>  	case 0:
>  	default:;
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
@ 2020-11-16  6:26     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-16  6:26 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: clang-built-linux, linux-kernel, Miguel Ojeda, Paul Mackerras,
	Nathan Chancellor, linuxppc-dev

On Sun, Nov 15, 2020 at 08:35:31PM -0800, Nick Desaulniers wrote:
> This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
> pseudo-keyword in lib/")
> 
> Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
> re-enable these fixes for lib/.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.com>

Thanks
--
Gustavo

> ---
>  lib/asn1_decoder.c      |  4 ++--
>  lib/assoc_array.c       |  2 +-
>  lib/bootconfig.c        |  4 ++--
>  lib/cmdline.c           | 10 +++++-----
>  lib/dim/net_dim.c       |  2 +-
>  lib/dim/rdma_dim.c      |  4 ++--
>  lib/glob.c              |  2 +-
>  lib/siphash.c           | 36 ++++++++++++++++++------------------
>  lib/ts_fsm.c            |  2 +-
>  lib/vsprintf.c          | 14 +++++++-------
>  lib/xz/xz_dec_lzma2.c   |  4 ++--
>  lib/xz/xz_dec_stream.c  | 16 ++++++++--------
>  lib/zstd/bitstream.h    | 10 +++++-----
>  lib/zstd/compress.c     |  2 +-
>  lib/zstd/decompress.c   | 12 ++++++------
>  lib/zstd/huf_compress.c |  4 ++--
>  16 files changed, 64 insertions(+), 64 deletions(-)
> 
> diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
> index 58f72b25f8e9..13da529e2e72 100644
> --- a/lib/asn1_decoder.c
> +++ b/lib/asn1_decoder.c
> @@ -381,7 +381,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
>  	case ASN1_OP_END_SET_ACT:
>  		if (unlikely(!(flags & FLAG_MATCHED)))
>  			goto tag_mismatch;
> -		/* fall through */
> +		fallthrough;
>  
>  	case ASN1_OP_END_SEQ:
>  	case ASN1_OP_END_SET_OF:
> @@ -448,7 +448,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
>  			pc += asn1_op_lengths[op];
>  			goto next_op;
>  		}
> -		/* fall through */
> +		fallthrough;
>  
>  	case ASN1_OP_ACT:
>  		ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
> diff --git a/lib/assoc_array.c b/lib/assoc_array.c
> index 6f4bcf524554..04c98799c3ba 100644
> --- a/lib/assoc_array.c
> +++ b/lib/assoc_array.c
> @@ -1113,7 +1113,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
>  						index_key))
>  				goto found_leaf;
>  		}
> -		/* fall through */
> +		fallthrough;
>  	case assoc_array_walk_tree_empty:
>  	case assoc_array_walk_found_wrong_shortcut:
>  	default:
> diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> index 649ed44f199c..9f8c70a98fcf 100644
> --- a/lib/bootconfig.c
> +++ b/lib/bootconfig.c
> @@ -827,7 +827,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
>  							q - 2);
>  				break;
>  			}
> -			/* fall through */
> +			fallthrough;
>  		case '=':
>  			ret = xbc_parse_kv(&p, q, c);
>  			break;
> @@ -836,7 +836,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
>  			break;
>  		case '#':
>  			q = skip_comment(q);
> -			/* fall through */
> +			fallthrough;
>  		case ';':
>  		case '\n':
>  			ret = xbc_parse_key(&p, q);
> diff --git a/lib/cmdline.c b/lib/cmdline.c
> index 9e186234edc0..46f2cb4ce6d1 100644
> --- a/lib/cmdline.c
> +++ b/lib/cmdline.c
> @@ -144,23 +144,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
>  	case 'E':
>  	case 'e':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'P':
>  	case 'p':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'T':
>  	case 't':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'G':
>  	case 'g':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'M':
>  	case 'm':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'K':
>  	case 'k':
>  		ret <<= 10;
> diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
> index a4db51c21266..06811d866775 100644
> --- a/lib/dim/net_dim.c
> +++ b/lib/dim/net_dim.c
> @@ -233,7 +233,7 @@ void net_dim(struct dim *dim, struct dim_sample end_sample)
>  			schedule_work(&dim->work);
>  			break;
>  		}
> -		/* fall through */
> +		fallthrough;
>  	case DIM_START_MEASURE:
>  		dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
>  				  end_sample.byte_ctr, &dim->start_sample);
> diff --git a/lib/dim/rdma_dim.c b/lib/dim/rdma_dim.c
> index f7e26c7b4749..15462d54758d 100644
> --- a/lib/dim/rdma_dim.c
> +++ b/lib/dim/rdma_dim.c
> @@ -59,7 +59,7 @@ static bool rdma_dim_decision(struct dim_stats *curr_stats, struct dim *dim)
>  			break;
>  		case DIM_STATS_WORSE:
>  			dim_turn(dim);
> -			/* fall through */
> +			fallthrough;
>  		case DIM_STATS_BETTER:
>  			step_res = rdma_dim_step(dim);
>  			if (step_res == DIM_ON_EDGE)
> @@ -94,7 +94,7 @@ void rdma_dim(struct dim *dim, u64 completions)
>  			schedule_work(&dim->work);
>  			break;
>  		}
> -		/* fall through */
> +		fallthrough;
>  	case DIM_START_MEASURE:
>  		dim->state = DIM_MEASURE_IN_PROGRESS;
>  		dim_update_sample_with_comps(curr_sample->event_ctr, 0, 0,
> diff --git a/lib/glob.c b/lib/glob.c
> index 52e3ed7e4a9b..85ecbda45cd8 100644
> --- a/lib/glob.c
> +++ b/lib/glob.c
> @@ -102,7 +102,7 @@ bool __pure glob_match(char const *pat, char const *str)
>  			break;
>  		case '\\':
>  			d = *pat++;
> -			/* fall through */
> +			fallthrough;
>  		default:	/* Literal character */
>  literal:
>  			if (c == d) {
> diff --git a/lib/siphash.c b/lib/siphash.c
> index c47bb6ff2149..a90112ee72a1 100644
> --- a/lib/siphash.c
> +++ b/lib/siphash.c
> @@ -68,11 +68,11 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key)
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= le32_to_cpup(data); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= le16_to_cpup(data); break;
>  	case 1: b |= end[0];
>  	}
> @@ -101,11 +101,11 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key)
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= get_unaligned_le32(end); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= get_unaligned_le16(end); break;
>  	case 1: b |= end[0];
>  	}
> @@ -268,11 +268,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= le32_to_cpup(data); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= le16_to_cpup(data); break;
>  	case 1: b |= end[0];
>  	}
> @@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= get_unaligned_le32(end); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= get_unaligned_le16(end); break;
>  	case 1: b |= end[0];
>  	}
> @@ -431,7 +431,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
>  		v0 ^= m;
>  	}
>  	switch (left) {
> -	case 3: b |= ((u32)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u32)end[2]) << 16; fallthrough;
>  	case 2: b |= le16_to_cpup(data); break;
>  	case 1: b |= end[0];
>  	}
> @@ -454,7 +454,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
>  		v0 ^= m;
>  	}
>  	switch (left) {
> -	case 3: b |= ((u32)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u32)end[2]) << 16; fallthrough;
>  	case 2: b |= get_unaligned_le16(end); break;
>  	case 1: b |= end[0];
>  	}
> diff --git a/lib/ts_fsm.c b/lib/ts_fsm.c
> index ab749ec10ab5..64fd9015ad80 100644
> --- a/lib/ts_fsm.c
> +++ b/lib/ts_fsm.c
> @@ -193,7 +193,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state)
>  				TOKEN_MISMATCH();
>  
>  			block_idx++;
> -			/* fall through */
> +			fallthrough;
>  
>  		case TS_FSM_ANY:
>  			if (next == NULL)
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 14c9a6af1b23..d3c5c16f391c 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1265,7 +1265,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
>  
>  	case 'R':
>  		reversed = true;
> -		/* fall through */
> +		fallthrough;
>  
>  	default:
>  		separator = ':';
> @@ -1682,7 +1682,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
>  	switch (*(++fmt)) {
>  	case 'L':
>  		uc = true;
> -		/* fall through */
> +		fallthrough;
>  	case 'l':
>  		index = guid_index;
>  		break;
> @@ -2219,7 +2219,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
>  	case 'S':
>  	case 's':
>  		ptr = dereference_symbol_descriptor(ptr);
> -		/* fall through */
> +		fallthrough;
>  	case 'B':
>  		return symbol_string(buf, end, ptr, spec, fmt);
>  	case 'R':
> @@ -2450,7 +2450,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
>  
>  	case 'x':
>  		spec->flags |= SMALL;
> -		/* fall through */
> +		fallthrough;
>  
>  	case 'X':
>  		spec->base = 16;
> @@ -2468,7 +2468,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
>  		 * utility, treat it as any other invalid or
>  		 * unsupported format specifier.
>  		 */
> -		/* fall through */
> +		fallthrough;
>  
>  	default:
>  		WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
> @@ -3411,10 +3411,10 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
>  			break;
>  		case 'i':
>  			base = 0;
> -			/* fall through */
> +			fallthrough;
>  		case 'd':
>  			is_sign = true;
> -			/* fall through */
> +			fallthrough;
>  		case 'u':
>  			break;
>  		case '%':
> diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
> index 65a1aad8c223..ca2603abee08 100644
> --- a/lib/xz/xz_dec_lzma2.c
> +++ b/lib/xz/xz_dec_lzma2.c
> @@ -1043,7 +1043,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
>  
>  			s->lzma2.sequence = SEQ_LZMA_PREPARE;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_LZMA_PREPARE:
>  			if (s->lzma2.compressed < RC_INIT_BYTES)
> @@ -1055,7 +1055,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
>  			s->lzma2.compressed -= RC_INIT_BYTES;
>  			s->lzma2.sequence = SEQ_LZMA_RUN;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_LZMA_RUN:
>  			/*
> diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
> index 32ab2a08b7cb..fea86deaaa01 100644
> --- a/lib/xz/xz_dec_stream.c
> +++ b/lib/xz/xz_dec_stream.c
> @@ -583,7 +583,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  			if (ret != XZ_OK)
>  				return ret;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_START:
>  			/* We need one byte of input to continue. */
> @@ -608,7 +608,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  			s->temp.pos = 0;
>  			s->sequence = SEQ_BLOCK_HEADER;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_HEADER:
>  			if (!fill_temp(s, b))
> @@ -620,7 +620,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_BLOCK_UNCOMPRESS;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_UNCOMPRESS:
>  			ret = dec_block(s, b);
> @@ -629,7 +629,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_BLOCK_PADDING;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_PADDING:
>  			/*
> @@ -651,7 +651,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_BLOCK_CHECK;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_CHECK:
>  			if (s->check_type == XZ_CHECK_CRC32) {
> @@ -675,7 +675,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_INDEX_PADDING;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_INDEX_PADDING:
>  			while ((s->index.size + (b->in_pos - s->in_start))
> @@ -699,7 +699,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_INDEX_CRC32;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_INDEX_CRC32:
>  			ret = crc32_validate(s, b);
> @@ -709,7 +709,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  			s->temp.size = STREAM_HEADER_SIZE;
>  			s->sequence = SEQ_STREAM_FOOTER;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_STREAM_FOOTER:
>  			if (!fill_temp(s, b))
> diff --git a/lib/zstd/bitstream.h b/lib/zstd/bitstream.h
> index 3a49784d5c61..7c65c66e41fd 100644
> --- a/lib/zstd/bitstream.h
> +++ b/lib/zstd/bitstream.h
> @@ -259,15 +259,15 @@ ZSTD_STATIC size_t BIT_initDStream(BIT_DStream_t *bitD, const void *srcBuffer, s
>  		bitD->bitContainer = *(const BYTE *)(bitD->start);
>  		switch (srcSize) {
>  		case 7: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[6]) << (sizeof(bitD->bitContainer) * 8 - 16);
> -			/* fall through */
> +			fallthrough;
>  		case 6: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[5]) << (sizeof(bitD->bitContainer) * 8 - 24);
> -			/* fall through */
> +			fallthrough;
>  		case 5: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[4]) << (sizeof(bitD->bitContainer) * 8 - 32);
> -			/* fall through */
> +			fallthrough;
>  		case 4: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[3]) << 24;
> -			/* fall through */
> +			fallthrough;
>  		case 3: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[2]) << 16;
> -			/* fall through */
> +			fallthrough;
>  		case 2: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[1]) << 8;
>  		default:;
>  		}
> diff --git a/lib/zstd/compress.c b/lib/zstd/compress.c
> index 5e0b67003e55..b080264ed3ad 100644
> --- a/lib/zstd/compress.c
> +++ b/lib/zstd/compress.c
> @@ -3182,7 +3182,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t *
>  				zcs->outBuffFlushedSize = 0;
>  				zcs->stage = zcss_flush; /* pass-through to flush stage */
>  			}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zcss_flush: {
>  			size_t const toFlush = zcs->outBuffContentSize - zcs->outBuffFlushedSize;
> diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
> index db6761ea4deb..66cd487a326a 100644
> --- a/lib/zstd/decompress.c
> +++ b/lib/zstd/decompress.c
> @@ -442,7 +442,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize
>  		case set_repeat:
>  			if (dctx->litEntropy == 0)
>  				return ERROR(dictionary_corrupted);
> -			/* fall through */
> +			fallthrough;
>  		case set_compressed:
>  			if (srcSize < 5)
>  				return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
> @@ -1768,7 +1768,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, c
>  			return 0;
>  		}
>  		dctx->expected = 0; /* not necessary to copy more */
> -		/* fall through */
> +		fallthrough;
>  
>  	case ZSTDds_decodeFrameHeader:
>  		memcpy(dctx->headerBuffer + ZSTD_frameHeaderSize_prefix, src, dctx->expected);
> @@ -2309,7 +2309,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  		switch (zds->stage) {
>  		case zdss_init:
>  			ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_loadHeader: {
>  			size_t const hSize = ZSTD_getFrameParams(&zds->fParams, zds->headerBuffer, zds->lhSize);
> @@ -2376,7 +2376,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  			}
>  			zds->stage = zdss_read;
>  		}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_read: {
>  			size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> @@ -2405,7 +2405,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  			zds->stage = zdss_load;
>  			/* pass-through */
>  		}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_load: {
>  			size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> @@ -2438,7 +2438,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  				/* pass-through */
>  			}
>  		}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_flush: {
>  			size_t const toFlushSize = zds->outEnd - zds->outStart;
> diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
> index e727812d12aa..08b4ae80aed4 100644
> --- a/lib/zstd/huf_compress.c
> +++ b/lib/zstd/huf_compress.c
> @@ -556,9 +556,9 @@ size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, si
>  	n = srcSize & ~3; /* join to mod 4 */
>  	switch (srcSize & 3) {
>  	case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
> -		/* fall through */
> +		fallthrough;
>  	case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
> -		/* fall through */
> +		fallthrough;
>  	case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
>  	case 0:
>  	default:;
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough
  2020-11-16  4:35   ` Nick Desaulniers
@ 2020-11-16  6:28     ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-16  6:28 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Nathan Chancellor, Miguel Ojeda, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel

On Sun, Nov 15, 2020 at 08:35:32PM -0800, Nick Desaulniers wrote:
> The "fallthrough" pseudo-keyword was added as a portable way to denote
> intentional fallthrough. Clang will still warn on cases where there is a
> fallthrough to an immediate break. Add explicit breaks for those cases.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
--
Gustavo

> ---
>  arch/powerpc/kernel/prom_init.c | 1 +
>  arch/powerpc/kernel/uprobes.c   | 1 +
>  arch/powerpc/perf/imc-pmu.c     | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index 38ae5933d917..e9d4eb6144e1 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -355,6 +355,7 @@ static int __init prom_strtobool(const char *s, bool *res)
>  		default:
>  			break;
>  		}
> +		break;
>  	default:
>  		break;
>  	}
> diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
> index d200e7df7167..e8a63713e655 100644
> --- a/arch/powerpc/kernel/uprobes.c
> +++ b/arch/powerpc/kernel/uprobes.c
> @@ -141,6 +141,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self,
>  	case DIE_SSTEP:
>  		if (uprobe_post_sstep_notifier(regs))
>  			return NOTIFY_STOP;
> +		break;
>  	default:
>  		break;
>  	}
> diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
> index 7b25548ec42b..e106909ff9c3 100644
> --- a/arch/powerpc/perf/imc-pmu.c
> +++ b/arch/powerpc/perf/imc-pmu.c
> @@ -1500,6 +1500,7 @@ static int update_pmu_ops(struct imc_pmu *pmu)
>  		pmu->pmu.stop = trace_imc_event_stop;
>  		pmu->pmu.read = trace_imc_event_read;
>  		pmu->attr_groups[IMC_FORMAT_ATTR] = &trace_imc_format_group;
> +		break;
>  	default:
>  		break;
>  	}
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough
@ 2020-11-16  6:28     ` Gustavo A. R. Silva
  0 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-16  6:28 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: clang-built-linux, linux-kernel, Miguel Ojeda, Paul Mackerras,
	Nathan Chancellor, linuxppc-dev

On Sun, Nov 15, 2020 at 08:35:32PM -0800, Nick Desaulniers wrote:
> The "fallthrough" pseudo-keyword was added as a portable way to denote
> intentional fallthrough. Clang will still warn on cases where there is a
> fallthrough to an immediate break. Add explicit breaks for those cases.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
--
Gustavo

> ---
>  arch/powerpc/kernel/prom_init.c | 1 +
>  arch/powerpc/kernel/uprobes.c   | 1 +
>  arch/powerpc/perf/imc-pmu.c     | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index 38ae5933d917..e9d4eb6144e1 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -355,6 +355,7 @@ static int __init prom_strtobool(const char *s, bool *res)
>  		default:
>  			break;
>  		}
> +		break;
>  	default:
>  		break;
>  	}
> diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
> index d200e7df7167..e8a63713e655 100644
> --- a/arch/powerpc/kernel/uprobes.c
> +++ b/arch/powerpc/kernel/uprobes.c
> @@ -141,6 +141,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self,
>  	case DIE_SSTEP:
>  		if (uprobe_post_sstep_notifier(regs))
>  			return NOTIFY_STOP;
> +		break;
>  	default:
>  		break;
>  	}
> diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
> index 7b25548ec42b..e106909ff9c3 100644
> --- a/arch/powerpc/perf/imc-pmu.c
> +++ b/arch/powerpc/perf/imc-pmu.c
> @@ -1500,6 +1500,7 @@ static int update_pmu_ops(struct imc_pmu *pmu)
>  		pmu->pmu.stop = trace_imc_event_stop;
>  		pmu->pmu.read = trace_imc_event_read;
>  		pmu->attr_groups[IMC_FORMAT_ATTR] = &trace_imc_format_group;
> +		break;
>  	default:
>  		break;
>  	}
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  2020-11-16  6:26     ` Gustavo A. R. Silva
@ 2020-11-16 11:18       ` Miguel Ojeda
  -1 siblings, 0 replies; 47+ messages in thread
From: Miguel Ojeda @ 2020-11-16 11:18 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Nick Desaulniers, Nathan Chancellor, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel

On Mon, Nov 16, 2020 at 7:26 AM Gustavo A. R. Silva
<gustavoars@kernel.org> wrote:
>
> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.com>

.org :-)

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
@ 2020-11-16 11:18       ` Miguel Ojeda
  0 siblings, 0 replies; 47+ messages in thread
From: Miguel Ojeda @ 2020-11-16 11:18 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Nick Desaulniers, linux-kernel, clang-built-linux,
	Paul Mackerras, Nathan Chancellor, linuxppc-dev

On Mon, Nov 16, 2020 at 7:26 AM Gustavo A. R. Silva
<gustavoars@kernel.org> wrote:
>
> Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.com>

.org :-)

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 1/3] powerpc: boot: include compiler_attributes.h
  2020-11-16  4:35   ` Nick Desaulniers
@ 2020-11-16 11:24     ` Miguel Ojeda
  -1 siblings, 0 replies; 47+ messages in thread
From: Miguel Ojeda @ 2020-11-16 11:24 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Gustavo A . R . Silva, Nathan Chancellor, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel

On Mon, Nov 16, 2020 at 5:35 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
> -include compiler_types.h like the main kernel does, though testing that
> produces a whole sea of warnings to cleanup. This approach is minimally
> invasive.

I would add a comment noting this as a reminder -- it also helps to
entice a cleanup.

Acked-by: Miguel Ojeda <ojeda@kernel.org>

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 1/3] powerpc: boot: include compiler_attributes.h
@ 2020-11-16 11:24     ` Miguel Ojeda
  0 siblings, 0 replies; 47+ messages in thread
From: Miguel Ojeda @ 2020-11-16 11:24 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Gustavo A . R . Silva, linux-kernel, clang-built-linux,
	Paul Mackerras, Nathan Chancellor, linuxppc-dev

On Mon, Nov 16, 2020 at 5:35 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
> -include compiler_types.h like the main kernel does, though testing that
> produces a whole sea of warnings to cleanup. This approach is minimally
> invasive.

I would add a comment noting this as a reminder -- it also helps to
entice a cleanup.

Acked-by: Miguel Ojeda <ojeda@kernel.org>

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  2020-11-16  4:35   ` Nick Desaulniers
@ 2020-11-16 11:26     ` Miguel Ojeda
  -1 siblings, 0 replies; 47+ messages in thread
From: Miguel Ojeda @ 2020-11-16 11:26 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Gustavo A . R . Silva, Nathan Chancellor, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel

On Mon, Nov 16, 2020 at 5:35 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
> pseudo-keyword in lib/")
>
> Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
> re-enable these fixes for lib/.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Looks fine on visual inspection:

Reviewed-by: Miguel Ojeda <ojeda@kernel.org>

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
@ 2020-11-16 11:26     ` Miguel Ojeda
  0 siblings, 0 replies; 47+ messages in thread
From: Miguel Ojeda @ 2020-11-16 11:26 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Gustavo A . R . Silva, linux-kernel, clang-built-linux,
	Paul Mackerras, Nathan Chancellor, linuxppc-dev

On Mon, Nov 16, 2020 at 5:35 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
> pseudo-keyword in lib/")
>
> Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
> re-enable these fixes for lib/.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Looks fine on visual inspection:

Reviewed-by: Miguel Ojeda <ojeda@kernel.org>

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough
  2020-11-16  4:35   ` Nick Desaulniers
@ 2020-11-16 11:33     ` Miguel Ojeda
  -1 siblings, 0 replies; 47+ messages in thread
From: Miguel Ojeda @ 2020-11-16 11:33 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Gustavo A . R . Silva, Nathan Chancellor, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel

On Mon, Nov 16, 2020 at 5:35 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> The "fallthrough" pseudo-keyword was added as a portable way to denote
> intentional fallthrough. Clang will still warn on cases where there is a
> fallthrough to an immediate break. Add explicit breaks for those cases.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

It makes things clearer having a `break` added, so I like that warning.

Reviewed-by: Miguel Ojeda <ojeda@kernel.org>

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough
@ 2020-11-16 11:33     ` Miguel Ojeda
  0 siblings, 0 replies; 47+ messages in thread
From: Miguel Ojeda @ 2020-11-16 11:33 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Gustavo A . R . Silva, linux-kernel, clang-built-linux,
	Paul Mackerras, Nathan Chancellor, linuxppc-dev

On Mon, Nov 16, 2020 at 5:35 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> The "fallthrough" pseudo-keyword was added as a portable way to denote
> intentional fallthrough. Clang will still warn on cases where there is a
> fallthrough to an immediate break. Add explicit breaks for those cases.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

It makes things clearer having a `break` added, so I like that warning.

Reviewed-by: Miguel Ojeda <ojeda@kernel.org>

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  2020-11-16  4:35   ` Nick Desaulniers
  (?)
@ 2020-11-16 11:49     ` kernel test robot
  -1 siblings, 0 replies; 47+ messages in thread
From: kernel test robot @ 2020-11-16 11:49 UTC (permalink / raw)
  To: Nick Desaulniers, Gustavo A . R . Silva, Nathan Chancellor,
	Miguel Ojeda, Michael Ellerman
  Cc: kbuild-all, Benjamin Herrenschmidt, Paul Mackerras,
	clang-built-linux, linuxppc-dev, linux-kernel, Nick Desaulniers

[-- Attachment #1: Type: text/plain, Size: 2966 bytes --]

Hi Nick,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on linus/master v5.10-rc4 next-20201116]
[cannot apply to pmladek/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nick-Desaulniers/PPC-Fix-Wimplicit-fallthrough-for-clang/20201116-123803
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: x86_64-randconfig-m001-20201115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

smatch warnings:
lib/zstd/huf_compress.c:559 HUF_compress1X_usingCTable() warn: inconsistent indenting

vim +559 lib/zstd/huf_compress.c

   529	
   530	#define HUF_FLUSHBITS_1(stream)                                            \
   531		if (sizeof((stream)->bitContainer) * 8 < HUF_TABLELOG_MAX * 2 + 7) \
   532		HUF_FLUSHBITS(stream)
   533	
   534	#define HUF_FLUSHBITS_2(stream)                                            \
   535		if (sizeof((stream)->bitContainer) * 8 < HUF_TABLELOG_MAX * 4 + 7) \
   536		HUF_FLUSHBITS(stream)
   537	
   538	size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, size_t srcSize, const HUF_CElt *CTable)
   539	{
   540		const BYTE *ip = (const BYTE *)src;
   541		BYTE *const ostart = (BYTE *)dst;
   542		BYTE *const oend = ostart + dstSize;
   543		BYTE *op = ostart;
   544		size_t n;
   545		BIT_CStream_t bitC;
   546	
   547		/* init */
   548		if (dstSize < 8)
   549			return 0; /* not enough space to compress */
   550		{
   551			size_t const initErr = BIT_initCStream(&bitC, op, oend - op);
   552			if (HUF_isError(initErr))
   553				return 0;
   554		}
   555	
   556		n = srcSize & ~3; /* join to mod 4 */
   557		switch (srcSize & 3) {
   558		case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
 > 559			fallthrough;
   560		case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
   561			fallthrough;
   562		case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
   563		case 0:
   564		default:;
   565		}
   566	
   567		for (; n > 0; n -= 4) { /* note : n&3==0 at this stage */
   568			HUF_encodeSymbol(&bitC, ip[n - 1], CTable);
   569			HUF_FLUSHBITS_1(&bitC);
   570			HUF_encodeSymbol(&bitC, ip[n - 2], CTable);
   571			HUF_FLUSHBITS_2(&bitC);
   572			HUF_encodeSymbol(&bitC, ip[n - 3], CTable);
   573			HUF_FLUSHBITS_1(&bitC);
   574			HUF_encodeSymbol(&bitC, ip[n - 4], CTable);
   575			HUF_FLUSHBITS(&bitC);
   576		}
   577	
   578		return BIT_closeCStream(&bitC);
   579	}
   580	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31321 bytes --]

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
@ 2020-11-16 11:49     ` kernel test robot
  0 siblings, 0 replies; 47+ messages in thread
From: kernel test robot @ 2020-11-16 11:49 UTC (permalink / raw)
  To: Nick Desaulniers, Gustavo A . R . Silva, Nathan Chancellor,
	Miguel Ojeda, Michael Ellerman
  Cc: kbuild-all, Nick Desaulniers, linux-kernel, clang-built-linux,
	Paul Mackerras, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 2966 bytes --]

Hi Nick,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on linus/master v5.10-rc4 next-20201116]
[cannot apply to pmladek/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nick-Desaulniers/PPC-Fix-Wimplicit-fallthrough-for-clang/20201116-123803
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: x86_64-randconfig-m001-20201115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

smatch warnings:
lib/zstd/huf_compress.c:559 HUF_compress1X_usingCTable() warn: inconsistent indenting

vim +559 lib/zstd/huf_compress.c

   529	
   530	#define HUF_FLUSHBITS_1(stream)                                            \
   531		if (sizeof((stream)->bitContainer) * 8 < HUF_TABLELOG_MAX * 2 + 7) \
   532		HUF_FLUSHBITS(stream)
   533	
   534	#define HUF_FLUSHBITS_2(stream)                                            \
   535		if (sizeof((stream)->bitContainer) * 8 < HUF_TABLELOG_MAX * 4 + 7) \
   536		HUF_FLUSHBITS(stream)
   537	
   538	size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, size_t srcSize, const HUF_CElt *CTable)
   539	{
   540		const BYTE *ip = (const BYTE *)src;
   541		BYTE *const ostart = (BYTE *)dst;
   542		BYTE *const oend = ostart + dstSize;
   543		BYTE *op = ostart;
   544		size_t n;
   545		BIT_CStream_t bitC;
   546	
   547		/* init */
   548		if (dstSize < 8)
   549			return 0; /* not enough space to compress */
   550		{
   551			size_t const initErr = BIT_initCStream(&bitC, op, oend - op);
   552			if (HUF_isError(initErr))
   553				return 0;
   554		}
   555	
   556		n = srcSize & ~3; /* join to mod 4 */
   557		switch (srcSize & 3) {
   558		case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
 > 559			fallthrough;
   560		case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
   561			fallthrough;
   562		case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
   563		case 0:
   564		default:;
   565		}
   566	
   567		for (; n > 0; n -= 4) { /* note : n&3==0 at this stage */
   568			HUF_encodeSymbol(&bitC, ip[n - 1], CTable);
   569			HUF_FLUSHBITS_1(&bitC);
   570			HUF_encodeSymbol(&bitC, ip[n - 2], CTable);
   571			HUF_FLUSHBITS_2(&bitC);
   572			HUF_encodeSymbol(&bitC, ip[n - 3], CTable);
   573			HUF_FLUSHBITS_1(&bitC);
   574			HUF_encodeSymbol(&bitC, ip[n - 4], CTable);
   575			HUF_FLUSHBITS(&bitC);
   576		}
   577	
   578		return BIT_closeCStream(&bitC);
   579	}
   580	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31321 bytes --]

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
@ 2020-11-16 11:49     ` kernel test robot
  0 siblings, 0 replies; 47+ messages in thread
From: kernel test robot @ 2020-11-16 11:49 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 3048 bytes --]

Hi Nick,

I love your patch! Perhaps something to improve:

[auto build test WARNING on powerpc/next]
[also build test WARNING on linus/master v5.10-rc4 next-20201116]
[cannot apply to pmladek/for-next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Nick-Desaulniers/PPC-Fix-Wimplicit-fallthrough-for-clang/20201116-123803
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: x86_64-randconfig-m001-20201115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

smatch warnings:
lib/zstd/huf_compress.c:559 HUF_compress1X_usingCTable() warn: inconsistent indenting

vim +559 lib/zstd/huf_compress.c

   529	
   530	#define HUF_FLUSHBITS_1(stream)                                            \
   531		if (sizeof((stream)->bitContainer) * 8 < HUF_TABLELOG_MAX * 2 + 7) \
   532		HUF_FLUSHBITS(stream)
   533	
   534	#define HUF_FLUSHBITS_2(stream)                                            \
   535		if (sizeof((stream)->bitContainer) * 8 < HUF_TABLELOG_MAX * 4 + 7) \
   536		HUF_FLUSHBITS(stream)
   537	
   538	size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, size_t srcSize, const HUF_CElt *CTable)
   539	{
   540		const BYTE *ip = (const BYTE *)src;
   541		BYTE *const ostart = (BYTE *)dst;
   542		BYTE *const oend = ostart + dstSize;
   543		BYTE *op = ostart;
   544		size_t n;
   545		BIT_CStream_t bitC;
   546	
   547		/* init */
   548		if (dstSize < 8)
   549			return 0; /* not enough space to compress */
   550		{
   551			size_t const initErr = BIT_initCStream(&bitC, op, oend - op);
   552			if (HUF_isError(initErr))
   553				return 0;
   554		}
   555	
   556		n = srcSize & ~3; /* join to mod 4 */
   557		switch (srcSize & 3) {
   558		case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
 > 559			fallthrough;
   560		case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
   561			fallthrough;
   562		case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
   563		case 0:
   564		default:;
   565		}
   566	
   567		for (; n > 0; n -= 4) { /* note : n&3==0 at this stage */
   568			HUF_encodeSymbol(&bitC, ip[n - 1], CTable);
   569			HUF_FLUSHBITS_1(&bitC);
   570			HUF_encodeSymbol(&bitC, ip[n - 2], CTable);
   571			HUF_FLUSHBITS_2(&bitC);
   572			HUF_encodeSymbol(&bitC, ip[n - 3], CTable);
   573			HUF_FLUSHBITS_1(&bitC);
   574			HUF_encodeSymbol(&bitC, ip[n - 4], CTable);
   575			HUF_FLUSHBITS(&bitC);
   576		}
   577	
   578		return BIT_closeCStream(&bitC);
   579	}
   580	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31321 bytes --]

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 1/3] powerpc: boot: include compiler_attributes.h
  2020-11-16  4:35   ` Nick Desaulniers
@ 2020-11-17  3:01     ` Nathan Chancellor
  -1 siblings, 0 replies; 47+ messages in thread
From: Nathan Chancellor @ 2020-11-17  3:01 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Gustavo A . R . Silva, Miguel Ojeda, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel

On Sun, Nov 15, 2020 at 08:35:30PM -0800, Nick Desaulniers wrote:
> The kernel uses `-include` to include include/linux/compiler_types.h
> into all translation units (see scripts/Makefile.lib), which #includes
> compiler_attributes.h.
> 
> arch/powerpc/boot/ uses different compiler flags from the rest of the
> kernel. As such, it doesn't contain the definitions from these headers,
> and redefines a few that it needs.
> 
> For the purpose of enabling -Wimplicit-fallthrough for ppc, include
> compiler_types.h via `-include`.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>

> ---
> We could just `#include "include/linux/compiler_types.h"` in the few .c
> sources used from lib/ (there are proper header guards in
> compiler_types.h).
> 
> It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
> -include compiler_types.h like the main kernel does, though testing that
> produces a whole sea of warnings to cleanup. This approach is minimally
> invasive.
> 
>  arch/powerpc/boot/Makefile     | 1 +
>  arch/powerpc/boot/decompress.c | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index f8ce6d2dde7b..1659963a8f1d 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -31,6 +31,7 @@ endif
>  BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
>  		 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
>  		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
> +		 -include $(srctree)/include/linux/compiler_attributes.h \
>  		 $(LINUXINCLUDE)
>  
>  ifdef CONFIG_PPC64_BOOT_WRAPPER
> diff --git a/arch/powerpc/boot/decompress.c b/arch/powerpc/boot/decompress.c
> index 8bf39ef7d2df..6098b879ac97 100644
> --- a/arch/powerpc/boot/decompress.c
> +++ b/arch/powerpc/boot/decompress.c
> @@ -21,7 +21,6 @@
>  
>  #define STATIC static
>  #define INIT
> -#define __always_inline inline
>  
>  /*
>   * The build process will copy the required zlib source files and headers
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 1/3] powerpc: boot: include compiler_attributes.h
@ 2020-11-17  3:01     ` Nathan Chancellor
  0 siblings, 0 replies; 47+ messages in thread
From: Nathan Chancellor @ 2020-11-17  3:01 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: clang-built-linux, Gustavo A . R . Silva, linux-kernel,
	Miguel Ojeda, Paul Mackerras, linuxppc-dev

On Sun, Nov 15, 2020 at 08:35:30PM -0800, Nick Desaulniers wrote:
> The kernel uses `-include` to include include/linux/compiler_types.h
> into all translation units (see scripts/Makefile.lib), which #includes
> compiler_attributes.h.
> 
> arch/powerpc/boot/ uses different compiler flags from the rest of the
> kernel. As such, it doesn't contain the definitions from these headers,
> and redefines a few that it needs.
> 
> For the purpose of enabling -Wimplicit-fallthrough for ppc, include
> compiler_types.h via `-include`.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>

> ---
> We could just `#include "include/linux/compiler_types.h"` in the few .c
> sources used from lib/ (there are proper header guards in
> compiler_types.h).
> 
> It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
> -include compiler_types.h like the main kernel does, though testing that
> produces a whole sea of warnings to cleanup. This approach is minimally
> invasive.
> 
>  arch/powerpc/boot/Makefile     | 1 +
>  arch/powerpc/boot/decompress.c | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index f8ce6d2dde7b..1659963a8f1d 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -31,6 +31,7 @@ endif
>  BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
>  		 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
>  		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
> +		 -include $(srctree)/include/linux/compiler_attributes.h \
>  		 $(LINUXINCLUDE)
>  
>  ifdef CONFIG_PPC64_BOOT_WRAPPER
> diff --git a/arch/powerpc/boot/decompress.c b/arch/powerpc/boot/decompress.c
> index 8bf39ef7d2df..6098b879ac97 100644
> --- a/arch/powerpc/boot/decompress.c
> +++ b/arch/powerpc/boot/decompress.c
> @@ -21,7 +21,6 @@
>  
>  #define STATIC static
>  #define INIT
> -#define __always_inline inline
>  
>  /*
>   * The build process will copy the required zlib source files and headers
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  2020-11-16  4:35   ` Nick Desaulniers
@ 2020-11-17  3:02     ` Nathan Chancellor
  -1 siblings, 0 replies; 47+ messages in thread
From: Nathan Chancellor @ 2020-11-17  3:02 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Gustavo A . R . Silva, Miguel Ojeda, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel

On Sun, Nov 15, 2020 at 08:35:31PM -0800, Nick Desaulniers wrote:
> This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
> pseudo-keyword in lib/")
> 
> Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
> re-enable these fixes for lib/.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>

> ---
>  lib/asn1_decoder.c      |  4 ++--
>  lib/assoc_array.c       |  2 +-
>  lib/bootconfig.c        |  4 ++--
>  lib/cmdline.c           | 10 +++++-----
>  lib/dim/net_dim.c       |  2 +-
>  lib/dim/rdma_dim.c      |  4 ++--
>  lib/glob.c              |  2 +-
>  lib/siphash.c           | 36 ++++++++++++++++++------------------
>  lib/ts_fsm.c            |  2 +-
>  lib/vsprintf.c          | 14 +++++++-------
>  lib/xz/xz_dec_lzma2.c   |  4 ++--
>  lib/xz/xz_dec_stream.c  | 16 ++++++++--------
>  lib/zstd/bitstream.h    | 10 +++++-----
>  lib/zstd/compress.c     |  2 +-
>  lib/zstd/decompress.c   | 12 ++++++------
>  lib/zstd/huf_compress.c |  4 ++--
>  16 files changed, 64 insertions(+), 64 deletions(-)
> 
> diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
> index 58f72b25f8e9..13da529e2e72 100644
> --- a/lib/asn1_decoder.c
> +++ b/lib/asn1_decoder.c
> @@ -381,7 +381,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
>  	case ASN1_OP_END_SET_ACT:
>  		if (unlikely(!(flags & FLAG_MATCHED)))
>  			goto tag_mismatch;
> -		/* fall through */
> +		fallthrough;
>  
>  	case ASN1_OP_END_SEQ:
>  	case ASN1_OP_END_SET_OF:
> @@ -448,7 +448,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
>  			pc += asn1_op_lengths[op];
>  			goto next_op;
>  		}
> -		/* fall through */
> +		fallthrough;
>  
>  	case ASN1_OP_ACT:
>  		ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
> diff --git a/lib/assoc_array.c b/lib/assoc_array.c
> index 6f4bcf524554..04c98799c3ba 100644
> --- a/lib/assoc_array.c
> +++ b/lib/assoc_array.c
> @@ -1113,7 +1113,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
>  						index_key))
>  				goto found_leaf;
>  		}
> -		/* fall through */
> +		fallthrough;
>  	case assoc_array_walk_tree_empty:
>  	case assoc_array_walk_found_wrong_shortcut:
>  	default:
> diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> index 649ed44f199c..9f8c70a98fcf 100644
> --- a/lib/bootconfig.c
> +++ b/lib/bootconfig.c
> @@ -827,7 +827,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
>  							q - 2);
>  				break;
>  			}
> -			/* fall through */
> +			fallthrough;
>  		case '=':
>  			ret = xbc_parse_kv(&p, q, c);
>  			break;
> @@ -836,7 +836,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
>  			break;
>  		case '#':
>  			q = skip_comment(q);
> -			/* fall through */
> +			fallthrough;
>  		case ';':
>  		case '\n':
>  			ret = xbc_parse_key(&p, q);
> diff --git a/lib/cmdline.c b/lib/cmdline.c
> index 9e186234edc0..46f2cb4ce6d1 100644
> --- a/lib/cmdline.c
> +++ b/lib/cmdline.c
> @@ -144,23 +144,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
>  	case 'E':
>  	case 'e':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'P':
>  	case 'p':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'T':
>  	case 't':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'G':
>  	case 'g':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'M':
>  	case 'm':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'K':
>  	case 'k':
>  		ret <<= 10;
> diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
> index a4db51c21266..06811d866775 100644
> --- a/lib/dim/net_dim.c
> +++ b/lib/dim/net_dim.c
> @@ -233,7 +233,7 @@ void net_dim(struct dim *dim, struct dim_sample end_sample)
>  			schedule_work(&dim->work);
>  			break;
>  		}
> -		/* fall through */
> +		fallthrough;
>  	case DIM_START_MEASURE:
>  		dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
>  				  end_sample.byte_ctr, &dim->start_sample);
> diff --git a/lib/dim/rdma_dim.c b/lib/dim/rdma_dim.c
> index f7e26c7b4749..15462d54758d 100644
> --- a/lib/dim/rdma_dim.c
> +++ b/lib/dim/rdma_dim.c
> @@ -59,7 +59,7 @@ static bool rdma_dim_decision(struct dim_stats *curr_stats, struct dim *dim)
>  			break;
>  		case DIM_STATS_WORSE:
>  			dim_turn(dim);
> -			/* fall through */
> +			fallthrough;
>  		case DIM_STATS_BETTER:
>  			step_res = rdma_dim_step(dim);
>  			if (step_res == DIM_ON_EDGE)
> @@ -94,7 +94,7 @@ void rdma_dim(struct dim *dim, u64 completions)
>  			schedule_work(&dim->work);
>  			break;
>  		}
> -		/* fall through */
> +		fallthrough;
>  	case DIM_START_MEASURE:
>  		dim->state = DIM_MEASURE_IN_PROGRESS;
>  		dim_update_sample_with_comps(curr_sample->event_ctr, 0, 0,
> diff --git a/lib/glob.c b/lib/glob.c
> index 52e3ed7e4a9b..85ecbda45cd8 100644
> --- a/lib/glob.c
> +++ b/lib/glob.c
> @@ -102,7 +102,7 @@ bool __pure glob_match(char const *pat, char const *str)
>  			break;
>  		case '\\':
>  			d = *pat++;
> -			/* fall through */
> +			fallthrough;
>  		default:	/* Literal character */
>  literal:
>  			if (c == d) {
> diff --git a/lib/siphash.c b/lib/siphash.c
> index c47bb6ff2149..a90112ee72a1 100644
> --- a/lib/siphash.c
> +++ b/lib/siphash.c
> @@ -68,11 +68,11 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key)
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= le32_to_cpup(data); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= le16_to_cpup(data); break;
>  	case 1: b |= end[0];
>  	}
> @@ -101,11 +101,11 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key)
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= get_unaligned_le32(end); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= get_unaligned_le16(end); break;
>  	case 1: b |= end[0];
>  	}
> @@ -268,11 +268,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= le32_to_cpup(data); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= le16_to_cpup(data); break;
>  	case 1: b |= end[0];
>  	}
> @@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= get_unaligned_le32(end); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= get_unaligned_le16(end); break;
>  	case 1: b |= end[0];
>  	}
> @@ -431,7 +431,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
>  		v0 ^= m;
>  	}
>  	switch (left) {
> -	case 3: b |= ((u32)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u32)end[2]) << 16; fallthrough;
>  	case 2: b |= le16_to_cpup(data); break;
>  	case 1: b |= end[0];
>  	}
> @@ -454,7 +454,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
>  		v0 ^= m;
>  	}
>  	switch (left) {
> -	case 3: b |= ((u32)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u32)end[2]) << 16; fallthrough;
>  	case 2: b |= get_unaligned_le16(end); break;
>  	case 1: b |= end[0];
>  	}
> diff --git a/lib/ts_fsm.c b/lib/ts_fsm.c
> index ab749ec10ab5..64fd9015ad80 100644
> --- a/lib/ts_fsm.c
> +++ b/lib/ts_fsm.c
> @@ -193,7 +193,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state)
>  				TOKEN_MISMATCH();
>  
>  			block_idx++;
> -			/* fall through */
> +			fallthrough;
>  
>  		case TS_FSM_ANY:
>  			if (next == NULL)
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 14c9a6af1b23..d3c5c16f391c 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1265,7 +1265,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
>  
>  	case 'R':
>  		reversed = true;
> -		/* fall through */
> +		fallthrough;
>  
>  	default:
>  		separator = ':';
> @@ -1682,7 +1682,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
>  	switch (*(++fmt)) {
>  	case 'L':
>  		uc = true;
> -		/* fall through */
> +		fallthrough;
>  	case 'l':
>  		index = guid_index;
>  		break;
> @@ -2219,7 +2219,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
>  	case 'S':
>  	case 's':
>  		ptr = dereference_symbol_descriptor(ptr);
> -		/* fall through */
> +		fallthrough;
>  	case 'B':
>  		return symbol_string(buf, end, ptr, spec, fmt);
>  	case 'R':
> @@ -2450,7 +2450,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
>  
>  	case 'x':
>  		spec->flags |= SMALL;
> -		/* fall through */
> +		fallthrough;
>  
>  	case 'X':
>  		spec->base = 16;
> @@ -2468,7 +2468,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
>  		 * utility, treat it as any other invalid or
>  		 * unsupported format specifier.
>  		 */
> -		/* fall through */
> +		fallthrough;
>  
>  	default:
>  		WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
> @@ -3411,10 +3411,10 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
>  			break;
>  		case 'i':
>  			base = 0;
> -			/* fall through */
> +			fallthrough;
>  		case 'd':
>  			is_sign = true;
> -			/* fall through */
> +			fallthrough;
>  		case 'u':
>  			break;
>  		case '%':
> diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
> index 65a1aad8c223..ca2603abee08 100644
> --- a/lib/xz/xz_dec_lzma2.c
> +++ b/lib/xz/xz_dec_lzma2.c
> @@ -1043,7 +1043,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
>  
>  			s->lzma2.sequence = SEQ_LZMA_PREPARE;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_LZMA_PREPARE:
>  			if (s->lzma2.compressed < RC_INIT_BYTES)
> @@ -1055,7 +1055,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
>  			s->lzma2.compressed -= RC_INIT_BYTES;
>  			s->lzma2.sequence = SEQ_LZMA_RUN;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_LZMA_RUN:
>  			/*
> diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
> index 32ab2a08b7cb..fea86deaaa01 100644
> --- a/lib/xz/xz_dec_stream.c
> +++ b/lib/xz/xz_dec_stream.c
> @@ -583,7 +583,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  			if (ret != XZ_OK)
>  				return ret;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_START:
>  			/* We need one byte of input to continue. */
> @@ -608,7 +608,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  			s->temp.pos = 0;
>  			s->sequence = SEQ_BLOCK_HEADER;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_HEADER:
>  			if (!fill_temp(s, b))
> @@ -620,7 +620,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_BLOCK_UNCOMPRESS;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_UNCOMPRESS:
>  			ret = dec_block(s, b);
> @@ -629,7 +629,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_BLOCK_PADDING;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_PADDING:
>  			/*
> @@ -651,7 +651,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_BLOCK_CHECK;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_CHECK:
>  			if (s->check_type == XZ_CHECK_CRC32) {
> @@ -675,7 +675,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_INDEX_PADDING;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_INDEX_PADDING:
>  			while ((s->index.size + (b->in_pos - s->in_start))
> @@ -699,7 +699,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_INDEX_CRC32;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_INDEX_CRC32:
>  			ret = crc32_validate(s, b);
> @@ -709,7 +709,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  			s->temp.size = STREAM_HEADER_SIZE;
>  			s->sequence = SEQ_STREAM_FOOTER;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_STREAM_FOOTER:
>  			if (!fill_temp(s, b))
> diff --git a/lib/zstd/bitstream.h b/lib/zstd/bitstream.h
> index 3a49784d5c61..7c65c66e41fd 100644
> --- a/lib/zstd/bitstream.h
> +++ b/lib/zstd/bitstream.h
> @@ -259,15 +259,15 @@ ZSTD_STATIC size_t BIT_initDStream(BIT_DStream_t *bitD, const void *srcBuffer, s
>  		bitD->bitContainer = *(const BYTE *)(bitD->start);
>  		switch (srcSize) {
>  		case 7: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[6]) << (sizeof(bitD->bitContainer) * 8 - 16);
> -			/* fall through */
> +			fallthrough;
>  		case 6: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[5]) << (sizeof(bitD->bitContainer) * 8 - 24);
> -			/* fall through */
> +			fallthrough;
>  		case 5: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[4]) << (sizeof(bitD->bitContainer) * 8 - 32);
> -			/* fall through */
> +			fallthrough;
>  		case 4: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[3]) << 24;
> -			/* fall through */
> +			fallthrough;
>  		case 3: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[2]) << 16;
> -			/* fall through */
> +			fallthrough;
>  		case 2: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[1]) << 8;
>  		default:;
>  		}
> diff --git a/lib/zstd/compress.c b/lib/zstd/compress.c
> index 5e0b67003e55..b080264ed3ad 100644
> --- a/lib/zstd/compress.c
> +++ b/lib/zstd/compress.c
> @@ -3182,7 +3182,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t *
>  				zcs->outBuffFlushedSize = 0;
>  				zcs->stage = zcss_flush; /* pass-through to flush stage */
>  			}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zcss_flush: {
>  			size_t const toFlush = zcs->outBuffContentSize - zcs->outBuffFlushedSize;
> diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
> index db6761ea4deb..66cd487a326a 100644
> --- a/lib/zstd/decompress.c
> +++ b/lib/zstd/decompress.c
> @@ -442,7 +442,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize
>  		case set_repeat:
>  			if (dctx->litEntropy == 0)
>  				return ERROR(dictionary_corrupted);
> -			/* fall through */
> +			fallthrough;
>  		case set_compressed:
>  			if (srcSize < 5)
>  				return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
> @@ -1768,7 +1768,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, c
>  			return 0;
>  		}
>  		dctx->expected = 0; /* not necessary to copy more */
> -		/* fall through */
> +		fallthrough;
>  
>  	case ZSTDds_decodeFrameHeader:
>  		memcpy(dctx->headerBuffer + ZSTD_frameHeaderSize_prefix, src, dctx->expected);
> @@ -2309,7 +2309,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  		switch (zds->stage) {
>  		case zdss_init:
>  			ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_loadHeader: {
>  			size_t const hSize = ZSTD_getFrameParams(&zds->fParams, zds->headerBuffer, zds->lhSize);
> @@ -2376,7 +2376,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  			}
>  			zds->stage = zdss_read;
>  		}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_read: {
>  			size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> @@ -2405,7 +2405,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  			zds->stage = zdss_load;
>  			/* pass-through */
>  		}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_load: {
>  			size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> @@ -2438,7 +2438,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  				/* pass-through */
>  			}
>  		}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_flush: {
>  			size_t const toFlushSize = zds->outEnd - zds->outStart;
> diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
> index e727812d12aa..08b4ae80aed4 100644
> --- a/lib/zstd/huf_compress.c
> +++ b/lib/zstd/huf_compress.c
> @@ -556,9 +556,9 @@ size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, si
>  	n = srcSize & ~3; /* join to mod 4 */
>  	switch (srcSize & 3) {
>  	case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
> -		/* fall through */
> +		fallthrough;
>  	case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
> -		/* fall through */
> +		fallthrough;
>  	case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
>  	case 0:
>  	default:;
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
@ 2020-11-17  3:02     ` Nathan Chancellor
  0 siblings, 0 replies; 47+ messages in thread
From: Nathan Chancellor @ 2020-11-17  3:02 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: clang-built-linux, Gustavo A . R . Silva, linux-kernel,
	Miguel Ojeda, Paul Mackerras, linuxppc-dev

On Sun, Nov 15, 2020 at 08:35:31PM -0800, Nick Desaulniers wrote:
> This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
> pseudo-keyword in lib/")
> 
> Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
> re-enable these fixes for lib/.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>

> ---
>  lib/asn1_decoder.c      |  4 ++--
>  lib/assoc_array.c       |  2 +-
>  lib/bootconfig.c        |  4 ++--
>  lib/cmdline.c           | 10 +++++-----
>  lib/dim/net_dim.c       |  2 +-
>  lib/dim/rdma_dim.c      |  4 ++--
>  lib/glob.c              |  2 +-
>  lib/siphash.c           | 36 ++++++++++++++++++------------------
>  lib/ts_fsm.c            |  2 +-
>  lib/vsprintf.c          | 14 +++++++-------
>  lib/xz/xz_dec_lzma2.c   |  4 ++--
>  lib/xz/xz_dec_stream.c  | 16 ++++++++--------
>  lib/zstd/bitstream.h    | 10 +++++-----
>  lib/zstd/compress.c     |  2 +-
>  lib/zstd/decompress.c   | 12 ++++++------
>  lib/zstd/huf_compress.c |  4 ++--
>  16 files changed, 64 insertions(+), 64 deletions(-)
> 
> diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
> index 58f72b25f8e9..13da529e2e72 100644
> --- a/lib/asn1_decoder.c
> +++ b/lib/asn1_decoder.c
> @@ -381,7 +381,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
>  	case ASN1_OP_END_SET_ACT:
>  		if (unlikely(!(flags & FLAG_MATCHED)))
>  			goto tag_mismatch;
> -		/* fall through */
> +		fallthrough;
>  
>  	case ASN1_OP_END_SEQ:
>  	case ASN1_OP_END_SET_OF:
> @@ -448,7 +448,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
>  			pc += asn1_op_lengths[op];
>  			goto next_op;
>  		}
> -		/* fall through */
> +		fallthrough;
>  
>  	case ASN1_OP_ACT:
>  		ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
> diff --git a/lib/assoc_array.c b/lib/assoc_array.c
> index 6f4bcf524554..04c98799c3ba 100644
> --- a/lib/assoc_array.c
> +++ b/lib/assoc_array.c
> @@ -1113,7 +1113,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
>  						index_key))
>  				goto found_leaf;
>  		}
> -		/* fall through */
> +		fallthrough;
>  	case assoc_array_walk_tree_empty:
>  	case assoc_array_walk_found_wrong_shortcut:
>  	default:
> diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> index 649ed44f199c..9f8c70a98fcf 100644
> --- a/lib/bootconfig.c
> +++ b/lib/bootconfig.c
> @@ -827,7 +827,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
>  							q - 2);
>  				break;
>  			}
> -			/* fall through */
> +			fallthrough;
>  		case '=':
>  			ret = xbc_parse_kv(&p, q, c);
>  			break;
> @@ -836,7 +836,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
>  			break;
>  		case '#':
>  			q = skip_comment(q);
> -			/* fall through */
> +			fallthrough;
>  		case ';':
>  		case '\n':
>  			ret = xbc_parse_key(&p, q);
> diff --git a/lib/cmdline.c b/lib/cmdline.c
> index 9e186234edc0..46f2cb4ce6d1 100644
> --- a/lib/cmdline.c
> +++ b/lib/cmdline.c
> @@ -144,23 +144,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
>  	case 'E':
>  	case 'e':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'P':
>  	case 'p':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'T':
>  	case 't':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'G':
>  	case 'g':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'M':
>  	case 'm':
>  		ret <<= 10;
> -		/* fall through */
> +		fallthrough;
>  	case 'K':
>  	case 'k':
>  		ret <<= 10;
> diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
> index a4db51c21266..06811d866775 100644
> --- a/lib/dim/net_dim.c
> +++ b/lib/dim/net_dim.c
> @@ -233,7 +233,7 @@ void net_dim(struct dim *dim, struct dim_sample end_sample)
>  			schedule_work(&dim->work);
>  			break;
>  		}
> -		/* fall through */
> +		fallthrough;
>  	case DIM_START_MEASURE:
>  		dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
>  				  end_sample.byte_ctr, &dim->start_sample);
> diff --git a/lib/dim/rdma_dim.c b/lib/dim/rdma_dim.c
> index f7e26c7b4749..15462d54758d 100644
> --- a/lib/dim/rdma_dim.c
> +++ b/lib/dim/rdma_dim.c
> @@ -59,7 +59,7 @@ static bool rdma_dim_decision(struct dim_stats *curr_stats, struct dim *dim)
>  			break;
>  		case DIM_STATS_WORSE:
>  			dim_turn(dim);
> -			/* fall through */
> +			fallthrough;
>  		case DIM_STATS_BETTER:
>  			step_res = rdma_dim_step(dim);
>  			if (step_res == DIM_ON_EDGE)
> @@ -94,7 +94,7 @@ void rdma_dim(struct dim *dim, u64 completions)
>  			schedule_work(&dim->work);
>  			break;
>  		}
> -		/* fall through */
> +		fallthrough;
>  	case DIM_START_MEASURE:
>  		dim->state = DIM_MEASURE_IN_PROGRESS;
>  		dim_update_sample_with_comps(curr_sample->event_ctr, 0, 0,
> diff --git a/lib/glob.c b/lib/glob.c
> index 52e3ed7e4a9b..85ecbda45cd8 100644
> --- a/lib/glob.c
> +++ b/lib/glob.c
> @@ -102,7 +102,7 @@ bool __pure glob_match(char const *pat, char const *str)
>  			break;
>  		case '\\':
>  			d = *pat++;
> -			/* fall through */
> +			fallthrough;
>  		default:	/* Literal character */
>  literal:
>  			if (c == d) {
> diff --git a/lib/siphash.c b/lib/siphash.c
> index c47bb6ff2149..a90112ee72a1 100644
> --- a/lib/siphash.c
> +++ b/lib/siphash.c
> @@ -68,11 +68,11 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key)
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= le32_to_cpup(data); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= le16_to_cpup(data); break;
>  	case 1: b |= end[0];
>  	}
> @@ -101,11 +101,11 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key)
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= get_unaligned_le32(end); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= get_unaligned_le16(end); break;
>  	case 1: b |= end[0];
>  	}
> @@ -268,11 +268,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= le32_to_cpup(data); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= le16_to_cpup(data); break;
>  	case 1: b |= end[0];
>  	}
> @@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
>  						  bytemask_from_count(left)));
>  #else
>  	switch (left) {
> -	case 7: b |= ((u64)end[6]) << 48; /* fall through */
> -	case 6: b |= ((u64)end[5]) << 40; /* fall through */
> -	case 5: b |= ((u64)end[4]) << 32; /* fall through */
> +	case 7: b |= ((u64)end[6]) << 48; fallthrough;
> +	case 6: b |= ((u64)end[5]) << 40; fallthrough;
> +	case 5: b |= ((u64)end[4]) << 32; fallthrough;
>  	case 4: b |= get_unaligned_le32(end); break;
> -	case 3: b |= ((u64)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u64)end[2]) << 16; fallthrough;
>  	case 2: b |= get_unaligned_le16(end); break;
>  	case 1: b |= end[0];
>  	}
> @@ -431,7 +431,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
>  		v0 ^= m;
>  	}
>  	switch (left) {
> -	case 3: b |= ((u32)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u32)end[2]) << 16; fallthrough;
>  	case 2: b |= le16_to_cpup(data); break;
>  	case 1: b |= end[0];
>  	}
> @@ -454,7 +454,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
>  		v0 ^= m;
>  	}
>  	switch (left) {
> -	case 3: b |= ((u32)end[2]) << 16; /* fall through */
> +	case 3: b |= ((u32)end[2]) << 16; fallthrough;
>  	case 2: b |= get_unaligned_le16(end); break;
>  	case 1: b |= end[0];
>  	}
> diff --git a/lib/ts_fsm.c b/lib/ts_fsm.c
> index ab749ec10ab5..64fd9015ad80 100644
> --- a/lib/ts_fsm.c
> +++ b/lib/ts_fsm.c
> @@ -193,7 +193,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state)
>  				TOKEN_MISMATCH();
>  
>  			block_idx++;
> -			/* fall through */
> +			fallthrough;
>  
>  		case TS_FSM_ANY:
>  			if (next == NULL)
> diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> index 14c9a6af1b23..d3c5c16f391c 100644
> --- a/lib/vsprintf.c
> +++ b/lib/vsprintf.c
> @@ -1265,7 +1265,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
>  
>  	case 'R':
>  		reversed = true;
> -		/* fall through */
> +		fallthrough;
>  
>  	default:
>  		separator = ':';
> @@ -1682,7 +1682,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
>  	switch (*(++fmt)) {
>  	case 'L':
>  		uc = true;
> -		/* fall through */
> +		fallthrough;
>  	case 'l':
>  		index = guid_index;
>  		break;
> @@ -2219,7 +2219,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
>  	case 'S':
>  	case 's':
>  		ptr = dereference_symbol_descriptor(ptr);
> -		/* fall through */
> +		fallthrough;
>  	case 'B':
>  		return symbol_string(buf, end, ptr, spec, fmt);
>  	case 'R':
> @@ -2450,7 +2450,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
>  
>  	case 'x':
>  		spec->flags |= SMALL;
> -		/* fall through */
> +		fallthrough;
>  
>  	case 'X':
>  		spec->base = 16;
> @@ -2468,7 +2468,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
>  		 * utility, treat it as any other invalid or
>  		 * unsupported format specifier.
>  		 */
> -		/* fall through */
> +		fallthrough;
>  
>  	default:
>  		WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
> @@ -3411,10 +3411,10 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
>  			break;
>  		case 'i':
>  			base = 0;
> -			/* fall through */
> +			fallthrough;
>  		case 'd':
>  			is_sign = true;
> -			/* fall through */
> +			fallthrough;
>  		case 'u':
>  			break;
>  		case '%':
> diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
> index 65a1aad8c223..ca2603abee08 100644
> --- a/lib/xz/xz_dec_lzma2.c
> +++ b/lib/xz/xz_dec_lzma2.c
> @@ -1043,7 +1043,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
>  
>  			s->lzma2.sequence = SEQ_LZMA_PREPARE;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_LZMA_PREPARE:
>  			if (s->lzma2.compressed < RC_INIT_BYTES)
> @@ -1055,7 +1055,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
>  			s->lzma2.compressed -= RC_INIT_BYTES;
>  			s->lzma2.sequence = SEQ_LZMA_RUN;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_LZMA_RUN:
>  			/*
> diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
> index 32ab2a08b7cb..fea86deaaa01 100644
> --- a/lib/xz/xz_dec_stream.c
> +++ b/lib/xz/xz_dec_stream.c
> @@ -583,7 +583,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  			if (ret != XZ_OK)
>  				return ret;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_START:
>  			/* We need one byte of input to continue. */
> @@ -608,7 +608,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  			s->temp.pos = 0;
>  			s->sequence = SEQ_BLOCK_HEADER;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_HEADER:
>  			if (!fill_temp(s, b))
> @@ -620,7 +620,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_BLOCK_UNCOMPRESS;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_UNCOMPRESS:
>  			ret = dec_block(s, b);
> @@ -629,7 +629,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_BLOCK_PADDING;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_PADDING:
>  			/*
> @@ -651,7 +651,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_BLOCK_CHECK;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_BLOCK_CHECK:
>  			if (s->check_type == XZ_CHECK_CRC32) {
> @@ -675,7 +675,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_INDEX_PADDING;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_INDEX_PADDING:
>  			while ((s->index.size + (b->in_pos - s->in_start))
> @@ -699,7 +699,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  
>  			s->sequence = SEQ_INDEX_CRC32;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_INDEX_CRC32:
>  			ret = crc32_validate(s, b);
> @@ -709,7 +709,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
>  			s->temp.size = STREAM_HEADER_SIZE;
>  			s->sequence = SEQ_STREAM_FOOTER;
>  
> -			/* fall through */
> +			fallthrough;
>  
>  		case SEQ_STREAM_FOOTER:
>  			if (!fill_temp(s, b))
> diff --git a/lib/zstd/bitstream.h b/lib/zstd/bitstream.h
> index 3a49784d5c61..7c65c66e41fd 100644
> --- a/lib/zstd/bitstream.h
> +++ b/lib/zstd/bitstream.h
> @@ -259,15 +259,15 @@ ZSTD_STATIC size_t BIT_initDStream(BIT_DStream_t *bitD, const void *srcBuffer, s
>  		bitD->bitContainer = *(const BYTE *)(bitD->start);
>  		switch (srcSize) {
>  		case 7: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[6]) << (sizeof(bitD->bitContainer) * 8 - 16);
> -			/* fall through */
> +			fallthrough;
>  		case 6: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[5]) << (sizeof(bitD->bitContainer) * 8 - 24);
> -			/* fall through */
> +			fallthrough;
>  		case 5: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[4]) << (sizeof(bitD->bitContainer) * 8 - 32);
> -			/* fall through */
> +			fallthrough;
>  		case 4: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[3]) << 24;
> -			/* fall through */
> +			fallthrough;
>  		case 3: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[2]) << 16;
> -			/* fall through */
> +			fallthrough;
>  		case 2: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[1]) << 8;
>  		default:;
>  		}
> diff --git a/lib/zstd/compress.c b/lib/zstd/compress.c
> index 5e0b67003e55..b080264ed3ad 100644
> --- a/lib/zstd/compress.c
> +++ b/lib/zstd/compress.c
> @@ -3182,7 +3182,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t *
>  				zcs->outBuffFlushedSize = 0;
>  				zcs->stage = zcss_flush; /* pass-through to flush stage */
>  			}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zcss_flush: {
>  			size_t const toFlush = zcs->outBuffContentSize - zcs->outBuffFlushedSize;
> diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
> index db6761ea4deb..66cd487a326a 100644
> --- a/lib/zstd/decompress.c
> +++ b/lib/zstd/decompress.c
> @@ -442,7 +442,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize
>  		case set_repeat:
>  			if (dctx->litEntropy == 0)
>  				return ERROR(dictionary_corrupted);
> -			/* fall through */
> +			fallthrough;
>  		case set_compressed:
>  			if (srcSize < 5)
>  				return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
> @@ -1768,7 +1768,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, c
>  			return 0;
>  		}
>  		dctx->expected = 0; /* not necessary to copy more */
> -		/* fall through */
> +		fallthrough;
>  
>  	case ZSTDds_decodeFrameHeader:
>  		memcpy(dctx->headerBuffer + ZSTD_frameHeaderSize_prefix, src, dctx->expected);
> @@ -2309,7 +2309,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  		switch (zds->stage) {
>  		case zdss_init:
>  			ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_loadHeader: {
>  			size_t const hSize = ZSTD_getFrameParams(&zds->fParams, zds->headerBuffer, zds->lhSize);
> @@ -2376,7 +2376,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  			}
>  			zds->stage = zdss_read;
>  		}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_read: {
>  			size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> @@ -2405,7 +2405,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  			zds->stage = zdss_load;
>  			/* pass-through */
>  		}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_load: {
>  			size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> @@ -2438,7 +2438,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
>  				/* pass-through */
>  			}
>  		}
> -			/* fall through */
> +			fallthrough;
>  
>  		case zdss_flush: {
>  			size_t const toFlushSize = zds->outEnd - zds->outStart;
> diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
> index e727812d12aa..08b4ae80aed4 100644
> --- a/lib/zstd/huf_compress.c
> +++ b/lib/zstd/huf_compress.c
> @@ -556,9 +556,9 @@ size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, si
>  	n = srcSize & ~3; /* join to mod 4 */
>  	switch (srcSize & 3) {
>  	case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
> -		/* fall through */
> +		fallthrough;
>  	case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
> -		/* fall through */
> +		fallthrough;
>  	case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
>  	case 0:
>  	default:;
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough
  2020-11-16  4:35   ` Nick Desaulniers
@ 2020-11-17  3:02     ` Nathan Chancellor
  -1 siblings, 0 replies; 47+ messages in thread
From: Nathan Chancellor @ 2020-11-17  3:02 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Gustavo A . R . Silva, Miguel Ojeda, Michael Ellerman,
	Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel

On Sun, Nov 15, 2020 at 08:35:32PM -0800, Nick Desaulniers wrote:
> The "fallthrough" pseudo-keyword was added as a portable way to denote
> intentional fallthrough. Clang will still warn on cases where there is a
> fallthrough to an immediate break. Add explicit breaks for those cases.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>

> ---
>  arch/powerpc/kernel/prom_init.c | 1 +
>  arch/powerpc/kernel/uprobes.c   | 1 +
>  arch/powerpc/perf/imc-pmu.c     | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index 38ae5933d917..e9d4eb6144e1 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -355,6 +355,7 @@ static int __init prom_strtobool(const char *s, bool *res)
>  		default:
>  			break;
>  		}
> +		break;
>  	default:
>  		break;
>  	}
> diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
> index d200e7df7167..e8a63713e655 100644
> --- a/arch/powerpc/kernel/uprobes.c
> +++ b/arch/powerpc/kernel/uprobes.c
> @@ -141,6 +141,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self,
>  	case DIE_SSTEP:
>  		if (uprobe_post_sstep_notifier(regs))
>  			return NOTIFY_STOP;
> +		break;
>  	default:
>  		break;
>  	}
> diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
> index 7b25548ec42b..e106909ff9c3 100644
> --- a/arch/powerpc/perf/imc-pmu.c
> +++ b/arch/powerpc/perf/imc-pmu.c
> @@ -1500,6 +1500,7 @@ static int update_pmu_ops(struct imc_pmu *pmu)
>  		pmu->pmu.stop = trace_imc_event_stop;
>  		pmu->pmu.read = trace_imc_event_read;
>  		pmu->attr_groups[IMC_FORMAT_ATTR] = &trace_imc_format_group;
> +		break;
>  	default:
>  		break;
>  	}
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough
@ 2020-11-17  3:02     ` Nathan Chancellor
  0 siblings, 0 replies; 47+ messages in thread
From: Nathan Chancellor @ 2020-11-17  3:02 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: clang-built-linux, Gustavo A . R . Silva, linux-kernel,
	Miguel Ojeda, Paul Mackerras, linuxppc-dev

On Sun, Nov 15, 2020 at 08:35:32PM -0800, Nick Desaulniers wrote:
> The "fallthrough" pseudo-keyword was added as a portable way to denote
> intentional fallthrough. Clang will still warn on cases where there is a
> fallthrough to an immediate break. Add explicit breaks for those cases.
> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
Tested-by: Nathan Chancellor <natechancellor@gmail.com>

> ---
>  arch/powerpc/kernel/prom_init.c | 1 +
>  arch/powerpc/kernel/uprobes.c   | 1 +
>  arch/powerpc/perf/imc-pmu.c     | 1 +
>  3 files changed, 3 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index 38ae5933d917..e9d4eb6144e1 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -355,6 +355,7 @@ static int __init prom_strtobool(const char *s, bool *res)
>  		default:
>  			break;
>  		}
> +		break;
>  	default:
>  		break;
>  	}
> diff --git a/arch/powerpc/kernel/uprobes.c b/arch/powerpc/kernel/uprobes.c
> index d200e7df7167..e8a63713e655 100644
> --- a/arch/powerpc/kernel/uprobes.c
> +++ b/arch/powerpc/kernel/uprobes.c
> @@ -141,6 +141,7 @@ int arch_uprobe_exception_notify(struct notifier_block *self,
>  	case DIE_SSTEP:
>  		if (uprobe_post_sstep_notifier(regs))
>  			return NOTIFY_STOP;
> +		break;
>  	default:
>  		break;
>  	}
> diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c
> index 7b25548ec42b..e106909ff9c3 100644
> --- a/arch/powerpc/perf/imc-pmu.c
> +++ b/arch/powerpc/perf/imc-pmu.c
> @@ -1500,6 +1500,7 @@ static int update_pmu_ops(struct imc_pmu *pmu)
>  		pmu->pmu.stop = trace_imc_event_stop;
>  		pmu->pmu.read = trace_imc_event_read;
>  		pmu->attr_groups[IMC_FORMAT_ATTR] = &trace_imc_format_group;
> +		break;
>  	default:
>  		break;
>  	}
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  2020-11-17  3:02     ` Nathan Chancellor
@ 2020-11-17 19:10       ` Nick Desaulniers
  -1 siblings, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 2020-11-17 19:10 UTC (permalink / raw)
  To: Gustavo A . R . Silva, Michael Ellerman
  Cc: Nathan Chancellor, Benjamin Herrenschmidt, Paul Mackerras,
	clang-built-linux, linuxppc-dev, LKML, Miguel Ojeda

On Mon, Nov 16, 2020 at 7:02 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Sun, Nov 15, 2020 at 08:35:31PM -0800, Nick Desaulniers wrote:
> > This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
> > pseudo-keyword in lib/")

Gustavo, whose tree did 6a9dc5fd6170 and df561f6688fe go up to
mainline in?  I'm not sure whether you or MPE (ppc) or someone else
should pick it this series?

> >
> > Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
> > re-enable these fixes for lib/.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/236
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
>
> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> Tested-by: Nathan Chancellor <natechancellor@gmail.com>
>
> > ---
> >  lib/asn1_decoder.c      |  4 ++--
> >  lib/assoc_array.c       |  2 +-
> >  lib/bootconfig.c        |  4 ++--
> >  lib/cmdline.c           | 10 +++++-----
> >  lib/dim/net_dim.c       |  2 +-
> >  lib/dim/rdma_dim.c      |  4 ++--
> >  lib/glob.c              |  2 +-
> >  lib/siphash.c           | 36 ++++++++++++++++++------------------
> >  lib/ts_fsm.c            |  2 +-
> >  lib/vsprintf.c          | 14 +++++++-------
> >  lib/xz/xz_dec_lzma2.c   |  4 ++--
> >  lib/xz/xz_dec_stream.c  | 16 ++++++++--------
> >  lib/zstd/bitstream.h    | 10 +++++-----
> >  lib/zstd/compress.c     |  2 +-
> >  lib/zstd/decompress.c   | 12 ++++++------
> >  lib/zstd/huf_compress.c |  4 ++--
> >  16 files changed, 64 insertions(+), 64 deletions(-)
> >
> > diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
> > index 58f72b25f8e9..13da529e2e72 100644
> > --- a/lib/asn1_decoder.c
> > +++ b/lib/asn1_decoder.c
> > @@ -381,7 +381,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
> >       case ASN1_OP_END_SET_ACT:
> >               if (unlikely(!(flags & FLAG_MATCHED)))
> >                       goto tag_mismatch;
> > -             /* fall through */
> > +             fallthrough;
> >
> >       case ASN1_OP_END_SEQ:
> >       case ASN1_OP_END_SET_OF:
> > @@ -448,7 +448,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
> >                       pc += asn1_op_lengths[op];
> >                       goto next_op;
> >               }
> > -             /* fall through */
> > +             fallthrough;
> >
> >       case ASN1_OP_ACT:
> >               ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
> > diff --git a/lib/assoc_array.c b/lib/assoc_array.c
> > index 6f4bcf524554..04c98799c3ba 100644
> > --- a/lib/assoc_array.c
> > +++ b/lib/assoc_array.c
> > @@ -1113,7 +1113,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
> >                                               index_key))
> >                               goto found_leaf;
> >               }
> > -             /* fall through */
> > +             fallthrough;
> >       case assoc_array_walk_tree_empty:
> >       case assoc_array_walk_found_wrong_shortcut:
> >       default:
> > diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> > index 649ed44f199c..9f8c70a98fcf 100644
> > --- a/lib/bootconfig.c
> > +++ b/lib/bootconfig.c
> > @@ -827,7 +827,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
> >                                                       q - 2);
> >                               break;
> >                       }
> > -                     /* fall through */
> > +                     fallthrough;
> >               case '=':
> >                       ret = xbc_parse_kv(&p, q, c);
> >                       break;
> > @@ -836,7 +836,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
> >                       break;
> >               case '#':
> >                       q = skip_comment(q);
> > -                     /* fall through */
> > +                     fallthrough;
> >               case ';':
> >               case '\n':
> >                       ret = xbc_parse_key(&p, q);
> > diff --git a/lib/cmdline.c b/lib/cmdline.c
> > index 9e186234edc0..46f2cb4ce6d1 100644
> > --- a/lib/cmdline.c
> > +++ b/lib/cmdline.c
> > @@ -144,23 +144,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
> >       case 'E':
> >       case 'e':
> >               ret <<= 10;
> > -             /* fall through */
> > +             fallthrough;
> >       case 'P':
> >       case 'p':
> >               ret <<= 10;
> > -             /* fall through */
> > +             fallthrough;
> >       case 'T':
> >       case 't':
> >               ret <<= 10;
> > -             /* fall through */
> > +             fallthrough;
> >       case 'G':
> >       case 'g':
> >               ret <<= 10;
> > -             /* fall through */
> > +             fallthrough;
> >       case 'M':
> >       case 'm':
> >               ret <<= 10;
> > -             /* fall through */
> > +             fallthrough;
> >       case 'K':
> >       case 'k':
> >               ret <<= 10;
> > diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
> > index a4db51c21266..06811d866775 100644
> > --- a/lib/dim/net_dim.c
> > +++ b/lib/dim/net_dim.c
> > @@ -233,7 +233,7 @@ void net_dim(struct dim *dim, struct dim_sample end_sample)
> >                       schedule_work(&dim->work);
> >                       break;
> >               }
> > -             /* fall through */
> > +             fallthrough;
> >       case DIM_START_MEASURE:
> >               dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
> >                                 end_sample.byte_ctr, &dim->start_sample);
> > diff --git a/lib/dim/rdma_dim.c b/lib/dim/rdma_dim.c
> > index f7e26c7b4749..15462d54758d 100644
> > --- a/lib/dim/rdma_dim.c
> > +++ b/lib/dim/rdma_dim.c
> > @@ -59,7 +59,7 @@ static bool rdma_dim_decision(struct dim_stats *curr_stats, struct dim *dim)
> >                       break;
> >               case DIM_STATS_WORSE:
> >                       dim_turn(dim);
> > -                     /* fall through */
> > +                     fallthrough;
> >               case DIM_STATS_BETTER:
> >                       step_res = rdma_dim_step(dim);
> >                       if (step_res == DIM_ON_EDGE)
> > @@ -94,7 +94,7 @@ void rdma_dim(struct dim *dim, u64 completions)
> >                       schedule_work(&dim->work);
> >                       break;
> >               }
> > -             /* fall through */
> > +             fallthrough;
> >       case DIM_START_MEASURE:
> >               dim->state = DIM_MEASURE_IN_PROGRESS;
> >               dim_update_sample_with_comps(curr_sample->event_ctr, 0, 0,
> > diff --git a/lib/glob.c b/lib/glob.c
> > index 52e3ed7e4a9b..85ecbda45cd8 100644
> > --- a/lib/glob.c
> > +++ b/lib/glob.c
> > @@ -102,7 +102,7 @@ bool __pure glob_match(char const *pat, char const *str)
> >                       break;
> >               case '\\':
> >                       d = *pat++;
> > -                     /* fall through */
> > +                     fallthrough;
> >               default:        /* Literal character */
> >  literal:
> >                       if (c == d) {
> > diff --git a/lib/siphash.c b/lib/siphash.c
> > index c47bb6ff2149..a90112ee72a1 100644
> > --- a/lib/siphash.c
> > +++ b/lib/siphash.c
> > @@ -68,11 +68,11 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key)
> >                                                 bytemask_from_count(left)));
> >  #else
> >       switch (left) {
> > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> >       case 4: b |= le32_to_cpup(data); break;
> > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> >       case 2: b |= le16_to_cpup(data); break;
> >       case 1: b |= end[0];
> >       }
> > @@ -101,11 +101,11 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key)
> >                                                 bytemask_from_count(left)));
> >  #else
> >       switch (left) {
> > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> >       case 4: b |= get_unaligned_le32(end); break;
> > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> >       case 2: b |= get_unaligned_le16(end); break;
> >       case 1: b |= end[0];
> >       }
> > @@ -268,11 +268,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
> >                                                 bytemask_from_count(left)));
> >  #else
> >       switch (left) {
> > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> >       case 4: b |= le32_to_cpup(data); break;
> > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> >       case 2: b |= le16_to_cpup(data); break;
> >       case 1: b |= end[0];
> >       }
> > @@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
> >                                                 bytemask_from_count(left)));
> >  #else
> >       switch (left) {
> > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> >       case 4: b |= get_unaligned_le32(end); break;
> > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> >       case 2: b |= get_unaligned_le16(end); break;
> >       case 1: b |= end[0];
> >       }
> > @@ -431,7 +431,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
> >               v0 ^= m;
> >       }
> >       switch (left) {
> > -     case 3: b |= ((u32)end[2]) << 16; /* fall through */
> > +     case 3: b |= ((u32)end[2]) << 16; fallthrough;
> >       case 2: b |= le16_to_cpup(data); break;
> >       case 1: b |= end[0];
> >       }
> > @@ -454,7 +454,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
> >               v0 ^= m;
> >       }
> >       switch (left) {
> > -     case 3: b |= ((u32)end[2]) << 16; /* fall through */
> > +     case 3: b |= ((u32)end[2]) << 16; fallthrough;
> >       case 2: b |= get_unaligned_le16(end); break;
> >       case 1: b |= end[0];
> >       }
> > diff --git a/lib/ts_fsm.c b/lib/ts_fsm.c
> > index ab749ec10ab5..64fd9015ad80 100644
> > --- a/lib/ts_fsm.c
> > +++ b/lib/ts_fsm.c
> > @@ -193,7 +193,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state)
> >                               TOKEN_MISMATCH();
> >
> >                       block_idx++;
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case TS_FSM_ANY:
> >                       if (next == NULL)
> > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> > index 14c9a6af1b23..d3c5c16f391c 100644
> > --- a/lib/vsprintf.c
> > +++ b/lib/vsprintf.c
> > @@ -1265,7 +1265,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
> >
> >       case 'R':
> >               reversed = true;
> > -             /* fall through */
> > +             fallthrough;
> >
> >       default:
> >               separator = ':';
> > @@ -1682,7 +1682,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
> >       switch (*(++fmt)) {
> >       case 'L':
> >               uc = true;
> > -             /* fall through */
> > +             fallthrough;
> >       case 'l':
> >               index = guid_index;
> >               break;
> > @@ -2219,7 +2219,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
> >       case 'S':
> >       case 's':
> >               ptr = dereference_symbol_descriptor(ptr);
> > -             /* fall through */
> > +             fallthrough;
> >       case 'B':
> >               return symbol_string(buf, end, ptr, spec, fmt);
> >       case 'R':
> > @@ -2450,7 +2450,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
> >
> >       case 'x':
> >               spec->flags |= SMALL;
> > -             /* fall through */
> > +             fallthrough;
> >
> >       case 'X':
> >               spec->base = 16;
> > @@ -2468,7 +2468,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
> >                * utility, treat it as any other invalid or
> >                * unsupported format specifier.
> >                */
> > -             /* fall through */
> > +             fallthrough;
> >
> >       default:
> >               WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
> > @@ -3411,10 +3411,10 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
> >                       break;
> >               case 'i':
> >                       base = 0;
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 'd':
> >                       is_sign = true;
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 'u':
> >                       break;
> >               case '%':
> > diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
> > index 65a1aad8c223..ca2603abee08 100644
> > --- a/lib/xz/xz_dec_lzma2.c
> > +++ b/lib/xz/xz_dec_lzma2.c
> > @@ -1043,7 +1043,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
> >
> >                       s->lzma2.sequence = SEQ_LZMA_PREPARE;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_LZMA_PREPARE:
> >                       if (s->lzma2.compressed < RC_INIT_BYTES)
> > @@ -1055,7 +1055,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
> >                       s->lzma2.compressed -= RC_INIT_BYTES;
> >                       s->lzma2.sequence = SEQ_LZMA_RUN;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_LZMA_RUN:
> >                       /*
> > diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
> > index 32ab2a08b7cb..fea86deaaa01 100644
> > --- a/lib/xz/xz_dec_stream.c
> > +++ b/lib/xz/xz_dec_stream.c
> > @@ -583,7 +583,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >                       if (ret != XZ_OK)
> >                               return ret;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_BLOCK_START:
> >                       /* We need one byte of input to continue. */
> > @@ -608,7 +608,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >                       s->temp.pos = 0;
> >                       s->sequence = SEQ_BLOCK_HEADER;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_BLOCK_HEADER:
> >                       if (!fill_temp(s, b))
> > @@ -620,7 +620,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >
> >                       s->sequence = SEQ_BLOCK_UNCOMPRESS;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_BLOCK_UNCOMPRESS:
> >                       ret = dec_block(s, b);
> > @@ -629,7 +629,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >
> >                       s->sequence = SEQ_BLOCK_PADDING;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_BLOCK_PADDING:
> >                       /*
> > @@ -651,7 +651,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >
> >                       s->sequence = SEQ_BLOCK_CHECK;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_BLOCK_CHECK:
> >                       if (s->check_type == XZ_CHECK_CRC32) {
> > @@ -675,7 +675,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >
> >                       s->sequence = SEQ_INDEX_PADDING;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_INDEX_PADDING:
> >                       while ((s->index.size + (b->in_pos - s->in_start))
> > @@ -699,7 +699,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >
> >                       s->sequence = SEQ_INDEX_CRC32;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_INDEX_CRC32:
> >                       ret = crc32_validate(s, b);
> > @@ -709,7 +709,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >                       s->temp.size = STREAM_HEADER_SIZE;
> >                       s->sequence = SEQ_STREAM_FOOTER;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_STREAM_FOOTER:
> >                       if (!fill_temp(s, b))
> > diff --git a/lib/zstd/bitstream.h b/lib/zstd/bitstream.h
> > index 3a49784d5c61..7c65c66e41fd 100644
> > --- a/lib/zstd/bitstream.h
> > +++ b/lib/zstd/bitstream.h
> > @@ -259,15 +259,15 @@ ZSTD_STATIC size_t BIT_initDStream(BIT_DStream_t *bitD, const void *srcBuffer, s
> >               bitD->bitContainer = *(const BYTE *)(bitD->start);
> >               switch (srcSize) {
> >               case 7: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[6]) << (sizeof(bitD->bitContainer) * 8 - 16);
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 6: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[5]) << (sizeof(bitD->bitContainer) * 8 - 24);
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 5: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[4]) << (sizeof(bitD->bitContainer) * 8 - 32);
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 4: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[3]) << 24;
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 3: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[2]) << 16;
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 2: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[1]) << 8;
> >               default:;
> >               }
> > diff --git a/lib/zstd/compress.c b/lib/zstd/compress.c
> > index 5e0b67003e55..b080264ed3ad 100644
> > --- a/lib/zstd/compress.c
> > +++ b/lib/zstd/compress.c
> > @@ -3182,7 +3182,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t *
> >                               zcs->outBuffFlushedSize = 0;
> >                               zcs->stage = zcss_flush; /* pass-through to flush stage */
> >                       }
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case zcss_flush: {
> >                       size_t const toFlush = zcs->outBuffContentSize - zcs->outBuffFlushedSize;
> > diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
> > index db6761ea4deb..66cd487a326a 100644
> > --- a/lib/zstd/decompress.c
> > +++ b/lib/zstd/decompress.c
> > @@ -442,7 +442,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize
> >               case set_repeat:
> >                       if (dctx->litEntropy == 0)
> >                               return ERROR(dictionary_corrupted);
> > -                     /* fall through */
> > +                     fallthrough;
> >               case set_compressed:
> >                       if (srcSize < 5)
> >                               return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
> > @@ -1768,7 +1768,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, c
> >                       return 0;
> >               }
> >               dctx->expected = 0; /* not necessary to copy more */
> > -             /* fall through */
> > +             fallthrough;
> >
> >       case ZSTDds_decodeFrameHeader:
> >               memcpy(dctx->headerBuffer + ZSTD_frameHeaderSize_prefix, src, dctx->expected);
> > @@ -2309,7 +2309,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> >               switch (zds->stage) {
> >               case zdss_init:
> >                       ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case zdss_loadHeader: {
> >                       size_t const hSize = ZSTD_getFrameParams(&zds->fParams, zds->headerBuffer, zds->lhSize);
> > @@ -2376,7 +2376,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> >                       }
> >                       zds->stage = zdss_read;
> >               }
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case zdss_read: {
> >                       size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> > @@ -2405,7 +2405,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> >                       zds->stage = zdss_load;
> >                       /* pass-through */
> >               }
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case zdss_load: {
> >                       size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> > @@ -2438,7 +2438,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> >                               /* pass-through */
> >                       }
> >               }
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case zdss_flush: {
> >                       size_t const toFlushSize = zds->outEnd - zds->outStart;
> > diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
> > index e727812d12aa..08b4ae80aed4 100644
> > --- a/lib/zstd/huf_compress.c
> > +++ b/lib/zstd/huf_compress.c
> > @@ -556,9 +556,9 @@ size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, si
> >       n = srcSize & ~3; /* join to mod 4 */
> >       switch (srcSize & 3) {
> >       case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
> > -             /* fall through */
> > +             fallthrough;
> >       case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
> > -             /* fall through */
> > +             fallthrough;
> >       case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
> >       case 0:
> >       default:;
> > --
> > 2.29.2.299.gdc1121823c-goog
> >



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
@ 2020-11-17 19:10       ` Nick Desaulniers
  0 siblings, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 2020-11-17 19:10 UTC (permalink / raw)
  To: Gustavo A . R . Silva, Michael Ellerman
  Cc: Miguel Ojeda, LKML, clang-built-linux, Paul Mackerras,
	Nathan Chancellor, linuxppc-dev

On Mon, Nov 16, 2020 at 7:02 PM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Sun, Nov 15, 2020 at 08:35:31PM -0800, Nick Desaulniers wrote:
> > This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
> > pseudo-keyword in lib/")

Gustavo, whose tree did 6a9dc5fd6170 and df561f6688fe go up to
mainline in?  I'm not sure whether you or MPE (ppc) or someone else
should pick it this series?

> >
> > Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
> > re-enable these fixes for lib/.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/236
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
>
> Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> Tested-by: Nathan Chancellor <natechancellor@gmail.com>
>
> > ---
> >  lib/asn1_decoder.c      |  4 ++--
> >  lib/assoc_array.c       |  2 +-
> >  lib/bootconfig.c        |  4 ++--
> >  lib/cmdline.c           | 10 +++++-----
> >  lib/dim/net_dim.c       |  2 +-
> >  lib/dim/rdma_dim.c      |  4 ++--
> >  lib/glob.c              |  2 +-
> >  lib/siphash.c           | 36 ++++++++++++++++++------------------
> >  lib/ts_fsm.c            |  2 +-
> >  lib/vsprintf.c          | 14 +++++++-------
> >  lib/xz/xz_dec_lzma2.c   |  4 ++--
> >  lib/xz/xz_dec_stream.c  | 16 ++++++++--------
> >  lib/zstd/bitstream.h    | 10 +++++-----
> >  lib/zstd/compress.c     |  2 +-
> >  lib/zstd/decompress.c   | 12 ++++++------
> >  lib/zstd/huf_compress.c |  4 ++--
> >  16 files changed, 64 insertions(+), 64 deletions(-)
> >
> > diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
> > index 58f72b25f8e9..13da529e2e72 100644
> > --- a/lib/asn1_decoder.c
> > +++ b/lib/asn1_decoder.c
> > @@ -381,7 +381,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
> >       case ASN1_OP_END_SET_ACT:
> >               if (unlikely(!(flags & FLAG_MATCHED)))
> >                       goto tag_mismatch;
> > -             /* fall through */
> > +             fallthrough;
> >
> >       case ASN1_OP_END_SEQ:
> >       case ASN1_OP_END_SET_OF:
> > @@ -448,7 +448,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
> >                       pc += asn1_op_lengths[op];
> >                       goto next_op;
> >               }
> > -             /* fall through */
> > +             fallthrough;
> >
> >       case ASN1_OP_ACT:
> >               ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
> > diff --git a/lib/assoc_array.c b/lib/assoc_array.c
> > index 6f4bcf524554..04c98799c3ba 100644
> > --- a/lib/assoc_array.c
> > +++ b/lib/assoc_array.c
> > @@ -1113,7 +1113,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
> >                                               index_key))
> >                               goto found_leaf;
> >               }
> > -             /* fall through */
> > +             fallthrough;
> >       case assoc_array_walk_tree_empty:
> >       case assoc_array_walk_found_wrong_shortcut:
> >       default:
> > diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> > index 649ed44f199c..9f8c70a98fcf 100644
> > --- a/lib/bootconfig.c
> > +++ b/lib/bootconfig.c
> > @@ -827,7 +827,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
> >                                                       q - 2);
> >                               break;
> >                       }
> > -                     /* fall through */
> > +                     fallthrough;
> >               case '=':
> >                       ret = xbc_parse_kv(&p, q, c);
> >                       break;
> > @@ -836,7 +836,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
> >                       break;
> >               case '#':
> >                       q = skip_comment(q);
> > -                     /* fall through */
> > +                     fallthrough;
> >               case ';':
> >               case '\n':
> >                       ret = xbc_parse_key(&p, q);
> > diff --git a/lib/cmdline.c b/lib/cmdline.c
> > index 9e186234edc0..46f2cb4ce6d1 100644
> > --- a/lib/cmdline.c
> > +++ b/lib/cmdline.c
> > @@ -144,23 +144,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
> >       case 'E':
> >       case 'e':
> >               ret <<= 10;
> > -             /* fall through */
> > +             fallthrough;
> >       case 'P':
> >       case 'p':
> >               ret <<= 10;
> > -             /* fall through */
> > +             fallthrough;
> >       case 'T':
> >       case 't':
> >               ret <<= 10;
> > -             /* fall through */
> > +             fallthrough;
> >       case 'G':
> >       case 'g':
> >               ret <<= 10;
> > -             /* fall through */
> > +             fallthrough;
> >       case 'M':
> >       case 'm':
> >               ret <<= 10;
> > -             /* fall through */
> > +             fallthrough;
> >       case 'K':
> >       case 'k':
> >               ret <<= 10;
> > diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
> > index a4db51c21266..06811d866775 100644
> > --- a/lib/dim/net_dim.c
> > +++ b/lib/dim/net_dim.c
> > @@ -233,7 +233,7 @@ void net_dim(struct dim *dim, struct dim_sample end_sample)
> >                       schedule_work(&dim->work);
> >                       break;
> >               }
> > -             /* fall through */
> > +             fallthrough;
> >       case DIM_START_MEASURE:
> >               dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
> >                                 end_sample.byte_ctr, &dim->start_sample);
> > diff --git a/lib/dim/rdma_dim.c b/lib/dim/rdma_dim.c
> > index f7e26c7b4749..15462d54758d 100644
> > --- a/lib/dim/rdma_dim.c
> > +++ b/lib/dim/rdma_dim.c
> > @@ -59,7 +59,7 @@ static bool rdma_dim_decision(struct dim_stats *curr_stats, struct dim *dim)
> >                       break;
> >               case DIM_STATS_WORSE:
> >                       dim_turn(dim);
> > -                     /* fall through */
> > +                     fallthrough;
> >               case DIM_STATS_BETTER:
> >                       step_res = rdma_dim_step(dim);
> >                       if (step_res == DIM_ON_EDGE)
> > @@ -94,7 +94,7 @@ void rdma_dim(struct dim *dim, u64 completions)
> >                       schedule_work(&dim->work);
> >                       break;
> >               }
> > -             /* fall through */
> > +             fallthrough;
> >       case DIM_START_MEASURE:
> >               dim->state = DIM_MEASURE_IN_PROGRESS;
> >               dim_update_sample_with_comps(curr_sample->event_ctr, 0, 0,
> > diff --git a/lib/glob.c b/lib/glob.c
> > index 52e3ed7e4a9b..85ecbda45cd8 100644
> > --- a/lib/glob.c
> > +++ b/lib/glob.c
> > @@ -102,7 +102,7 @@ bool __pure glob_match(char const *pat, char const *str)
> >                       break;
> >               case '\\':
> >                       d = *pat++;
> > -                     /* fall through */
> > +                     fallthrough;
> >               default:        /* Literal character */
> >  literal:
> >                       if (c == d) {
> > diff --git a/lib/siphash.c b/lib/siphash.c
> > index c47bb6ff2149..a90112ee72a1 100644
> > --- a/lib/siphash.c
> > +++ b/lib/siphash.c
> > @@ -68,11 +68,11 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key)
> >                                                 bytemask_from_count(left)));
> >  #else
> >       switch (left) {
> > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> >       case 4: b |= le32_to_cpup(data); break;
> > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> >       case 2: b |= le16_to_cpup(data); break;
> >       case 1: b |= end[0];
> >       }
> > @@ -101,11 +101,11 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key)
> >                                                 bytemask_from_count(left)));
> >  #else
> >       switch (left) {
> > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> >       case 4: b |= get_unaligned_le32(end); break;
> > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> >       case 2: b |= get_unaligned_le16(end); break;
> >       case 1: b |= end[0];
> >       }
> > @@ -268,11 +268,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
> >                                                 bytemask_from_count(left)));
> >  #else
> >       switch (left) {
> > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> >       case 4: b |= le32_to_cpup(data); break;
> > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> >       case 2: b |= le16_to_cpup(data); break;
> >       case 1: b |= end[0];
> >       }
> > @@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
> >                                                 bytemask_from_count(left)));
> >  #else
> >       switch (left) {
> > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> >       case 4: b |= get_unaligned_le32(end); break;
> > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> >       case 2: b |= get_unaligned_le16(end); break;
> >       case 1: b |= end[0];
> >       }
> > @@ -431,7 +431,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
> >               v0 ^= m;
> >       }
> >       switch (left) {
> > -     case 3: b |= ((u32)end[2]) << 16; /* fall through */
> > +     case 3: b |= ((u32)end[2]) << 16; fallthrough;
> >       case 2: b |= le16_to_cpup(data); break;
> >       case 1: b |= end[0];
> >       }
> > @@ -454,7 +454,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
> >               v0 ^= m;
> >       }
> >       switch (left) {
> > -     case 3: b |= ((u32)end[2]) << 16; /* fall through */
> > +     case 3: b |= ((u32)end[2]) << 16; fallthrough;
> >       case 2: b |= get_unaligned_le16(end); break;
> >       case 1: b |= end[0];
> >       }
> > diff --git a/lib/ts_fsm.c b/lib/ts_fsm.c
> > index ab749ec10ab5..64fd9015ad80 100644
> > --- a/lib/ts_fsm.c
> > +++ b/lib/ts_fsm.c
> > @@ -193,7 +193,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state)
> >                               TOKEN_MISMATCH();
> >
> >                       block_idx++;
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case TS_FSM_ANY:
> >                       if (next == NULL)
> > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> > index 14c9a6af1b23..d3c5c16f391c 100644
> > --- a/lib/vsprintf.c
> > +++ b/lib/vsprintf.c
> > @@ -1265,7 +1265,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
> >
> >       case 'R':
> >               reversed = true;
> > -             /* fall through */
> > +             fallthrough;
> >
> >       default:
> >               separator = ':';
> > @@ -1682,7 +1682,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
> >       switch (*(++fmt)) {
> >       case 'L':
> >               uc = true;
> > -             /* fall through */
> > +             fallthrough;
> >       case 'l':
> >               index = guid_index;
> >               break;
> > @@ -2219,7 +2219,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
> >       case 'S':
> >       case 's':
> >               ptr = dereference_symbol_descriptor(ptr);
> > -             /* fall through */
> > +             fallthrough;
> >       case 'B':
> >               return symbol_string(buf, end, ptr, spec, fmt);
> >       case 'R':
> > @@ -2450,7 +2450,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
> >
> >       case 'x':
> >               spec->flags |= SMALL;
> > -             /* fall through */
> > +             fallthrough;
> >
> >       case 'X':
> >               spec->base = 16;
> > @@ -2468,7 +2468,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
> >                * utility, treat it as any other invalid or
> >                * unsupported format specifier.
> >                */
> > -             /* fall through */
> > +             fallthrough;
> >
> >       default:
> >               WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
> > @@ -3411,10 +3411,10 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
> >                       break;
> >               case 'i':
> >                       base = 0;
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 'd':
> >                       is_sign = true;
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 'u':
> >                       break;
> >               case '%':
> > diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
> > index 65a1aad8c223..ca2603abee08 100644
> > --- a/lib/xz/xz_dec_lzma2.c
> > +++ b/lib/xz/xz_dec_lzma2.c
> > @@ -1043,7 +1043,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
> >
> >                       s->lzma2.sequence = SEQ_LZMA_PREPARE;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_LZMA_PREPARE:
> >                       if (s->lzma2.compressed < RC_INIT_BYTES)
> > @@ -1055,7 +1055,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
> >                       s->lzma2.compressed -= RC_INIT_BYTES;
> >                       s->lzma2.sequence = SEQ_LZMA_RUN;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_LZMA_RUN:
> >                       /*
> > diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
> > index 32ab2a08b7cb..fea86deaaa01 100644
> > --- a/lib/xz/xz_dec_stream.c
> > +++ b/lib/xz/xz_dec_stream.c
> > @@ -583,7 +583,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >                       if (ret != XZ_OK)
> >                               return ret;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_BLOCK_START:
> >                       /* We need one byte of input to continue. */
> > @@ -608,7 +608,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >                       s->temp.pos = 0;
> >                       s->sequence = SEQ_BLOCK_HEADER;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_BLOCK_HEADER:
> >                       if (!fill_temp(s, b))
> > @@ -620,7 +620,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >
> >                       s->sequence = SEQ_BLOCK_UNCOMPRESS;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_BLOCK_UNCOMPRESS:
> >                       ret = dec_block(s, b);
> > @@ -629,7 +629,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >
> >                       s->sequence = SEQ_BLOCK_PADDING;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_BLOCK_PADDING:
> >                       /*
> > @@ -651,7 +651,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >
> >                       s->sequence = SEQ_BLOCK_CHECK;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_BLOCK_CHECK:
> >                       if (s->check_type == XZ_CHECK_CRC32) {
> > @@ -675,7 +675,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >
> >                       s->sequence = SEQ_INDEX_PADDING;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_INDEX_PADDING:
> >                       while ((s->index.size + (b->in_pos - s->in_start))
> > @@ -699,7 +699,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >
> >                       s->sequence = SEQ_INDEX_CRC32;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_INDEX_CRC32:
> >                       ret = crc32_validate(s, b);
> > @@ -709,7 +709,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> >                       s->temp.size = STREAM_HEADER_SIZE;
> >                       s->sequence = SEQ_STREAM_FOOTER;
> >
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case SEQ_STREAM_FOOTER:
> >                       if (!fill_temp(s, b))
> > diff --git a/lib/zstd/bitstream.h b/lib/zstd/bitstream.h
> > index 3a49784d5c61..7c65c66e41fd 100644
> > --- a/lib/zstd/bitstream.h
> > +++ b/lib/zstd/bitstream.h
> > @@ -259,15 +259,15 @@ ZSTD_STATIC size_t BIT_initDStream(BIT_DStream_t *bitD, const void *srcBuffer, s
> >               bitD->bitContainer = *(const BYTE *)(bitD->start);
> >               switch (srcSize) {
> >               case 7: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[6]) << (sizeof(bitD->bitContainer) * 8 - 16);
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 6: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[5]) << (sizeof(bitD->bitContainer) * 8 - 24);
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 5: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[4]) << (sizeof(bitD->bitContainer) * 8 - 32);
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 4: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[3]) << 24;
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 3: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[2]) << 16;
> > -                     /* fall through */
> > +                     fallthrough;
> >               case 2: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[1]) << 8;
> >               default:;
> >               }
> > diff --git a/lib/zstd/compress.c b/lib/zstd/compress.c
> > index 5e0b67003e55..b080264ed3ad 100644
> > --- a/lib/zstd/compress.c
> > +++ b/lib/zstd/compress.c
> > @@ -3182,7 +3182,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t *
> >                               zcs->outBuffFlushedSize = 0;
> >                               zcs->stage = zcss_flush; /* pass-through to flush stage */
> >                       }
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case zcss_flush: {
> >                       size_t const toFlush = zcs->outBuffContentSize - zcs->outBuffFlushedSize;
> > diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
> > index db6761ea4deb..66cd487a326a 100644
> > --- a/lib/zstd/decompress.c
> > +++ b/lib/zstd/decompress.c
> > @@ -442,7 +442,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize
> >               case set_repeat:
> >                       if (dctx->litEntropy == 0)
> >                               return ERROR(dictionary_corrupted);
> > -                     /* fall through */
> > +                     fallthrough;
> >               case set_compressed:
> >                       if (srcSize < 5)
> >                               return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
> > @@ -1768,7 +1768,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, c
> >                       return 0;
> >               }
> >               dctx->expected = 0; /* not necessary to copy more */
> > -             /* fall through */
> > +             fallthrough;
> >
> >       case ZSTDds_decodeFrameHeader:
> >               memcpy(dctx->headerBuffer + ZSTD_frameHeaderSize_prefix, src, dctx->expected);
> > @@ -2309,7 +2309,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> >               switch (zds->stage) {
> >               case zdss_init:
> >                       ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case zdss_loadHeader: {
> >                       size_t const hSize = ZSTD_getFrameParams(&zds->fParams, zds->headerBuffer, zds->lhSize);
> > @@ -2376,7 +2376,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> >                       }
> >                       zds->stage = zdss_read;
> >               }
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case zdss_read: {
> >                       size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> > @@ -2405,7 +2405,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> >                       zds->stage = zdss_load;
> >                       /* pass-through */
> >               }
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case zdss_load: {
> >                       size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> > @@ -2438,7 +2438,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> >                               /* pass-through */
> >                       }
> >               }
> > -                     /* fall through */
> > +                     fallthrough;
> >
> >               case zdss_flush: {
> >                       size_t const toFlushSize = zds->outEnd - zds->outStart;
> > diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
> > index e727812d12aa..08b4ae80aed4 100644
> > --- a/lib/zstd/huf_compress.c
> > +++ b/lib/zstd/huf_compress.c
> > @@ -556,9 +556,9 @@ size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, si
> >       n = srcSize & ~3; /* join to mod 4 */
> >       switch (srcSize & 3) {
> >       case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
> > -             /* fall through */
> > +             fallthrough;
> >       case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
> > -             /* fall through */
> > +             fallthrough;
> >       case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
> >       case 0:
> >       default:;
> > --
> > 2.29.2.299.gdc1121823c-goog
> >



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  2020-11-17 19:10       ` Nick Desaulniers
@ 2020-11-17 22:16         ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-17 22:16 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Michael Ellerman, Nathan Chancellor, Benjamin Herrenschmidt,
	Paul Mackerras, clang-built-linux, linuxppc-dev, LKML,
	Miguel Ojeda

On Tue, Nov 17, 2020 at 11:10:26AM -0800, Nick Desaulniers wrote:
> On Mon, Nov 16, 2020 at 7:02 PM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > On Sun, Nov 15, 2020 at 08:35:31PM -0800, Nick Desaulniers wrote:
> > > This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
> > > pseudo-keyword in lib/")
> 
> Gustavo, whose tree did 6a9dc5fd6170 and df561f6688fe go up to

Mine.

> mainline in?  I'm not sure whether you or MPE (ppc) or someone else
> should pick it this series?

I'm happy to take this series in my tree.  I'm planing to send a
pull-request for -rc5 with more related changes. So, I can include
this in the same PR.

In the meantime I'll add this to my testing tree, so it can be
build-tested by the 0-day folks. :)

Thanks
--
Gustavo

> 
> > >
> > > Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
> > > re-enable these fixes for lib/.
> > >
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/236
> > > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> >
> > Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> > Tested-by: Nathan Chancellor <natechancellor@gmail.com>
> >
> > > ---
> > >  lib/asn1_decoder.c      |  4 ++--
> > >  lib/assoc_array.c       |  2 +-
> > >  lib/bootconfig.c        |  4 ++--
> > >  lib/cmdline.c           | 10 +++++-----
> > >  lib/dim/net_dim.c       |  2 +-
> > >  lib/dim/rdma_dim.c      |  4 ++--
> > >  lib/glob.c              |  2 +-
> > >  lib/siphash.c           | 36 ++++++++++++++++++------------------
> > >  lib/ts_fsm.c            |  2 +-
> > >  lib/vsprintf.c          | 14 +++++++-------
> > >  lib/xz/xz_dec_lzma2.c   |  4 ++--
> > >  lib/xz/xz_dec_stream.c  | 16 ++++++++--------
> > >  lib/zstd/bitstream.h    | 10 +++++-----
> > >  lib/zstd/compress.c     |  2 +-
> > >  lib/zstd/decompress.c   | 12 ++++++------
> > >  lib/zstd/huf_compress.c |  4 ++--
> > >  16 files changed, 64 insertions(+), 64 deletions(-)
> > >
> > > diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
> > > index 58f72b25f8e9..13da529e2e72 100644
> > > --- a/lib/asn1_decoder.c
> > > +++ b/lib/asn1_decoder.c
> > > @@ -381,7 +381,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
> > >       case ASN1_OP_END_SET_ACT:
> > >               if (unlikely(!(flags & FLAG_MATCHED)))
> > >                       goto tag_mismatch;
> > > -             /* fall through */
> > > +             fallthrough;
> > >
> > >       case ASN1_OP_END_SEQ:
> > >       case ASN1_OP_END_SET_OF:
> > > @@ -448,7 +448,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
> > >                       pc += asn1_op_lengths[op];
> > >                       goto next_op;
> > >               }
> > > -             /* fall through */
> > > +             fallthrough;
> > >
> > >       case ASN1_OP_ACT:
> > >               ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
> > > diff --git a/lib/assoc_array.c b/lib/assoc_array.c
> > > index 6f4bcf524554..04c98799c3ba 100644
> > > --- a/lib/assoc_array.c
> > > +++ b/lib/assoc_array.c
> > > @@ -1113,7 +1113,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
> > >                                               index_key))
> > >                               goto found_leaf;
> > >               }
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case assoc_array_walk_tree_empty:
> > >       case assoc_array_walk_found_wrong_shortcut:
> > >       default:
> > > diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> > > index 649ed44f199c..9f8c70a98fcf 100644
> > > --- a/lib/bootconfig.c
> > > +++ b/lib/bootconfig.c
> > > @@ -827,7 +827,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
> > >                                                       q - 2);
> > >                               break;
> > >                       }
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case '=':
> > >                       ret = xbc_parse_kv(&p, q, c);
> > >                       break;
> > > @@ -836,7 +836,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
> > >                       break;
> > >               case '#':
> > >                       q = skip_comment(q);
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case ';':
> > >               case '\n':
> > >                       ret = xbc_parse_key(&p, q);
> > > diff --git a/lib/cmdline.c b/lib/cmdline.c
> > > index 9e186234edc0..46f2cb4ce6d1 100644
> > > --- a/lib/cmdline.c
> > > +++ b/lib/cmdline.c
> > > @@ -144,23 +144,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
> > >       case 'E':
> > >       case 'e':
> > >               ret <<= 10;
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'P':
> > >       case 'p':
> > >               ret <<= 10;
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'T':
> > >       case 't':
> > >               ret <<= 10;
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'G':
> > >       case 'g':
> > >               ret <<= 10;
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'M':
> > >       case 'm':
> > >               ret <<= 10;
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'K':
> > >       case 'k':
> > >               ret <<= 10;
> > > diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
> > > index a4db51c21266..06811d866775 100644
> > > --- a/lib/dim/net_dim.c
> > > +++ b/lib/dim/net_dim.c
> > > @@ -233,7 +233,7 @@ void net_dim(struct dim *dim, struct dim_sample end_sample)
> > >                       schedule_work(&dim->work);
> > >                       break;
> > >               }
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case DIM_START_MEASURE:
> > >               dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
> > >                                 end_sample.byte_ctr, &dim->start_sample);
> > > diff --git a/lib/dim/rdma_dim.c b/lib/dim/rdma_dim.c
> > > index f7e26c7b4749..15462d54758d 100644
> > > --- a/lib/dim/rdma_dim.c
> > > +++ b/lib/dim/rdma_dim.c
> > > @@ -59,7 +59,7 @@ static bool rdma_dim_decision(struct dim_stats *curr_stats, struct dim *dim)
> > >                       break;
> > >               case DIM_STATS_WORSE:
> > >                       dim_turn(dim);
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case DIM_STATS_BETTER:
> > >                       step_res = rdma_dim_step(dim);
> > >                       if (step_res == DIM_ON_EDGE)
> > > @@ -94,7 +94,7 @@ void rdma_dim(struct dim *dim, u64 completions)
> > >                       schedule_work(&dim->work);
> > >                       break;
> > >               }
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case DIM_START_MEASURE:
> > >               dim->state = DIM_MEASURE_IN_PROGRESS;
> > >               dim_update_sample_with_comps(curr_sample->event_ctr, 0, 0,
> > > diff --git a/lib/glob.c b/lib/glob.c
> > > index 52e3ed7e4a9b..85ecbda45cd8 100644
> > > --- a/lib/glob.c
> > > +++ b/lib/glob.c
> > > @@ -102,7 +102,7 @@ bool __pure glob_match(char const *pat, char const *str)
> > >                       break;
> > >               case '\\':
> > >                       d = *pat++;
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               default:        /* Literal character */
> > >  literal:
> > >                       if (c == d) {
> > > diff --git a/lib/siphash.c b/lib/siphash.c
> > > index c47bb6ff2149..a90112ee72a1 100644
> > > --- a/lib/siphash.c
> > > +++ b/lib/siphash.c
> > > @@ -68,11 +68,11 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key)
> > >                                                 bytemask_from_count(left)));
> > >  #else
> > >       switch (left) {
> > > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> > >       case 4: b |= le32_to_cpup(data); break;
> > > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> > >       case 2: b |= le16_to_cpup(data); break;
> > >       case 1: b |= end[0];
> > >       }
> > > @@ -101,11 +101,11 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key)
> > >                                                 bytemask_from_count(left)));
> > >  #else
> > >       switch (left) {
> > > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> > >       case 4: b |= get_unaligned_le32(end); break;
> > > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> > >       case 2: b |= get_unaligned_le16(end); break;
> > >       case 1: b |= end[0];
> > >       }
> > > @@ -268,11 +268,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
> > >                                                 bytemask_from_count(left)));
> > >  #else
> > >       switch (left) {
> > > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> > >       case 4: b |= le32_to_cpup(data); break;
> > > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> > >       case 2: b |= le16_to_cpup(data); break;
> > >       case 1: b |= end[0];
> > >       }
> > > @@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
> > >                                                 bytemask_from_count(left)));
> > >  #else
> > >       switch (left) {
> > > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> > >       case 4: b |= get_unaligned_le32(end); break;
> > > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> > >       case 2: b |= get_unaligned_le16(end); break;
> > >       case 1: b |= end[0];
> > >       }
> > > @@ -431,7 +431,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
> > >               v0 ^= m;
> > >       }
> > >       switch (left) {
> > > -     case 3: b |= ((u32)end[2]) << 16; /* fall through */
> > > +     case 3: b |= ((u32)end[2]) << 16; fallthrough;
> > >       case 2: b |= le16_to_cpup(data); break;
> > >       case 1: b |= end[0];
> > >       }
> > > @@ -454,7 +454,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
> > >               v0 ^= m;
> > >       }
> > >       switch (left) {
> > > -     case 3: b |= ((u32)end[2]) << 16; /* fall through */
> > > +     case 3: b |= ((u32)end[2]) << 16; fallthrough;
> > >       case 2: b |= get_unaligned_le16(end); break;
> > >       case 1: b |= end[0];
> > >       }
> > > diff --git a/lib/ts_fsm.c b/lib/ts_fsm.c
> > > index ab749ec10ab5..64fd9015ad80 100644
> > > --- a/lib/ts_fsm.c
> > > +++ b/lib/ts_fsm.c
> > > @@ -193,7 +193,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state)
> > >                               TOKEN_MISMATCH();
> > >
> > >                       block_idx++;
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case TS_FSM_ANY:
> > >                       if (next == NULL)
> > > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> > > index 14c9a6af1b23..d3c5c16f391c 100644
> > > --- a/lib/vsprintf.c
> > > +++ b/lib/vsprintf.c
> > > @@ -1265,7 +1265,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
> > >
> > >       case 'R':
> > >               reversed = true;
> > > -             /* fall through */
> > > +             fallthrough;
> > >
> > >       default:
> > >               separator = ':';
> > > @@ -1682,7 +1682,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
> > >       switch (*(++fmt)) {
> > >       case 'L':
> > >               uc = true;
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'l':
> > >               index = guid_index;
> > >               break;
> > > @@ -2219,7 +2219,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
> > >       case 'S':
> > >       case 's':
> > >               ptr = dereference_symbol_descriptor(ptr);
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'B':
> > >               return symbol_string(buf, end, ptr, spec, fmt);
> > >       case 'R':
> > > @@ -2450,7 +2450,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
> > >
> > >       case 'x':
> > >               spec->flags |= SMALL;
> > > -             /* fall through */
> > > +             fallthrough;
> > >
> > >       case 'X':
> > >               spec->base = 16;
> > > @@ -2468,7 +2468,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
> > >                * utility, treat it as any other invalid or
> > >                * unsupported format specifier.
> > >                */
> > > -             /* fall through */
> > > +             fallthrough;
> > >
> > >       default:
> > >               WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
> > > @@ -3411,10 +3411,10 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
> > >                       break;
> > >               case 'i':
> > >                       base = 0;
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 'd':
> > >                       is_sign = true;
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 'u':
> > >                       break;
> > >               case '%':
> > > diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
> > > index 65a1aad8c223..ca2603abee08 100644
> > > --- a/lib/xz/xz_dec_lzma2.c
> > > +++ b/lib/xz/xz_dec_lzma2.c
> > > @@ -1043,7 +1043,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
> > >
> > >                       s->lzma2.sequence = SEQ_LZMA_PREPARE;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_LZMA_PREPARE:
> > >                       if (s->lzma2.compressed < RC_INIT_BYTES)
> > > @@ -1055,7 +1055,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
> > >                       s->lzma2.compressed -= RC_INIT_BYTES;
> > >                       s->lzma2.sequence = SEQ_LZMA_RUN;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_LZMA_RUN:
> > >                       /*
> > > diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
> > > index 32ab2a08b7cb..fea86deaaa01 100644
> > > --- a/lib/xz/xz_dec_stream.c
> > > +++ b/lib/xz/xz_dec_stream.c
> > > @@ -583,7 +583,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >                       if (ret != XZ_OK)
> > >                               return ret;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_BLOCK_START:
> > >                       /* We need one byte of input to continue. */
> > > @@ -608,7 +608,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >                       s->temp.pos = 0;
> > >                       s->sequence = SEQ_BLOCK_HEADER;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_BLOCK_HEADER:
> > >                       if (!fill_temp(s, b))
> > > @@ -620,7 +620,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >
> > >                       s->sequence = SEQ_BLOCK_UNCOMPRESS;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_BLOCK_UNCOMPRESS:
> > >                       ret = dec_block(s, b);
> > > @@ -629,7 +629,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >
> > >                       s->sequence = SEQ_BLOCK_PADDING;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_BLOCK_PADDING:
> > >                       /*
> > > @@ -651,7 +651,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >
> > >                       s->sequence = SEQ_BLOCK_CHECK;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_BLOCK_CHECK:
> > >                       if (s->check_type == XZ_CHECK_CRC32) {
> > > @@ -675,7 +675,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >
> > >                       s->sequence = SEQ_INDEX_PADDING;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_INDEX_PADDING:
> > >                       while ((s->index.size + (b->in_pos - s->in_start))
> > > @@ -699,7 +699,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >
> > >                       s->sequence = SEQ_INDEX_CRC32;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_INDEX_CRC32:
> > >                       ret = crc32_validate(s, b);
> > > @@ -709,7 +709,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >                       s->temp.size = STREAM_HEADER_SIZE;
> > >                       s->sequence = SEQ_STREAM_FOOTER;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_STREAM_FOOTER:
> > >                       if (!fill_temp(s, b))
> > > diff --git a/lib/zstd/bitstream.h b/lib/zstd/bitstream.h
> > > index 3a49784d5c61..7c65c66e41fd 100644
> > > --- a/lib/zstd/bitstream.h
> > > +++ b/lib/zstd/bitstream.h
> > > @@ -259,15 +259,15 @@ ZSTD_STATIC size_t BIT_initDStream(BIT_DStream_t *bitD, const void *srcBuffer, s
> > >               bitD->bitContainer = *(const BYTE *)(bitD->start);
> > >               switch (srcSize) {
> > >               case 7: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[6]) << (sizeof(bitD->bitContainer) * 8 - 16);
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 6: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[5]) << (sizeof(bitD->bitContainer) * 8 - 24);
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 5: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[4]) << (sizeof(bitD->bitContainer) * 8 - 32);
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 4: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[3]) << 24;
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 3: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[2]) << 16;
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 2: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[1]) << 8;
> > >               default:;
> > >               }
> > > diff --git a/lib/zstd/compress.c b/lib/zstd/compress.c
> > > index 5e0b67003e55..b080264ed3ad 100644
> > > --- a/lib/zstd/compress.c
> > > +++ b/lib/zstd/compress.c
> > > @@ -3182,7 +3182,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t *
> > >                               zcs->outBuffFlushedSize = 0;
> > >                               zcs->stage = zcss_flush; /* pass-through to flush stage */
> > >                       }
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case zcss_flush: {
> > >                       size_t const toFlush = zcs->outBuffContentSize - zcs->outBuffFlushedSize;
> > > diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
> > > index db6761ea4deb..66cd487a326a 100644
> > > --- a/lib/zstd/decompress.c
> > > +++ b/lib/zstd/decompress.c
> > > @@ -442,7 +442,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize
> > >               case set_repeat:
> > >                       if (dctx->litEntropy == 0)
> > >                               return ERROR(dictionary_corrupted);
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case set_compressed:
> > >                       if (srcSize < 5)
> > >                               return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
> > > @@ -1768,7 +1768,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, c
> > >                       return 0;
> > >               }
> > >               dctx->expected = 0; /* not necessary to copy more */
> > > -             /* fall through */
> > > +             fallthrough;
> > >
> > >       case ZSTDds_decodeFrameHeader:
> > >               memcpy(dctx->headerBuffer + ZSTD_frameHeaderSize_prefix, src, dctx->expected);
> > > @@ -2309,7 +2309,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> > >               switch (zds->stage) {
> > >               case zdss_init:
> > >                       ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case zdss_loadHeader: {
> > >                       size_t const hSize = ZSTD_getFrameParams(&zds->fParams, zds->headerBuffer, zds->lhSize);
> > > @@ -2376,7 +2376,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> > >                       }
> > >                       zds->stage = zdss_read;
> > >               }
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case zdss_read: {
> > >                       size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> > > @@ -2405,7 +2405,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> > >                       zds->stage = zdss_load;
> > >                       /* pass-through */
> > >               }
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case zdss_load: {
> > >                       size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> > > @@ -2438,7 +2438,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> > >                               /* pass-through */
> > >                       }
> > >               }
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case zdss_flush: {
> > >                       size_t const toFlushSize = zds->outEnd - zds->outStart;
> > > diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
> > > index e727812d12aa..08b4ae80aed4 100644
> > > --- a/lib/zstd/huf_compress.c
> > > +++ b/lib/zstd/huf_compress.c
> > > @@ -556,9 +556,9 @@ size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, si
> > >       n = srcSize & ~3; /* join to mod 4 */
> > >       switch (srcSize & 3) {
> > >       case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
> > >       case 0:
> > >       default:;
> > > --
> > > 2.29.2.299.gdc1121823c-goog
> > >
> 
> 
> 
> -- 
> Thanks,
> ~Nick Desaulniers

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
@ 2020-11-17 22:16         ` Gustavo A. R. Silva
  0 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-17 22:16 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Miguel Ojeda, LKML, clang-built-linux, Paul Mackerras,
	Nathan Chancellor, linuxppc-dev

On Tue, Nov 17, 2020 at 11:10:26AM -0800, Nick Desaulniers wrote:
> On Mon, Nov 16, 2020 at 7:02 PM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > On Sun, Nov 15, 2020 at 08:35:31PM -0800, Nick Desaulniers wrote:
> > > This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
> > > pseudo-keyword in lib/")
> 
> Gustavo, whose tree did 6a9dc5fd6170 and df561f6688fe go up to

Mine.

> mainline in?  I'm not sure whether you or MPE (ppc) or someone else
> should pick it this series?

I'm happy to take this series in my tree.  I'm planing to send a
pull-request for -rc5 with more related changes. So, I can include
this in the same PR.

In the meantime I'll add this to my testing tree, so it can be
build-tested by the 0-day folks. :)

Thanks
--
Gustavo

> 
> > >
> > > Now that we can build arch/powerpc/boot/ free of -Wimplicit-fallthrough,
> > > re-enable these fixes for lib/.
> > >
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/236
> > > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> >
> > Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> > Tested-by: Nathan Chancellor <natechancellor@gmail.com>
> >
> > > ---
> > >  lib/asn1_decoder.c      |  4 ++--
> > >  lib/assoc_array.c       |  2 +-
> > >  lib/bootconfig.c        |  4 ++--
> > >  lib/cmdline.c           | 10 +++++-----
> > >  lib/dim/net_dim.c       |  2 +-
> > >  lib/dim/rdma_dim.c      |  4 ++--
> > >  lib/glob.c              |  2 +-
> > >  lib/siphash.c           | 36 ++++++++++++++++++------------------
> > >  lib/ts_fsm.c            |  2 +-
> > >  lib/vsprintf.c          | 14 +++++++-------
> > >  lib/xz/xz_dec_lzma2.c   |  4 ++--
> > >  lib/xz/xz_dec_stream.c  | 16 ++++++++--------
> > >  lib/zstd/bitstream.h    | 10 +++++-----
> > >  lib/zstd/compress.c     |  2 +-
> > >  lib/zstd/decompress.c   | 12 ++++++------
> > >  lib/zstd/huf_compress.c |  4 ++--
> > >  16 files changed, 64 insertions(+), 64 deletions(-)
> > >
> > > diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
> > > index 58f72b25f8e9..13da529e2e72 100644
> > > --- a/lib/asn1_decoder.c
> > > +++ b/lib/asn1_decoder.c
> > > @@ -381,7 +381,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
> > >       case ASN1_OP_END_SET_ACT:
> > >               if (unlikely(!(flags & FLAG_MATCHED)))
> > >                       goto tag_mismatch;
> > > -             /* fall through */
> > > +             fallthrough;
> > >
> > >       case ASN1_OP_END_SEQ:
> > >       case ASN1_OP_END_SET_OF:
> > > @@ -448,7 +448,7 @@ int asn1_ber_decoder(const struct asn1_decoder *decoder,
> > >                       pc += asn1_op_lengths[op];
> > >                       goto next_op;
> > >               }
> > > -             /* fall through */
> > > +             fallthrough;
> > >
> > >       case ASN1_OP_ACT:
> > >               ret = actions[machine[pc + 1]](context, hdr, tag, data + tdp, len);
> > > diff --git a/lib/assoc_array.c b/lib/assoc_array.c
> > > index 6f4bcf524554..04c98799c3ba 100644
> > > --- a/lib/assoc_array.c
> > > +++ b/lib/assoc_array.c
> > > @@ -1113,7 +1113,7 @@ struct assoc_array_edit *assoc_array_delete(struct assoc_array *array,
> > >                                               index_key))
> > >                               goto found_leaf;
> > >               }
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case assoc_array_walk_tree_empty:
> > >       case assoc_array_walk_found_wrong_shortcut:
> > >       default:
> > > diff --git a/lib/bootconfig.c b/lib/bootconfig.c
> > > index 649ed44f199c..9f8c70a98fcf 100644
> > > --- a/lib/bootconfig.c
> > > +++ b/lib/bootconfig.c
> > > @@ -827,7 +827,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
> > >                                                       q - 2);
> > >                               break;
> > >                       }
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case '=':
> > >                       ret = xbc_parse_kv(&p, q, c);
> > >                       break;
> > > @@ -836,7 +836,7 @@ int __init xbc_init(char *buf, const char **emsg, int *epos)
> > >                       break;
> > >               case '#':
> > >                       q = skip_comment(q);
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case ';':
> > >               case '\n':
> > >                       ret = xbc_parse_key(&p, q);
> > > diff --git a/lib/cmdline.c b/lib/cmdline.c
> > > index 9e186234edc0..46f2cb4ce6d1 100644
> > > --- a/lib/cmdline.c
> > > +++ b/lib/cmdline.c
> > > @@ -144,23 +144,23 @@ unsigned long long memparse(const char *ptr, char **retptr)
> > >       case 'E':
> > >       case 'e':
> > >               ret <<= 10;
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'P':
> > >       case 'p':
> > >               ret <<= 10;
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'T':
> > >       case 't':
> > >               ret <<= 10;
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'G':
> > >       case 'g':
> > >               ret <<= 10;
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'M':
> > >       case 'm':
> > >               ret <<= 10;
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'K':
> > >       case 'k':
> > >               ret <<= 10;
> > > diff --git a/lib/dim/net_dim.c b/lib/dim/net_dim.c
> > > index a4db51c21266..06811d866775 100644
> > > --- a/lib/dim/net_dim.c
> > > +++ b/lib/dim/net_dim.c
> > > @@ -233,7 +233,7 @@ void net_dim(struct dim *dim, struct dim_sample end_sample)
> > >                       schedule_work(&dim->work);
> > >                       break;
> > >               }
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case DIM_START_MEASURE:
> > >               dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
> > >                                 end_sample.byte_ctr, &dim->start_sample);
> > > diff --git a/lib/dim/rdma_dim.c b/lib/dim/rdma_dim.c
> > > index f7e26c7b4749..15462d54758d 100644
> > > --- a/lib/dim/rdma_dim.c
> > > +++ b/lib/dim/rdma_dim.c
> > > @@ -59,7 +59,7 @@ static bool rdma_dim_decision(struct dim_stats *curr_stats, struct dim *dim)
> > >                       break;
> > >               case DIM_STATS_WORSE:
> > >                       dim_turn(dim);
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case DIM_STATS_BETTER:
> > >                       step_res = rdma_dim_step(dim);
> > >                       if (step_res == DIM_ON_EDGE)
> > > @@ -94,7 +94,7 @@ void rdma_dim(struct dim *dim, u64 completions)
> > >                       schedule_work(&dim->work);
> > >                       break;
> > >               }
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case DIM_START_MEASURE:
> > >               dim->state = DIM_MEASURE_IN_PROGRESS;
> > >               dim_update_sample_with_comps(curr_sample->event_ctr, 0, 0,
> > > diff --git a/lib/glob.c b/lib/glob.c
> > > index 52e3ed7e4a9b..85ecbda45cd8 100644
> > > --- a/lib/glob.c
> > > +++ b/lib/glob.c
> > > @@ -102,7 +102,7 @@ bool __pure glob_match(char const *pat, char const *str)
> > >                       break;
> > >               case '\\':
> > >                       d = *pat++;
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               default:        /* Literal character */
> > >  literal:
> > >                       if (c == d) {
> > > diff --git a/lib/siphash.c b/lib/siphash.c
> > > index c47bb6ff2149..a90112ee72a1 100644
> > > --- a/lib/siphash.c
> > > +++ b/lib/siphash.c
> > > @@ -68,11 +68,11 @@ u64 __siphash_aligned(const void *data, size_t len, const siphash_key_t *key)
> > >                                                 bytemask_from_count(left)));
> > >  #else
> > >       switch (left) {
> > > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> > >       case 4: b |= le32_to_cpup(data); break;
> > > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> > >       case 2: b |= le16_to_cpup(data); break;
> > >       case 1: b |= end[0];
> > >       }
> > > @@ -101,11 +101,11 @@ u64 __siphash_unaligned(const void *data, size_t len, const siphash_key_t *key)
> > >                                                 bytemask_from_count(left)));
> > >  #else
> > >       switch (left) {
> > > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> > >       case 4: b |= get_unaligned_le32(end); break;
> > > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> > >       case 2: b |= get_unaligned_le16(end); break;
> > >       case 1: b |= end[0];
> > >       }
> > > @@ -268,11 +268,11 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
> > >                                                 bytemask_from_count(left)));
> > >  #else
> > >       switch (left) {
> > > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> > >       case 4: b |= le32_to_cpup(data); break;
> > > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> > >       case 2: b |= le16_to_cpup(data); break;
> > >       case 1: b |= end[0];
> > >       }
> > > @@ -301,11 +301,11 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
> > >                                                 bytemask_from_count(left)));
> > >  #else
> > >       switch (left) {
> > > -     case 7: b |= ((u64)end[6]) << 48; /* fall through */
> > > -     case 6: b |= ((u64)end[5]) << 40; /* fall through */
> > > -     case 5: b |= ((u64)end[4]) << 32; /* fall through */
> > > +     case 7: b |= ((u64)end[6]) << 48; fallthrough;
> > > +     case 6: b |= ((u64)end[5]) << 40; fallthrough;
> > > +     case 5: b |= ((u64)end[4]) << 32; fallthrough;
> > >       case 4: b |= get_unaligned_le32(end); break;
> > > -     case 3: b |= ((u64)end[2]) << 16; /* fall through */
> > > +     case 3: b |= ((u64)end[2]) << 16; fallthrough;
> > >       case 2: b |= get_unaligned_le16(end); break;
> > >       case 1: b |= end[0];
> > >       }
> > > @@ -431,7 +431,7 @@ u32 __hsiphash_aligned(const void *data, size_t len, const hsiphash_key_t *key)
> > >               v0 ^= m;
> > >       }
> > >       switch (left) {
> > > -     case 3: b |= ((u32)end[2]) << 16; /* fall through */
> > > +     case 3: b |= ((u32)end[2]) << 16; fallthrough;
> > >       case 2: b |= le16_to_cpup(data); break;
> > >       case 1: b |= end[0];
> > >       }
> > > @@ -454,7 +454,7 @@ u32 __hsiphash_unaligned(const void *data, size_t len,
> > >               v0 ^= m;
> > >       }
> > >       switch (left) {
> > > -     case 3: b |= ((u32)end[2]) << 16; /* fall through */
> > > +     case 3: b |= ((u32)end[2]) << 16; fallthrough;
> > >       case 2: b |= get_unaligned_le16(end); break;
> > >       case 1: b |= end[0];
> > >       }
> > > diff --git a/lib/ts_fsm.c b/lib/ts_fsm.c
> > > index ab749ec10ab5..64fd9015ad80 100644
> > > --- a/lib/ts_fsm.c
> > > +++ b/lib/ts_fsm.c
> > > @@ -193,7 +193,7 @@ static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state)
> > >                               TOKEN_MISMATCH();
> > >
> > >                       block_idx++;
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case TS_FSM_ANY:
> > >                       if (next == NULL)
> > > diff --git a/lib/vsprintf.c b/lib/vsprintf.c
> > > index 14c9a6af1b23..d3c5c16f391c 100644
> > > --- a/lib/vsprintf.c
> > > +++ b/lib/vsprintf.c
> > > @@ -1265,7 +1265,7 @@ char *mac_address_string(char *buf, char *end, u8 *addr,
> > >
> > >       case 'R':
> > >               reversed = true;
> > > -             /* fall through */
> > > +             fallthrough;
> > >
> > >       default:
> > >               separator = ':';
> > > @@ -1682,7 +1682,7 @@ char *uuid_string(char *buf, char *end, const u8 *addr,
> > >       switch (*(++fmt)) {
> > >       case 'L':
> > >               uc = true;
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'l':
> > >               index = guid_index;
> > >               break;
> > > @@ -2219,7 +2219,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
> > >       case 'S':
> > >       case 's':
> > >               ptr = dereference_symbol_descriptor(ptr);
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 'B':
> > >               return symbol_string(buf, end, ptr, spec, fmt);
> > >       case 'R':
> > > @@ -2450,7 +2450,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
> > >
> > >       case 'x':
> > >               spec->flags |= SMALL;
> > > -             /* fall through */
> > > +             fallthrough;
> > >
> > >       case 'X':
> > >               spec->base = 16;
> > > @@ -2468,7 +2468,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)
> > >                * utility, treat it as any other invalid or
> > >                * unsupported format specifier.
> > >                */
> > > -             /* fall through */
> > > +             fallthrough;
> > >
> > >       default:
> > >               WARN_ONCE(1, "Please remove unsupported %%%c in format string\n", *fmt);
> > > @@ -3411,10 +3411,10 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
> > >                       break;
> > >               case 'i':
> > >                       base = 0;
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 'd':
> > >                       is_sign = true;
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 'u':
> > >                       break;
> > >               case '%':
> > > diff --git a/lib/xz/xz_dec_lzma2.c b/lib/xz/xz_dec_lzma2.c
> > > index 65a1aad8c223..ca2603abee08 100644
> > > --- a/lib/xz/xz_dec_lzma2.c
> > > +++ b/lib/xz/xz_dec_lzma2.c
> > > @@ -1043,7 +1043,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
> > >
> > >                       s->lzma2.sequence = SEQ_LZMA_PREPARE;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_LZMA_PREPARE:
> > >                       if (s->lzma2.compressed < RC_INIT_BYTES)
> > > @@ -1055,7 +1055,7 @@ XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s,
> > >                       s->lzma2.compressed -= RC_INIT_BYTES;
> > >                       s->lzma2.sequence = SEQ_LZMA_RUN;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_LZMA_RUN:
> > >                       /*
> > > diff --git a/lib/xz/xz_dec_stream.c b/lib/xz/xz_dec_stream.c
> > > index 32ab2a08b7cb..fea86deaaa01 100644
> > > --- a/lib/xz/xz_dec_stream.c
> > > +++ b/lib/xz/xz_dec_stream.c
> > > @@ -583,7 +583,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >                       if (ret != XZ_OK)
> > >                               return ret;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_BLOCK_START:
> > >                       /* We need one byte of input to continue. */
> > > @@ -608,7 +608,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >                       s->temp.pos = 0;
> > >                       s->sequence = SEQ_BLOCK_HEADER;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_BLOCK_HEADER:
> > >                       if (!fill_temp(s, b))
> > > @@ -620,7 +620,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >
> > >                       s->sequence = SEQ_BLOCK_UNCOMPRESS;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_BLOCK_UNCOMPRESS:
> > >                       ret = dec_block(s, b);
> > > @@ -629,7 +629,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >
> > >                       s->sequence = SEQ_BLOCK_PADDING;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_BLOCK_PADDING:
> > >                       /*
> > > @@ -651,7 +651,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >
> > >                       s->sequence = SEQ_BLOCK_CHECK;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_BLOCK_CHECK:
> > >                       if (s->check_type == XZ_CHECK_CRC32) {
> > > @@ -675,7 +675,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >
> > >                       s->sequence = SEQ_INDEX_PADDING;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_INDEX_PADDING:
> > >                       while ((s->index.size + (b->in_pos - s->in_start))
> > > @@ -699,7 +699,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >
> > >                       s->sequence = SEQ_INDEX_CRC32;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_INDEX_CRC32:
> > >                       ret = crc32_validate(s, b);
> > > @@ -709,7 +709,7 @@ static enum xz_ret dec_main(struct xz_dec *s, struct xz_buf *b)
> > >                       s->temp.size = STREAM_HEADER_SIZE;
> > >                       s->sequence = SEQ_STREAM_FOOTER;
> > >
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case SEQ_STREAM_FOOTER:
> > >                       if (!fill_temp(s, b))
> > > diff --git a/lib/zstd/bitstream.h b/lib/zstd/bitstream.h
> > > index 3a49784d5c61..7c65c66e41fd 100644
> > > --- a/lib/zstd/bitstream.h
> > > +++ b/lib/zstd/bitstream.h
> > > @@ -259,15 +259,15 @@ ZSTD_STATIC size_t BIT_initDStream(BIT_DStream_t *bitD, const void *srcBuffer, s
> > >               bitD->bitContainer = *(const BYTE *)(bitD->start);
> > >               switch (srcSize) {
> > >               case 7: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[6]) << (sizeof(bitD->bitContainer) * 8 - 16);
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 6: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[5]) << (sizeof(bitD->bitContainer) * 8 - 24);
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 5: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[4]) << (sizeof(bitD->bitContainer) * 8 - 32);
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 4: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[3]) << 24;
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 3: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[2]) << 16;
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case 2: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[1]) << 8;
> > >               default:;
> > >               }
> > > diff --git a/lib/zstd/compress.c b/lib/zstd/compress.c
> > > index 5e0b67003e55..b080264ed3ad 100644
> > > --- a/lib/zstd/compress.c
> > > +++ b/lib/zstd/compress.c
> > > @@ -3182,7 +3182,7 @@ static size_t ZSTD_compressStream_generic(ZSTD_CStream *zcs, void *dst, size_t *
> > >                               zcs->outBuffFlushedSize = 0;
> > >                               zcs->stage = zcss_flush; /* pass-through to flush stage */
> > >                       }
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case zcss_flush: {
> > >                       size_t const toFlush = zcs->outBuffContentSize - zcs->outBuffFlushedSize;
> > > diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
> > > index db6761ea4deb..66cd487a326a 100644
> > > --- a/lib/zstd/decompress.c
> > > +++ b/lib/zstd/decompress.c
> > > @@ -442,7 +442,7 @@ size_t ZSTD_decodeLiteralsBlock(ZSTD_DCtx *dctx, const void *src, size_t srcSize
> > >               case set_repeat:
> > >                       if (dctx->litEntropy == 0)
> > >                               return ERROR(dictionary_corrupted);
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >               case set_compressed:
> > >                       if (srcSize < 5)
> > >                               return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for case 3 */
> > > @@ -1768,7 +1768,7 @@ size_t ZSTD_decompressContinue(ZSTD_DCtx *dctx, void *dst, size_t dstCapacity, c
> > >                       return 0;
> > >               }
> > >               dctx->expected = 0; /* not necessary to copy more */
> > > -             /* fall through */
> > > +             fallthrough;
> > >
> > >       case ZSTDds_decodeFrameHeader:
> > >               memcpy(dctx->headerBuffer + ZSTD_frameHeaderSize_prefix, src, dctx->expected);
> > > @@ -2309,7 +2309,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> > >               switch (zds->stage) {
> > >               case zdss_init:
> > >                       ZSTD_resetDStream(zds); /* transparent reset on starting decoding a new frame */
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case zdss_loadHeader: {
> > >                       size_t const hSize = ZSTD_getFrameParams(&zds->fParams, zds->headerBuffer, zds->lhSize);
> > > @@ -2376,7 +2376,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> > >                       }
> > >                       zds->stage = zdss_read;
> > >               }
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case zdss_read: {
> > >                       size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> > > @@ -2405,7 +2405,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> > >                       zds->stage = zdss_load;
> > >                       /* pass-through */
> > >               }
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case zdss_load: {
> > >                       size_t const neededInSize = ZSTD_nextSrcSizeToDecompress(zds->dctx);
> > > @@ -2438,7 +2438,7 @@ size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inB
> > >                               /* pass-through */
> > >                       }
> > >               }
> > > -                     /* fall through */
> > > +                     fallthrough;
> > >
> > >               case zdss_flush: {
> > >                       size_t const toFlushSize = zds->outEnd - zds->outStart;
> > > diff --git a/lib/zstd/huf_compress.c b/lib/zstd/huf_compress.c
> > > index e727812d12aa..08b4ae80aed4 100644
> > > --- a/lib/zstd/huf_compress.c
> > > +++ b/lib/zstd/huf_compress.c
> > > @@ -556,9 +556,9 @@ size_t HUF_compress1X_usingCTable(void *dst, size_t dstSize, const void *src, si
> > >       n = srcSize & ~3; /* join to mod 4 */
> > >       switch (srcSize & 3) {
> > >       case 3: HUF_encodeSymbol(&bitC, ip[n + 2], CTable); HUF_FLUSHBITS_2(&bitC);
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 2: HUF_encodeSymbol(&bitC, ip[n + 1], CTable); HUF_FLUSHBITS_1(&bitC);
> > > -             /* fall through */
> > > +             fallthrough;
> > >       case 1: HUF_encodeSymbol(&bitC, ip[n + 0], CTable); HUF_FLUSHBITS(&bitC);
> > >       case 0:
> > >       default:;
> > > --
> > > 2.29.2.299.gdc1121823c-goog
> > >
> 
> 
> 
> -- 
> Thanks,
> ~Nick Desaulniers

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  2020-11-17 22:16         ` Gustavo A. R. Silva
@ 2020-11-17 22:28           ` Nick Desaulniers
  -1 siblings, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 2020-11-17 22:28 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Michael Ellerman, Nathan Chancellor, Benjamin Herrenschmidt,
	Paul Mackerras, clang-built-linux, linuxppc-dev, LKML,
	Miguel Ojeda

On Tue, Nov 17, 2020 at 2:16 PM Gustavo A. R. Silva
<gustavoars@kernel.org> wrote:
>
> I'm happy to take this series in my tree.  I'm planing to send a
> pull-request for -rc5 with more related changes. So, I can include
> this in the same PR.
>
> In the meantime I'll add this to my testing tree, so it can be
> build-tested by the 0-day folks. :)

SGTM, and thank you.  I'm sure you saw the existing warning about
indentation.  Do we want to modify the revert patch, or put another
patch on top?

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
@ 2020-11-17 22:28           ` Nick Desaulniers
  0 siblings, 0 replies; 47+ messages in thread
From: Nick Desaulniers @ 2020-11-17 22:28 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Miguel Ojeda, LKML, clang-built-linux, Paul Mackerras,
	Nathan Chancellor, linuxppc-dev

On Tue, Nov 17, 2020 at 2:16 PM Gustavo A. R. Silva
<gustavoars@kernel.org> wrote:
>
> I'm happy to take this series in my tree.  I'm planing to send a
> pull-request for -rc5 with more related changes. So, I can include
> this in the same PR.
>
> In the meantime I'll add this to my testing tree, so it can be
> build-tested by the 0-day folks. :)

SGTM, and thank you.  I'm sure you saw the existing warning about
indentation.  Do we want to modify the revert patch, or put another
patch on top?

-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 1/3] powerpc: boot: include compiler_attributes.h
  2020-11-16  4:35   ` Nick Desaulniers
@ 2020-11-17 22:30     ` Arvind Sankar
  -1 siblings, 0 replies; 47+ messages in thread
From: Arvind Sankar @ 2020-11-17 22:30 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda,
	Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	clang-built-linux, linuxppc-dev, linux-kernel

On Sun, Nov 15, 2020 at 08:35:30PM -0800, Nick Desaulniers wrote:
> The kernel uses `-include` to include include/linux/compiler_types.h
> into all translation units (see scripts/Makefile.lib), which #includes
> compiler_attributes.h.
> 
> arch/powerpc/boot/ uses different compiler flags from the rest of the
> kernel. As such, it doesn't contain the definitions from these headers,
> and redefines a few that it needs.
> 
> For the purpose of enabling -Wimplicit-fallthrough for ppc, include
> compiler_types.h via `-include`.

This should be "compiler_attributes.h".

> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> We could just `#include "include/linux/compiler_types.h"` in the few .c
> sources used from lib/ (there are proper header guards in
> compiler_types.h).
> 
> It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
> -include compiler_types.h like the main kernel does, though testing that
> produces a whole sea of warnings to cleanup. This approach is minimally
> invasive.
> 
>  arch/powerpc/boot/Makefile     | 1 +
>  arch/powerpc/boot/decompress.c | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index f8ce6d2dde7b..1659963a8f1d 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -31,6 +31,7 @@ endif
>  BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
>  		 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
>  		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
> +		 -include $(srctree)/include/linux/compiler_attributes.h \
>  		 $(LINUXINCLUDE)
>  
>  ifdef CONFIG_PPC64_BOOT_WRAPPER
> diff --git a/arch/powerpc/boot/decompress.c b/arch/powerpc/boot/decompress.c
> index 8bf39ef7d2df..6098b879ac97 100644
> --- a/arch/powerpc/boot/decompress.c
> +++ b/arch/powerpc/boot/decompress.c
> @@ -21,7 +21,6 @@
>  
>  #define STATIC static
>  #define INIT
> -#define __always_inline inline
>  
>  /*
>   * The build process will copy the required zlib source files and headers
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 1/3] powerpc: boot: include compiler_attributes.h
@ 2020-11-17 22:30     ` Arvind Sankar
  0 siblings, 0 replies; 47+ messages in thread
From: Arvind Sankar @ 2020-11-17 22:30 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: clang-built-linux, Gustavo A . R . Silva, linux-kernel,
	Miguel Ojeda, Paul Mackerras, Nathan Chancellor, linuxppc-dev

On Sun, Nov 15, 2020 at 08:35:30PM -0800, Nick Desaulniers wrote:
> The kernel uses `-include` to include include/linux/compiler_types.h
> into all translation units (see scripts/Makefile.lib), which #includes
> compiler_attributes.h.
> 
> arch/powerpc/boot/ uses different compiler flags from the rest of the
> kernel. As such, it doesn't contain the definitions from these headers,
> and redefines a few that it needs.
> 
> For the purpose of enabling -Wimplicit-fallthrough for ppc, include
> compiler_types.h via `-include`.

This should be "compiler_attributes.h".

> 
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> We could just `#include "include/linux/compiler_types.h"` in the few .c
> sources used from lib/ (there are proper header guards in
> compiler_types.h).
> 
> It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
> -include compiler_types.h like the main kernel does, though testing that
> produces a whole sea of warnings to cleanup. This approach is minimally
> invasive.
> 
>  arch/powerpc/boot/Makefile     | 1 +
>  arch/powerpc/boot/decompress.c | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index f8ce6d2dde7b..1659963a8f1d 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -31,6 +31,7 @@ endif
>  BOOTCFLAGS    := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
>  		 -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx \
>  		 -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc \
> +		 -include $(srctree)/include/linux/compiler_attributes.h \
>  		 $(LINUXINCLUDE)
>  
>  ifdef CONFIG_PPC64_BOOT_WRAPPER
> diff --git a/arch/powerpc/boot/decompress.c b/arch/powerpc/boot/decompress.c
> index 8bf39ef7d2df..6098b879ac97 100644
> --- a/arch/powerpc/boot/decompress.c
> +++ b/arch/powerpc/boot/decompress.c
> @@ -21,7 +21,6 @@
>  
>  #define STATIC static
>  #define INIT
> -#define __always_inline inline
>  
>  /*
>   * The build process will copy the required zlib source files and headers
> -- 
> 2.29.2.299.gdc1121823c-goog
> 

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  2020-11-17 22:28           ` Nick Desaulniers
@ 2020-11-17 23:45             ` Gustavo A. R. Silva
  -1 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-17 23:45 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Michael Ellerman, Nathan Chancellor, Benjamin Herrenschmidt,
	Paul Mackerras, clang-built-linux, linuxppc-dev, LKML,
	Miguel Ojeda

On Tue, Nov 17, 2020 at 02:28:43PM -0800, Nick Desaulniers wrote:
> On Tue, Nov 17, 2020 at 2:16 PM Gustavo A. R. Silva
> <gustavoars@kernel.org> wrote:
> >
> > I'm happy to take this series in my tree.  I'm planing to send a
> > pull-request for -rc5 with more related changes. So, I can include
> > this in the same PR.
> >
> > In the meantime I'll add this to my testing tree, so it can be
> > build-tested by the 0-day folks. :)
> 
> SGTM, and thank you.  I'm sure you saw the existing warning about
> indentation.  Do we want to modify the revert patch, or put another
> patch on top?

In this case, it'd be much better to modify the revert patch. I also
saw someone made a comment to the first patch of the series. If you
can address both issues and send v2 it'd be great.  Anyways, as those
are trivial changes, I already added the series to my testing tree for
0-day build-testing.

Thanks
--
Gustavo

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
@ 2020-11-17 23:45             ` Gustavo A. R. Silva
  0 siblings, 0 replies; 47+ messages in thread
From: Gustavo A. R. Silva @ 2020-11-17 23:45 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Miguel Ojeda, LKML, clang-built-linux, Paul Mackerras,
	Nathan Chancellor, linuxppc-dev

On Tue, Nov 17, 2020 at 02:28:43PM -0800, Nick Desaulniers wrote:
> On Tue, Nov 17, 2020 at 2:16 PM Gustavo A. R. Silva
> <gustavoars@kernel.org> wrote:
> >
> > I'm happy to take this series in my tree.  I'm planing to send a
> > pull-request for -rc5 with more related changes. So, I can include
> > this in the same PR.
> >
> > In the meantime I'll add this to my testing tree, so it can be
> > build-tested by the 0-day folks. :)
> 
> SGTM, and thank you.  I'm sure you saw the existing warning about
> indentation.  Do we want to modify the revert patch, or put another
> patch on top?

In this case, it'd be much better to modify the revert patch. I also
saw someone made a comment to the first patch of the series. If you
can address both issues and send v2 it'd be great.  Anyways, as those
are trivial changes, I already added the series to my testing tree for
0-day build-testing.

Thanks
--
Gustavo

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 1/3] powerpc: boot: include compiler_attributes.h
  2020-11-16  4:35   ` Nick Desaulniers
@ 2020-11-17 23:46     ` Michael Ellerman
  -1 siblings, 0 replies; 47+ messages in thread
From: Michael Ellerman @ 2020-11-17 23:46 UTC (permalink / raw)
  To: Nick Desaulniers, Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda
  Cc: Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel, Nick Desaulniers

Nick Desaulniers <ndesaulniers@google.com> writes:
> The kernel uses `-include` to include include/linux/compiler_types.h
> into all translation units (see scripts/Makefile.lib), which #includes
> compiler_attributes.h.
>
> arch/powerpc/boot/ uses different compiler flags from the rest of the
> kernel. As such, it doesn't contain the definitions from these headers,
> and redefines a few that it needs.
>
> For the purpose of enabling -Wimplicit-fallthrough for ppc, include
> compiler_types.h via `-include`.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> We could just `#include "include/linux/compiler_types.h"` in the few .c
> sources used from lib/ (there are proper header guards in
> compiler_types.h).
>
> It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
> -include compiler_types.h like the main kernel does, though testing that
> produces a whole sea of warnings to cleanup. This approach is minimally
> invasive.
>
>  arch/powerpc/boot/Makefile     | 1 +
>  arch/powerpc/boot/decompress.c | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 1/3] powerpc: boot: include compiler_attributes.h
@ 2020-11-17 23:46     ` Michael Ellerman
  0 siblings, 0 replies; 47+ messages in thread
From: Michael Ellerman @ 2020-11-17 23:46 UTC (permalink / raw)
  To: Nick Desaulniers, Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda
  Cc: Nick Desaulniers, linux-kernel, clang-built-linux,
	Paul Mackerras, linuxppc-dev

Nick Desaulniers <ndesaulniers@google.com> writes:
> The kernel uses `-include` to include include/linux/compiler_types.h
> into all translation units (see scripts/Makefile.lib), which #includes
> compiler_attributes.h.
>
> arch/powerpc/boot/ uses different compiler flags from the rest of the
> kernel. As such, it doesn't contain the definitions from these headers,
> and redefines a few that it needs.
>
> For the purpose of enabling -Wimplicit-fallthrough for ppc, include
> compiler_types.h via `-include`.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> We could just `#include "include/linux/compiler_types.h"` in the few .c
> sources used from lib/ (there are proper header guards in
> compiler_types.h).
>
> It was also noted in 6a9dc5fd6170 that we could -D__KERNEL__ and
> -include compiler_types.h like the main kernel does, though testing that
> produces a whole sea of warnings to cleanup. This approach is minimally
> invasive.
>
>  arch/powerpc/boot/Makefile     | 1 +
>  arch/powerpc/boot/decompress.c | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough
  2020-11-16  4:35   ` Nick Desaulniers
@ 2020-11-17 23:46     ` Michael Ellerman
  -1 siblings, 0 replies; 47+ messages in thread
From: Michael Ellerman @ 2020-11-17 23:46 UTC (permalink / raw)
  To: Nick Desaulniers, Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda
  Cc: Benjamin Herrenschmidt, Paul Mackerras, clang-built-linux,
	linuxppc-dev, linux-kernel, Nick Desaulniers

Nick Desaulniers <ndesaulniers@google.com> writes:
> The "fallthrough" pseudo-keyword was added as a portable way to denote
> intentional fallthrough. Clang will still warn on cases where there is a
> fallthrough to an immediate break. Add explicit breaks for those cases.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
>  arch/powerpc/kernel/prom_init.c | 1 +
>  arch/powerpc/kernel/uprobes.c   | 1 +
>  arch/powerpc/perf/imc-pmu.c     | 1 +
>  3 files changed, 3 insertions(+)

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough
@ 2020-11-17 23:46     ` Michael Ellerman
  0 siblings, 0 replies; 47+ messages in thread
From: Michael Ellerman @ 2020-11-17 23:46 UTC (permalink / raw)
  To: Nick Desaulniers, Gustavo A . R . Silva, Nathan Chancellor, Miguel Ojeda
  Cc: Nick Desaulniers, linux-kernel, clang-built-linux,
	Paul Mackerras, linuxppc-dev

Nick Desaulniers <ndesaulniers@google.com> writes:
> The "fallthrough" pseudo-keyword was added as a portable way to denote
> intentional fallthrough. Clang will still warn on cases where there is a
> fallthrough to an immediate break. Add explicit breaks for those cases.
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/236
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
>  arch/powerpc/kernel/prom_init.c | 1 +
>  arch/powerpc/kernel/uprobes.c   | 1 +
>  arch/powerpc/perf/imc-pmu.c     | 1 +
>  3 files changed, 3 insertions(+)

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
  2020-11-17 22:16         ` Gustavo A. R. Silva
@ 2020-11-17 23:48           ` Michael Ellerman
  -1 siblings, 0 replies; 47+ messages in thread
From: Michael Ellerman @ 2020-11-17 23:48 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Nick Desaulniers
  Cc: Nathan Chancellor, Benjamin Herrenschmidt, Paul Mackerras,
	clang-built-linux, linuxppc-dev, LKML, Miguel Ojeda

"Gustavo A. R. Silva" <gustavoars@kernel.org> writes:
> On Tue, Nov 17, 2020 at 11:10:26AM -0800, Nick Desaulniers wrote:
>> On Mon, Nov 16, 2020 at 7:02 PM Nathan Chancellor
>> <natechancellor@gmail.com> wrote:
>> >
>> > On Sun, Nov 15, 2020 at 08:35:31PM -0800, Nick Desaulniers wrote:
>> > > This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
>> > > pseudo-keyword in lib/")
>> 
>> Gustavo, whose tree did 6a9dc5fd6170 and df561f6688fe go up to
>
> Mine.
>
>> mainline in?  I'm not sure whether you or MPE (ppc) or someone else
>> should pick it this series?
>
> I'm happy to take this series in my tree.  I'm planing to send a
> pull-request for -rc5 with more related changes. So, I can include
> this in the same PR.

I doesn't really seem like rc5 material to me, but that's up to you.

I'd rather not take it in my tree because there's a lot of changes in
lib/ and that's not my area. I'm happy for the two powerpc patches to go
via your tree.

cheers

^ permalink raw reply	[flat|nested] 47+ messages in thread

* Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"
@ 2020-11-17 23:48           ` Michael Ellerman
  0 siblings, 0 replies; 47+ messages in thread
From: Michael Ellerman @ 2020-11-17 23:48 UTC (permalink / raw)
  To: Gustavo A. R. Silva, Nick Desaulniers
  Cc: Miguel Ojeda, LKML, clang-built-linux, Paul Mackerras,
	Nathan Chancellor, linuxppc-dev

"Gustavo A. R. Silva" <gustavoars@kernel.org> writes:
> On Tue, Nov 17, 2020 at 11:10:26AM -0800, Nick Desaulniers wrote:
>> On Mon, Nov 16, 2020 at 7:02 PM Nathan Chancellor
>> <natechancellor@gmail.com> wrote:
>> >
>> > On Sun, Nov 15, 2020 at 08:35:31PM -0800, Nick Desaulniers wrote:
>> > > This reverts commit 6a9dc5fd6170 ("lib: Revert use of fallthrough
>> > > pseudo-keyword in lib/")
>> 
>> Gustavo, whose tree did 6a9dc5fd6170 and df561f6688fe go up to
>
> Mine.
>
>> mainline in?  I'm not sure whether you or MPE (ppc) or someone else
>> should pick it this series?
>
> I'm happy to take this series in my tree.  I'm planing to send a
> pull-request for -rc5 with more related changes. So, I can include
> this in the same PR.

I doesn't really seem like rc5 material to me, but that's up to you.

I'd rather not take it in my tree because there's a lot of changes in
lib/ and that's not my area. I'm happy for the two powerpc patches to go
via your tree.

cheers

^ permalink raw reply	[flat|nested] 47+ messages in thread

end of thread, other threads:[~2020-11-17 23:54 UTC | newest]

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-16  4:35 [PATCH 0/3] PPC: Fix -Wimplicit-fallthrough for clang Nick Desaulniers
2020-11-16  4:35 ` Nick Desaulniers
2020-11-16  4:35 ` [PATCH 1/3] powerpc: boot: include compiler_attributes.h Nick Desaulniers
2020-11-16  4:35   ` Nick Desaulniers
2020-11-16  6:25   ` Gustavo A. R. Silva
2020-11-16  6:25     ` Gustavo A. R. Silva
2020-11-16 11:24   ` Miguel Ojeda
2020-11-16 11:24     ` Miguel Ojeda
2020-11-17  3:01   ` Nathan Chancellor
2020-11-17  3:01     ` Nathan Chancellor
2020-11-17 22:30   ` Arvind Sankar
2020-11-17 22:30     ` Arvind Sankar
2020-11-17 23:46   ` Michael Ellerman
2020-11-17 23:46     ` Michael Ellerman
2020-11-16  4:35 ` [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/" Nick Desaulniers
2020-11-16  4:35   ` Nick Desaulniers
2020-11-16  6:26   ` Gustavo A. R. Silva
2020-11-16  6:26     ` Gustavo A. R. Silva
2020-11-16 11:18     ` Miguel Ojeda
2020-11-16 11:18       ` Miguel Ojeda
2020-11-16 11:26   ` Miguel Ojeda
2020-11-16 11:26     ` Miguel Ojeda
2020-11-16 11:49   ` kernel test robot
2020-11-16 11:49     ` kernel test robot
2020-11-16 11:49     ` kernel test robot
2020-11-17  3:02   ` Nathan Chancellor
2020-11-17  3:02     ` Nathan Chancellor
2020-11-17 19:10     ` Nick Desaulniers
2020-11-17 19:10       ` Nick Desaulniers
2020-11-17 22:16       ` Gustavo A. R. Silva
2020-11-17 22:16         ` Gustavo A. R. Silva
2020-11-17 22:28         ` Nick Desaulniers
2020-11-17 22:28           ` Nick Desaulniers
2020-11-17 23:45           ` Gustavo A. R. Silva
2020-11-17 23:45             ` Gustavo A. R. Silva
2020-11-17 23:48         ` Michael Ellerman
2020-11-17 23:48           ` Michael Ellerman
2020-11-16  4:35 ` [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough Nick Desaulniers
2020-11-16  4:35   ` Nick Desaulniers
2020-11-16  6:28   ` Gustavo A. R. Silva
2020-11-16  6:28     ` Gustavo A. R. Silva
2020-11-16 11:33   ` Miguel Ojeda
2020-11-16 11:33     ` Miguel Ojeda
2020-11-17  3:02   ` Nathan Chancellor
2020-11-17  3:02     ` Nathan Chancellor
2020-11-17 23:46   ` Michael Ellerman
2020-11-17 23:46     ` Michael Ellerman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.