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 246A13858C50 for ; Sun, 1 May 2022 18:21:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 246A13858C50 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-215-Lo5ALu_bPkWQ6WTVzm77NA-1; Sun, 01 May 2022 14:21:14 -0400 X-MC-Unique: Lo5ALu_bPkWQ6WTVzm77NA-1 Received: by mail-qk1-f198.google.com with SMTP id bs18-20020a05620a471200b0069f8c1c8b27so8804583qkb.8 for ; Sun, 01 May 2022 11:21:14 -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=r8EangrKou3WKxvKmXfYEtJySZc3/cJ1fT0UqQ21VF29+IoZLODPKR1Z8PTC0/bYQn G3WxA0QIbe7aJpdQcrSEKif1U4UuODnMairN1WgQi63Eni6F2v/tW28gb0JrFt6exJh4 T8er7qc4bIkz5qwG1tgxvRq1ta62KFjwkWLP/dKXj9NDpIP1453vL4aNl6/6+UUEQVvO SxQCGcmOkAMd+GByrOALBYblcIc7RWT5mJbe0lEWziYw1mPrq6Ixp2ylLnG96SiAV34X W33mlB5PJ9xlfCCbXe0DD6MmS2k83k8sbjv+cG8sNOhgMZZI3WPHqjHaZ0EZIgogDgh4 tyPg== X-Gm-Message-State: AOAM532PEMP1wxree47k0HJXhSaBVSBTYpoplwJPILMeEp5d06y4vW/E 26sGD0DKvJCfZBYaJIrUkYOZQUXcC5eLU8OlYffcH8aBcmJLqwkRVduAlpM1SfjFzbM/Zr9wABJ 5AQUr1+42yh1Ip1k= X-Received: by 2002:ac8:5f83:0:b0:2f3:9488:fd55 with SMTP id j3-20020ac85f83000000b002f39488fd55mr7668240qta.135.1651429274242; 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=-14.6 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=ham 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 18:21:17 -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