This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Mark some variables as inline, per the spec
AbandonedPublic

Authored by ldionne on Feb 10 2023, 5:00 PM.

Details

Reviewers
Mordante
Group Reviewers
Restricted Project
Summary

This is really what D110243 should have done. These variables are
inline in the spec. We unfortunately need to support pre-C++17 since
some of these inline variables are in C++17 parts of the library that
we provide pre-C++17 as an extension.

Diff Detail

Event Timeline

ldionne created this revision.Feb 10 2023, 5:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 10 2023, 5:00 PM
ldionne requested review of this revision.Feb 10 2023, 5:00 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 10 2023, 5:00 PM
Herald added a reviewer: Restricted Project. · View Herald Transcript

Thanks for working on this. LGTM, but I would like to bikeshed regarding the name.

libcxx/include/__config
895

I wonder should we use this instead? And just constexpr in the #else. For me that makes it easier to understand what the macro does.

ldionne marked an inline comment as done.Feb 11 2023, 8:36 AM
ldionne added inline comments.
libcxx/include/__config
895

The problem is that we still want those variables to be constexpr even in pre C++17.

Mordante added inline comments.Feb 12 2023, 10:24 AM
libcxx/include/__config
895

Yes therefore I suggested "And just constexpr in the #else". With our attributes we often write the "ideal" version for a certain C++ version and a work-around for older versions.

ldionne updated this revision to Diff 496950.Feb 13 2023, 6:09 AM
ldionne marked an inline comment as done.

Address comments.

Mordante accepted this revision.Feb 13 2023, 10:32 AM

LGTM!

libcxx/include/__config
897

I really like to comment!

This revision is now accepted and ready to land.Feb 13 2023, 10:32 AM
ldionne abandoned this revision.Mar 8 2023, 8:17 AM

It turns out that this is more complicated than it seems. I am going to abandon this in favour of the stack of patches starting at D145422.