This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Add missing __has_include checks for C headers not provided by libc++
ClosedPublic

Authored by ldionne on Nov 22 2022, 10:48 AM.

Details

Summary

This makes the library consistent in how it handles C library headers. For C headers provided by libc++,
we unconditionally include <foo.h> from <cfoo>, and then <foo.h> conditionally include_next <foo.h>.
For headers not provided by libc++, <cfoo> conditionally includes the system's <foo.h> directly.

Diff Detail

Event Timeline

ldionne created this revision.Nov 22 2022, 10:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 22 2022, 10:48 AM
ldionne requested review of this revision.Nov 22 2022, 10:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 22 2022, 10:48 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
philnik accepted this revision.Nov 22 2022, 11:07 AM
philnik added a subscriber: philnik.

LGTM with green CI.

libcxx/include/cassert
25

Could we add something like

#ifdef _LIBCPP_ASSERT_H
#  error "Does libc++ provide an assert.h now?"
#endif

to make sure?

This revision is now accepted and ready to land.Nov 22 2022, 11:07 AM
ldionne marked an inline comment as done.Nov 22 2022, 1:33 PM
ldionne updated this revision to Diff 477285.Nov 22 2022, 1:34 PM

Address comment.

The AIX failures are flakes.

This revision was landed with ongoing or failed builds.Nov 23 2022, 6:50 AM
This revision was automatically updated to reflect the committed changes.