https://gcc.gnu.org/g:5d1ffe2d957529f43a7e4077ef15a8fa0f1ea10a

commit r17-5114-g5d1ffe2d957529f43a7e4077ef15a8fa0f1ea10a
Author: Léo Hardt <[email protected]>
Date:   Tue Sep 29 00:19:40 2026 -0300

    clean(includes): Remove duplicate includes.
    
    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.

Diff:
---
 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 5e1a38e47dbc..100d2e33a808 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 eabc2342b062..13b2e4ccbef0 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 3fefa9fc02d9..e8958051656d 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 63be0e1f369e..6d1bd820ca88 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 f573c54744cb..044386f1cf08 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 b9f9e1deeff4..5cd8f483b595 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 a920e557d111..de6e16a4f798 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 001865605a15..b36e50b0fd48 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 43c4f5fee31f..ae2fdf0ec09e 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 898eb6964b75..8fb248729fe5 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 39ef59ab9a65..a05d8f7d8693 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 f70ed21652a3..872dfc2216a5 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 3f190ec2ad04..1a83e83d52b6 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 d55e2ca78560..b5e1404d9381 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 663952de7049..2e6121886698 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 315b027516dc..e8d003173a64 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 3b34894917f5..a0c6661818d9 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 42c16d99f39e..f51b24d8d68b 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 382a2d75c076..c3f8b7ce3f20 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 7123827cfd7b..5f54d7d8a539 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 36334e7559d9..34f44064537b 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 cc3e1dfb4ef2..bd1430e68451 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 63f970c2f93f..6eb30ddd520d 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 e9d2870feb41..89bafc47c6a0 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 27d30c39cbe6..49531e52a3b7 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 bcaf80749517..7ce5032a6cb9 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"

Reply via email to