Skip to content

Commit

Permalink
[libc++][format] Removes the experimental status.
Browse files Browse the repository at this point in the history
The code has been quite ready for a while now and there are no more ABI
breaking papers. So this is a good time to mark the feature as stable.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D150802
  • Loading branch information
mordante committed May 24, 2023
1 parent bb4f88f commit dff62f5
Show file tree
Hide file tree
Showing 183 changed files with 40 additions and 259 deletions.
5 changes: 5 additions & 0 deletions libcxx/docs/ReleaseNotes.rst
Expand Up @@ -59,6 +59,11 @@ Improvements and New Features
- `D122780 <https://reviews.llvm.org/D122780>`_ Improved the performance of ``std::sort`` and ``std::ranges::sort``
by up to 50% for arithmetic types and by approximately 10% for other types.

- The ``<format>`` header is no longer considered experimental. 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.

Deprecations and Removals
-------------------------

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/formatter.h
Expand Up @@ -53,7 +53,7 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
#if _LIBCPP_STD_VER >= 20

namespace __formatter {

Expand Down Expand Up @@ -825,7 +825,7 @@ struct formatter<chrono::hh_mm_ss<_Duration>, _CharT> : public __formatter_chron
return _Base::__parse(__ctx, __format_spec::__fields_chrono, __format_spec::__flags::__time);
}
};
#endif // if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
#endif // if _LIBCPP_STD_VER >= 20

_LIBCPP_END_NAMESPACE_STD

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/ostream.h
Expand Up @@ -37,7 +37,7 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
#if _LIBCPP_STD_VER >= 20

namespace chrono {

Expand Down Expand Up @@ -257,7 +257,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const hh_mm_ss<_Duration> __hms

} // namespace chrono

#endif // if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
#endif // if _LIBCPP_STD_VER >= 20

_LIBCPP_END_NAMESPACE_STD

Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__chrono/parser_std_format_spec.h
Expand Up @@ -24,7 +24,7 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
#if _LIBCPP_STD_VER >= 20

namespace __format_spec {

Expand Down Expand Up @@ -409,7 +409,7 @@ class _LIBCPP_TEMPLATE_VIS __parser_chrono {

} // namespace __format_spec

#endif //_LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
#endif //_LIBCPP_STD_VER >= 20

_LIBCPP_END_NAMESPACE_STD

Expand Down
1 change: 0 additions & 1 deletion libcxx/include/__config
Expand Up @@ -273,7 +273,6 @@
// Incomplete features get their own specific disabling flags. This makes it
// easier to grep for target specific flags once the feature is complete.
# if !defined(_LIBCPP_ENABLE_EXPERIMENTAL) && !defined(_LIBCPP_BUILDING_LIBRARY)
# define _LIBCPP_HAS_NO_INCOMPLETE_FORMAT
# define _LIBCPP_HAS_NO_INCOMPLETE_PSTL
# endif

Expand Down
6 changes: 0 additions & 6 deletions libcxx/include/__format/format_functions.h
Expand Up @@ -10,10 +10,6 @@
#ifndef _LIBCPP___FORMAT_FORMAT_FUNCTIONS
#define _LIBCPP___FORMAT_FORMAT_FUNCTIONS

// TODO FMT This is added to fix Apple back-deployment.
#include <version>
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)

#include <__algorithm/clamp.h>
#include <__availability>
#include <__concepts/convertible_to.h>
Expand Down Expand Up @@ -678,6 +674,4 @@ formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args)

_LIBCPP_END_NAMESPACE_STD

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)

#endif // _LIBCPP___FORMAT_FORMAT_FUNCTIONS
2 changes: 1 addition & 1 deletion libcxx/include/chrono
Expand Up @@ -801,7 +801,7 @@ constexpr chrono::year operator ""y(unsigned lo
// [time.syn]
#include <compare>

#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) && _LIBCPP_STD_VER >= 20
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && _LIBCPP_STD_VER >= 20
# include <__chrono/formatter.h>
# include <__chrono/ostream.h>
# include <__chrono/parser_std_format_spec.h>
Expand Down
8 changes: 1 addition & 7 deletions libcxx/include/format
Expand Up @@ -170,11 +170,6 @@ namespace std {
*/

#include <__assert> // all public C++ headers provide the assertion handler
// Make sure all feature-test macros are available.
#include <version>
// Enable the contents of the header only when libc++ was built with experimental features enabled.
#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)

#include <__config>
#include <__format/buffer.h>
#include <__format/concepts.h>
Expand Down Expand Up @@ -202,11 +197,10 @@ namespace std {
#include <__format/range_default_formatter.h>
#include <__format/range_formatter.h>
#include <__format/unicode.h>
#include <version>

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif

#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)

#endif // _LIBCPP_FORMAT
4 changes: 2 additions & 2 deletions libcxx/include/vector
Expand Up @@ -3524,7 +3524,7 @@ inline constexpr bool __format::__enable_insertable<vector<wchar_t>> = true;

#endif // _LIBCPP_STD_VER >= 20

#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) && _LIBCPP_STD_VER >= 23
#if _LIBCPP_STD_VER >= 23
template <class _Tp, class CharT>
// Since is-vector-bool-reference is only used once it's inlined here.
requires same_as<typename _Tp::__container, vector<bool, typename _Tp::__container::allocator_type>>
Expand All @@ -3543,7 +3543,7 @@ public:
return __underlying_.format(__ref, __ctx);
}
};
#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) && _LIBCPP_STD_VER >= 23
#endif // _LIBCPP_STD_VER >= 23

_LIBCPP_END_NAMESPACE_STD

Expand Down
12 changes: 3 additions & 9 deletions libcxx/include/version
Expand Up @@ -341,9 +341,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_erase_if 202002L
# undef __cpp_lib_execution
// # define __cpp_lib_execution 201902L
# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
// # define __cpp_lib_format 202106L
# endif
// # define __cpp_lib_format 202106L
# define __cpp_lib_generic_unordered_lookup 201811L
# define __cpp_lib_int_pow2 202002L
# define __cpp_lib_integer_comparison_functions 202002L
Expand Down Expand Up @@ -400,12 +398,8 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_constexpr_memory 202202L
# define __cpp_lib_constexpr_typeinfo 202106L
# define __cpp_lib_expected 202211L
# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
# define __cpp_lib_format_ranges 202207L
# endif
# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
// # define __cpp_lib_formatters 202302L
# endif
# define __cpp_lib_format_ranges 202207L
// # define __cpp_lib_formatters 202302L
# define __cpp_lib_forward_like 202207L
# define __cpp_lib_invoke_r 202106L
# define __cpp_lib_is_scoped_enum 202011L
Expand Down
Expand Up @@ -22,7 +22,3 @@
// ADDITIONAL_COMPILE_FLAGS: -fexperimental-library

#include <version>

#ifdef _LIBCPP_HAS_NO_INCOMPLETE_FORMAT
# error "-fexperimental-library should enable <format>"
#endif
1 change: 0 additions & 1 deletion libcxx/test/libcxx/time/convert_to_tm.pass.cpp
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: libcpp-has-no-incomplete-format

// <chrono>

Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/transitive_includes.sh.cpp
Expand Up @@ -18,7 +18,7 @@

// This test doesn't support being run when some headers are not available, since we
// would need to add significant complexity to make that work.
// UNSUPPORTED: no-localization, no-threads, no-wide-characters, no-filesystem, libcpp-has-no-incomplete-format
// UNSUPPORTED: no-localization, no-threads, no-wide-characters, no-filesystem

// When built with modules, this test doesn't work because --trace-includes doesn't
// report the stack of includes correctly.
Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: libcpp-has-no-incomplete-format

// <format>

Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: libcpp-has-no-incomplete-format

// <format>

Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: libcpp-has-no-incomplete-format

// <format>

Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: libcpp-has-no-incomplete-format
// TODO FMT Fix this test using GCC, it currently times out.
// UNSUPPORTED: gcc-12

Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17
// UNSUPPORTED: libcpp-has-no-incomplete-format
// TODO FMT Fix this test using GCC, it currently times out.
// UNSUPPORTED: gcc-12

Expand Down
2 changes: 0 additions & 2 deletions libcxx/test/libcxx/utilities/format/version.compile.pass.cpp
Expand Up @@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: libcpp-has-no-incomplete-format

// <format>

#include <format>
Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: libcpp-has-no-incomplete-format

// TODO FMT Fix this test using GCC, it currently times out.
// UNSUPPORTED: gcc-12
Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: libcpp-has-no-incomplete-format

// TODO FMT Fix this test using GCC, it currently times out.
// UNSUPPORTED: gcc-12
Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: libcpp-has-no-incomplete-format

// TODO FMT Fix this test using GCC, it currently times out.
// UNSUPPORTED: gcc-12
Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: libcpp-has-no-incomplete-format

// TODO FMT Fix this test using GCC, it currently times out.
// UNSUPPORTED: gcc-12
Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: libcpp-has-no-incomplete-format

// [container.adaptors.format]/1
// For each of queue, priority_queue, and stack, the library provides the
Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: libcpp-has-no-incomplete-format

// TODO FMT Fix this test using GCC, it currently times out.
// UNSUPPORTED: gcc-12
Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: libcpp-has-no-incomplete-format

// TODO FMT Fix this test using GCC, it currently times out.
// UNSUPPORTED: gcc-12
Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: libcpp-has-no-incomplete-format

// TODO FMT Fix this test using GCC, it currently times out.
// UNSUPPORTED: gcc-12
Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: libcpp-has-no-incomplete-format

// TODO FMT Fix this test using GCC, it currently times out.
// UNSUPPORTED: gcc-12
Expand Down
Expand Up @@ -6,7 +6,6 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// UNSUPPORTED: libcpp-has-no-incomplete-format

// <vector>

Expand Down
Expand Up @@ -11,8 +11,6 @@
//
// clang-format off

// UNSUPPORTED: libcpp-has-no-incomplete-format

// <format>

// Test the feature test macros defined by <format>
Expand Down Expand Up @@ -89,17 +87,11 @@
# endif
# endif

# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
# ifndef __cpp_lib_format_ranges
# error "__cpp_lib_format_ranges should be defined in c++23"
# endif
# if __cpp_lib_format_ranges != 202207L
# error "__cpp_lib_format_ranges should have the value 202207L in c++23"
# endif
# else
# ifdef __cpp_lib_format_ranges
# error "__cpp_lib_format_ranges should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)' is not met!"
# endif
# ifndef __cpp_lib_format_ranges
# error "__cpp_lib_format_ranges should be defined in c++23"
# endif
# if __cpp_lib_format_ranges != 202207L
# error "__cpp_lib_format_ranges should have the value 202207L in c++23"
# endif

#elif TEST_STD_VER > 23
Expand All @@ -117,17 +109,11 @@
# endif
# endif

# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)
# ifndef __cpp_lib_format_ranges
# error "__cpp_lib_format_ranges should be defined in c++26"
# endif
# if __cpp_lib_format_ranges != 202207L
# error "__cpp_lib_format_ranges should have the value 202207L in c++26"
# endif
# else
# ifdef __cpp_lib_format_ranges
# error "__cpp_lib_format_ranges should not be defined when the requirement '!defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT)' is not met!"
# endif
# ifndef __cpp_lib_format_ranges
# error "__cpp_lib_format_ranges should be defined in c++26"
# endif
# if __cpp_lib_format_ranges != 202207L
# error "__cpp_lib_format_ranges should have the value 202207L in c++26"
# endif

#endif // TEST_STD_VER > 23
Expand Down

0 comments on commit dff62f5

Please sign in to comment.