This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Check _LIBCPP_USE_CLOCK_GETTIME before using clock_gettime
ClosedPublic

Authored by ldionne on Oct 5 2020, 4:52 AM.

Details

Summary

[libc++] Check _LIBCPP_USE_CLOCK_GETTIME before using clock_gettime

The clock_gettime function is available when _POSIX_TIMERS is defined.
We check for this and set _LIBCPP_USE_CLOCK_GETTIME accordingly since
59b3102739c. But check for _LIBCPP_USE_CLOCK_GETTIME was removed in
babd3aefc91. As a result, code is now trying to use clock_gettime even
on platform where it is not available and it is causing build failure with newlib

This patch restores the checks to fix this.

Diff Detail

Event Timeline

abidh created this revision.Oct 5 2020, 4:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 5 2020, 4:52 AM
abidh requested review of this revision.Oct 5 2020, 4:52 AM
ldionne commandeered this revision.Oct 5 2020, 2:27 PM
ldionne edited reviewers, added: abidh; removed: ldionne.

We don't have CI on newlib. Would you be willing to set some up so we can officially support that configuration?

Commandeering to apply a slightly different fix.

ldionne updated this revision to Diff 296301.Oct 5 2020, 2:32 PM

Simplify the logic for #include

ldionne updated this revision to Diff 296302.Oct 5 2020, 2:34 PM

Update commit author

abidh accepted this revision.Oct 6 2020, 2:46 AM

Thanks for the review.

We don't have CI on newlib. Would you be willing to set some up so we can officially support that configuration?

I would like to setup the CI as I have more patches coming up that improve newlib support. Do we have any guidance/documentation on how to setup a CI?

Commandeering to apply a slightly different fix.

The updated patch looks ok to me.

Thanks for the review.

We don't have CI on newlib. Would you be willing to set some up so we can officially support that configuration?

I would like to setup the CI as I have more patches coming up that improve newlib support. Do we have any guidance/documentation on how to setup a CI?

I need to write some. I'll do that and ping you.

ldionne accepted this revision as: Restricted Project.Oct 6 2020, 8:56 AM
This revision is now accepted and ready to land.Oct 6 2020, 8:56 AM