From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 3436D3858D3C for ; Sun, 1 May 2022 19:07:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3436D3858D3C Received: from mail-yb1-f199.google.com (mail-yb1-f199.google.com [209.85.219.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-16-JYjmW96HPlq_DO-Wx6gCfw-1; Sun, 01 May 2022 15:07:36 -0400 X-MC-Unique: JYjmW96HPlq_DO-Wx6gCfw-1 Received: by mail-yb1-f199.google.com with SMTP id v17-20020a056902029100b006484d85132eso11615684ybh.14 for ; Sun, 01 May 2022 12:07:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FoehhOJsJA0rCn83ZoLF44kqvns/wUY+sjL7Bwl27Fg=; b=3eD8bUt4iqY02KCD/bakTVwZkkHdwM0TrxAvtx97Nfdp6MaRo2aeoKX9tdONPwaPFg hTR2labrvSUGCs8HiesvxujFnyXCmY9tzWpJn/MzhNrGy01OTBBTafveG1RObHHDhacP ibQo9LWtsMd73ltJt4WIPukXJe8LmV75Atioi53MRvB6JldJZIr/mOtLunJyX2ped9im nR6D9JVwSFAnBNNf+0ZV3EUEu2Wz1s3sdVio4otrI855A5lTH4T0agtz1QLxQ7RhpH5D sJaBN6u4rTJ/CujCemw+CFdND/gTfRhwgmL1h+lzblMK4TfbMpWyQQ7RgCGcZHYFQi90 GomA== X-Gm-Message-State: AOAM530AaQtkiCIexjY5tHP2oOmUGo3p4fRhD5Lqa5SzzTlfxcEcNaI1 9z5TduK3HkNB8PzWsOFRBuD4yhdWAO975klXZuFp2AmT7m/kuztujIYbpLoi0bwZnhzM0PNJfR4 eohfHivpht89UkKPx7EKonN4AlncRl+g= X-Received: by 2002:a0d:f484:0:b0:2f8:87c1:4e19 with SMTP id d126-20020a0df484000000b002f887c14e19mr8735827ywf.475.1651432056328; Sun, 01 May 2022 12:07:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXLytzes00U4zPE1mekxGhdjwfDXCFpZ7AVJD4kcltEOKo0ocTge6eW7dR1wRpJ8LPL7xUez9/A0CtputYspk= X-Received: by 2002:a0d:f484:0:b0:2f8:87c1:4e19 with SMTP id d126-20020a0df484000000b002f887c14e19mr8735811ywf.475.1651432056089; Sun, 01 May 2022 12:07:36 -0700 (PDT) MIME-Version: 1.0 References: <20220501182109.3668200-1-ppalka@redhat.com> <20220501182109.3668200-2-ppalka@redhat.com> In-Reply-To: <20220501182109.3668200-2-ppalka@redhat.com> From: Jonathan Wakely Date: Sun, 1 May 2022 20:07:24 +0100 Message-ID: Subject: Re: [PATCH 2/2] libstdc++: Don't use std::tolower in [PR103911] To: Patrick Palka Cc: gcc Patches , "libstdc++" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 May 2022 19:07:39 -0000 On Sun, 1 May 2022 at 19:21, Patrick Palka via Libstdc++ wrote: > > As in r12-6281-gc83ecfbe74a5cf for std::isdigit, shouldn't > use std::tolower either I think. > > Tested on x86_64-pc-linux-gnu, does this look OK for trunk/11 and the > 12 branch after it's thawed? OK, thanks. > > PR libstdc++/103911 > > libstdc++-v3/ChangeLog: > > * src/c++17/floating_from_chars.cc (find_end_of_float): Accept > two possible delimeters for the exponent part in the form of a > (possibly NULL) string of length two. Don't use std::tolower. > (pattern): Adjust calls to find_end_of_float accordingly. > --- > libstdc++-v3/src/c++17/floating_from_chars.cc | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/libstdc++-v3/src/c++17/floating_from_chars.cc b/libstdc++-v3/src/c++17/floating_from_chars.cc > index e7f3a58cf18..5d2a931d5dd 100644 > --- a/libstdc++-v3/src/c++17/floating_from_chars.cc > +++ b/libstdc++-v3/src/c++17/floating_from_chars.cc > @@ -40,7 +40,6 @@ > #include > #include > #include > -#include > #include > #include > #if _GLIBCXX_HAVE_XLOCALE_H > @@ -142,10 +141,10 @@ namespace > > // Find initial portion of [first, last) containing a floating-point number. > // The string `digits` is either `dec_digits` or `hex_digits` > - // and `exp` is 'e' or 'p' or '\0'. > + // and `exp` is "eE", "pP" or NULL. > const char* > find_end_of_float(const char* first, const char* last, const char* digits, > - char exp) > + const char *exp) > { > while (first < last && strchr(digits, *first) != nullptr) > ++first; > @@ -155,7 +154,7 @@ namespace > while (first < last && strchr(digits, *first)) > ++first; > } > - if (first < last && exp != 0 && std::tolower((unsigned char)*first) == exp) > + if (first < last && exp != nullptr && (*first == exp[0] || *first == exp[1])) > { > ++first; > if (first < last && (*first == '-' || *first == '+')) > @@ -237,7 +236,7 @@ namespace > > if ((last - first + 2) > buffer_resource::guaranteed_capacity()) > { > - last = find_end_of_float(first + neg, last, digits, 'p'); > + last = find_end_of_float(first + neg, last, digits, "pP"); > #ifndef __cpp_exceptions > if ((last - first + 2) > buffer_resource::guaranteed_capacity()) > { > @@ -261,7 +260,7 @@ namespace > if ((last - first) > buffer_resource::guaranteed_capacity()) > { > last = find_end_of_float(first + neg, last, digits, > - "e"[fmt == chars_format::fixed]); > + fmt == chars_format::fixed ? nullptr : "eE"); > #ifndef __cpp_exceptions > if ((last - first) > buffer_resource::guaranteed_capacity()) > { > -- > 2.36.0.44.g0f828332d5 >