[clang] [clang][AST][NFC] Add '[[fallthrough]]' to cases fall through (PR #85921)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 21 08:36:37 PDT 2024


Sirraide wrote:

> Is this addressing a diagnostic you're seeing in the wild? This shouldn't be necessary because the `case` statements are adjacent to one another with only comments/whitespace between them: https://godbolt.org/z/oM7x65hq9
> 
> (I'd like to understand the motivation better because I don't think we want to add `[[fallthrough]]` to all adjacent cases in the code base, so this seems inconsistent.)

I agree that it seems unnecessary and I probably wouldn’t add it, but in this case the comment indicates (at least to me) that it’s maybe not obvious that fallthrough was intended (for whatever reason)—and at the very least, there is precedent for us using `[[fallthrough]]` in adjacent case labels in some places.

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


More information about the cfe-commits mailing list