[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 07:16:12 PST 2025


================
@@ -91,6 +91,16 @@ Improvements to clang-tidy
 New checks
 ^^^^^^^^^^
 
+- New :doc:`bugprone-true-macro
+  <clang-tidy/checks/bugprone/true-macro>` check.
+
+  In C++, ``true`` is considered a keyword by the preprocessor so an ``#if true``
+  enters the true branch, while in C, ``true`` is not treated as a special 
+  keyword by the preprocessor, so the false branch is entered. 
+  
+  The check identifies such cases, when ``true`` is used without being defined
----------------
EugeneZelenko wrote:

Once sentence is enough. See previous release Release Notes as example of such sentences.

https://github.com/llvm/llvm-project/pull/128265


More information about the cfe-commits mailing list