[libc++] Removes _LIBCPP_AVAILABILITY_TO_CHARS.
After moving the std::to_chars base 10 implementation from the dylib to
the header the integral overloads of std::to_chars are available on all
platforms.
Remove the _LIBCPP_AVAILABILITY_TO_CHARS availability macro and update
the tests.
Depends on D125704
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D125745
NOKEYCHECK=True
GitOrigin-RevId: b968c3452b6a6ccef2545d860c4694dc95dcebc1
diff --git a/docs/ReleaseNotes.rst b/docs/ReleaseNotes.rst
index c2a43a6..c21d1f9 100644
--- a/docs/ReleaseNotes.rst
+++ b/docs/ReleaseNotes.rst
@@ -69,6 +69,10 @@
should include assertions or not by default. For details, see
:ref:`the documentation <assertions-mode>` about this new feature.
+- The implementation of the function ``std::to_chars`` for integral types has
+ moved from the dylib to the header. This means the function no longer has a
+ minimum deployment target.
+
API Changes
-----------
diff --git a/include/__availability b/include/__availability
index 789e266..f9d8245 100644
--- a/include/__availability
+++ b/include/__availability
@@ -135,9 +135,6 @@
# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP
// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem
- // This controls the availability of std::to_chars for integral arguments.
-# define _LIBCPP_AVAILABILITY_TO_CHARS
-
// This controls the availability of floating-point std::to_chars functions.
// These overloads were added later than the integer overloads.
# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT
@@ -253,9 +250,6 @@
# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem
# endif
-# define _LIBCPP_AVAILABILITY_TO_CHARS \
- _LIBCPP_AVAILABILITY_FILESYSTEM
-
# define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT \
__attribute__((unavailable))
diff --git a/include/charconv b/include/charconv
index 96440e1..ce2897c 100644
--- a/include/charconv
+++ b/include/charconv
@@ -125,7 +125,6 @@
return __t - (__v < __table<>::__pow10_64[__t]) + 1;
}
- _LIBCPP_AVAILABILITY_TO_CHARS
static _LIBCPP_HIDE_FROM_ABI char* __convert(_Tp __v, char* __p)
{
return __itoa::__base_10_u64(__v, __p);
@@ -146,7 +145,6 @@
return __t - (__v < __table<>::__pow10_32[__t]) + 1;
}
- _LIBCPP_AVAILABILITY_TO_CHARS
static _LIBCPP_HIDE_FROM_ABI char* __convert(_Tp __v, char* __p)
{
return __itoa::__base_10_u32(__v, __p);
@@ -243,7 +241,6 @@
}
template <typename _Tp>
-_LIBCPP_AVAILABILITY_TO_CHARS
inline _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_itoa(char* __first, char* __last, _Tp __value, true_type)
{
@@ -258,7 +255,6 @@
}
template <typename _Tp>
-_LIBCPP_AVAILABILITY_TO_CHARS
inline _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type)
{
@@ -272,7 +268,6 @@
}
template <typename _Tp>
-_LIBCPP_AVAILABILITY_TO_CHARS
inline _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value, int __base,
true_type)
@@ -430,7 +425,7 @@
}
template <typename _Tp>
-_LIBCPP_AVAILABILITY_TO_CHARS _LIBCPP_HIDE_FROM_ABI int
+_LIBCPP_HIDE_FROM_ABI int
__to_chars_integral_width(_Tp __value, unsigned __base) {
_LIBCPP_ASSERT(__value >= 0, "The function requires a non-negative value.");
@@ -457,7 +452,6 @@
}
template <typename _Tp>
-_LIBCPP_AVAILABILITY_TO_CHARS
inline _LIBCPP_HIDE_FROM_ABI to_chars_result
__to_chars_integral(char* __first, char* __last, _Tp __value, int __base,
false_type)
@@ -490,7 +484,6 @@
}
template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
-_LIBCPP_AVAILABILITY_TO_CHARS
inline _LIBCPP_HIDE_FROM_ABI to_chars_result
to_chars(char* __first, char* __last, _Tp __value)
{
@@ -498,7 +491,6 @@
}
template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0>
-_LIBCPP_AVAILABILITY_TO_CHARS
inline _LIBCPP_HIDE_FROM_ABI to_chars_result
to_chars(char* __first, char* __last, _Tp __value, int __base)
{
diff --git a/test/libcxx/utilities/charconv/charconv.to.chars/availability.fail.cpp b/test/libcxx/utilities/charconv/charconv.to.chars/availability.fail.cpp
deleted file mode 100644
index e1ca28a..0000000
--- a/test/libcxx/utilities/charconv/charconv.to.chars/availability.fail.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++03
-// REQUIRES: use_system_cxx_lib && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
-
-// Test the availability markup on std::to_chars.
-
-#include <charconv>
-
-int main(int, char**)
-{
- char buf[100];
- int int_value = 33;
- long long_value = 33;
- int base = 2;
- std::to_chars(buf, buf + 100, int_value); // expected-error{{is unavailable: introduced in}}
- std::to_chars(buf, buf + 100, int_value, base); // expected-error{{is unavailable: introduced in}}
-
- std::to_chars(buf, buf + 100, long_value); // expected-error{{is unavailable: introduced in}}
- std::to_chars(buf, buf + 100, long_value, base); // expected-error{{is unavailable: introduced in}}
-}
diff --git a/test/std/utilities/charconv/charconv.from.chars/integral.roundtrip.pass.cpp b/test/std/utilities/charconv/charconv.from.chars/integral.roundtrip.pass.cpp
index 6aa4953..cd90fae 100644
--- a/test/std/utilities/charconv/charconv.from.chars/integral.roundtrip.pass.cpp
+++ b/test/std/utilities/charconv/charconv.from.chars/integral.roundtrip.pass.cpp
@@ -10,11 +10,6 @@
// UNSUPPORTED: !stdlib=libc++ && c++11
// UNSUPPORTED: !stdlib=libc++ && c++14
-// The roundtrip test uses to_chars, which requires functions in the dylib
-// that were introduced in Mac OS 10.15.
-//
-// XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
-
// <charconv>
// from_chars_result from_chars(const char* first, const char* last,
diff --git a/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp b/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp
index d137461..70f85a5 100644
--- a/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp
+++ b/test/std/utilities/charconv/charconv.to.chars/integral.pass.cpp
@@ -10,10 +10,6 @@
// UNSUPPORTED: !stdlib=libc++ && c++11
// UNSUPPORTED: !stdlib=libc++ && c++14
-// to_chars requires functions in the dylib that were introduced in Mac OS 10.15.
-//
-// XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
-
// <charconv>
// to_chars_result to_chars(char* first, char* last, Integral value,