[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
Tue Dec 28 11:22:42 PST 2021
alxu created this revision.
alxu added a project: clang.
alxu requested review of this revision.
Herald added a subscriber: cfe-commits.
This causes modern glibc to unset math_errhandling MATH_ERRNO. gcc 12 also sets some other macros, but most of them are associated with flags ignored by clang, so without library examples, it is difficult to determine whether they should be set. I think setting this one macro is OK for now.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116337
Files:
clang/lib/Frontend/InitPreprocessor.cpp
Index: clang/lib/Frontend/InitPreprocessor.cpp
===================================================================
--- clang/lib/Frontend/InitPreprocessor.cpp
+++ clang/lib/Frontend/InitPreprocessor.cpp
@@ -1019,6 +1019,9 @@
Builder.defineMacro("__USER_LABEL_PREFIX__", TI.getUserLabelPrefix());
+ if (LangOpts.FastMath || !LangOpts.MathErrno)
+ Builder.defineMacro("__NO_MATH_ERRNO__");
+
if (LangOpts.FastMath || LangOpts.FiniteMathOnly)
Builder.defineMacro("__FINITE_MATH_ONLY__", "1");
else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116337.396416.patch
Type: text/x-patch
Size: 527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211228/d96cea28/attachment.bin>
More information about the cfe-commits
mailing list