diff options
author | Tom Hughes <tomhughes@chromium.org> | 2022-10-14 08:55:18 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-10-19 20:56:04 +0000 |
commit | 0d1b98c7183e8bc058a00ace0c30c1ea0e736a8a (patch) | |
tree | 6ff876b5578d5c83285dd90c295f0b697efc238c /common/system.c | |
parent | e66c6fe6efab16bed9b06c1b9e349c71eddb5a3f (diff) | |
download | chrome-ec-0d1b98c7183e8bc058a00ace0c30c1ea0e736a8a.tar.gz |
tree: Enable warning for fallthrough in switch statements
The EC code has generally been good about adding comments about
intentional fallthrough in switch statements, but there were a few cases
without comments (e.g., https://crrev.com/c/3949622). Enabling
-Wimplicit-fallthrough generates a compiler warning if the fallthrough
is not annotated with __attribute__((fallthrough)). For convenience, we
add a "__fallthrough" macro for this attribute.
See https://clang.llvm.org/docs/AttributeReference.html#fallthrough and
https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html.
BRANCH=none
BUG=b:253644823
TEST=make buildall
LOW_COVERAGE_REASON=legacy code
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I9f4d6049f4507a25ce706675d159b70e28b4b825
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3957420
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Diffstat (limited to 'common/system.c')
-rw-r--r-- | common/system.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/system.c b/common/system.c index c3a0f8ac58..6f64960170 100644 --- a/common/system.c +++ b/common/system.c @@ -1020,7 +1020,7 @@ static int handle_pending_reboot(enum ec_reboot_cmd cmd) chip_save_reset_flags(chip_read_reset_flags() & ~EC_RESET_FLAG_AP_IDLE); } - /* Intentional fall-through */ + __fallthrough; case EC_REBOOT_HIBERNATE: if (!IS_ENABLED(CONFIG_HIBERNATE)) return EC_ERROR_INVAL; |