Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"

2020-11-17 Thread Michael Ellerman
"Gustavo A. R. Silva"  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
>>  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


Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"

2020-11-17 Thread Gustavo A. R. Silva
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
>  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


Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"

2020-11-17 Thread Nick Desaulniers
On Tue, Nov 17, 2020 at 2:16 PM Gustavo A. R. Silva
 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


Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"

2020-11-17 Thread Gustavo A. R. Silva
On Tue, Nov 17, 2020 at 11:10:26AM -0800, Nick Desaulniers wrote:
> On Mon, Nov 16, 2020 at 7:02 PM Nathan Chancellor
>  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 
> >
> > Reviewed-by: Nathan Chancellor 
> > Tested-by: Nathan Chancellor 
> >
> > > ---
> > >  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(, 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(, 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 

Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"

2020-11-17 Thread Nick Desaulniers
On Mon, Nov 16, 2020 at 7:02 PM Nathan Chancellor
 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 
>
> Reviewed-by: Nathan Chancellor 
> Tested-by: Nathan Chancellor 
>
> > ---
> >  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(, 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(, 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
> > 

Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"

2020-11-16 Thread Nathan Chancellor
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 

Reviewed-by: Nathan Chancellor 
Tested-by: Nathan Chancellor 

> ---
>  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(, 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(, 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(>work);
>   break;
>   }
> - /* fall through */
> + fallthrough;
>   case DIM_START_MEASURE:
>   dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
> end_sample.byte_ctr, >start_sample);
> diff --git 

Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"

2020-11-16 Thread kernel test robot
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 

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(, 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(, ip[n + 2], CTable); 
HUF_FLUSHBITS_2();
 > 559  fallthrough;
   560  case 2: HUF_encodeSymbol(, ip[n + 1], CTable); 
HUF_FLUSHBITS_1();
   561  fallthrough;
   562  case 1: HUF_encodeSymbol(, ip[n + 0], CTable); 
HUF_FLUSHBITS();
   563  case 0:
   564  default:;
   565  }
   566  
   567  for (; n > 0; n -= 4) { /* note : n&3==0 at this stage */
   568  HUF_encodeSymbol(, ip[n - 1], CTable);
   569  HUF_FLUSHBITS_1();
   570  HUF_encodeSymbol(, ip[n - 2], CTable);
   571  HUF_FLUSHBITS_2();
   572  HUF_encodeSymbol(, ip[n - 3], CTable);
   573  HUF_FLUSHBITS_1();
   574  HUF_encodeSymbol(, ip[n - 4], CTable);
   575  HUF_FLUSHBITS();
   576  }
   577  
   578  return BIT_closeCStream();
   579  }
   580  

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


.config.gz
Description: application/gzip


Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"

2020-11-16 Thread Miguel Ojeda
On Mon, Nov 16, 2020 at 5:35 AM 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 

Looks fine on visual inspection:

Reviewed-by: Miguel Ojeda 

Cheers,
Miguel


Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"

2020-11-16 Thread Miguel Ojeda
On Mon, Nov 16, 2020 at 7:26 AM Gustavo A. R. Silva
 wrote:
>
> Reviewed-by: Gustavo A. R. Silva 

.org :-)

Cheers,
Miguel


Re: [PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"

2020-11-15 Thread Gustavo A. R. Silva
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 

Reviewed-by: Gustavo A. R. Silva 

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(, 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(, 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(>work);
>   break;
>   }
> - /* fall through */
> + fallthrough;
>   case DIM_START_MEASURE:
>   dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
> end_sample.byte_ctr, >start_sample);
> diff --git a/lib/dim/rdma_dim.c 

[PATCH 2/3] Revert "lib: Revert use of fallthrough pseudo-keyword in lib/"

2020-11-15 Thread 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 
---
 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(, 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(, 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(>work);
break;
}
-   /* fall through */
+   fallthrough;
case DIM_START_MEASURE:
dim_update_sample(end_sample.event_ctr, end_sample.pkt_ctr,
  end_sample.byte_ctr, >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;