From patchwork Wed Mar 10 15:28:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1450557 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=iowsu0zw; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Dwbb6406Mz9sRR for ; Thu, 11 Mar 2021 02:29:06 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 4C72139730F5; Wed, 10 Mar 2021 15:29:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4C72139730F5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1615390142; bh=FX7DS+S2jtG2lhZWiEDWlx9Vu7FadSSZkDX1gHDoZDo=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=iowsu0zwD657vfoW4I3BxESb9BDWqRCOyoF9aDlubPXKKX/hl805AOyQROq8T/iwU 0fcMKRiLQAIoUhfcieqIXsUcMVJ5EDaW212d4BIiZtPyADbHEYzQnuo73eHaYTafYg UWqcEDX+vOgoAlDzH1tHzh/CbOLFdXq0ZyiehE0M= 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 [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id B29E1397300F for ; Wed, 10 Mar 2021 15:28:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B29E1397300F Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-576-QtL7Q_IGNeCm_mQpfn6GVA-1; Wed, 10 Mar 2021 10:28:57 -0500 X-MC-Unique: QtL7Q_IGNeCm_mQpfn6GVA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 10325512C; Wed, 10 Mar 2021 15:28:56 +0000 (UTC) Received: from localhost (unknown [10.33.37.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id AC4F95B6A8; Wed, 10 Mar 2021 15:28:55 +0000 (UTC) Date: Wed, 10 Mar 2021 15:28:54 +0000 To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Fix headers that can't be used as header units [PR 99413] Message-ID: MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-14.8 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_PASS, TXREP autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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@gcc.gnu.org Sender: "Gcc-patches" This adds missing includes to internal library headers which get included from more than one other header, so that they can be compiled as a stand-alone header unit. For existing use cases these includes are no-ops because they're already done by the header that includes these files. For compiling them as a header unit, this ensures that they include what they use. libstdc++-v3/ChangeLog: PR libstdc++/99413 * include/bits/align.h: Include debug/assertions.h. * include/bits/codecvt.h: Include bits/c++config.h. * include/bits/enable_special_members.h: Likewise. * include/bits/erase_if.h: Likewise. * include/bits/functional_hash.h: Include . * include/bits/invoke.h: Include bits/move.h. * include/bits/ostream_insert.h: Include bits/exception_defines.h. * include/bits/parse_numbers.h: Include . * include/bits/predefined_ops.h: Include bits/c++config.h. * include/bits/range_access.h: Include bits/stl_iterator.h. * include/bits/stl_bvector.h: Do not include bits/stl_vector.h. * include/bits/stl_iterator.h: Include bits/stl_iterator_base_types.h. * include/bits/stl_uninitialized.h: Include bits/stl_algobase.h. * include/bits/uniform_int_dist.h: Include bits/concept_check.h. * include/bits/unique_lock.h: Include bits/std_mutex.h. * include/debug/assertions.h: Include bits/c++config.h. Tested powerpc64le-linux. Committed to trunk. commit 47cca0288d06bd851e5801d13bbee7d9374b685d Author: Jonathan Wakely Date: Wed Mar 10 15:27:41 2021 libstdc++: Fix headers that can't be used as header units [PR 99413] This adds missing includes to internal library headers which get included from more than one other header, so that they can be compiled as a stand-alone header unit. For existing use cases these includes are no-ops because they're already done by the header that includes these files. For compiling them as a header unit, this ensures that they include what they use. libstdc++-v3/ChangeLog: PR libstdc++/99413 * include/bits/align.h: Include debug/assertions.h. * include/bits/codecvt.h: Include bits/c++config.h. * include/bits/enable_special_members.h: Likewise. * include/bits/erase_if.h: Likewise. * include/bits/functional_hash.h: Include . * include/bits/invoke.h: Include bits/move.h. * include/bits/ostream_insert.h: Include bits/exception_defines.h. * include/bits/parse_numbers.h: Include . * include/bits/predefined_ops.h: Include bits/c++config.h. * include/bits/range_access.h: Include bits/stl_iterator.h. * include/bits/stl_bvector.h: Do not include bits/stl_vector.h. * include/bits/stl_iterator.h: Include bits/stl_iterator_base_types.h. * include/bits/stl_uninitialized.h: Include bits/stl_algobase.h. * include/bits/uniform_int_dist.h: Include bits/concept_check.h. * include/bits/unique_lock.h: Include bits/std_mutex.h. * include/debug/assertions.h: Include bits/c++config.h. diff --git a/libstdc++-v3/include/bits/align.h b/libstdc++-v3/include/bits/align.h index a81cc3e7a7b..eabdaa6163d 100644 --- a/libstdc++-v3/include/bits/align.h +++ b/libstdc++-v3/include/bits/align.h @@ -34,6 +34,7 @@ #include // std::has_single_bit #include // uintptr_t +#include // _GLIBCXX_DEBUG_ASSERT namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/codecvt.h b/libstdc++-v3/include/bits/codecvt.h index af841edf947..85f92b14650 100644 --- a/libstdc++-v3/include/bits/codecvt.h +++ b/libstdc++-v3/include/bits/codecvt.h @@ -38,6 +38,9 @@ #pragma GCC system_header +#include +#include // locale::facet + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/bits/enable_special_members.h b/libstdc++-v3/include/bits/enable_special_members.h index b772b7e4c28..8361a063b4d 100644 --- a/libstdc++-v3/include/bits/enable_special_members.h +++ b/libstdc++-v3/include/bits/enable_special_members.h @@ -32,6 +32,8 @@ #pragma GCC system_header +#include + namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/bits/erase_if.h b/libstdc++-v3/include/bits/erase_if.h index 796382cc74c..8d1d23168fa 100644 --- a/libstdc++-v3/include/bits/erase_if.h +++ b/libstdc++-v3/include/bits/erase_if.h @@ -34,6 +34,8 @@ #if __cplusplus >= 201402L +#include + namespace std { _GLIBCXX_BEGIN_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/bits/functional_hash.h b/libstdc++-v3/include/bits/functional_hash.h index 2024af1e585..ac1d7e2979e 100644 --- a/libstdc++-v3/include/bits/functional_hash.h +++ b/libstdc++-v3/include/bits/functional_hash.h @@ -32,6 +32,7 @@ #pragma GCC system_header +#include #include namespace std _GLIBCXX_VISIBILITY(default) diff --git a/libstdc++-v3/include/bits/invoke.h b/libstdc++-v3/include/bits/invoke.h index d8969ea49ba..3ffcabbaebe 100644 --- a/libstdc++-v3/include/bits/invoke.h +++ b/libstdc++-v3/include/bits/invoke.h @@ -37,6 +37,7 @@ #else #include +#include // forward namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/ostream_insert.h b/libstdc++-v3/include/bits/ostream_insert.h index e5b03f8f93a..72eea8b1d05 100644 --- a/libstdc++-v3/include/bits/ostream_insert.h +++ b/libstdc++-v3/include/bits/ostream_insert.h @@ -34,6 +34,7 @@ #include #include +#include namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/parse_numbers.h b/libstdc++-v3/include/bits/parse_numbers.h index ada91567afe..56186612f0f 100644 --- a/libstdc++-v3/include/bits/parse_numbers.h +++ b/libstdc++-v3/include/bits/parse_numbers.h @@ -36,6 +36,7 @@ #if __cplusplus >= 201402L +#include #include namespace std _GLIBCXX_VISIBILITY(default) diff --git a/libstdc++-v3/include/bits/predefined_ops.h b/libstdc++-v3/include/bits/predefined_ops.h index b8814588b1c..97a8a6c3dac 100644 --- a/libstdc++-v3/include/bits/predefined_ops.h +++ b/libstdc++-v3/include/bits/predefined_ops.h @@ -30,6 +30,8 @@ #ifndef _GLIBCXX_PREDEFINED_OPS_H #define _GLIBCXX_PREDEFINED_OPS_H 1 +#include + namespace __gnu_cxx { namespace __ops diff --git a/libstdc++-v3/include/bits/range_access.h b/libstdc++-v3/include/bits/range_access.h index bfb3449a7ee..ab26b64e44c 100644 --- a/libstdc++-v3/include/bits/range_access.h +++ b/libstdc++-v3/include/bits/range_access.h @@ -35,6 +35,7 @@ #if __cplusplus >= 201103L #include #include // common_type_t, make_signed_t +#include // reverse_iterator namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/stl_bvector.h b/libstdc++-v3/include/bits/stl_bvector.h index 1e3d71f3a6f..fadb6615102 100644 --- a/libstdc++-v3/include/bits/stl_bvector.h +++ b/libstdc++-v3/include/bits/stl_bvector.h @@ -573,18 +573,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return (__n + int(_S_word_bit) - 1) / int(_S_word_bit); } }; -_GLIBCXX_END_NAMESPACE_CONTAINER -_GLIBCXX_END_NAMESPACE_VERSION -} // namespace std - -// Declare a partial specialization of vector. -#include - -namespace std _GLIBCXX_VISIBILITY(default) -{ -_GLIBCXX_BEGIN_NAMESPACE_VERSION -_GLIBCXX_BEGIN_NAMESPACE_CONTAINER - /** * @brief A specialization of vector for booleans which offers fixed time * access to individual elements in any order. diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 385d3256742..ac8a7c4b1a8 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -61,6 +61,7 @@ #define _STL_ITERATOR_H 1 #include +#include #include #include #include diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h index d28dafafaae..ace83000b20 100644 --- a/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/libstdc++-v3/include/bits/stl_uninitialized.h @@ -56,15 +56,16 @@ #ifndef _STL_UNINITIALIZED_H #define _STL_UNINITIALIZED_H 1 -#if __cplusplus > 201402L -#include -#endif - #if __cplusplus >= 201103L #include #endif -#include +#include // copy +#include // __alloc_traits + +#if __cplusplus >= 201703L +#include +#endif namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/uniform_int_dist.h b/libstdc++-v3/include/bits/uniform_int_dist.h index 3ab5c9a669f..2d83524caf6 100644 --- a/libstdc++-v3/include/bits/uniform_int_dist.h +++ b/libstdc++-v3/include/bits/uniform_int_dist.h @@ -36,6 +36,7 @@ #if __cplusplus > 201703L # include #endif +#include // __glibcxx_function_requires namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/bits/unique_lock.h b/libstdc++-v3/include/bits/unique_lock.h index 03f1d3b505a..07edfbbccb1 100644 --- a/libstdc++-v3/include/bits/unique_lock.h +++ b/libstdc++-v3/include/bits/unique_lock.h @@ -38,6 +38,7 @@ #include #include // for std::swap +#include // for std::defer_lock_t namespace std _GLIBCXX_VISIBILITY(default) { diff --git a/libstdc++-v3/include/debug/assertions.h b/libstdc++-v3/include/debug/assertions.h index da5fb278dc0..e34061e6baf 100644 --- a/libstdc++-v3/include/debug/assertions.h +++ b/libstdc++-v3/include/debug/assertions.h @@ -29,6 +29,8 @@ #ifndef _GLIBCXX_DEBUG_ASSERTIONS_H #define _GLIBCXX_DEBUG_ASSERTIONS_H 1 +#include + #ifndef _GLIBCXX_DEBUG # define _GLIBCXX_DEBUG_ASSERT(_Condition)