[PATCH] D18501: Fix <cmath> compilation on FreeBSD
Dimitry Andric via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 27 13:36:47 PDT 2016
dim created this revision.
dim added reviewers: mclow.lists, EricWF, emaste.
dim added subscribers: cfe-commits, bdrewery.
Herald added a subscriber: emaste.
On FreeBSD, a number of math.h functions are actually defined as macros,
such as `signbit()`, `fpclassify()` and others. Since libc++'s <cmath>
attempts to do `using ::signbit;`, `using ::fpclassify;`, and so on,
this results in compile errors:
libcxx/include/cmath:309:9: error: '::signbit' has not been declared
using ::signbit;
^
libcxx/include/cmath:310:9: error: '::fpclassify' has not been declared
using ::fpclassify;
^
Here is a patch to exclude `signbit` through `isunordered`, and also
`abs`, which we don't have in math.h.
(Actually, I'm not sure that `::abs` should even be in here, since it is
a stdlib.h function? We don't have it in math.h, in any case.)
http://reviews.llvm.org/D18501
Files:
include/cmath
Index: include/cmath
===================================================================
--- include/cmath
+++ include/cmath
@@ -306,6 +306,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+#ifndef __FreeBSD__
using ::signbit;
using ::fpclassify;
using ::isfinite;
@@ -319,13 +320,14 @@
using ::islessgreater;
using ::isunordered;
using ::isunordered;
+#endif // __FreeBSD__
using ::float_t;
using ::double_t;
-#ifndef _AIX
+#if !defined(_AIX) && !defined(__FreeBSD__)
using ::abs;
-#endif
+#endif // !AIX && !__FreeBSD__
#ifndef __sun__
using ::acos;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18501.51747.patch
Type: text/x-patch
Size: 558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160327/525b0160/attachment.bin>
More information about the cfe-commits
mailing list