This is an archive of the discontinued LLVM Phabricator instance.

Newlib names ELAST differently than linux
ClosedPublic

Authored by jroelofs on Aug 26 2014, 2:45 PM.

Details

Reviewers
danalbert

Diff Detail

Event Timeline

jroelofs updated this revision to Diff 12971.Aug 26 2014, 2:45 PM
jroelofs retitled this revision from to Newlib names ELAST differently than linux.
jroelofs updated this object.
jroelofs edited the test plan for this revision. (Show Details)
jroelofs added a reviewer: danalbert.
jroelofs added a subscriber: Unknown Object (MLST).
danalbert edited edge metadata.Aug 26 2014, 2:55 PM

It would probably make sense to add the following block to include/__config and clean up all the duplication.

#ifndef ELAST
#if defined(__linux__)
#define ELAST 4095
#elif defined(_NEWLIB_VERSION) && defined(__ELASTERROR)
#define ELAST __ELASTERROR
#endif
#endif
jroelofs added a comment.EditedAug 26 2014, 3:51 PM

That sounds like a good idea. Maybe it's better to have it be:

#if defined(ELAST)
#define LIBCPP_ELAST ELAST
#elif defined(__linux__)
#define LIBCPP_ELAST 4095
#elif defined(_NEWLIB_VERSION) && defined(__ELASTERROR)
#define LIBCPP_ELAST __ELASTERROR
#else
// Error here so that the person doing the libcxx port has an easier time:
#error This platform's ELAST hasn't been ported yet
#endif
#endif

... as I don't think it's appropriate for __config to be defining ELAST so globally.

Yes, that would be better.

jroelofs updated this revision to Diff 13081.Aug 29 2014, 7:28 AM
jroelofs edited edge metadata.

Address @danalbert's suggestion to move the configuration-ey stuff to include/__config

danalbert accepted this revision.Aug 29 2014, 8:27 AM
danalbert edited edge metadata.
danalbert added inline comments.
src/ios.cpp
56

Could also define _LIBCPP_ELAST to a large dummy value that would make the second half of the conditional always true and get rid of all the pesky ifdefs. Up to you. I'm happy with the patch now.

This revision is now accepted and ready to land.Aug 29 2014, 8:27 AM
jroelofs closed this revision.Sep 2 2014, 1:44 PM

r216943