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 900F6385841F for ; Tue, 16 Nov 2021 00:25:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 900F6385841F Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-319-0jU1lUU-OPWA45fxX9Ns3A-1; Mon, 15 Nov 2021 19:25:17 -0500 X-MC-Unique: 0jU1lUU-OPWA45fxX9Ns3A-1 Received: by mail-qk1-f198.google.com with SMTP id q5-20020a05620a0d8500b0045edb4779dbso12478095qkl.2 for ; Mon, 15 Nov 2021 16:25:17 -0800 (PST) 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=MSfF6dohJNJfl8T+4RW3ssgybkqogDxP77ju2d2mIaM=; b=jsExqcbQmyKKIF7sIZDLZVSYheHuZS36nTzAJRpd7Fbpu3RnWwf5mYi9VVZgnwS0b7 m+mvg9dBd6g7RcAyYDdyX5iJkxfJyuwQM88lmDWTAmdld0auSa5UQoIEJebbJ/3jGbA9 SxJ8ysXg2DEx8tqcRYCaMUjRWDklzKuH+KhJiJ66LfM5vEl/24UVakFh6HUOU50nd7j3 V/2/wQBHjsgseZJhNmF1Fb/ArUxjC8wpFjWRw8z5gah3DuCLiwYeLsfOszILhS0y8rWu 8qkiVswvhLP7Ayk/oBg0+XAXqn3rmgYEVbgSDpX3ff+ACGyjyo6/0AupMDRk9/C1wiEi Bj1Q== X-Gm-Message-State: AOAM533PGfmXYuP1NW+5DsBFoDcaaQ+LeVGVUKURgASzLG7ZQ5ZGh3wh 5OmdWBn1+C7EvEzgt7In0YN0aK61gBReBycETejS7zAnMaKKlupHbbhK8v1ScK0b2Y3InzF2Iox 77NtxQw53cCVBf1o= X-Received: by 2002:ac8:3d49:: with SMTP id u9mr3357215qtf.264.1637022316390; Mon, 15 Nov 2021 16:25:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqrfZRv7nIqekxnFxpKJ621S1UMG9pSsPVBMRMTaUi4MXcvRQQcYVTNY2dSNEDyczExnwRbg== X-Received: by 2002:ac8:3d49:: with SMTP id u9mr3357197qtf.264.1637022316172; Mon, 15 Nov 2021 16:25:16 -0800 (PST) Received: from localhost.localdomain (ool-457d493a.dyn.optonline.net. [69.125.73.58]) by smtp.gmail.com with ESMTPSA id j19sm7836545qkp.28.2021.11.15.16.25.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Nov 2021 16:25:15 -0800 (PST) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH 2/5] libstdc++: Apply modifications to our local copy of fast_float Date: Mon, 15 Nov 2021 19:25:02 -0500 Message-Id: <20211116002505.2324582-2-ppalka@redhat.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211116002505.2324582-1-ppalka@redhat.com> References: <20211116002505.2324582-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-Spam-Status: No, score=-15.7 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, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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: Tue, 16 Nov 2021 00:25:20 -0000 This performs the following modifications to our local copy of fast_float in order to make it more readily usable in our std::from_chars implementation: * Remove system #includes * Replace stray call to assert * Use the standard library chars_format and from_chars_result types libstdc++-v3/ChangeLog: * src/c++17/fast_float/LOCAL_PATCHES: Update. * src/c++17/fast_float/ascii_number.h, src/c++17/fast_float/bigint.h, src/c++17/fast_float/decimal_to_binary.h, src/c++17/fast_float/digit_comparison.h, src/c++17/fast_float/fast_float.h, src/c++17/fast_float/fast_table.h, src/c++17/fast_float/float_common.h, src/c++17/fast_float/parse_number.h: Apply local modifications. --- libstdc++-v3/src/c++17/fast_float/LOCAL_PATCHES | 1 + libstdc++-v3/src/c++17/fast_float/ascii_number.h | 11 +++-------- libstdc++-v3/src/c++17/fast_float/bigint.h | 5 ----- .../src/c++17/fast_float/decimal_to_binary.h | 6 ------ .../src/c++17/fast_float/digit_comparison.h | 5 ----- libstdc++-v3/src/c++17/fast_float/fast_float.h | 15 ++------------- libstdc++-v3/src/c++17/fast_float/fast_table.h | 2 -- libstdc++-v3/src/c++17/fast_float/float_common.h | 7 +------ libstdc++-v3/src/c++17/fast_float/parse_number.h | 5 ----- 9 files changed, 7 insertions(+), 50 deletions(-) diff --git a/libstdc++-v3/src/c++17/fast_float/LOCAL_PATCHES b/libstdc++-v3/src/c++17/fast_float/LOCAL_PATCHES index e69de29bb2d..e9d7bba6195 100644 --- a/libstdc++-v3/src/c++17/fast_float/LOCAL_PATCHES +++ b/libstdc++-v3/src/c++17/fast_float/LOCAL_PATCHES @@ -0,0 +1 @@ +r12-???? diff --git a/libstdc++-v3/src/c++17/fast_float/ascii_number.h b/libstdc++-v3/src/c++17/fast_float/ascii_number.h index 3e6bb3e9ef3..c2f69326b2f 100644 --- a/libstdc++-v3/src/c++17/fast_float/ascii_number.h +++ b/libstdc++-v3/src/c++17/fast_float/ascii_number.h @@ -1,11 +1,6 @@ #ifndef FASTFLOAT_ASCII_NUMBER_H #define FASTFLOAT_ASCII_NUMBER_H -#include -#include -#include -#include - #include "float_common.h" namespace fast_float { @@ -144,7 +139,7 @@ parsed_number_string parse_number_string(const char *p, const char *pend, parse_ return answer; } int64_t exp_number = 0; // explicit exponential part - if ((fmt & chars_format::scientific) && (p != pend) && (('e' == *p) || ('E' == *p))) { + if (bool(fmt & chars_format::scientific) && (p != pend) && (('e' == *p) || ('E' == *p))) { const char * location_of_e = p; ++p; bool neg_exp = false; @@ -155,7 +150,7 @@ parsed_number_string parse_number_string(const char *p, const char *pend, parse_ ++p; } if ((p == pend) || !is_integer(*p)) { - if(!(fmt & chars_format::fixed)) { + if(!bool(fmt & chars_format::fixed)) { // We are in error. return answer; } @@ -174,7 +169,7 @@ parsed_number_string parse_number_string(const char *p, const char *pend, parse_ } } else { // If it scientific and not fixed, we have to bail out. - if((fmt & chars_format::scientific) && !(fmt & chars_format::fixed)) { return answer; } + if(bool(fmt & chars_format::scientific) && !bool(fmt & chars_format::fixed)) { return answer; } } answer.lastmatch = p; answer.valid = true; diff --git a/libstdc++-v3/src/c++17/fast_float/bigint.h b/libstdc++-v3/src/c++17/fast_float/bigint.h index b56cb9b03b3..5c9552cab4c 100644 --- a/libstdc++-v3/src/c++17/fast_float/bigint.h +++ b/libstdc++-v3/src/c++17/fast_float/bigint.h @@ -1,11 +1,6 @@ #ifndef FASTFLOAT_BIGINT_H #define FASTFLOAT_BIGINT_H -#include -#include -#include -#include - #include "float_common.h" namespace fast_float { diff --git a/libstdc++-v3/src/c++17/fast_float/decimal_to_binary.h b/libstdc++-v3/src/c++17/fast_float/decimal_to_binary.h index 6da6c66a3ac..26343c4cd20 100644 --- a/libstdc++-v3/src/c++17/fast_float/decimal_to_binary.h +++ b/libstdc++-v3/src/c++17/fast_float/decimal_to_binary.h @@ -3,12 +3,6 @@ #include "float_common.h" #include "fast_table.h" -#include -#include -#include -#include -#include -#include namespace fast_float { diff --git a/libstdc++-v3/src/c++17/fast_float/digit_comparison.h b/libstdc++-v3/src/c++17/fast_float/digit_comparison.h index 7ffe874303b..4af465420c9 100644 --- a/libstdc++-v3/src/c++17/fast_float/digit_comparison.h +++ b/libstdc++-v3/src/c++17/fast_float/digit_comparison.h @@ -1,11 +1,6 @@ #ifndef FASTFLOAT_DIGIT_COMPARISON_H #define FASTFLOAT_DIGIT_COMPARISON_H -#include -#include -#include -#include - #include "float_common.h" #include "bigint.h" #include "ascii_number.h" diff --git a/libstdc++-v3/src/c++17/fast_float/fast_float.h b/libstdc++-v3/src/c++17/fast_float/fast_float.h index 3c483803af3..a4b967f5dd7 100644 --- a/libstdc++-v3/src/c++17/fast_float/fast_float.h +++ b/libstdc++-v3/src/c++17/fast_float/fast_float.h @@ -1,21 +1,10 @@ #ifndef FASTFLOAT_FAST_FLOAT_H #define FASTFLOAT_FAST_FLOAT_H -#include - namespace fast_float { -enum chars_format { - scientific = 1<<0, - fixed = 1<<2, - hex = 1<<3, - general = fixed | scientific -}; - -struct from_chars_result { - const char *ptr; - std::errc ec; -}; +using std::chars_format; +using std::from_chars_result; struct parse_options { constexpr explicit parse_options(chars_format fmt = chars_format::general, diff --git a/libstdc++-v3/src/c++17/fast_float/fast_table.h b/libstdc++-v3/src/c++17/fast_float/fast_table.h index 5766274ca41..5e0faf71d6a 100644 --- a/libstdc++-v3/src/c++17/fast_float/fast_table.h +++ b/libstdc++-v3/src/c++17/fast_float/fast_table.h @@ -1,8 +1,6 @@ #ifndef FASTFLOAT_FAST_TABLE_H #define FASTFLOAT_FAST_TABLE_H -#include - namespace fast_float { /** diff --git a/libstdc++-v3/src/c++17/fast_float/float_common.h b/libstdc++-v3/src/c++17/fast_float/float_common.h index c8e7e4fc99e..e2b50cb3e69 100644 --- a/libstdc++-v3/src/c++17/fast_float/float_common.h +++ b/libstdc++-v3/src/c++17/fast_float/float_common.h @@ -1,11 +1,6 @@ #ifndef FASTFLOAT_FLOAT_COMMON_H #define FASTFLOAT_FLOAT_COMMON_H -#include -#include -#include -#include - #if (defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) \ || defined(__amd64) || defined(__aarch64__) || defined(_M_ARM64) \ || defined(__MINGW64__) \ @@ -129,7 +124,7 @@ struct value128 { /* result might be undefined when input_num is zero */ fastfloat_really_inline int leading_zeroes(uint64_t input_num) { - assert(input_num > 0); + FASTFLOAT_DEBUG_ASSERT(input_num > 0); #ifdef FASTFLOAT_VISUAL_STUDIO #if defined(_M_X64) || defined(_M_ARM64) unsigned long leading_zero = 0; diff --git a/libstdc++-v3/src/c++17/fast_float/parse_number.h b/libstdc++-v3/src/c++17/fast_float/parse_number.h index 62ae3b039e6..86dea2287b4 100644 --- a/libstdc++-v3/src/c++17/fast_float/parse_number.h +++ b/libstdc++-v3/src/c++17/fast_float/parse_number.h @@ -5,11 +5,6 @@ #include "decimal_to_binary.h" #include "digit_comparison.h" -#include -#include -#include -#include - namespace fast_float { -- 2.34.0