public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Reduce includes of block.h
@ 2023-01-21 21:09 Tom Tromey
  2023-01-21 21:09 ` [PATCH 1/2] Don't include block.h from expop.h Tom Tromey
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom Tromey @ 2023-01-21 21:09 UTC (permalink / raw)
  To: gdb-patches

My recent work on block.h had a bunch of recompilations that seemed
strange to me.  Investigating and examining the .Po files revealed a
few inclusions of block.h that aren't truly needed.  This short series
simplifies these.

Tom



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] Don't include block.h from expop.h
  2023-01-21 21:09 [PATCH 0/2] Reduce includes of block.h Tom Tromey
@ 2023-01-21 21:09 ` Tom Tromey
  2023-01-21 21:09 ` [PATCH 2/2] Remove block.h includes from some tdep files Tom Tromey
  2023-02-08 18:27 ` [PATCH 0/2] Reduce includes of block.h Tom Tromey
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2023-01-21 21:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

expop.h needs block.h for a single inline function.  However, I don't
think most of the check_objfile functions need to be defined in the
header (just the templates).  This patch moves the one offending
function and removes the include.
---
 gdb/expop.h    | 8 ++------
 gdb/expprint.c | 6 ++++++
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/gdb/expop.h b/gdb/expop.h
index 9e6ab0dd244..bfe55e4f2fd 100644
--- a/gdb/expop.h
+++ b/gdb/expop.h
@@ -20,7 +20,6 @@
 #ifndef EXPOP_H
 #define EXPOP_H
 
-#include "block.h"
 #include "c-lang.h"
 #include "cp-abi.h"
 #include "expression.h"
@@ -229,11 +228,8 @@ check_objfile (struct symbol *sym, struct objfile *objfile)
   return check_objfile (sym->objfile (), objfile);
 }
 
-static inline bool
-check_objfile (const struct block *block, struct objfile *objfile)
-{
-  return check_objfile (block_objfile (block), objfile);
-}
+extern bool check_objfile (const struct block *block,
+			   struct objfile *objfile);
 
 static inline bool
 check_objfile (const block_symbol &sym, struct objfile *objfile)
diff --git a/gdb/expprint.c b/gdb/expprint.c
index b70645fac92..63004f7f106 100644
--- a/gdb/expprint.c
+++ b/gdb/expprint.c
@@ -75,6 +75,12 @@ debug_exp (struct expression *exp)
 namespace expr
 {
 
+bool
+check_objfile (const struct block *block, struct objfile *objfile)
+{
+  return check_objfile (block_objfile (block), objfile);
+}
+
 void
 dump_for_expression (struct ui_file *stream, int depth, enum exp_opcode op)
 {
-- 
2.39.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] Remove block.h includes from some tdep files
  2023-01-21 21:09 [PATCH 0/2] Reduce includes of block.h Tom Tromey
  2023-01-21 21:09 ` [PATCH 1/2] Don't include block.h from expop.h Tom Tromey
@ 2023-01-21 21:09 ` Tom Tromey
  2023-02-08 18:27 ` [PATCH 0/2] Reduce includes of block.h Tom Tromey
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2023-01-21 21:09 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

A few tdep files include block.h but do not need to.  This patch
removes the inclusions.  I checked that this worked correctly by
examining the resulting .Po file to make sure that block.h was not
being included by some other route.
---
 gdb/alpha-tdep.c    | 1 -
 gdb/amd64-tdep.c    | 1 -
 gdb/mips-sde-tdep.c | 1 -
 gdb/or1k-tdep.c     | 1 -
 gdb/riscv-tdep.c    | 1 -
 5 files changed, 5 deletions(-)

diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index eaf32feab75..14f5a0492d3 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -35,7 +35,6 @@
 #include "reggroups.h"
 #include "arch-utils.h"
 #include "osabi.h"
-#include "block.h"
 #include "infcall.h"
 #include "trad-frame.h"
 
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 70d0d0f3318..328e001f5bb 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -24,7 +24,6 @@
 #include "opcode/i386.h"
 #include "dis-asm.h"
 #include "arch-utils.h"
-#include "block.h"
 #include "dummy-frame.h"
 #include "frame.h"
 #include "frame-base.h"
diff --git a/gdb/mips-sde-tdep.c b/gdb/mips-sde-tdep.c
index 79568c46500..b921d84131b 100644
--- a/gdb/mips-sde-tdep.c
+++ b/gdb/mips-sde-tdep.c
@@ -20,7 +20,6 @@
 #include "defs.h"
 #include "osabi.h"
 #include "elf-bfd.h"
-#include "block.h"
 #include "symtab.h"
 
 #include "frame.h"
diff --git a/gdb/or1k-tdep.c b/gdb/or1k-tdep.c
index 89954566283..3616d7751ca 100644
--- a/gdb/or1k-tdep.c
+++ b/gdb/or1k-tdep.c
@@ -30,7 +30,6 @@
 #include "target.h"
 #include "regcache.h"
 #include "safe-ctype.h"
-#include "block.h"
 #include "reggroups.h"
 #include "arch-utils.h"
 #include "frame-unwind.h"
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 6e5e8fb87a0..60de60382c8 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -33,7 +33,6 @@
 #include "regcache.h"
 #include "osabi.h"
 #include "riscv-tdep.h"
-#include "block.h"
 #include "reggroups.h"
 #include "opcode/riscv.h"
 #include "elf/riscv.h"
-- 
2.39.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] Reduce includes of block.h
  2023-01-21 21:09 [PATCH 0/2] Reduce includes of block.h Tom Tromey
  2023-01-21 21:09 ` [PATCH 1/2] Don't include block.h from expop.h Tom Tromey
  2023-01-21 21:09 ` [PATCH 2/2] Remove block.h includes from some tdep files Tom Tromey
@ 2023-02-08 18:27 ` Tom Tromey
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2023-02-08 18:27 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> My recent work on block.h had a bunch of recompilations that seemed
Tom> strange to me.  Investigating and examining the .Po files revealed a
Tom> few inclusions of block.h that aren't truly needed.  This short series
Tom> simplifies these.

I'm checking these in.

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-02-08 18:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-21 21:09 [PATCH 0/2] Reduce includes of block.h Tom Tromey
2023-01-21 21:09 ` [PATCH 1/2] Don't include block.h from expop.h Tom Tromey
2023-01-21 21:09 ` [PATCH 2/2] Remove block.h includes from some tdep files Tom Tromey
2023-02-08 18:27 ` [PATCH 0/2] Reduce includes of block.h Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).