This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Remove C++03 extensions for std::allocator_arg & friends
ClosedPublic

Authored by ldionne on Mar 6 2023, 1:46 PM.

Details

Summary

As explained in the release note, libc++ used to provide various
global variables as an extension in C++03 mode. Unfortunately, that
made our definition non-conforming in all standard modes. This was
never a big problem until recently, since we are trying to support
C++20 Modules in libc++, and that requires cleaning up the definition
of these variables.

This change is the first in a series of changes to achieve our end goal.
This patch removes the ability for users to rely on the (incorrect)
definition of those global variables inside the shared library. The
plan is to then remove those definitions from the shared library
(which is an ABI break but I don't think it will have impact), and
finally to make our definition of those variables conforming in all
standard modes.

Diff Detail

Event Timeline

ldionne created this revision.Mar 6 2023, 1:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 1:46 PM
ldionne requested review of this revision.Mar 6 2023, 1:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 1:46 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

This is the first step of a 3 patch series to work around the ODR violations found in D143797. If this stack of patches works out, it would supersede D143797.

ldionne added a subscriber: Restricted Project.Mar 6 2023, 3:17 PM

Pinging vendors since this is a potentially breaking change, however I don't think the impact of this is very large. I'm building the world over here, I'll have more info soon.

EricWF accepted this revision.Mar 7 2023, 1:50 PM
EricWF added a subscriber: EricWF.

Is there a design document describing these sets of changes?
If this affects the library *build* primarily, then it should be possible to make this continue to work.

Either way, I have no strong feelings on this particular change. LGTM. Hopefully nobody complains.

This revision is now accepted and ready to land.Mar 7 2023, 1:50 PM

Is there a design document describing these sets of changes?

No, it's pretty simple, it's just a stack of 3 changes total. I'll upload everything so you can take a look if you want.

ldionne updated this revision to Diff 504659.Mar 13 2023, 7:52 AM

Fix test failures in C++03 mode. The CI had actually not run on the previous iteration of the patch, I think that's because I uploaded child patches after uploading the parent patch.

ldionne updated this revision to Diff 504764.Mar 13 2023, 11:15 AM

Remove a stray use of allocator_arg in C++03

Okay, so I got the results of building a large codebase with this change and I didn't see any regressions. I strongly think this won't be noticed by many users, if at all.

I'll ship this now, but if a vendor has concerns, please reach out.