[clang-tools-extra] [clang-tidy] warn when `true` is used as a preprocessor keyword in C (PR #128265)
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 28 18:05:03 PST 2025
zygoloid wrote:
> 1. Not adding check if -Wundef is sufficient
> 2. Create check that forbids usage of true/false in processor as an non-portable thing (could be in portability category)
> 3. Extracting 'true' case from -Wundef into separate warning like -Wundef-true
Option 3 seems best to me. This check is much better suited to being done in the compiler rather than after the fact in a checker, and indeed we are already warning in the preprocessor. Splitting out a sub-warning `-Wundef-true` and enabling it by default seems like a great choice here.
https://github.com/llvm/llvm-project/pull/128265
More information about the cfe-commits
mailing list