LegalizeAdulthood added a comment. In D116386#3227236 <https://reviews.llvm.org/D116386#3227236>, @aaron.ballman wrote:
> We're in strong agreement that guideline checkers with untenable false > positive rates are a > very bad thing. I think this particular check is of insufficient quality to > have been added in > the first place because it's based on a set of rules that are not generally > enforceable in a > way that isn't a constantly nagging for reasonable real world code. I think this guideline is mostly what this check is trying to accomplish: ES.31: Don't use macros for constants or "functions" Now, for the first part about constants, the check was issuing way too many false positives. That's what I fix in this review: it now only suggests that the macro be replaced with a `constexpr` constant when the macro expansion is truly a constant. Ironically I was working on my own check that covers some aspects of "Enum.1: Prefer enumerations over macros <https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#enum1-prefer-enumerations-over-macros>". However, there isn't any way an automated tool could recognize the example given in the guidelines because the macros in question don't share a common prefix, which I've found is a good heuristic for enums disguised as macros. There are additional heuristics one could apply, such as when a bunch of constant macros are defined on successive lines. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D116386/new/ https://reviews.llvm.org/D116386 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits