This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Support Newlib as libc++'s C library (on ARM) [cmath part, part 1]
AbandonedPublic

Authored by jroelofs on Sep 19 2014, 2:27 PM.

Details

Summary

Add shims for nexttoward/nexttowardf/nexttowardl to patch over newlib missing them.

Diff Detail

Event Timeline

jroelofs updated this revision to Diff 13892.Sep 19 2014, 2:27 PM
jroelofs retitled this revision from to [libc++] Support Newlib as libc++'s C library (on ARM) [cmath part, part 1].
jroelofs updated this object.
jroelofs edited the test plan for this revision. (Show Details)
jroelofs added reviewers: danalbert, jfb, EricWF.
jroelofs added a subscriber: Unknown Object (MLST).
jfb added inline comments.Sep 22 2014, 10:48 AM
include/support/newlib/math.h
17

Why __arm__? It seems better to key off long double being the same as double. I'm not sure if clang has a macro for this, but it should.

jfb added inline comments.Sep 22 2014, 10:57 AM
include/support/newlib/math.h
17

Discussed on IRC:

#if __SIZEOF_DOUBLE__ == __SIZEOF_LONG_DOUBLE__
rengolin added inline comments.
src/support/newlib/math.cpp
15

you wont need this assert if you use the same macro as above (double == long double), right? Possibly not even the comment...

jroelofs added inline comments.Sep 22 2014, 6:30 PM
src/support/newlib/math.cpp
15

right :) I think though that the comment makes it clear: these are not an approximation; they precisely implement the required behavior.

rengolin added inline comments.Sep 22 2014, 6:58 PM
src/support/newlib/math.cpp
15

good point.

jroelofs updated this revision to Diff 13994.Sep 23 2014, 7:29 AM

Use __SIZEOF_DOUBLE__ == __SIZEOF_LONG_DOUBLE__ for the check, and guards to make sure these new support files are only used for newlib.

jfb edited edge metadata.Sep 23 2014, 9:06 AM

Everything looks good but the presence of math.cpp.

src/support/newlib/math.cpp
33

Wouldn't it be better to inline all of these into math.h?

jroelofs abandoned this revision.Sep 23 2014, 1:35 PM

Abandoning in favor of plunking these directly in Newlib: https://sourceware.org/ml/newlib/2014/msg00469.html