gcc7: comments for falling through a switch case

GCC 7 adds a warning -Wimplicit-fallthrough to catch when falling
through a switch statement without a break. Since we actually want that
behaviour sometimes, we can add a comment so the compiler knows we
intended the fallthrough.
This commit is contained in:
Matthew Barr
2017-04-10 13:25:07 +10:00
parent 055ff7391c
commit 221229f71c
3 changed files with 22 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015-2016, Intel Corporation
* Copyright (c) 2015-2017, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -117,9 +117,9 @@ hwlm_error_t scanSingleShort(const u8 *buf, size_t len, const u8 *key,
if (l < 4) {
u8 *vp = (u8*)&v;
switch (l) {
case 3: vp[2] = d[2];
case 2: vp[1] = d[1];
case 1: vp[0] = d[0];
case 3: vp[2] = d[2]; // fallthrough
case 2: vp[1] = d[1]; // fallthrough
case 1: vp[0] = d[0]; // fallthrough
}
} else {
v = masked_move256_len(d, l);
@@ -157,9 +157,9 @@ hwlm_error_t scanDoubleShort(const u8 *buf, size_t len, const u8 *key,
if (l < 4) {
u8 *vp = (u8*)&v;
switch (l) {
case 3: vp[2] = d[2];
case 2: vp[1] = d[1];
case 1: vp[0] = d[0];
case 3: vp[2] = d[2]; // fallthrough
case 2: vp[1] = d[1]; // fallthrough
case 1: vp[0] = d[0]; // fallthrough
}
} else {
v = masked_move256_len(d, l);