================ @@ -2847,12 +2848,15 @@ class Preprocessor { !SourceMgr.isInMainFile(Identifier.getLocation())) emitRestrictExpansionWarning(Identifier); - if (Info->getName() == "INFINITY") - if (getLangOpts().NoHonorInfs) - emitRestrictInfNaNWarning(Identifier, 0); - if (Info->getName() == "NAN") - if (getLangOpts().NoHonorNaNs) - emitRestrictInfNaNWarning(Identifier, 1); + if (!IsIfnDef) { + bool UnsafeMath = getLangOpts().UnsafeFPMath; + if (Info->getName() == "INFINITY") + if (getLangOpts().NoHonorInfs) + emitRestrictInfNaNWarning(Identifier, 0, UnsafeMath); + if (Info->getName() == "NAN") + if (getLangOpts().NoHonorNaNs) + emitRestrictInfNaNWarning(Identifier, 1, UnsafeMath); ---------------- AaronBallman wrote:
```suggestion bool UnsafeMath = getLangOpts().UnsafeFPMath; if (Info->getName() == "INFINITY" && getLangOpts().NoHonorInfs) emitRestrictInfNaNWarning(Identifier, 0, UnsafeMath); if (Info->getName() == "NAN" && getLangOpts().NoHonorNaNs) emitRestrictInfNaNWarning(Identifier, 1, UnsafeMath); ``` https://github.com/llvm/llvm-project/pull/80290 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits