Skip to content

[libc++] does not define __cpp_lib_format #77773

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
h-2 opened this issue Jan 11, 2024 · 8 comments · Fixed by #98275
Closed

[libc++] does not define __cpp_lib_format #77773

h-2 opened this issue Jan 11, 2024 · 8 comments · Fixed by #98275
Assignees
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@h-2
Copy link
Member

h-2 commented Jan 11, 2024

dff62f5

states that

Some std::formatter specializations are not yet available since the class used in the specialization has not been implemented in libc++. This prevents the feature-test macro to be set.

Which specializations are that? I think it is unfortunate that the header is available for a while, but conforming code that relies on the macro cannot use it. Furthermore, __cpp_lib_format_ranges and __cpp_lib_format_uchar are set, which is weird, because they are features that build on __cpp_lib_format so implementations might even think that checking one of the former is sufficient, even though in this situation it is not?

@github-actions github-actions bot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jan 11, 2024
@frederick-vs-ja
Copy link
Contributor

Currently both __cpp_lib_format and __cpp_lib_chrono are blocked by missing chrono types. See #73953 (comment).

@h-2
Copy link
Member Author

h-2 commented Jan 11, 2024

Ah, that is unfortunate... is there a timeline for adding this?

@mordante
Copy link
Member

__cpp_lib_format requires the chrono formatters to be available. 3 papers set the macro to the same initial value. __cpp_lib_format_ranges and __cpp_lib_format_uchar are defined separately. I don't have a timeline but this is high on the top of my priority list for LLVM-19. (LLVM-18 will branch in later this month.)

@pawsaw
Copy link

pawsaw commented Jul 4, 2024

@mordante Could you give us a status update? I'm working with Homebrew clang version 18.1.6 and the corresponding libc++. Does this version suppose to have this __cpp_lib_format macro defined? According to my experiments, it does not. However, [1] says this feature is implemented?

Edit: Ok, I misunderstood your comment. So, this will be fixed with LLVM-19 and not backported to LLVM-18, correct?

[1] https://en.cppreference.com/w/cpp/compiler_support/20

@frederick-vs-ja

This comment was marked as outdated.

@mordante
Copy link
Member

mordante commented Jul 4, 2024

cppreference is not the authoritative source for the status, https://libcxx.llvm.org/Status/Cxx20.html is the authoritative source. (Still I try to keep the status up-to-date on the parts I work on.)

I disagree with @frederick-vs-ja. I think it might be possible to get all chrono parts required for the initial version of __cpp_lib_format done before LLVM-19 is branched. But not all chrono parts for the chrono FTM. The latter would require parsing support, which will not be done before LLVM-19.

So it might be possible to get it in before LLVM-19, but it will be tight. It will not be backported to LLVM-18.

@pawsaw
Copy link

pawsaw commented Jul 4, 2024

Thank you.

mordante added a commit to mordante/llvm-project that referenced this issue Jul 10, 2024
In order to define the format __cpp_lib_format to its initial value
(201907) these papers need to be completed:
- P0645R10 Text Formatting
- P1652R1 Printf corner cases in std::format
- 1361R2 Integration of chrono with text formatting
The first two have been implemented for a while the latter is almost done.

The next value (202106) requires:
- P2216R3 std::format improvements
which has been implemented

The next value (202110) requires:
- P2418R2 Add support for std::generator-like types to std::format
- P2372R3 Fixing locale handling in chrono formatters
The first one has been implemented for a while the latter is almost
done. The latter paper is a DR against 1361R2 and both are implemented
at the same time.

We've had user feedback that the missing of the __cpp_lib_format makes
their lives harder (llvm#77773).
The missing papers 1361R2 and P2372R3 are very close to completion and
might completed before LLVM-19, but it will be a close call. This has
been discussed in the monthly libc++ meeting and we decided to set the
__cpp_lib_format so it will be set in LLVM-19.

Based on the discussion and the implementation status the
__cpp_lib_format is set to 202110
@mordante
Copy link
Member

We've decided to define the macro regardless whether the missing chrono parts are done before LLVM 19. See #98275.

swift-ci pushed a commit to swiftlang/llvm-project that referenced this issue Jul 10, 2024
In order to define the format __cpp_lib_format to its initial value
(201907) these papers need to be completed:
- P0645R10 Text Formatting
- P1652R1 Printf corner cases in std::format
- 1361R2 Integration of chrono with text formatting The first two have
been implemented for a while the latter is almost done.

The next value (202106) requires:
- P2216R3 std::format improvements which has been implemented

The next value (202110) requires:
- P2418R2 Add support for std::generator-like types to std::format
- P2372R3 Fixing locale handling in chrono formatters The first one has
been implemented for a while the latter is almost done. The latter paper
is a DR against 1361R2 and both are implemented at the same time.

We've had user feedback that the missing of the __cpp_lib_format makes
their lives harder (llvm#77773).
The missing papers 1361R2 and P2372R3 are very close to completion and
might completed before LLVM-19, but it will be a close call. This has
been discussed in the monthly libc++ meeting and we decided to set the
__cpp_lib_format so it will be set in LLVM-19.

Based on the discussion and the implementation status the
__cpp_lib_format is set to 202110.

Fixes llvm#77773
aaryanshukla pushed a commit to aaryanshukla/llvm-project that referenced this issue Jul 14, 2024
In order to define the format __cpp_lib_format to its initial value
(201907) these papers need to be completed:
- P0645R10 Text Formatting
- P1652R1 Printf corner cases in std::format
- 1361R2 Integration of chrono with text formatting The first two have
been implemented for a while the latter is almost done.

The next value (202106) requires:
- P2216R3 std::format improvements which has been implemented

The next value (202110) requires:
- P2418R2 Add support for std::generator-like types to std::format
- P2372R3 Fixing locale handling in chrono formatters The first one has
been implemented for a while the latter is almost done. The latter paper
is a DR against 1361R2 and both are implemented at the same time.

We've had user feedback that the missing of the __cpp_lib_format makes
their lives harder (llvm#77773).
The missing papers 1361R2 and P2372R3 are very close to completion and
might completed before LLVM-19, but it will be a close call. This has
been discussed in the monthly libc++ meeting and we decided to set the
__cpp_lib_format so it will be set in LLVM-19.

Based on the discussion and the implementation status the
__cpp_lib_format is set to 202110.

Fixes llvm#77773
blueboxd pushed a commit to blueboxd/libcxx that referenced this issue Apr 19, 2025
In order to define the format __cpp_lib_format to its initial value
(201907) these papers need to be completed:
- P0645R10 Text Formatting
- P1652R1 Printf corner cases in std::format
- 1361R2 Integration of chrono with text formatting The first two have
been implemented for a while the latter is almost done.

The next value (202106) requires:
- P2216R3 std::format improvements which has been implemented

The next value (202110) requires:
- P2418R2 Add support for std::generator-like types to std::format
- P2372R3 Fixing locale handling in chrono formatters The first one has
been implemented for a while the latter is almost done. The latter paper
is a DR against 1361R2 and both are implemented at the same time.

We've had user feedback that the missing of the __cpp_lib_format makes
their lives harder (llvm/llvm-project#77773).
The missing papers 1361R2 and P2372R3 are very close to completion and
might completed before LLVM-19, but it will be a close call. This has
been discussed in the monthly libc++ meeting and we decided to set the
__cpp_lib_format so it will be set in LLVM-19.

Based on the discussion and the implementation status the
__cpp_lib_format is set to 202110.

Fixes #77773

NOKEYCHECK=True
GitOrigin-RevId: deeb936863f26e124cc870319148b0576266f11c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants