2020-11-16 04:40:29

by Nick Desaulniers

[permalink] [raw]
Subject: [PATCH 0/3] PPC: Fix -Wimplicit-fallthrough for clang

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


2020-11-16 04:41:13

by Nick Desaulniers

[permalink] [raw]
Subject: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough

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 <[email protected]>
---
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

2020-11-16 06:32:02

by Gustavo A. R. Silva

[permalink] [raw]
Subject: Re: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough

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 <[email protected]>

Reviewed-by: Gustavo A. R. Silva <[email protected]>

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
>

2020-11-17 01:49:06

by Miguel Ojeda

[permalink] [raw]
Subject: Re: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough

On Mon, Nov 16, 2020 at 5:35 AM Nick Desaulniers
<[email protected]> 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 <[email protected]>

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

Reviewed-by: Miguel Ojeda <[email protected]>

Cheers,
Miguel

2020-11-17 03:06:09

by Nathan Chancellor

[permalink] [raw]
Subject: Re: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough

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 <[email protected]>

Reviewed-by: Nathan Chancellor <[email protected]>
Tested-by: Nathan Chancellor <[email protected]>

> ---
> 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
>

2020-11-17 23:49:28

by Michael Ellerman

[permalink] [raw]
Subject: Re: [PATCH 3/3] powerpc: fix -Wimplicit-fallthrough

Nick Desaulniers <[email protected]> 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 <[email protected]>
> ---
> 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 <[email protected]>

cheers