[clang-tools-extra] [clang-tidy] warn when `true` is used as a preprocessor keyword in C (PR #128265)
via cfe-commits
cfe-commits at lists.llvm.org
Sun Feb 23 05:36:14 PST 2025
================
@@ -0,0 +1,45 @@
+// RUN: %check_clang_tidy -std=c99 %s bugprone-true-macro %t
+// RUN: %check_clang_tidy -std=c11 %s bugprone-true-macro %t
+// RUN: %check_clang_tidy -std=c17 %s bugprone-true-macro %t
----------------
isuckatcs wrote:
That's from `C23-and-later`, but the check is not enabled in such cases.
```C++
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.C99 || LangOpts.C11 || LangOpts.C17;
}
```
IIRC, we don't test the other cases either when the check is not available, so I don't see why we would make an exception.
https://github.com/llvm/llvm-project/pull/128265
More information about the cfe-commits
mailing list