This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Change workaround for init_priority((101)) outside of system headers
ClosedPublic

Authored by ldionne on Dec 8 2021, 5:30 AM.

Details

Summary

We had previously been using a different workaround for pretending that
we were inside a system header, however it had some undesirable effects
on dependency parsing for build systems, as explained in [1].

This patch changes the workaround to use #pragma GCC system_header,
which shouldn't suffer from the same issue. Unfortunately, it is a lot
more verbose. The issue is that #pragma GCC system_header is ignored
when we are inside a source file, so we have to create a header just for
the sake of using it. IMO this seems like an artificial restriction
without much benefit, but investigating that is a different story.
For now, this should at least solve build system problems at the
cost of some readability.

[1]: https://reviews.llvm.org/D95972#3178968

Diff Detail

Event Timeline

ldionne requested review of this revision.Dec 8 2021, 5:30 AM
ldionne created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2021, 5:30 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
mstorsjo accepted this revision.Dec 8 2021, 10:14 AM

Thanks, this does seem to fix the issue. A small nit about the commit message though - it’s priority 100 that requires the workaround, 101 is the one that can be used freely.

Thanks, this does seem to fix the issue. A small nit about the commit message though - it’s priority 100 that requires the workaround, 101 is the one that can be used freely.

Thanks, will fix when landing.

This revision was not accepted when it landed; it landed in state Needs Review.Dec 13 2021, 11:38 AM
This revision was automatically updated to reflect the committed changes.