* [PATCH net] jhash: fix -Wimplicit-fallthrough warnings
@ 2017-07-15 6:03 Jakub Kicinski
2017-07-17 16:23 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Kicinski @ 2017-07-15 6:03 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, kadlec, oss-drivers, Jakub Kicinski
GCC 7 added a new -Wimplicit-fallthrough warning. It's only enabled
with W=1, but since linux/jhash.h is included in over hundred places
(including other global headers) it seems worthwhile fixing this
warning.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
If it looks good, would it be OK to take it via the net tree?
include/linux/jhash.h | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/include/linux/jhash.h b/include/linux/jhash.h
index 348c6f47e4cc..8037850f3104 100644
--- a/include/linux/jhash.h
+++ b/include/linux/jhash.h
@@ -85,19 +85,18 @@ static inline u32 jhash(const void *key, u32 length, u32 initval)
k += 12;
}
/* Last block: affect all 32 bits of (c) */
- /* All the case statements fall through */
switch (length) {
- case 12: c += (u32)k[11]<<24;
- case 11: c += (u32)k[10]<<16;
- case 10: c += (u32)k[9]<<8;
- case 9: c += k[8];
- case 8: b += (u32)k[7]<<24;
- case 7: b += (u32)k[6]<<16;
- case 6: b += (u32)k[5]<<8;
- case 5: b += k[4];
- case 4: a += (u32)k[3]<<24;
- case 3: a += (u32)k[2]<<16;
- case 2: a += (u32)k[1]<<8;
+ case 12: c += (u32)k[11]<<24; /* fall through */
+ case 11: c += (u32)k[10]<<16; /* fall through */
+ case 10: c += (u32)k[9]<<8; /* fall through */
+ case 9: c += k[8]; /* fall through */
+ case 8: b += (u32)k[7]<<24; /* fall through */
+ case 7: b += (u32)k[6]<<16; /* fall through */
+ case 6: b += (u32)k[5]<<8; /* fall through */
+ case 5: b += k[4]; /* fall through */
+ case 4: a += (u32)k[3]<<24; /* fall through */
+ case 3: a += (u32)k[2]<<16; /* fall through */
+ case 2: a += (u32)k[1]<<8; /* fall through */
case 1: a += k[0];
__jhash_final(a, b, c);
case 0: /* Nothing left to add */
@@ -131,10 +130,10 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval)
k += 3;
}
- /* Handle the last 3 u32's: all the case statements fall through */
+ /* Handle the last 3 u32's */
switch (length) {
- case 3: c += k[2];
- case 2: b += k[1];
+ case 3: c += k[2]; /* fall through */
+ case 2: b += k[1]; /* fall through */
case 1: a += k[0];
__jhash_final(a, b, c);
case 0: /* Nothing left to add */
--
2.11.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH net] jhash: fix -Wimplicit-fallthrough warnings
2017-07-15 6:03 [PATCH net] jhash: fix -Wimplicit-fallthrough warnings Jakub Kicinski
@ 2017-07-17 16:23 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-07-17 16:23 UTC (permalink / raw)
To: jakub.kicinski; +Cc: netdev, linux-kernel, kadlec, oss-drivers
From: Jakub Kicinski <jakub.kicinski@netronome.com>
Date: Fri, 14 Jul 2017 23:03:49 -0700
> GCC 7 added a new -Wimplicit-fallthrough warning. It's only enabled
> with W=1, but since linux/jhash.h is included in over hundred places
> (including other global headers) it seems worthwhile fixing this
> warning.
>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> ---
> If it looks good, would it be OK to take it via the net tree?
Applied, thanks Jakub.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-17 16:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-15 6:03 [PATCH net] jhash: fix -Wimplicit-fallthrough warnings Jakub Kicinski
2017-07-17 16:23 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®