From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 468BE396DC23; Wed, 16 Nov 2022 20:59:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 468BE396DC23 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668632372; bh=/LqxqvAKaLN3sObmAMyHfK7bgCGjpSeKYyGBo8TfFxc=; h=From:To:Subject:Date:From; b=krmVULgyeLHDwrUit0kXfV10VMPygd0iiyX+9vFr3JeppGaWZo9DB3eBqKCDizw+i agdDWDjeZnAEzO/DN1MBWIuWCm9DRkZOJpNMcpRdj1d7dVtuUER9ciHGyost0yKG6N KxozrQ0JvPZ8KFyGL+fayQRxA+SqyZJ18RB9M7RE= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-4109] libstdc++: Adjust for Clang compatibility [PR107712] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 22cb0fea718fd4dab8c97c8f03054a2fb7dc3d76 X-Git-Newrev: 2f5c071860ba3f8ef67d0b9d8291a73766ce0a44 Message-Id: <20221116205932.468BE396DC23@sourceware.org> Date: Wed, 16 Nov 2022 20:59:32 +0000 (GMT) List-Id: https://gcc.gnu.org/g:2f5c071860ba3f8ef67d0b9d8291a73766ce0a44 commit r13-4109-g2f5c071860ba3f8ef67d0b9d8291a73766ce0a44 Author: Jonathan Wakely Date: Wed Nov 16 13:48:39 2022 +0000 libstdc++: Adjust for Clang compatibility [PR107712] Clang doesn't define __builtin_toupper, so use std::toupper. Also add some (not actually required since C++20) typename keywords to help Clang versions up to and including 15. libstdc++-v3/ChangeLog: PR libstdc++/107712 * include/std/format (__format::__formatter_int::format): Use std::toupper when __builtin_toupper isn't available. (basic_format_arg::handle): Add 'typename'. * include/std/complex (complex): Add 'typename'. Diff: --- libstdc++-v3/include/std/complex | 2 +- libstdc++-v3/include/std/format | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index 7fed8a7757c..86d5ca3c3e1 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -1840,7 +1840,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { public: typedef _Tp value_type; - typedef std::__complex_type<_Tp>::type _ComplexT; + typedef typename std::__complex_type<_Tp>::type _ComplexT; constexpr complex(_ComplexT __z) : _M_value(__z) { } diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index fb29f7e7835..995b05c2ab2 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -52,6 +52,10 @@ #include // tuple_size_v #include // __int_traits +#if !__has_builtin(__builtin_toupper) +# include +#endif + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -1027,7 +1031,11 @@ namespace __format __res = to_chars(__start, __end, __u, 16); if (_M_spec._M_type == _Pres_X) for (auto __p = __start; __p != __res.ptr; ++__p) +#if __has_builtin(__builtin_toupper) *__p = __builtin_toupper(*__p); +#else + *__p = std::toupper(*__p); +#endif break; default: __builtin_unreachable(); @@ -2718,7 +2726,7 @@ namespace __format public: class handle : public __format::_Arg_value<_Context>::_HandleBase { - using _Base = __format::_Arg_value<_Context>::_HandleBase; + using _Base = typename __format::_Arg_value<_Context>::_HandleBase; // Format as const if possible, to reduce instantiations. template