Hi!

Successfully (re)bootstrapped with current trunk on my Intel machine.
Patch still seems to apply correctly.

Unfortunately I don't have push permission, so would anyone mind doing so?
I sent the patch as an attachment now.

Best regards,
Léo

On 2026-10-03 09:38, Martin Jambor wrote:
Hi,

On Tue, Sep 29 2026, Léo Hardt wrote:
Good evening,

This is a trivial patch that follows r17-4362-g49501df9860312.

Removed instances in which header files were included twice with no
effect. Checked that the included header files have include-guards
and that the includes weren't in different '#if' blocks. The first
inclusion was preserved.

This usually happens when a file must be included, and so the patch
author just adds the required header plus all their dependencies,
without thoroughly checking whether each file was already included.

You can check the validity of this commit by running on ./gcc:

    find . -maxdepth 2 -type f -name "*.cc" \
        | xargs grep '#include "stor-layout.h"' \
        | sort \
        | uniq -d

And similarly for other includes by replacing "stor-layout.h" above.

Bootstrapped successfully on my Intel machine.

Signed-off-by: Léo Hardt <[email protected]>

gcc/ChangeLog:

        * caller-save.cc: Remove unused include directives
        * cse.cc: Likewise.
        * dwarf2ctf.cc: Likewise.
        * function-tests.cc: Likewise.
        * gimple-pretty-print.cc: Likewise.
        * gimple-range-trace.cc: Likewise.
        * gimple-range.cc: Likewise.
        * gimple-ssa-store-merging.cc: Likewise.
        * ipa-devirt.cc: Likewise.
        * ipa-inline-transform.cc: Likewise.

The ipa-devirt.cc and ipa-inline-transform.cc changes are OK.

But my personal opinion is that the whole patch is obviously OK and
after bootstrapping it you can check it in as such.

Martin



        * langhooks.cc: Likewise.
        * lto-streamer-in.cc: Likewise.
        * print-rtl.cc: Likewise.
        * rtl-tests.cc: Likewise.
        * sanopt.cc: Likewise.
        * stmt.cc: Likewise.
        * targhooks.cc: Likewise.
        * tree-diagnostic-cfg.cc: Likewise.
        * tree-if-conv.cc: Likewise.
        * tree-ssa-threadupdate.cc: Likewise.
        * tree-vect-patterns.cc: Likewise.
        * tree.cc: Likewise.
        * varasm.cc: Likewise.

gcc/cp/ChangeLog:

        * call.cc: Remove unused include directives.
        * init.cc: Likewise.
        * semantics.cc: Likewise.
---
  gcc/caller-save.cc              | 1 -
  gcc/cp/call.cc                  | 1 -
  gcc/cp/init.cc                  | 1 -
  gcc/cp/semantics.cc             | 1 -
  gcc/cse.cc                      | 1 -
  gcc/dwarf2ctf.cc                | 1 -
  gcc/function-tests.cc           | 9 ---------
  gcc/gimple-pretty-print.cc      | 3 +--
  gcc/gimple-range-trace.cc       | 1 -
  gcc/gimple-range.cc             | 1 -
  gcc/gimple-ssa-store-merging.cc | 1 -
  gcc/ipa-devirt.cc               | 1 -
  gcc/ipa-inline-transform.cc     | 1 -
  gcc/langhooks.cc                | 1 -
  gcc/lto-streamer-in.cc          | 1 -
  gcc/print-rtl.cc                | 1 -
  gcc/rtl-tests.cc                | 1 -
  gcc/sanopt.cc                   | 1 -
  gcc/stmt.cc                     | 1 -
  gcc/targhooks.cc                | 1 -
  gcc/tree-diagnostic-cfg.cc      | 1 -
  gcc/tree-if-conv.cc             | 1 -
  gcc/tree-ssa-threadupdate.cc    | 1 -
  gcc/tree-vect-patterns.cc       | 2 --
  gcc/tree.cc                     | 1 -
  gcc/varasm.cc                   | 1 -
  26 files changed, 1 insertion(+), 36 deletions(-)
From 829f93a469b7fd16ec75e4160aaa820062e8afaa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?L=C3=A9o=20Hardt?= <[email protected]>
Date: Tue, 29 Sep 2026 00:19:40 -0300
Subject: [PATCH] clean(includes): Remove duplicate includes.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is a trivial patch that follows r17-4362-g49501df9860312.

Removed instances in which header files were included twice with no
effect. Checked that the included header files have include-guards
and that the includes weren't in different '#if' blocks.

This usually happens when a file must be included, and so the patch
author just adds the required header plus all their dependencies.

You can check the validity of this commit by running on ./gcc:

    find . -maxdepth 2 -type f -name "*.cc" \
	| xargs grep '#include "stor-layout.h"' \
	| sort \
	| uniq -d

And similarly for other includes by replacing "stor-layout.h" above.

Signed-off-by: Léo Hardt <[email protected]>

gcc/ChangeLog:

	* caller-save.cc: Remove unused include directives
	* cse.cc: Likewise.
	* dwarf2ctf.cc: Likewise.
	* function-tests.cc: Likewise.
	* gimple-pretty-print.cc: Likewise.
	* gimple-range-trace.cc: Likewise.
	* gimple-range.cc: Likewise.
	* gimple-ssa-store-merging.cc: Likewise.
	* ipa-devirt.cc: Likewise.
	* ipa-inline-transform.cc: Likewise.
	* langhooks.cc: Likewise.
	* lto-streamer-in.cc: Likewise.
	* print-rtl.cc: Likewise.
	* rtl-tests.cc: Likewise.
	* sanopt.cc: Likewise.
	* stmt.cc: Likewise.
	* targhooks.cc: Likewise.
	* tree-diagnostic-cfg.cc: Likewise.
	* tree-if-conv.cc: Likewise.
	* tree-ssa-threadupdate.cc: Likewise.
	* tree-vect-patterns.cc: Likewise.
	* tree.cc: Likewise.
	* varasm.cc: Likewise.

gcc/cp/ChangeLog:

	* call.cc: Remove unused include directives.
	* init.cc: Likewise.
	* semantics.cc: Likewise.
---
 gcc/caller-save.cc              | 1 -
 gcc/cp/call.cc                  | 1 -
 gcc/cp/init.cc                  | 1 -
 gcc/cp/semantics.cc             | 1 -
 gcc/cse.cc                      | 1 -
 gcc/dwarf2ctf.cc                | 1 -
 gcc/function-tests.cc           | 9 ---------
 gcc/gimple-pretty-print.cc      | 3 +--
 gcc/gimple-range-trace.cc       | 1 -
 gcc/gimple-range.cc             | 1 -
 gcc/gimple-ssa-store-merging.cc | 1 -
 gcc/ipa-devirt.cc               | 1 -
 gcc/ipa-inline-transform.cc     | 1 -
 gcc/langhooks.cc                | 1 -
 gcc/lto-streamer-in.cc          | 1 -
 gcc/print-rtl.cc                | 1 -
 gcc/rtl-tests.cc                | 1 -
 gcc/sanopt.cc                   | 1 -
 gcc/stmt.cc                     | 1 -
 gcc/targhooks.cc                | 1 -
 gcc/tree-diagnostic-cfg.cc      | 1 -
 gcc/tree-if-conv.cc             | 1 -
 gcc/tree-ssa-threadupdate.cc    | 1 -
 gcc/tree-vect-patterns.cc       | 2 --
 gcc/tree.cc                     | 1 -
 gcc/varasm.cc                   | 1 -
 26 files changed, 1 insertion(+), 36 deletions(-)

diff --git a/gcc/caller-save.cc b/gcc/caller-save.cc
index 5e1a38e47db..100d2e33a80 100644
--- a/gcc/caller-save.cc
+++ b/gcc/caller-save.cc
@@ -37,7 +37,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "addresses.h"
 #include "dumpfile.h"
 #include "rtl-iter.h"
-#include "target.h"
 #include "function-abi.h"
 
 #define MOVE_MAX_WORDS (MOVE_MAX / UNITS_PER_WORD)
diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc
index eabc2342b06..13b2e4ccbef 100644
--- a/gcc/cp/call.cc
+++ b/gcc/cp/call.cc
@@ -39,7 +39,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "langhooks.h"
 #include "c-family/c-objc.h"
 #include "internal-fn.h"
-#include "stringpool.h"
 #include "attribs.h"
 #include "decl.h"
 #include "c-family/c-type-mismatch.h"
diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc
index 3fefa9fc02d..e8958051656 100644
--- a/gcc/cp/init.cc
+++ b/gcc/cp/init.cc
@@ -30,7 +30,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimplify.h"
 #include "c-family/c-ubsan.h"
 #include "intl.h"
-#include "stringpool.h"
 #include "attribs.h"
 #include "asan.h"
 #include "stor-layout.h"
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index f9f05eb0923..f0dd5f45586 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -40,7 +40,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-iterator.h"
 #include "omp-general.h"
 #include "convert.h"
-#include "stringpool.h"
 #include "attribs.h"
 #include "gomp-constants.h"
 #include "predict.h"
diff --git a/gcc/cse.cc b/gcc/cse.cc
index f573c54744c..044386f1cf0 100644
--- a/gcc/cse.cc
+++ b/gcc/cse.cc
@@ -42,7 +42,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-pass.h"
 #include "dbgcnt.h"
 #include "rtl-iter.h"
-#include "regs.h"
 #include "function-abi.h"
 #include "rtlanal.h"
 #include "expr.h"
diff --git a/gcc/dwarf2ctf.cc b/gcc/dwarf2ctf.cc
index b9f9e1deeff..5cd8f483b59 100644
--- a/gcc/dwarf2ctf.cc
+++ b/gcc/dwarf2ctf.cc
@@ -22,7 +22,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "coretypes.h"
 #include "target.h"
 #include "dwarf2out.h"
-#include "dwarf2out.h"
 
 #include "dwarf2ctf.h"
 #include "ctfc.h"
diff --git a/gcc/function-tests.cc b/gcc/function-tests.cc
index a920e557d11..de6e16a4f79 100644
--- a/gcc/function-tests.cc
+++ b/gcc/function-tests.cc
@@ -31,12 +31,10 @@ along with GCC; see the file COPYING3.  If not see
 #include "stor-layout.h"
 #include "tree.h"
 #include "stringpool.h"
-#include "stor-layout.h"
 #include "rtl.h"
 #include "predict.h"
 #include "vec.h"
 #include "hashtab.h"
-#include "hash-set.h"
 #include "hard-reg-set.h"
 #include "input.h"
 #include "function.h"
@@ -56,18 +54,11 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-iterator.h"
 #include "gimplify.h"
 #include "tree-cfg.h"
-#include "basic-block.h"
-#include "alias.h"
 #include "symtab.h"
 #include "inchash.h"
-#include "tree.h"
 #include "fold-const.h"
-#include "stor-layout.h"
 #include "stmt.h"
 #include "hash-table.h"
-#include "tree-ssa-alias.h"
-#include "internal-fn.h"
-#include "gimple-expr.h"
 #include "is-a.h"
 #include "tree-pass.h"
 #include "context.h"
diff --git a/gcc/gimple-pretty-print.cc b/gcc/gimple-pretty-print.cc
index 001865605a1..b36e50b0fd4 100644
--- a/gcc/gimple-pretty-print.cc
+++ b/gcc/gimple-pretty-print.cc
@@ -22,7 +22,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
-#include "dumpfile.h"
+#include "dumpfile.h"	/* for dump_flags */
 #include "backend.h"
 #include "tree.h"
 #include "gimple.h"
@@ -35,7 +35,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-eh.h"
 #include "gimple-iterator.h"
 #include "tree-cfg.h"
-#include "dumpfile.h"	/* for dump_flags */
 #include "value-prof.h"
 #include "trans-mem.h"
 #include "cfganal.h"
diff --git a/gcc/gimple-range-trace.cc b/gcc/gimple-range-trace.cc
index 43c4f5fee31..ae2fdf0ec09 100644
--- a/gcc/gimple-range-trace.cc
+++ b/gcc/gimple-range-trace.cc
@@ -30,7 +30,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-iterator.h"
 #include "tree-cfg.h"
 #include "fold-const.h"
-#include "tree-cfg.h"
 #include "cfgloop.h"
 #include "tree-scalar-evolution.h"
 #include "gimple-range.h"
diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index 898eb6964b7..8fb248729fe 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -30,7 +30,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "gimple-iterator.h"
 #include "tree-cfg.h"
 #include "fold-const.h"
-#include "tree-cfg.h"
 #include "cfgloop.h"
 #include "tree-scalar-evolution.h"
 #include "gimple-range.h"
diff --git a/gcc/gimple-ssa-store-merging.cc b/gcc/gimple-ssa-store-merging.cc
index 39ef59ab9a6..a05d8f7d869 100644
--- a/gcc/gimple-ssa-store-merging.cc
+++ b/gcc/gimple-ssa-store-merging.cc
@@ -150,7 +150,6 @@
 #include "ssa.h"
 #include "gimple-pretty-print.h"
 #include "alias.h"
-#include "fold-const.h"
 #include "print-tree.h"
 #include "tree-hash-traits.h"
 #include "gimple-iterator.h"
diff --git a/gcc/ipa-devirt.cc b/gcc/ipa-devirt.cc
index f70ed21652a..872dfc2216a 100644
--- a/gcc/ipa-devirt.cc
+++ b/gcc/ipa-devirt.cc
@@ -135,7 +135,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "stringpool.h"
 #include "attribs.h"
 #include "data-streamer.h"
-#include "lto-streamer.h"
 #include "streamer-hooks.h"
 
 /* Hash based set of pairs of types.  */
diff --git a/gcc/ipa-inline-transform.cc b/gcc/ipa-inline-transform.cc
index 3f190ec2ad0..1a83e83d52b 100644
--- a/gcc/ipa-inline-transform.cc
+++ b/gcc/ipa-inline-transform.cc
@@ -47,7 +47,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-fnsummary.h"
 #include "ipa-inline.h"
 #include "tree-inline.h"
-#include "function.h"
 #include "cfg.h"
 #include "basic-block.h"
 #include "ipa-utils.h"
diff --git a/gcc/langhooks.cc b/gcc/langhooks.cc
index d55e2ca7856..b5e1404d938 100644
--- a/gcc/langhooks.cc
+++ b/gcc/langhooks.cc
@@ -35,7 +35,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "langhooks.h"
 #include "tree-diagnostic.h"
 #include "output.h"
-#include "timevar.h"
 #include "stor-layout.h"
 #include "cgraph.h"
 #include "debug.h"
diff --git a/gcc/lto-streamer-in.cc b/gcc/lto-streamer-in.cc
index 663952de704..2e612188669 100644
--- a/gcc/lto-streamer-in.cc
+++ b/gcc/lto-streamer-in.cc
@@ -43,7 +43,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "cfgloop.h"
 #include "debug.h"
 #include "alloc-pool.h"
-#include "toplev.h"
 
 /* Allocator used to hold string slot entries for line map streaming.  */
 static struct object_allocator<struct string_slot> *string_slot_allocator;
diff --git a/gcc/print-rtl.cc b/gcc/print-rtl.cc
index 315b027516d..e8d003173a6 100644
--- a/gcc/print-rtl.cc
+++ b/gcc/print-rtl.cc
@@ -41,7 +41,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "predict.h"
 #include "function.h"
 #include "cfg.h"
-#include "basic-block.h"
 #include "diagnostic.h"
 #include "tree-pretty-print.h"
 #include "alloc-pool.h"
diff --git a/gcc/rtl-tests.cc b/gcc/rtl-tests.cc
index 3b34894917f..a0c6661818d 100644
--- a/gcc/rtl-tests.cc
+++ b/gcc/rtl-tests.cc
@@ -31,7 +31,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "stor-layout.h"
 #include "tree.h"
 #include "stringpool.h"
-#include "stor-layout.h"
 #include "rtl.h"
 #include "pretty-print.h"
 #include "cfgbuild.h"
diff --git a/gcc/sanopt.cc b/gcc/sanopt.cc
index 42c16d99f39..f51b24d8d68 100644
--- a/gcc/sanopt.cc
+++ b/gcc/sanopt.cc
@@ -39,7 +39,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-phinodes.h"
 #include "ssa-iterators.h"
 #include "gimplify.h"
-#include "gimple-iterator.h"
 #include "gimple-walk.h"
 #include "cfghooks.h"
 #include "tree-dfa.h"
diff --git a/gcc/stmt.cc b/gcc/stmt.cc
index 382a2d75c07..c3f8b7ce3f2 100644
--- a/gcc/stmt.cc
+++ b/gcc/stmt.cc
@@ -55,7 +55,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "dumpfile.h"
 #include "builtins.h"
 #include "cfgexpand.h"
-#include "output.h"
 
 
 /* Functions and data structures for expanding case statements.  */
diff --git a/gcc/targhooks.cc b/gcc/targhooks.cc
index 7123827cfd7..5f54d7d8a53 100644
--- a/gcc/targhooks.cc
+++ b/gcc/targhooks.cc
@@ -89,7 +89,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "function-abi.h"
 #include "attribs.h"
 #include "asan.h"
-#include "emit-rtl.h"
 #include "gimple.h"
 #include "cfgloop.h"
 #include "tree-vectorizer.h"
diff --git a/gcc/tree-diagnostic-cfg.cc b/gcc/tree-diagnostic-cfg.cc
index 36334e7559d..34f44064537 100644
--- a/gcc/tree-diagnostic-cfg.cc
+++ b/gcc/tree-diagnostic-cfg.cc
@@ -35,7 +35,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "custom-sarif-properties/cfg.h"
 #include "tree-diagnostic-sink-extensions.h"
 #include "tree-logical-location.h"
-#include "tree-pass.h"
 #include "function.h"
 #include "topics/pass-events.h"
 #include "diagnostics/digraphs.h"
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index cc3e1dfb4ef..bd1430e6845 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -117,7 +117,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "builtins.h"
 #include "cfganal.h"
 #include "internal-fn.h"
-#include "fold-const.h"
 #include "tree-ssa-sccvn.h"
 #include "tree-cfgcleanup.h"
 #include "tree-ssa-dse.h"
diff --git a/gcc/tree-ssa-threadupdate.cc b/gcc/tree-ssa-threadupdate.cc
index 63f970c2f93..6eb30ddd520 100644
--- a/gcc/tree-ssa-threadupdate.cc
+++ b/gcc/tree-ssa-threadupdate.cc
@@ -35,7 +35,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "dbgcnt.h"
 #include "tree-cfg.h"
 #include "tree-vectorizer.h"
-#include "tree-pass.h"
 
 /* Given a block B, update the CFG and SSA graph to reflect redirecting
    one or more in-edges to B to instead reach the destination of an
diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
index 06159fa6ab8..310d9bb678c 100644
--- a/gcc/tree-vect-patterns.cc
+++ b/gcc/tree-vect-patterns.cc
@@ -36,8 +36,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "stor-layout.h"
 #include "tree-eh.h"
 #include "gimplify.h"
-#include "gimple-iterator.h"
-#include "gimple-fold.h"
 #include "gimplify-me.h"
 #include "cfgloop.h"
 #include "tree-vectorizer.h"
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 3b7ad2b1818..174c5ef211e 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -64,7 +64,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-utils.h"
 #include "selftest.h"
 #include "stringpool.h"
-#include "attribs.h"
 #include "rtl.h"
 #include "regs.h"
 #include "tree-vector-builder.h"
diff --git a/gcc/varasm.cc b/gcc/varasm.cc
index bcaf8074951..7ce5032a6cb 100644
--- a/gcc/varasm.cc
+++ b/gcc/varasm.cc
@@ -60,7 +60,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "alloc-pool.h"
 #include "toplev.h"
 #include "opts.h"
-#include "asan.h"
 #include "recog.h"
 #include "gimple-expr.h"
 
-- 
2.47.3

Reply via email to