[libc++] Make charconv require C++17 or later.

Implementing the paper
P2291R3 Add Constexpr Modifiers to Functions to_chars and from_chars for
        Integral Types in <charconv> Header

Gives issues in language versions prior to C++17. As suggested in
D131855 disable the code prior to C++17. This removes libc++'s
extension.

Reviewed By: ldionne, #libc_vendors, #libc, philnik

Differential Revision: https://reviews.llvm.org/D133216
This commit is contained in:
Mark de Wever
2022-09-02 18:46:59 +02:00
parent a8fbd1157d
commit e17ec8e9ba
13 changed files with 26 additions and 36 deletions

View File

@@ -78,6 +78,12 @@ Deprecations and Removals
reach out to the libc++ developers if you find something missing in the new
configuration system.
- The functions ``to_chars`` and ``from_chars`` for integral types are
available starting with C++17. Libc++ offered these functions in C++11 and
C++14 as an undocumented extension. This extension makes it hard to implement
the C++23 paper that makes these functions ``constexpr``, therefore the
extension has been removed.
Upcoming Deprecations and Removals
----------------------------------

View File

@@ -19,7 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 14
enum class _LIBCPP_ENUM_VIS chars_format
{
@@ -70,7 +70,7 @@ operator^=(chars_format& __x, chars_format __y) {
return __x;
}
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_STD_VER > 14
_LIBCPP_END_NAMESPACE_STD

View File

@@ -19,7 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 14
struct _LIBCPP_TYPE_VIS from_chars_result
{
@@ -30,7 +30,7 @@ struct _LIBCPP_TYPE_VIS from_chars_result
# endif
};
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_STD_VER > 14
_LIBCPP_END_NAMESPACE_STD

View File

@@ -19,7 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 14
namespace __itoa {
@@ -173,7 +173,7 @@ const char __table<_Tp>::__digits_base_10[200] = {
} // namespace __itoa
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_STD_VER > 14
_LIBCPP_END_NAMESPACE_STD

View File

@@ -25,7 +25,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 14
namespace __itoa {
@@ -176,7 +176,7 @@ _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u128(char* __buffer, __uint128_t __
# endif
} // namespace __itoa
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_STD_VER > 14
_LIBCPP_END_NAMESPACE_STD

View File

@@ -19,7 +19,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 14
struct _LIBCPP_TYPE_VIS to_chars_result
{
@@ -30,7 +30,7 @@ struct _LIBCPP_TYPE_VIS to_chars_result
# endif
};
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_STD_VER > 14
_LIBCPP_END_NAMESPACE_STD

View File

@@ -106,7 +106,7 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 14
to_chars_result to_chars(char*, char*, bool, int = 10) = delete;
from_chars_result from_chars(const char*, const char*, bool, int = 10) = delete;
@@ -776,10 +776,6 @@ from_chars(const char* __first, const char* __last, _Tp& __value, int __base)
return __from_chars_integral(__first, __last, __value, __base);
}
// Floating-point implementation starts here.
// Unlike the other parts of charconv this is only available in C++17 and newer.
#if _LIBCPP_STD_VER > 14
_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS
to_chars_result to_chars(char* __first, char* __last, float __value);
@@ -807,8 +803,7 @@ to_chars_result to_chars(char* __first, char* __last, double __value, chars_form
_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS
to_chars_result to_chars(char* __first, char* __last, long double __value, chars_format __fmt, int __precision);
# endif // _LIBCPP_STD_VER > 14
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_STD_VER > 14
_LIBCPP_END_NAMESPACE_STD

View File

@@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// UNSUPPORTED: !stdlib=libc++ && c++11
// UNSUPPORTED: !stdlib=libc++ && c++14
// UNSUPPORTED: c++03, c++11, c++14
// <charconv>
// In

View File

@@ -6,9 +6,7 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// UNSUPPORTED: !stdlib=libc++ && c++11
// UNSUPPORTED: !stdlib=libc++ && c++14
// UNSUPPORTED: c++03, c++11, c++14
// <charconv>

View File

@@ -6,9 +6,7 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// UNSUPPORTED: !stdlib=libc++ && c++11
// UNSUPPORTED: !stdlib=libc++ && c++14
// UNSUPPORTED: c++03, c++11, c++14
// <charconv>

View File

@@ -6,10 +6,7 @@
//
//===----------------------------------------------------------------------===//
// Note: chars_format is a C++17 feature backported to C++11. Assert isn't
// allowed in a constexpr function in C++11. To keep the code readable, C++11
// support is untested.
// UNSUPPORTED: c++03, c++11
// UNSUPPORTED: c++03, c++11, c++14
// <charconv>

View File

@@ -6,9 +6,8 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// UNSUPPORTED: !stdlib=libc++ && c++11
// UNSUPPORTED: !stdlib=libc++ && c++14
// UNSUPPORTED: c++03, c++11, c++14
// <charconv>
// In

View File

@@ -6,9 +6,7 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++03
// UNSUPPORTED: !stdlib=libc++ && c++11
// UNSUPPORTED: !stdlib=libc++ && c++14
// UNSUPPORTED: c++03, c++11, c++14
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=12712420
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-ops-limit): -fconstexpr-ops-limit=12712420