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.129.124]) by sourceware.org (Postfix) with ESMTPS id EC1D83858C51 for ; Sun, 1 May 2022 18:21:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EC1D83858C51 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-217-jIuXiIJONUaawWM5i9VIdA-1; Sun, 01 May 2022 14:21:15 -0400 X-MC-Unique: jIuXiIJONUaawWM5i9VIdA-1 Received: by mail-qk1-f198.google.com with SMTP id l127-20020a378985000000b0069f997b79easo8066773qkd.21 for ; Sun, 01 May 2022 11:21:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ChKw4CcPPb5ocN18gxwrJMPkqfPAR5JOXbX/MnssYrE=; b=fIsBORFk1U/bFge/sZ6CW5dkaw8KfwCd0RWZIL+uihXDDAIMeuy29j5VW74PGs7zFA zIugdeSlnZJopWFd5RJekm1qy0zH/BefORC8dwNZvuasdTChaD8Vipen+aaCyNiO9CO8 xRxya0FV8cIH56qHom7YQNHUqrtVYAMOiWggOJcQIzO4u45GASED0DR2K6sDej10kRc3 DdXZnSGBVyaQ/Heyxsiz6C90omXSH7193YB8KGt/CpJw7g8zbJI6NFRu5Jp4CxtWz4oa W3G6RtHgEJ6Sm4MlP4xd1t6y3rz/+NG5F+cWY5hxMqAxT/7XNfFwyUdIc3ekLb3nE1B/ AygQ== X-Gm-Message-State: AOAM531hXFxTepVl2tZB7cPDPFthf3SAYby3xa7Uh8dRGNSJ5e9K0zte dl8i9crfkFcEZq0x+VLPkwIkgLOP4GJ8WNHGwxKWWm3tkEzfvp5oD9Xu8pnXKnaq9rLbRBTSESg fQSnFzaFBACyHD82uhFbISdalDSlO0nRN7ScifkMZDfS1A4rSTiRP39AOC7idRVwAY0I= X-Received: by 2002:ac8:5f83:0:b0:2f3:9488:fd55 with SMTP id j3-20020ac85f83000000b002f39488fd55mr7668244qta.135.1651429274297; Sun, 01 May 2022 11:21:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpJOeQfZakh5rNlQuafrpcqf2yp0a6ontDpc/iNcjPlOwIRXRitVa1u9qHQHDF8EA8N8LfUw== X-Received: by 2002:ac8:5f83:0:b0:2f3:9488:fd55 with SMTP id j3-20020ac85f83000000b002f39488fd55mr7668232qta.135.1651429274007; Sun, 01 May 2022 11:21:14 -0700 (PDT) Received: from localhost.localdomain (ool-18e40894.dyn.optonline.net. [24.228.8.148]) by smtp.gmail.com with ESMTPSA id i11-20020ac84f4b000000b002f39b99f672sm2932817qtw.12.2022.05.01.11.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 May 2022 11:21:13 -0700 (PDT) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH 2/2] libstdc++: Don't use std::tolower in [PR103911] Date: Sun, 1 May 2022 14:21:09 -0400 Message-Id: <20220501182109.3668200-2-ppalka@redhat.com> X-Mailer: git-send-email 2.36.0.44.g0f828332d5 In-Reply-To: <20220501182109.3668200-1-ppalka@redhat.com> References: <20220501182109.3668200-1-ppalka@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-15.1 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 May 2022 18:21:18 -0000 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? 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