This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] Set _LIBCPP_ELAST for mingw.
ClosedPublic

Authored by danalbert on Dec 5 2014, 4:57 PM.

Diff Detail

Event Timeline

danalbert updated this revision to Diff 17009.Dec 5 2014, 4:57 PM
danalbert retitled this revision from to [libcxx] Set _LIBCPP_ELAST for mingw..
danalbert updated this object.
danalbert edited the test plan for this revision. (Show Details)
danalbert added reviewers: mclow.lists, K-ballo, EricWF.
danalbert added a subscriber: Unknown Object (MLST).

Normally wouldn't bother with a review for something so trivial, but I know close to nothing about mingw, so I'm hoping someone can tell me if this is right. AIUI, mingw should emulate Linux, so that's what I've done here.

EricWF edited edge metadata.Dec 5 2014, 4:59 PM

I have a mingw environment set up so I'll test this and look into it tomorrow.

mclow.lists edited edge metadata.Dec 5 2014, 9:53 PM

I, too, know pretty much nothing about mingw. but structurally, this looks fine to me.

I don't think it makes sense to use 4095, that number comes from Linux's kernel-user space ABI. MinGW targets link against the MSVC runtime, we should use _sys_nerr.

danalbert updated this revision to Diff 17018.Dec 5 2014, 11:13 PM
danalbert edited edge metadata.

Use _sys_nerr at David's suggestion.

Thanks, figured you might know yet forgot to add you as a reviewer...

EricWF added a comment.Dec 8 2014, 8:40 PM

_sys_nerr seems to be the correct value but it is not available in <__config>. In my mingw setup the definition is located in <stdlib.h>, so an include needs to be added.

I'm reluctant to add yet another include into <__config>.
It includes too much stuff already.

can it be forward declared?

_LIBCPP_ELAST is sparsely used, and it already drags in <errno.h>. I think we should just find a new place for it to live.
It's only used in src/system_error.cpp and src/ios.cpp so it doesn't even have to live in the headers.

danalbert updated this revision to Diff 17193.Dec 11 2014, 1:58 PM

Factor ELAST configuration out into src/config_elast.h.
Use _WIN32 instead of MINGW32 since this is true for MSVC as well.

danalbert updated this revision to Diff 17200.Dec 11 2014, 4:43 PM

Fix file name in file header.

Other than that - this looks good to me.

Has anyone tried this on FreeBSD?

src/system_error.cpp
11 ↗(On Diff #17200)

Please always include <__config> first.

This is a convention, rather than a requirement, since the first thing that <system_error> does is include <__config>

danalbert updated this revision to Diff 17299.Dec 15 2014, 11:41 AM

Move __config inclusion back to the top of the list.

EricWF accepted this revision.Dec 19 2014, 12:55 PM
EricWF edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Dec 19 2014, 12:55 PM
danalbert closed this revision.Jan 6 2015, 9:35 AM