linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lib: zstd: bitstream: Mark expected switch fall-throughs
@ 2017-11-28  0:00 Gustavo A. R. Silva
  2017-11-28 21:38 ` Nick Terrell
  0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2017-11-28  0:00 UTC (permalink / raw)
  To: Nick Terrell, Chris Mason; +Cc: linux-kernel, Gustavo A. R. Silva, Kees Cook

In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
---
 lib/zstd/bitstream.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/zstd/bitstream.h b/lib/zstd/bitstream.h
index a826b99..18d8200 100644
--- a/lib/zstd/bitstream.h
+++ b/lib/zstd/bitstream.h
@@ -259,11 +259,17 @@ 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 */
 		case 6: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[5]) << (sizeof(bitD->bitContainer) * 8 - 24);
+			/* fall through */
 		case 5: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[4]) << (sizeof(bitD->bitContainer) * 8 - 32);
+			/* fall through */
 		case 4: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[3]) << 24;
+			/* fall through */
 		case 3: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[2]) << 16;
+			/* fall through */
 		case 2: bitD->bitContainer += (size_t)(((const BYTE *)(srcBuffer))[1]) << 8;
+			/* fall through */
 		default:;
 		}
 		{
-- 
2.7.4

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

* Re: [PATCH] lib: zstd: bitstream: Mark expected switch fall-throughs
  2017-11-28  0:00 [PATCH] lib: zstd: bitstream: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2017-11-28 21:38 ` Nick Terrell
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Terrell @ 2017-11-28 21:38 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: Chris Mason, linux-kernel, Kees Cook


> On Nov 27, 2017, at 4:00 PM, Gustavo A. R. Silva <garsilva@embeddedor.com> wrote:
> 
> In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> where we are expecting to fall through.
> 
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>

Looks good to me. We had the same patch in upstream PR#690 [1].
I believe that PR#695 [2] was also necessary to quiet the warning.

[1] https://github.com/facebook/zstd/pull/690/files
[2] https://github.com/facebook/zstd/pull/695/files

Reviewed-by: Nick Terrell <terrelln@fb.com>

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

end of thread, other threads:[~2017-11-28 21:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-28  0:00 [PATCH] lib: zstd: bitstream: Mark expected switch fall-throughs Gustavo A. R. Silva
2017-11-28 21:38 ` Nick Terrell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).