This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Add the version header to all headers.
ClosedPublic

Authored by Mordante on Dec 22 2021, 9:15 AM.

Details

Summary

Some headers which require the version header depend on other headers to
provide it. Include the version header in all top-level headers to make
sure a header cleanup can't remove the version header.

Note this doesn't add the version header to the c headers.

Diff Detail

Event Timeline

Mordante requested review of this revision.Dec 22 2021, 9:15 AM
Mordante created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptDec 22 2021, 9:15 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
Mordante updated this revision to Diff 396046.Dec 23 2021, 10:15 AM

Add the version header to all headers except C headers.

Mordante retitled this revision from [libc++] Add the version header to compare. to [libc++] Add the version header to all headers..Dec 23 2021, 10:18 AM
Mordante edited the summary of this revision. (Show Details)
Quuxplusone added a subscriber: Quuxplusone.

LGTM! It occurs to me that we could add a Python check to enforce this, but that's a question for another day.
Please do add version to the "ignored headers" on the graph-header-deps script, though:

diff --git a/libcxx/utils/graph_header_deps.py b/libcxx/utils/graph_header_deps.py
 
 def is_config_header(h):
-    return os.path.basename(h) in ['__config', '__libcpp_version', '__undef_macros']
+    return os.path.basename(h) in ['__config', '__libcpp_version', '__undef_macros', 'version']
Mordante updated this revision to Diff 396063.Dec 23 2021, 11:38 AM

As requested adds version to the "ignored headers" on the graph-header-deps script.
Give it another CI run to make sure this keeps working.

ldionne accepted this revision.Dec 29 2021, 8:00 AM
This revision is now accepted and ready to land.Dec 29 2021, 8:00 AM

It should be possible to rebase this onto main now and ship it once CI passes.

Mordante updated this revision to Diff 397303.Jan 4 2022, 8:00 AM

Rebase to trigger CI

This revision was automatically updated to reflect the committed changes.