[PATCH] D116337: [clang] set __NO_MATH_ERRNO__ if -fno-math-errno

Alex Xu (Hello71) via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 5 14:04:43 PST 2022


alxu added inline comments.


================
Comment at: clang/lib/Frontend/InitPreprocessor.cpp    :1022
+    Builder.defineMacro("__NO_MATH_ERRNO__");
+
   if (LangOpts.FastMath || LangOpts.FiniteMathOnly)
----------------
aaron.ballman wrote:
> Does GCC gate on `-ffast-math`? My testing suggests that `-fno-math-errno` alone is what sets this macro in GCC.
I thought that MathErrno was not set if -ffast-math is specified, but that is apparently not true. It looks like lib/Driver/ToolChains/Clang.cpp should set FiniteMathOnly for -ffast-math, and the check below should be adjusted; otherwise it is wrong for -ffast-math -fno-finite-math-only.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D116337/new/

https://reviews.llvm.org/D116337



More information about the cfe-commits mailing list