From patchwork Thu May 26 12:36:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 54403 Return-Path: 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 04F1038344E8 for ; Thu, 26 May 2022 12:38:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04F1038344E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1653568683; bh=70KblFFIQQJ/RCd3vhuhch5mwgdzOiR42jfyBKfdC3Y=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=gxUpL8Gj1+Aed2GXQIe3GTgNxOL8KU3IjzSn970Y617Dh2b2Gp2ZS20ZI8fRfs5D1 JkQysvCIGIEiXBWiXCxMD758FBzr07hdY3GDS5y21AOsWQ3+ME0gf3EgzJqA9d9sdM vLRiDCHuxBrhh5Ls1jxHPOJ6f1y0LBsVw7rQH4JQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 688BF3834E58 for ; Thu, 26 May 2022 12:36:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 688BF3834E58 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-661-NzkHg8_-Nfy5gITC__WXCg-1; Thu, 26 May 2022 08:36:33 -0400 X-MC-Unique: NzkHg8_-Nfy5gITC__WXCg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 932D129DD9B2; Thu, 26 May 2022 12:36:33 +0000 (UTC) Received: from localhost (unknown [10.33.36.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5BBC6492CA4; Thu, 26 May 2022 12:36:33 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 1/3] libstdc++: Make headers include their prerequisites Date: Thu, 26 May 2022 13:36:30 +0100 Message-Id: <20220526123632.1284224-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.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=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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Cc: Nathan Sidwell Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Nathan Sidwell Tested powerpc64le-linux, pushed to trunk. -- >8 -- These headers were relying on their includers having already included some prerequisites. That makes them unsuitable to be header-units. So directly include the needed headers. Reviewed-by: Jonathan Wakely libstdc++-v3/ChangeLog: * include/bits/hashtable.h: Include required headers. * include/bits/hashtable_policy.h: Likewise. * include/bits/stl_heap.h: Likewise. * include/bits/stl_iterator_base_funcs.h: Likewise. --- libstdc++-v3/include/bits/hashtable.h | 2 ++ libstdc++-v3/include/bits/hashtable_policy.h | 2 ++ libstdc++-v3/include/bits/stl_heap.h | 1 + libstdc++-v3/include/bits/stl_iterator_base_funcs.h | 1 + 4 files changed, 6 insertions(+) diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index 5e1a417f7cd..edc151ef15b 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -37,6 +37,8 @@ #if __cplusplus > 201402L # include #endif +#include +#include // equal_to, _Identity, _Select1st namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h index 0f0b0f9ea51..799c3e986b4 100644 --- a/libstdc++-v3/include/bits/hashtable_policy.h +++ b/libstdc++-v3/include/bits/hashtable_policy.h @@ -33,6 +33,8 @@ #include // for std::tuple, std::forward_as_tuple #include // for std::min, std::is_permutation. +#include // for __gnu_cxx::__aligned_buffer +#include // for std::__alloc_rebind #include // for __gnu_cxx::__int_traits namespace std _GLIBCXX_VISIBILITY(default) diff --git a/libstdc++-v3/include/bits/stl_heap.h b/libstdc++-v3/include/bits/stl_heap.h index 6e08f81c115..eee946c3818 100644 --- a/libstdc++-v3/include/bits/stl_heap.h +++ b/libstdc++-v3/include/bits/stl_heap.h @@ -58,6 +58,7 @@ #include #include #include +#include namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/stl_iterator_base_funcs.h b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h index e9dc54cc628..1551b226ff4 100644 --- a/libstdc++-v3/include/bits/stl_iterator_base_funcs.h +++ b/libstdc++-v3/include/bits/stl_iterator_base_funcs.h @@ -63,6 +63,7 @@ #include #include +#include namespace std _GLIBCXX_VISIBILITY(default) { From patchwork Thu May 26 12:36:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 54402 Return-Path: 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 E866738344C6 for ; Thu, 26 May 2022 12:37:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E866738344C6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1653568625; bh=pZnfhb4GjSLZ5zY4o99emOzfMUejkc7H+CfpzDVAYTo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=GhgCzK8lqFdn+Z3Jv8yXHwU9O0wloCdCYaxNqQSKs25a1F5vmiMV3KtfiKxGgdmdu JILIsKOOix8rGrqo0baiUB5mqvih8tKNx8ZyE2rfhi+pJeT2rdMZkRIdZzvPM2uGnD 36/nPDpr5Bdu3tsChhbSFVxZeAguonGzFcst3zZo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 64B54383665A for ; Thu, 26 May 2022 12:36:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 64B54383665A Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-439-IxK_kZL8Pf2PXBFn-A3qnQ-1; Thu, 26 May 2022 08:36:34 -0400 X-MC-Unique: IxK_kZL8Pf2PXBFn-A3qnQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 719F438349B5; Thu, 26 May 2022 12:36:34 +0000 (UTC) Received: from localhost (unknown [10.33.36.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AF18400F38; Thu, 26 May 2022 12:36:34 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 2/3] libstdc++: Remove some unnecessary includes Date: Thu, 26 May 2022 13:36:31 +0100 Message-Id: <20220526123632.1284224-2-jwakely@redhat.com> In-Reply-To: <20220526123632.1284224-1-jwakely@redhat.com> References: <20220526123632.1284224-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-13.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=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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested powerpc64le-linux, pushed to trunk. -- >8 -- These headers do not use anything in directly, and it's included by and anyway, because they do need it. libstdc++-v3/ChangeLog: * include/bits/ranges_algobase.h: Do not include . * include/std/string: Likewise. * include/std/variant: Likewise. --- libstdc++-v3/include/bits/ranges_algobase.h | 1 - libstdc++-v3/include/std/string | 1 - libstdc++-v3/include/std/variant | 1 - 3 files changed, 3 deletions(-) diff --git a/libstdc++-v3/include/bits/ranges_algobase.h b/libstdc++-v3/include/bits/ranges_algobase.h index 1bbc44fc668..f6f0b9c83b0 100644 --- a/libstdc++-v3/include/bits/ranges_algobase.h +++ b/libstdc++-v3/include/bits/ranges_algobase.h @@ -33,7 +33,6 @@ #if __cplusplus > 201703L #include -#include #include #include #include // ranges::begin, ranges::range etc. diff --git a/libstdc++-v3/include/std/string b/libstdc++-v3/include/std/string index 24051663f74..4a0633067bd 100644 --- a/libstdc++-v3/include/std/string +++ b/libstdc++-v3/include/std/string @@ -42,7 +42,6 @@ #include #include // For operators >>, <<, and getline. #include -#include #include #include #include // For less diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index beed396fccb..c5f25ef6b47 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -40,7 +40,6 @@ #include #include #include -#include #include #include #include // in_place_index_t From patchwork Thu May 26 12:36:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 54404 Return-Path: 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 6CD5D38376C3 for ; Thu, 26 May 2022 12:40:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6CD5D38376C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1653568837; bh=AW44Y6Cwoyfw7jpJwKUcgyIFv4xz/NHz2qRGjcB79xc=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=gKbfmHRKmjL8cZz2YePQ+x7x+Zs0jtmknQ9jhACjPRjAL65YoFbMphE4UeZlb2Awv hcNLk+hgiuZzojna87RZqo/nDNNW+jcaZ/P6zAXYTHF8lozzTJ36RIjzE8G4MnbkjH c5d2iJ7t8UrZYFnVwMlC12C3Uc7vxO54kxBADyic= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org 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 2406C3834E55 for ; Thu, 26 May 2022 12:36:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2406C3834E55 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-30-7dFSviTpMge22esWeO2h6g-1; Thu, 26 May 2022 08:36:35 -0400 X-MC-Unique: 7dFSviTpMge22esWeO2h6g-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8C2E938349B3; Thu, 26 May 2022 12:36:35 +0000 (UTC) Received: from localhost (unknown [10.33.36.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 179FE2166B26; Thu, 26 May 2022 12:36:34 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 3/3] libstdc++: Refactor includes for unordered containers Date: Thu, 26 May 2022 13:36:32 +0100 Message-Id: <20220526123632.1284224-3-jwakely@redhat.com> In-Reply-To: <20220526123632.1284224-1-jwakely@redhat.com> References: <20220526123632.1284224-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.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_NONE, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested powerpc64le-linux, pushed to trunk. -- >8 -- This moves some #include directives to the relevant place. For example, needs so should include it directly instead of relying on and to do so first. libstdc++-v3/ChangeLog: * include/bits/functional_hash.h (__is_fast_hash): Add doxygen comment. * include/bits/hashtable.h: Do not include here. * include/bits/hashtable_policy.h: Include and . * include/bits/unordered_map.h: Include required headers. * include/bits/unordered_set.h: Likewise. * include/std/unordered_map: Do not include headers for indirect dependencies. * include/std/unordered_set: Likewise. --- libstdc++-v3/include/bits/functional_hash.h | 15 +++++++++++---- libstdc++-v3/include/bits/hashtable.h | 3 +-- libstdc++-v3/include/bits/hashtable_policy.h | 2 ++ libstdc++-v3/include/bits/unordered_map.h | 5 +++++ libstdc++-v3/include/bits/unordered_set.h | 5 +++++ libstdc++-v3/include/std/unordered_map | 8 -------- libstdc++-v3/include/std/unordered_set | 8 -------- 7 files changed, 24 insertions(+), 22 deletions(-) diff --git a/libstdc++-v3/include/bits/functional_hash.h b/libstdc++-v3/include/bits/functional_hash.h index c00113eff83..292c0ee03f7 100644 --- a/libstdc++-v3/include/bits/functional_hash.h +++ b/libstdc++-v3/include/bits/functional_hash.h @@ -280,10 +280,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// @} group hashes - // Hint about performance of hash functor. If not fast the hash-based - // containers will cache the hash code. - // Default behavior is to consider that hashers are fast unless specified - // otherwise. + /** Hint about performance of hash functions. + * + * If a given hash function object is not fast, the hash-based containers + * will cache the hash code. + * The default behavior is to consider that hashers are fast unless specified + * otherwise. + * + * Users can specialize this for their own hash functions in order to force + * caching of hash codes in unordered containers. Specializing this trait + * affects the ABI of the unordered containers, so use it carefully. + */ template struct __is_fast_hash : public std::true_type { }; diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index edc151ef15b..29ec1192f32 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -34,11 +34,10 @@ #include #include +#include // __has_is_transparent_t #if __cplusplus > 201402L # include #endif -#include -#include // equal_to, _Identity, _Select1st namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h index 799c3e986b4..1a259702f98 100644 --- a/libstdc++-v3/include/bits/hashtable_policy.h +++ b/libstdc++-v3/include/bits/hashtable_policy.h @@ -32,7 +32,9 @@ #define _HASHTABLE_POLICY_H 1 #include // for std::tuple, std::forward_as_tuple +#include // for __is_fast_hash #include // for std::min, std::is_permutation. +#include // for std::pair #include // for __gnu_cxx::__aligned_buffer #include // for std::__alloc_rebind #include // for __gnu_cxx::__int_traits diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h index d5edfde8caf..5a3e6f61af2 100644 --- a/libstdc++-v3/include/bits/unordered_map.h +++ b/libstdc++-v3/include/bits/unordered_map.h @@ -30,6 +30,11 @@ #ifndef _UNORDERED_MAP_H #define _UNORDERED_MAP_H +#include +#include +#include // hash +#include // equal_to + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h index d2fa2c51171..740bbafd4c9 100644 --- a/libstdc++-v3/include/bits/unordered_set.h +++ b/libstdc++-v3/include/bits/unordered_set.h @@ -30,6 +30,11 @@ #ifndef _UNORDERED_SET_H #define _UNORDERED_SET_H +#include +#include +#include // hash +#include // equal_to + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/std/unordered_map b/libstdc++-v3/include/std/unordered_map index e13bb9a2148..b50ec2a8de2 100644 --- a/libstdc++-v3/include/std/unordered_map +++ b/libstdc++-v3/include/std/unordered_map @@ -35,15 +35,7 @@ # include #else -#include #include -#include -#include -#include -#include -#include // equal_to, _Identity, _Select1st -#include -#include #include #include #include diff --git a/libstdc++-v3/include/std/unordered_set b/libstdc++-v3/include/std/unordered_set index 8b665718a83..edaa517635b 100644 --- a/libstdc++-v3/include/std/unordered_set +++ b/libstdc++-v3/include/std/unordered_set @@ -35,15 +35,7 @@ # include #else -#include #include -#include -#include -#include -#include -#include // equal_to, _Identity, _Select1st -#include -#include #include #include #include