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

> Since NAN is defined as (-(float)(INFINITY * 0.0F)) when used in the program 
> it will trigger the "use of infinity via a macro results in undefined 
> behavior due to the currently enabled floating-point options 
> [-Wnan-and-infinity-disabled]". Wouldn't that be enough? If I add NaN here we 
> would get 2 warnings.

This is actually a bit unfortunate. If I use "-fhonor-nans 
-fno-honor-infinities" this definition of NAN will trigger a warning, even 
though I expect that we'll constant-fold it as expected without regard to the 
"no-honor-infinities" setting.

https://github.com/llvm/llvm-project/pull/76873
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to