[PATCH] D53817: [clang-tidy] cppcoreguidelines-macro-usage: print macro names

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 29 10:40:48 PDT 2018


aaron.ballman added a comment.

In https://reviews.llvm.org/D53817#1279053, @JonasToth wrote:

> > I personally haven't yet seen this check firing on *predefined* macros.
>
> I did specifically check the compiler defined macros I could see in the AST and they were not diagnosed from the beginning.
>  I would guess, only the compiler-flag macros are passed in the PPCallbacks, which would explain the current behaviour.


Thanks for checking; I hadn't had the chance to try it out yet and was making a guess.

>> The only problem i have are these command-line-based macros.
>>  They *may* be outside of programmer's control, but if one has access to the buildsystem
>>  (as in, not *just* to the source code to be compiled, but to the build system definitions
>>  that say *how* to build it), then one can easily add such command-line-based macros.
> 
> It is a burden with little to gain as they the toggle-stuff use-case is not replaceable with other constructs.
>  Having it as opt-in might be ok, but by default the check should not diagnose them.

+1; I'd be fine with an opt-in option for the behavior.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53817





More information about the cfe-commits mailing list