[clang] [clang] Add -Wimplicit-fallthrough to -Wextra (PR #97926)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 25 11:11:55 PDT 2024


AaronBallman wrote:

> I'm not seeing any compile time impact from dropping the `DefaultIgnore`s on warn_unannotated_fallthrough/warn_unannotated_fallthrough_per_function. So either it's free or I'm still doing something wrong. (http://llvm-compile-time-tracker.com/compare.php?from=6d12b3f67df429bffff6e1953d9f55867d7e2469&to=4117b087cc607686c472f54f82f1222688b5f2bf&stat=instructions:u)

Yeah, that logic should suffice:
```
  bool FallThroughDiagFull =
      !Diags.isIgnored(diag::warn_unannotated_fallthrough, D->getBeginLoc());
  bool FallThroughDiagPerFunction = !Diags.isIgnored(
      diag::warn_unannotated_fallthrough_per_function, D->getBeginLoc());
  if (FallThroughDiagFull || FallThroughDiagPerFunction ||
      fscope->HasFallthroughStmt) {
    DiagnoseSwitchLabelsFallthrough(S, AC, !FallThroughDiagFull);
  }
```
so unless something explicitly ignores the fallthrough warning in the setup, it seems like a valid test.

https://github.com/llvm/llvm-project/pull/97926


More information about the cfe-commits mailing list