[llvm] [clang-tools-extra] [clang] [CLANG] Add warning when INF or NAN are used in a binary operation or as function argument in fast math mode. (PR #76873)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 07:55:04 PST 2024


================
@@ -2835,6 +2835,9 @@ class Preprocessor {
     if (Identifier.getIdentifierInfo()->isRestrictExpansion() &&
         !SourceMgr.isInMainFile(Identifier.getLocation()))
       emitRestrictExpansionWarning(Identifier);
+
+    if (Identifier.getIdentifierInfo()->getName() == "INFINITY")
----------------
AaronBallman wrote:

Because there are other C standard libraries which do something different. For example, musl: https://git.musl-libc.org/cgit/musl/tree/include/math.h#n18

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


More information about the cfe-commits mailing list