From patchwork Thu Jun 6 15:38:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1111200 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-502499-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="OhLfGjpi"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45KVFW3BfSz9s4Y for ; Fri, 7 Jun 2019 01:39:09 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=kz9EmfpdHUqg8E17SiNcD4S42Ix/A786lqkIO1ZSQtlpH0g3NQE/u vZzxBcdn537NPUTPrLamLxOEEPFaBIKWAlxJudgYEV8EGnkqGFwpLk4GWLXGOmER WqdKv8IjCbGmXaFnU9tjnML+UcZgF9peCf5zwVF4zdTI5B5ZJ4aMJY= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=JPfSU4Nx4HAfVJ/JFWUY7Hig6tI=; b=OhLfGjpiaOGBsabU47fy qtQB3SYZNISonGu/MJFbaDyYPBTCABN+0ZSmhAqsJvu47wIYfnkAOJWkUWWFhFVF tk7tHVPqeVfHUM94O3r+O4hRlgDbFkJmrCD7wKW8P1khPVtzL21z2aERH79FHnFY 35ywPgLym0dkMuv2vTxdwVk= Received: (qmail 115749 invoked by alias); 6 Jun 2019 15:38:55 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 115540 invoked by uid 89); 6 Jun 2019 15:38:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-15.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=greatly, Before, UD:porting_to.html, porting_tohtml X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Jun 2019 15:38:53 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 84BD38552E; Thu, 6 Jun 2019 15:38:38 +0000 (UTC) Received: from localhost (unknown [10.33.36.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 22A735C693; Thu, 6 Jun 2019 15:38:36 +0000 (UTC) Date: Thu, 6 Jun 2019 16:38:36 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] Avoid unnecessary inclusion of header Message-ID: <20190606153836.GT2599@redhat.com> MIME-Version: 1.0 Content-Disposition: inline X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.11.3 (2019-02-01) This can greatly reduce the amount of preprocessed code that is included by other headers, because depends on which is huge. * include/std/array: Do not include . * include/std/optional: Include and instead of . Preprocessed line counts for C++17 mode: Before 25774 32453 31616 After 9925 23194 19062 Tested x86_64-linux, committed to trunk. Once we have a gcc-10/porting_to.html page I'll note this change there, because code relying on std::string and std::allocator being defined by transitive includes will need to include the right headers. commit 9eb6db53fb072e20b1d54b16d8c1c77638c934e5 Author: redi Date: Thu Jun 6 15:34:56 2019 +0000 Avoid unnecessary inclusion of header This can greatly reduce the amount of preprocessed code that is included by other headers, because depends on which is huge. * include/std/array: Do not include . * include/std/optional: Include and instead of . * testsuite/20_util/function_objects/searchers.cc: Include for std::isalnum. * testsuite/20_util/tuple/cons/deduction.cc: Include for std::allocator. * testsuite/23_containers/map/erasure.cc: Include . * testsuite/23_containers/unordered_map/erasure.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@272011 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/libstdc++-v3/include/std/array b/libstdc++-v3/include/std/array index 02c6f4b4dbe..230e2b0f593 100644 --- a/libstdc++-v3/include/std/array +++ b/libstdc++-v3/include/std/array @@ -36,7 +36,7 @@ #else #include -#include +#include #include #include diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index ae825d3e327..79cd6c97019 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -35,10 +35,10 @@ #include #include -#include +#include #include #include -#include +#include #include #include diff --git a/libstdc++-v3/testsuite/20_util/function_objects/searchers.cc b/libstdc++-v3/testsuite/20_util/function_objects/searchers.cc index aae21d28d3a..fc278860f5c 100644 --- a/libstdc++-v3/testsuite/20_util/function_objects/searchers.cc +++ b/libstdc++-v3/testsuite/20_util/function_objects/searchers.cc @@ -19,6 +19,7 @@ #include #include +#include #ifdef _GLIBCXX_USE_WCHAR_T # include #endif diff --git a/libstdc++-v3/testsuite/20_util/tuple/cons/deduction.cc b/libstdc++-v3/testsuite/20_util/tuple/cons/deduction.cc index fa91f8fa539..eb3f2f3d6ab 100644 --- a/libstdc++-v3/testsuite/20_util/tuple/cons/deduction.cc +++ b/libstdc++-v3/testsuite/20_util/tuple/cons/deduction.cc @@ -19,6 +19,7 @@ // . #include +#include template struct require_same; template struct require_same { using type = void; }; diff --git a/libstdc++-v3/testsuite/23_containers/map/erasure.cc b/libstdc++-v3/testsuite/23_containers/map/erasure.cc index d8a57160865..5b211c3602b 100644 --- a/libstdc++-v3/testsuite/23_containers/map/erasure.cc +++ b/libstdc++-v3/testsuite/23_containers/map/erasure.cc @@ -19,6 +19,7 @@ // . #include +#include #include #ifndef __cpp_lib_erase_if diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/erasure.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/erasure.cc index 35190a0d19e..17bb940f00f 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_map/erasure.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/erasure.cc @@ -19,6 +19,7 @@ // . #include +#include #include #ifndef __cpp_lib_erase_if