Skip to content

Commit bfff42c

Browse files
authored
Revert "[libc++][format] P3953R3: Rename std::runtime_format (#189657)" (#191912)
This reverts commit 67c893e due to buildbot breakage (#189657 (comment), #189657 (comment)).
1 parent 72df1fc commit bfff42c

10 files changed

Lines changed: 53 additions & 55 deletions

File tree

libcxx/docs/ReleaseNotes/23.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Implemented Papers
4040

4141
- P2440R1: ``ranges::iota``, ``ranges::shift_left`` and ``ranges::shift_right`` (`Github <https://llvm.org/PR105184>`__)
4242
- P3936R1: Safer ``atomic_ref::address`` (`Github <https://llvm.org/PR189594>`__)
43-
- P3953R3: Rename ``std::runtime_format`` (`Github <https://llvm.org/PR189624>`__)
4443
- P4052R0: Renaming saturation arithmetic functions (`Github <https://llvm.org/PR189589>`__)
4544

4645
Improvements and New Features

libcxx/docs/Status/Cxx2cPapers.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
"`P3826R5 <https://wg21.link/P3826R5>`__","Fix Sender Algorithm Customization","2026-03 (Croydon)","","","`#189620 <https://github.com/llvm/llvm-project/issues/189620>`__",""
208208
"`P3980R1 <https://wg21.link/P3980R1>`__","Task's Allocator Use","2026-03 (Croydon)","","","`#189621 <https://github.com/llvm/llvm-project/issues/189621>`__",""
209209
"`P4156R0 <https://wg21.link/P4156R0>`__","Rename meta::has_ellipsis_parameter to meta::is_vararg_function","2026-03 (Croydon)","","","`#189622 <https://github.com/llvm/llvm-project/issues/189622>`__",""
210-
"`P3953R3 <https://wg21.link/P3953R3>`__","Rename ``std::runtime_format``","2026-03 (Croydon)","|Complete|","23","`#189624 <https://github.com/llvm/llvm-project/issues/189624>`__",""
210+
"`P3953R3 <https://wg21.link/P3953R3>`__","Rename ``std::runtime_format``","2026-03 (Croydon)","","","`#189624 <https://github.com/llvm/llvm-project/issues/189624>`__",""
211211
"`P4052R0 <https://wg21.link/P4052R0>`__","Renaming saturation arithmetic functions","2026-03 (Croydon)","|Complete|","23","`#189589 <https://github.com/llvm/llvm-project/issues/189589>`__",""
212212
"`P3941R4 <https://wg21.link/P3941R4>`__","Scheduler Affinity","2026-03 (Croydon)","","","`#189627 <https://github.com/llvm/llvm-project/issues/189627>`__",""
213213
"`P3856R8 <https://wg21.link/P3856R8>`__","New reflection metafunction - is_structural_type (US NB comment 49)","2026-03 (Croydon)","","","`#189625 <https://github.com/llvm/llvm-project/issues/189625>`__",""

libcxx/include/__format/format_functions.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -342,23 +342,23 @@ _LIBCPP_HIDE_FROM_ABI constexpr typename _Ctx::iterator __vformat_to(_ParseCtx&&
342342

343343
# if _LIBCPP_STD_VER >= 26
344344
template <class _CharT>
345-
struct __dynamic_format_string {
345+
struct __runtime_format_string {
346346
private:
347347
basic_string_view<_CharT> __str_;
348348

349349
template <class _Cp, class... _Args>
350350
friend struct basic_format_string;
351351

352352
public:
353-
_LIBCPP_HIDE_FROM_ABI __dynamic_format_string(basic_string_view<_CharT> __s) noexcept : __str_(__s) {}
353+
_LIBCPP_HIDE_FROM_ABI __runtime_format_string(basic_string_view<_CharT> __s) noexcept : __str_(__s) {}
354354

355-
__dynamic_format_string(const __dynamic_format_string&) = delete;
356-
__dynamic_format_string& operator=(const __dynamic_format_string&) = delete;
355+
__runtime_format_string(const __runtime_format_string&) = delete;
356+
__runtime_format_string& operator=(const __runtime_format_string&) = delete;
357357
};
358358

359-
_LIBCPP_HIDE_FROM_ABI inline __dynamic_format_string<char> dynamic_format(string_view __fmt) noexcept { return __fmt; }
359+
_LIBCPP_HIDE_FROM_ABI inline __runtime_format_string<char> runtime_format(string_view __fmt) noexcept { return __fmt; }
360360
# if _LIBCPP_HAS_WIDE_CHARACTERS
361-
_LIBCPP_HIDE_FROM_ABI inline __dynamic_format_string<wchar_t> dynamic_format(wstring_view __fmt) noexcept {
361+
_LIBCPP_HIDE_FROM_ABI inline __runtime_format_string<wchar_t> runtime_format(wstring_view __fmt) noexcept {
362362
return __fmt;
363363
}
364364
# endif
@@ -375,7 +375,7 @@ struct basic_format_string {
375375

376376
_LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> get() const noexcept { return __str_; }
377377
# if _LIBCPP_STD_VER >= 26
378-
_LIBCPP_HIDE_FROM_ABI basic_format_string(__dynamic_format_string<_CharT> __s) noexcept : __str_(__s.__str_) {}
378+
_LIBCPP_HIDE_FROM_ABI basic_format_string(__runtime_format_string<_CharT> __s) noexcept : __str_(__s.__str_) {}
379379
# endif
380380

381381
private:

libcxx/include/format

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ namespace std {
3131
3232
public:
3333
template<class T> consteval basic_format_string(const T& s);
34-
basic_format_string(dynamic-format-string<charT> s) noexcept : str(s.str) {} // since C++26
34+
basic_format_string(runtime-format-string<charT> s) noexcept : str(s.str) {} // since C++26
3535
3636
constexpr basic_string_view<charT> get() const noexcept { return str; }
3737
};
@@ -42,21 +42,21 @@ namespace std {
4242
using wformat_string = // since C++23, exposition only before C++23
4343
basic_format_string<wchar_t, type_identity_t<Args>...>;
4444
45-
template<class charT> struct dynamic-format-string { // since C++26, exposition-only
45+
template<class charT> struct runtime-format-string { // since C++26, exposition-only
4646
private:
4747
basic_string_view<charT> str; // exposition-only
4848
4949
public:
50-
dynamic-format-string(basic_string_view<charT> s) noexcept : str(s) {}
50+
runtime-format-string(basic_string_view<charT> s) noexcept : str(s) {}
5151
52-
dynamic-format-string(const dynamic-format-string&) = delete;
53-
dynamic-format-string& operator=(const dynamic-format-string&) = delete;
52+
runtime-format-string(const runtime-format-string&) = delete;
53+
runtime-format-string& operator=(const runtime-format-string&) = delete;
5454
};
5555
56-
dynamic-format-string<char> dynamic_format(string_view fmt) noexcept {
56+
runtime-format-string<char> runtime_format(string_view fmt) noexcept {
5757
return fmt;
5858
}
59-
dynamic-format-string<wchar_t> dynamic_format(wstring_view fmt) noexcept {
59+
runtime-format-string<wchar_t> runtime_format(wstring_view fmt) noexcept {
6060
return fmt;
6161
}
6262

libcxx/modules/std/format.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export namespace std {
2929
using std::wformat_string;
3030
#endif
3131
#if _LIBCPP_STD_VER >= 26
32-
using std::dynamic_format;
32+
using std::runtime_format;
3333
#endif // _LIBCPP_STD_VER >= 26
3434

3535
// [format.functions], formatting functions

libcxx/test/std/utilities/format/format.fmt.string/ctor.dynamic-format-string.pass.cpp renamed to libcxx/test/std/utilities/format/format.fmt.string/ctor.runtime-format-string.pass.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@
1313
// template<class charT, class... Args>
1414
// class basic_format_string<charT, type_identity_t<Args>...>
1515
//
16-
// basic_format_string(dynamic-format-string<charT> s) noexcept : str(s.str) {}
16+
// basic_format_string(runtime-format-string<charT> s) noexcept : str(s.str) {}
1717
//
1818
// Additional testing is done in
19-
// - libcxx/test/std/utilities/format/format.functions/format.dynamic_format.pass.cpp
20-
// - libcxx/test/std/utilities/format/format.functions/format.locale.dynamic_format.pass.cpp
19+
// - libcxx/test/std/utilities/format/format.functions/format.runtime_format.pass.cpp
20+
// - libcxx/test/std/utilities/format/format.functions/format.locale.runtime_format.pass.cpp
2121

2222
#include <format>
2323
#include <cassert>
2424

2525
#include "test_macros.h"
2626

2727
int main(int, char**) {
28-
static_assert(noexcept(std::format_string<>{std::dynamic_format(std::string_view{})}));
28+
static_assert(noexcept(std::format_string<>{std::runtime_format(std::string_view{})}));
2929
{
30-
std::format_string<> s = std::dynamic_format("}{invalid format string}{");
30+
std::format_string<> s = std::runtime_format("}{invalid format string}{");
3131
assert(s.get() == "}{invalid format string}{");
3232
}
3333

3434
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
35-
static_assert(noexcept(std::wformat_string<>{std::dynamic_format(std::wstring_view{})}));
35+
static_assert(noexcept(std::wformat_string<>{std::runtime_format(std::wstring_view{})}));
3636
{
37-
std::wformat_string<> s = std::dynamic_format(L"}{invalid format string}{");
37+
std::wformat_string<> s = std::runtime_format(L"}{invalid format string}{");
3838
assert(s.get() == L"}{invalid format string}{");
3939
}
4040
#endif // TEST_HAS_NO_WIDE_CHARACTERS

libcxx/test/std/utilities/format/format.functions/format.locale.dynamic_format.pass.cpp renamed to libcxx/test/std/utilities/format/format.functions/format.locale.runtime_format.pass.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
// Tests the behavior of
1818
//
19-
// dynamic-format-string<char> dynamic_format(string_view fmt) noexcept;
20-
// dynamic-format-string<wchar_t> dynamic_format(wstring_view fmt) noexcept;
19+
// runtime-format-string<char> runtime_format(string_view fmt) noexcept;
20+
// runtime-format-string<wchar_t> runtime_format(wstring_view fmt) noexcept;
2121
//
2222
// and
2323
//
2424
// template<class charT, class... Args>
2525
// struct basic_format_string {
2626
// ...
27-
// basic_format_string(dynamic-format-string<charT> s) noexcept : str(s.str) {}
27+
// basic_format_string(runtime-format-string<charT> s) noexcept : str(s.str) {}
2828
// ...
2929
// }
3030
//
@@ -35,9 +35,9 @@
3535
// template<class... Args>
3636
// wstring format(const locale& loc, wformat_string<Args...> fmt, Args&&... args);
3737
//
38-
// The basics of dynamic_format and basic_format_string's constructor are tested in
39-
// - libcxx/test/std/utilities/format/format.syn/dynamic_format_string.pass.cpp
40-
// - libcxx/test/std/utilities/format/format.fmt.string/ctor.dynamic-format-string.pass.cpp
38+
// The basics of runtime_format and basic_format_string's constructor are tested in
39+
// - libcxx/test/std/utilities/format/format.syn/runtime_format_string.pass.cpp
40+
// - libcxx/test/std/utilities/format/format.fmt.string/ctor.runtime-format-string.pass.cpp
4141

4242
#include <format>
4343
#include <cassert>
@@ -52,7 +52,7 @@
5252

5353
auto test = []<class CharT, class... Args>(
5454
std::basic_string_view<CharT> expected, std::basic_string_view<CharT> fmt, Args&&... args) constexpr {
55-
std::basic_string<CharT> out = std::format(std::locale(), std::dynamic_format(fmt), std::forward<Args>(args)...);
55+
std::basic_string<CharT> out = std::format(std::locale(), std::runtime_format(fmt), std::forward<Args>(args)...);
5656
TEST_REQUIRE(out == expected,
5757
TEST_WRITE_CONCATENATED(
5858
"\nFormat string ", fmt, "\nExpected output ", expected, "\nActual output ", out, '\n'));
@@ -71,7 +71,7 @@ auto test_exception =
7171
TEST_WRITE_CONCATENATED(
7272
"\nFormat string ", fmt, "\nExpected exception ", what, "\nActual exception ", e.what(), '\n'));
7373
},
74-
TEST_IGNORE_NODISCARD std::format(std::locale(), std::dynamic_format(fmt), std::forward<Args>(args)...));
74+
TEST_IGNORE_NODISCARD std::format(std::locale(), std::runtime_format(fmt), std::forward<Args>(args)...));
7575
};
7676

7777
int main(int, char**) {

libcxx/test/std/utilities/format/format.functions/format.dynamic_format.pass.cpp renamed to libcxx/test/std/utilities/format/format.functions/format.runtime_format.pass.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515

1616
// Tests the behavior of
1717
//
18-
// dynamic-format-string<char> dynamic_format(string_view fmt) noexcept;
19-
// dynamic-format-string<wchar_t> dynamic_format(wstring_view fmt) noexcept;
18+
// runtime-format-string<char> runtime_format(string_view fmt) noexcept;
19+
// runtime-format-string<wchar_t> runtime_format(wstring_view fmt) noexcept;
2020
//
2121
// and
2222
//
2323
// template<class charT, class... Args>
2424
// struct basic_format_string {
2525
// ...
26-
// basic_format_string(dynamic-format-string<charT> s) noexcept : str(s.str) {}
26+
// basic_format_string(runtime-format-string<charT> s) noexcept : str(s.str) {}
2727
// ...
2828
// }
2929
//
@@ -34,9 +34,9 @@
3434
// template<class... Args>
3535
// wstring format(wformat_string<Args...> fmt, Args&&... args);
3636
//
37-
// The basics of dynamic_format and basic_format_string's constructor are tested in
38-
// - libcxx/test/std/utilities/format/format.syn/dynamic_format_string.pass.cpp
39-
// - libcxx/test/std/utilities/format/format.fmt.string/ctor.dynamic-format-string.pass.cpp
37+
// The basics of runtime_format and basic_format_string's constructor are tested in
38+
// - libcxx/test/std/utilities/format/format.syn/runtime_format_string.pass.cpp
39+
// - libcxx/test/std/utilities/format/format.fmt.string/ctor.runtime-format-string.pass.cpp
4040

4141
#include <format>
4242
#include <cassert>
@@ -50,7 +50,7 @@
5050

5151
auto test = []<class CharT, class... Args>(
5252
std::basic_string_view<CharT> expected, std::basic_string_view<CharT> fmt, Args&&... args) constexpr {
53-
std::basic_string<CharT> out = std::format(std::dynamic_format(fmt), std::forward<Args>(args)...);
53+
std::basic_string<CharT> out = std::format(std::runtime_format(fmt), std::forward<Args>(args)...);
5454
TEST_REQUIRE(out == expected,
5555
TEST_WRITE_CONCATENATED(
5656
"\nFormat string ", fmt, "\nExpected output ", expected, "\nActual output ", out, '\n'));
@@ -69,7 +69,7 @@ auto test_exception =
6969
TEST_WRITE_CONCATENATED(
7070
"\nFormat string ", fmt, "\nExpected exception ", what, "\nActual exception ", e.what(), '\n'));
7171
},
72-
TEST_IGNORE_NODISCARD std::format(std::dynamic_format(fmt), std::forward<Args>(args)...));
72+
TEST_IGNORE_NODISCARD std::format(std::runtime_format(fmt), std::forward<Args>(args)...));
7373
};
7474

7575
int main(int, char**) {

libcxx/test/std/utilities/format/format.syn/dynamic_format_string.pass.cpp renamed to libcxx/test/std/utilities/format/format.syn/runtime_format_string.pass.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@
1010

1111
// <format>
1212

13-
// template<class charT> struct dynamic-format-string { // exposition-only
13+
// template<class charT> struct runtime-format-string { // exposition-only
1414
// private:
1515
// basic_string_view<charT> str; // exposition-only
1616
//
1717
// public:
18-
// dynamic-format-string(basic_string_view<charT> s) noexcept : str(s) {}
18+
// runtime-format-string(basic_string_view<charT> s) noexcept : str(s) {}
1919
//
20-
// dynamic-format-string(const dynamic-format-string&) = delete;
21-
// dynamic-format-string& operator=(const dynamic-format-string&) = delete;
20+
// runtime-format-string(const runtime-format-string&) = delete;
21+
// runtime-format-string& operator=(const runtime-format-string&) = delete;
2222
// };
2323
//
24-
// dynamic-format-string<char> dynamic_format(string_view fmt) noexcept;
25-
// dynamic-format-string<wchar_t> dynamic_format(wstring_view fmt) noexcept;
24+
// runtime-format-string<char> runtime_format(string_view fmt) noexcept;
25+
// runtime-format-string<wchar_t> runtime_format(wstring_view fmt) noexcept;
2626
//
2727
// Additional testing is done in
28-
// - libcxx/test/std/utilities/format/format.functions/format.dynamic_format.pass.cpp
29-
// - libcxx/test/std/utilities/format/format.functions/format.locale.dynamic_format.pass.cpp
28+
// - libcxx/test/std/utilities/format/format.functions/format.runtime_format.pass.cpp
29+
// - libcxx/test/std/utilities/format/format.functions/format.locale.runtime_format.pass.cpp
3030

3131
#include <format>
3232

@@ -50,19 +50,19 @@ static void test_properties() {
5050
}
5151

5252
int main(int, char**) {
53-
static_assert(noexcept(std::dynamic_format(std::string_view{})));
54-
auto format_string = std::dynamic_format(std::string_view{});
53+
static_assert(noexcept(std::runtime_format(std::string_view{})));
54+
auto format_string = std::runtime_format(std::string_view{});
5555

5656
using FormatString = decltype(format_string);
57-
LIBCPP_ASSERT((std::same_as<FormatString, std::__dynamic_format_string<char>>));
57+
LIBCPP_ASSERT((std::same_as<FormatString, std::__runtime_format_string<char>>));
5858
test_properties<FormatString, char>();
5959

6060
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
61-
static_assert(noexcept(std::dynamic_format(std::wstring_view{})));
62-
auto wformat_string = std::dynamic_format(std::wstring_view{});
61+
static_assert(noexcept(std::runtime_format(std::wstring_view{})));
62+
auto wformat_string = std::runtime_format(std::wstring_view{});
6363

6464
using WFormatString = decltype(wformat_string);
65-
LIBCPP_ASSERT((std::same_as<WFormatString, std::__dynamic_format_string<wchar_t>>));
65+
LIBCPP_ASSERT((std::same_as<WFormatString, std::__runtime_format_string<wchar_t>>));
6666
test_properties<WFormatString, wchar_t>();
6767
#endif // TEST_HAS_NO_WIDE_CHARACTERS
6868

libcxx/utils/generate_feature_test_macro_components.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,6 @@ def add_version_header(tc):
572572
# "c++23": 202207, Not implemented P2419R2 Clarify handling of encodings in localized formatting of chrono types
573573
# "c++26": 202306, P2637R3 Member Visit (implemented)
574574
# "c++26": 202311, P2918R2 Runtime format strings II (implemented)
575-
# "c++26": 202603, P3953R3 Rename std::runtime_format (implemented)
576575
},
577576
# Note these three papers are adopted at the June 2023 meeting and have sequential numbering
578577
# 202304 P2510R3 Formatting pointers (Implemented)

0 commit comments

Comments
 (0)