summaryrefslogtreecommitdiff
path: root/power
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2022-10-14 08:55:18 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-10-19 20:56:04 +0000
commit0d1b98c7183e8bc058a00ace0c30c1ea0e736a8a (patch)
tree6ff876b5578d5c83285dd90c295f0b697efc238c /power
parente66c6fe6efab16bed9b06c1b9e349c71eddb5a3f (diff)
downloadchrome-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 'power')
-rw-r--r--power/common.c6
-rw-r--r--power/intel_x86.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/power/common.c b/power/common.c
index c1675d31f2..65c1cf0779 100644
--- a/power/common.c
+++ b/power/common.c
@@ -521,12 +521,12 @@ static enum power_state power_common_state(void)
break;
case POWER_S4:
- /* fallthrough */
+ __fallthrough;
case POWER_S3:
- /* fallthrough */
+ __fallthrough;
case POWER_S0:
#ifdef CONFIG_POWER_S0IX
- /* fallthrough */
+ __fallthrough;
case POWER_S0ix:
#endif
/* Wait for a message */
diff --git a/power/intel_x86.c b/power/intel_x86.c
index 1c9f2ef8c8..4fa3aa3c8e 100644
--- a/power/intel_x86.c
+++ b/power/intel_x86.c
@@ -381,7 +381,7 @@ enum power_state common_intel_x86_power_handle_state(enum power_state state)
return POWER_S4; /* Power down to the next state */
case POWER_S5S3:
- /* fallthrough */
+ __fallthrough;
case POWER_S4S3:
if (!power_has_signals(IN_PGOOD_ALL_CORE)) {
/* Required rail went away */