This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Move once_flag outside of <mutex>
ClosedPublic

Authored by ldionne on Jul 17 2023, 9:58 AM.

Details

Reviewers
philnik
Group Reviewers
Restricted Project
Commits
rGc01794e7ae8e: [libc++] Move once_flag outside of <mutex>
Summary

This allows including once_flag directly from <__locale> instead of
depending on all of <mutex>, which requires threading. In turn, this
makes it easier to support locales on platforms without threading.

Drive-by change: clang-format once_flag.h and use _LIBCPP_HIDE_FROM_ABI

Diff Detail

Event Timeline

ldionne created this revision.Jul 17 2023, 9:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 9:58 AM
ldionne requested review of this revision.Jul 17 2023, 9:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2023, 9:58 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript
philnik accepted this revision.Jul 17 2023, 10:30 AM
philnik added a subscriber: philnik.

Is there a reason you want to remove the dependency?

libcxx/include/__mutex/once_flag.h
33

As a follow-up, maybe remove the C++03 code? It looks like the C++11 code should work just fine in C++03.

This revision is now accepted and ready to land.Jul 17 2023, 10:30 AM

Is there a reason you want to remove the dependency?

This was originally prompted by trying to unblock D144322. I'm not sure it's necessary anymore but it still seems like a good thing.

ldionne updated this revision to Diff 550375.Aug 15 2023, 10:01 AM
ldionne edited the summary of this revision. (Show Details)

Rebase.

ldionne updated this revision to Diff 555030.Aug 31 2023, 7:02 AM

Fix transitive includes.

This revision was automatically updated to reflect the committed changes.