From 0d1b98c7183e8bc058a00ace0c30c1ea0e736a8a Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 14 Oct 2022 08:55:18 -0700 Subject: 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 Change-Id: I9f4d6049f4507a25ce706675d159b70e28b4b825 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3957420 Reviewed-by: Daisuke Nojiri Code-Coverage: Zoss --- board/kappa/led.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'board/kappa') diff --git a/board/kappa/led.c b/board/kappa/led.c index 1c7979eac0..1dc86013d7 100644 --- a/board/kappa/led.c +++ b/board/kappa/led.c @@ -104,7 +104,7 @@ static void led_set_battery(void) led_set_color_battery(LED_WHITE); break; } - /* Intentional fall-through */ + __fallthrough; case PWR_STATE_DISCHARGE: /* * Blink white light (1 sec on, 1 sec off) -- cgit v1.2.1