libstdc++: Shorten integer std::to/from_chars symbol names
commitbf3c19903a801063551e43bdc2b8b7ea2f69b781
authorPatrick Palka <ppalka@redhat.com>
Mon, 25 Sep 2023 18:48:26 +0000 (25 14:48 -0400)
committerPatrick Palka <ppalka@redhat.com>
Mon, 25 Sep 2023 18:48:26 +0000 (25 14:48 -0400)
tree2f35908137580ffdaf5a9a45384c78777fba7d50
parentc92d330c63ac27db69da9a10056b726f686481c0
libstdc++: Shorten integer std::to/from_chars symbol names

For std::to_chars:

The constrained alias __integer_to_chars_result_type seems unnecessary
ever since r10-3080-g28f0075742ed58 got rid of the only public overload
which used it.  Now only non-public overloads are constrained by it
(through their return type) and these non-public overloads aren't used
in a SFINAE context, so the constraints have no observable effect.  So
this patch gets rid of this alias, which greatly shortens the symbol names
of the affected functions (since the expanded alias is quite large).

For std::from_chars:

We can't get rid of the corresponding alias because its constrains the
public integer std::from_chars overload.  But we can avoid having the
constraint bloat the mangled name by instead encoding it as a defaulted
template parameter.  We use the non-type parameter form

  enable_if_t<..., int> = 0

instead of the type parameter form

  typename = enable_if_t<...>

because the type form can be bypassed by giving an explicit template
argument for the type parameter, e.g. 'std::from_chars<int, void>(...)',
so the non-type form seems like the more robust choice.

In passing, use __is_standard_integer in the constraint.

libstdc++-v3/ChangeLog:

* include/std/charconv (__detail::__integer_to_chars_result_type):
Remove.
(__detail::__to_chars_16): Use to_chars_result as return type.
(__detail::__to_chars_10): Likewise.
(__detail::__to_chars_8): Likewise.
(__detail::__to_chars_2): Likewise.
(__detail::__to_chars_i): Likewise.
(__detail::__integer_from_chars_result_type): Inline the
constraint into ...
(from_chars): ... here.  Use __is_standard_integer in the
constraint.  Encode constraint as a defaulted non-type template
parameter instead of within the return type.
libstdc++-v3/include/std/charconv