[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 2 09:54:30 PST 2020


On Mon, Mar 2, 2020 at 11:42 AM Richard Smith - zygoloid via
Phabricator <reviews at reviews.llvm.org> wrote:
>
> rsmith added a comment.
>
> I'm also pretty concerned about using comments to drive warning behavior. We discussed this when first adding our gallery fallthrough warning and its suppression mechanism and made an explicit decision that we did not want comments to affect our behaviour. I don't think anything has changed in that regard.

Something has changed in that regard -- GCC has shipped with the
feature for several releases and third-party libraries are using it.
At the time when we first discussed this, neither of those were the
case that I recall. That said, if we don't want to enable comments to
suppress warnings despite clang-tidy having done this for years, we
should document that in the compiler internals document, back the
changes out of trunk, and contact the flex maintainers to let them
know we're explicitly not going to support their style of codegen.

> We shouldn't enable the warning under -Wextra in language modes where there's no standard way to suppress it.

Again, this warning is not enabled under -Wextra -- you still have to
explicitly enable the diagnostic. Also, there are two ways to suppress
it in C: comments (in trunk) and __attribute__((fallthrough)). The
issue is that the third-party libraries are generating code that
contain the comments, not the attribute.

~Aaron

>
>
> Repository:
>   rG LLVM Github Monorepo
>
> CHANGES SINCE LAST ACTION
>   https://reviews.llvm.org/D73852/new/
>
> https://reviews.llvm.org/D73852
>
>
>


More information about the cfe-commits mailing list