Add a symbol similar to _LIBCPP_HAS_NO_LONG_LONG to allow compatibility with newlib when _LDBL_EQ_DBL is not defined. One such platform where this is the case is the POSIX-compatible enclave development platform, Asylo.
Diff Detail
Event Timeline
Changed an instance of defined(ASYLO) to defined(_LIBCXX_HAS_NO_LONG_DOUBLE) in math.h
libcxx/include/math.h | ||
---|---|---|
789 | These seem unfortunate. Can you look at the history to see why there's no feature macro that explains with? |
libcxx/include/math.h | ||
---|---|---|
789 | It's not a uniform feature for Sun and AIX, as you can see further down for declarations like asinh. The sun support came 4 years ago in fbbfd092 for cmath, since math.h split from cmath after that. The AIX support was 6 years ago in 5d1a701, which seems slightly entangled with Microsoft's C runtime (_LIBCPP_MSVCRT). I'm not familiar enough with this codebase to suggest a feature strategy to overcome these unexpectedly non-uniform distinctions. |
libcxx/include/math.h | ||
---|---|---|
789 | Ugh yeah that sounds like a mess not worth touching in this patch. Thanks for looking into it. |
This patch seems incomplete to me. There's stuff in <type_traits> like is_floating_point, etc.
libcxx/include/cmath | ||
---|---|---|
445 | These seem wrong to me. nexttoward takes a double, and nexttowardf takes a float. | |
libcxx/include/cstdlib | ||
114 | There's a lot more work to be done if you want to remove strtold.
| |
libcxx/include/locale | ||
180 | Where did this come from? |
We have a similar problem with our port of libc++ and we also had to conditionalize all uses of long double downstream. Here is a list of files that we had to change: https://pastebin.com/5tTcSYxW
As you see, most of them are tests.
Another problem with long double is that it is used in a couple of places not strictly requiring it (include/locale, include/__mutex_base and include/thread), in those cases we introduced a _LIBCPP_LONGEST_DOUBLE macro which is defined to either double or long double depending on the availability of the latter.
After further experimentation in our toolchain, it is infeasible for us to avoid the long double maths functions. We will just have to supplement them.
libcxx/include/cmath | ||
---|---|---|
445 | They both take 2 arguments, the second of which is a long double. Neither are defined in newlib if _LDBL_EQ_DBL is not defined. | |
libcxx/include/locale | ||
180 | Removed. |
These seem wrong to me. nexttoward takes a double, and nexttowardf takes a float.