[PATCH] D73852: [clang] detect switch fallthrough marked by a comment (PR43465)
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 12 05:54:45 PST 2020
aaron.ballman added a comment.
In D73852#1872019 <https://reviews.llvm.org/D73852#1872019>, @hans wrote:
> I also jumped when I saw that this now makes certain comments "load bearing". That doesn't seem like a great idea to me.
It's an idea we already have in the project though with NOLINT comments, though that is a clang-tidy approach. So this does add load bearing comments in the frontend, but with plenty of precedence (both with clang-tidy and with GCC).
> The warning may be all right for C++ code, which has an attribute to suppress it, but C code does not normally use such attributes, and has no standard syntax for them.
That's not quite true. C2x has [[attr]] attributes, but that requires enabling a custom compiler extension for non-C2x mode. Given that there are reasonably popular libraries like flex which already using comments, this is supporting a real use case that is also supported by GCC.
> I think it would be better if the warning was off by default for C code. Those C projects that wish could opt-in to it and jump through the hoops of applying attributes to silence the warning.
The warning is off by default already for both C and C++. The issue being solved here is projects that enable the option in C.
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