Message ID | a9630c4c-1df6-4dd5-f7e1-3d63c2e1f34d@gmail.com |
---|---|
State | Committed |
Commit | a16a5460447eaaff0b4468064e4d7b1cc8fc42eb |
Headers |
Return-Path: <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7BA57385841E for <patchwork@sourceware.org>; Sat, 19 Nov 2022 13:03:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7BA57385841E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668862999; bh=foYEB+57OrE/GIGBaVg6UxiBOrbPw1fC/I8cCnzFqTc=; h=Date:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=i+0kWXh10QK2xTldiyyez1Rg+pZjWWyBVhawYP9/ynb+GNU1ghp7rrcFm0zFGxj4d LtSxoLSOVN1YhsaxkzJ71Pr9spVy1HhTY+VxX9XrF9AlMWypqWkif5h/8ZBSlLWBoM Pl4Fs8oJmMtJvd7z05+ClfFiC1KUtXJ/58Bryf98= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 560F73858D37; Sat, 19 Nov 2022 13:02:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 560F73858D37 Received: by mail-wm1-x331.google.com with SMTP id p16so5485816wmc.3; Sat, 19 Nov 2022 05:02:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=subject:from:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=foYEB+57OrE/GIGBaVg6UxiBOrbPw1fC/I8cCnzFqTc=; b=Fdh2kmGs2M54D91GZ8pAsRVWcx2zdpfSgRvbXpf8A1K7kgjMvgzhy26VcB6nqKVMUc WHBvaXCV23PHVin7QwslyYL3OoZ0Y94BOL+Si695//XLhnFtd4iujh2vNEQnrRt5vmb9 CVxZ0okSfsc7nBe0Vp3NFQBzOvM1lGD5TC4mONz7cZigCxG3QzMZaqoutZE3nRBYIqs0 qVHHoGmdza6fSrM8bh4LlOEKK+PJfThTogMBqYdI7ltnGjMN+dAuOGfD5WmfCVn0t7ea s97mDxKzZLytUBLC+uldjKQS/tWli7IhBHdHmhgQmBGWNkhCH0jzBg3bJ/hC4jSRIeT1 CKJA== X-Gm-Message-State: ANoB5pmDkI1cwUSOAAuW1cXeVeBVRkXMGokRf3jCnDLjabN+V8jlP1Sd T84UFQ7BfKR7jdVaJR77GYsHFwbQ1RU= X-Google-Smtp-Source: AA0mqf5N8jzxFfB7biGK5KMMQo25l69MoE0AT/RCi2wAjUeWztZlzkijY0bn1aJzPkWxg6sFgNHQSg== X-Received: by 2002:a05:600c:6011:b0:3c6:cc1d:89a with SMTP id az17-20020a05600c601100b003c6cc1d089amr931371wmb.78.1668862965803; Sat, 19 Nov 2022 05:02:45 -0800 (PST) Received: from ?IPV6:2a01:e0a:1dc:b1c0:dbf6:3958:e878:1557? ([2a01:e0a:1dc:b1c0:dbf6:3958:e878:1557]) by smtp.googlemail.com with ESMTPSA id r13-20020a05600c458d00b003c7087f6c9asm12935798wmo.32.2022.11.19.05.02.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Nov 2022 05:02:45 -0800 (PST) Content-Type: multipart/mixed; boundary="------------hYk6WqGs2wVwpQwIXltb1M0v" Message-ID: <a9630c4c-1df6-4dd5-f7e1-3d63c2e1f34d@gmail.com> Date: Sat, 19 Nov 2022 14:02:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Content-Language: fr To: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org> Cc: gcc-patches <gcc-patches@gcc.gnu.org> Subject: [PATCH] Fix <format> in _GLIBCXX_INLINE_VERSION mode X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: =?utf-8?q?Fran=C3=A7ois_Dumont_via_Gcc-patches?= <gcc-patches@gcc.gnu.org> Reply-To: =?utf-8?q?Fran=C3=A7ois_Dumont?= <frs.dumont@gmail.com> Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org> |
Series |
Fix <format> in _GLIBCXX_INLINE_VERSION mode
|
|
Commit Message
François Dumont
Nov. 19, 2022, 1:02 p.m. UTC
Without this qualification I have this in _GLIBCXX_INLINE_VERSION mode: /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: note: candidate: 'template<class _CharT> bool std::__9::isxdigit(_CharT, const locale&)' /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: note: template argument deduction/substitution failed: /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1540: note: candidate expects 2 arguments, 1 provided /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1630: error: no matching function for call to 'isxdigit(const std::__9::basic_string_view<char>::value_type&)' /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: note: candidate: 'template<class _CharT> bool std::__9::isxdigit(_CharT, const locale&)' /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: note: template argument deduction/substitution failed: /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1630: note: candidate expects 2 arguments, 1 provided compiler exited with status 1 FAIL: 17_intro/headers/c++2020/all_attributes.cc (test for excess errors) Excess errors: /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1540: error: no matching function for call to 'isxdigit(const std::__9::basic_string_view<char>::value_type&)' /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1630: error: no matching function for call to 'isxdigit(const std::__9::basic_string_view<char>::value_type&)' It sounds like the most reasonable fix as this is how toupper is being called. libstdc++: Add missing std qualification on isxdigit calls libstdc++-v3/ChangeLog * include/std/format: Add std qualification on isxdigit calls. Ok to commit ? François
Comments
On Sat, 19 Nov 2022 at 13:03, François Dumont via Libstdc++ <libstdc++@gcc.gnu.org> wrote: > > Without this qualification I have this in _GLIBCXX_INLINE_VERSION mode: > > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: > note: candidate: 'template<class _CharT> bool std::__9::isxdigit(_CharT, > const locale&)' > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: > note: template argument deduction/substitution failed: > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1540: > note: candidate expects 2 arguments, 1 provided > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1630: > error: no matching function for call to 'isxdigit(const > std::__9::basic_string_view<char>::value_type&)' > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: > note: candidate: 'template<class _CharT> bool std::__9::isxdigit(_CharT, > const locale&)' > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: > note: template argument deduction/substitution failed: > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1630: > note: candidate expects 2 arguments, 1 provided > compiler exited with status 1 > FAIL: 17_intro/headers/c++2020/all_attributes.cc (test for excess errors) > Excess errors: > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1540: > error: no matching function for call to 'isxdigit(const > std::__9::basic_string_view<char>::value_type&)' > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1630: > error: no matching function for call to 'isxdigit(const > std::__9::basic_string_view<char>::value_type&)' > > It sounds like the most reasonable fix as this is how toupper is being > called. I think the real problem is that include/c_global/cctype is missing the NAMESPACE_VERSION macros. All declarations of std::isxdigit etc should be in the same namespace, precisely so we don't need to do this. > > libstdc++: Add missing std qualification on isxdigit calls > > libstdc++-v3/ChangeLog > > * include/std/format: Add std qualification on isxdigit calls. > > Ok to commit ? Yes, OK.
On 19/11/22 14:11, Jonathan Wakely wrote: > On Sat, 19 Nov 2022 at 13:03, François Dumont via Libstdc++ > <libstdc++@gcc.gnu.org> wrote: >> Without this qualification I have this in _GLIBCXX_INLINE_VERSION mode: >> >> /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: >> note: candidate: 'template<class _CharT> bool std::__9::isxdigit(_CharT, >> const locale&)' >> /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: >> note: template argument deduction/substitution failed: >> /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1540: >> note: candidate expects 2 arguments, 1 provided >> /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1630: >> error: no matching function for call to 'isxdigit(const >> std::__9::basic_string_view<char>::value_type&)' >> /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: >> note: candidate: 'template<class _CharT> bool std::__9::isxdigit(_CharT, >> const locale&)' >> /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: >> note: template argument deduction/substitution failed: >> /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1630: >> note: candidate expects 2 arguments, 1 provided >> compiler exited with status 1 >> FAIL: 17_intro/headers/c++2020/all_attributes.cc (test for excess errors) >> Excess errors: >> /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1540: >> error: no matching function for call to 'isxdigit(const >> std::__9::basic_string_view<char>::value_type&)' >> /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1630: >> error: no matching function for call to 'isxdigit(const >> std::__9::basic_string_view<char>::value_type&)' >> >> It sounds like the most reasonable fix as this is how toupper is being >> called. > I think the real problem is that include/c_global/cctype is missing > the NAMESPACE_VERSION macros. > > All declarations of std::isxdigit etc should be in the same namespace, > precisely so we don't need to do this. Didn't you want to fix it this way then ? To be honest I was a little bit lost by this code: #if !__has_builtin(__builtin_toupper) # include <cctype> #endif Looks like cctype is included only for toupper, why not for isxdigit ? > >> libstdc++: Add missing std qualification on isxdigit calls >> >> libstdc++-v3/ChangeLog >> >> * include/std/format: Add std qualification on isxdigit calls. >> >> Ok to commit ? > Yes, OK. Committed.
On Sun, 20 Nov 2022, 20:45 François Dumont, <frs.dumont@gmail.com> wrote: > On 19/11/22 14:11, Jonathan Wakely wrote: > > On Sat, 19 Nov 2022 at 13:03, François Dumont via Libstdc++ > > <libstdc++@gcc.gnu.org> wrote: > >> Without this qualification I have this in _GLIBCXX_INLINE_VERSION mode: > >> > >> > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: > >> note: candidate: 'template<class _CharT> bool std::__9::isxdigit(_CharT, > >> const locale&)' > >> > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: > >> note: template argument deduction/substitution failed: > >> > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1540: > >> note: candidate expects 2 arguments, 1 provided > >> > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1630: > >> error: no matching function for call to 'isxdigit(const > >> std::__9::basic_string_view<char>::value_type&)' > >> > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: > >> note: candidate: 'template<class _CharT> bool std::__9::isxdigit(_CharT, > >> const locale&)' > >> > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/locale_facets.h:2649: > >> note: template argument deduction/substitution failed: > >> > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1630: > >> note: candidate expects 2 arguments, 1 provided > >> compiler exited with status 1 > >> FAIL: 17_intro/headers/c++2020/all_attributes.cc (test for excess > errors) > >> Excess errors: > >> > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1540: > >> error: no matching function for call to 'isxdigit(const > >> std::__9::basic_string_view<char>::value_type&)' > >> > /home/fdt/dev/gcc/build_versioned_ns/x86_64-pc-linux-gnu/libstdc++-v3/include/format:1630: > >> error: no matching function for call to 'isxdigit(const > >> std::__9::basic_string_view<char>::value_type&)' > >> > >> It sounds like the most reasonable fix as this is how toupper is being > >> called. > > I think the real problem is that include/c_global/cctype is missing > > the NAMESPACE_VERSION macros. > > > > All declarations of std::isxdigit etc should be in the same namespace, > > precisely so we don't need to do this. > > Didn't you want to fix it this way then ? > > To be honest I was a little bit lost by this code: > > #if !__has_builtin(__builtin_toupper) > # include <cctype> > #endif > > Looks like cctype is included only for toupper, why not for isxdigit ? > The idea was to only include it when needed for clang. But of course it's already included by <locale> and so that check is pointless. I think we might want to use the built-in for isxdigit as well, because the built-in ignores the locale which is what we want here. Or we should just replace toupper and isxdigit with locale-independent equivalents. > > > >> libstdc++: Add missing std qualification on isxdigit calls > >> > >> libstdc++-v3/ChangeLog > >> > >> * include/std/format: Add std qualification on isxdigit > calls. > >> > >> Ok to commit ? > > Yes, OK. > > Committed. > Thanks. >
diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index f4fc85a16d2..9f5b7bee2be 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -1537,7 +1537,7 @@ namespace __format if (__trailing_zeros) { - if (!isxdigit(__s[0])) + if (!std::isxdigit(__s[0])) --__sigfigs; __z = __prec - __sigfigs; } @@ -1627,7 +1627,7 @@ namespace __format { __fill_char = _CharT('0'); // Write sign before zero filling. - if (!isxdigit(__narrow_str[0])) + if (!std::isxdigit(__narrow_str[0])) { *__out++ = __str[0]; __str.remove_prefix(1);