public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove some unnecessary includes from *-exp.y
@ 2023-03-18 14:44 Tom Tromey
  2023-03-20 15:45 ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2023-03-18 14:44 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I noticed a weird comment in one of the .y files, and then ended up
removing some unnecessary #includes from these files.

Tested by rebuilding.
---
 gdb/ada-exp.y | 3 ---
 gdb/c-exp.y   | 3 ---
 gdb/d-exp.y   | 3 ---
 gdb/f-exp.y   | 3 ---
 gdb/go-exp.y  | 3 ---
 gdb/m2-exp.y  | 3 ---
 gdb/p-exp.y   | 4 ----
 7 files changed, 22 deletions(-)

diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 9b704968f90..a9c37bedff0 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -42,9 +42,6 @@
 #include "parser-defs.h"
 #include "language.h"
 #include "ada-lang.h"
-#include "bfd.h" /* Required by objfiles.h.  */
-#include "symfile.h" /* Required by objfiles.h.  */
-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
 #include "frame.h"
 #include "block.h"
 #include "ada-exp.h"
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 00599b0da7f..9ee4115560a 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -43,9 +43,6 @@
 #include "language.h"
 #include "c-lang.h"
 #include "c-support.h"
-#include "bfd.h" /* Required by objfiles.h.  */
-#include "symfile.h" /* Required by objfiles.h.  */
-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
 #include "charset.h"
 #include "block.h"
 #include "cp-support.h"
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index 1c299bf7ac6..3a4e7ee0434 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -46,9 +46,6 @@
 #include "language.h"
 #include "c-lang.h"
 #include "d-lang.h"
-#include "bfd.h" /* Required by objfiles.h.  */
-#include "symfile.h" /* Required by objfiles.h.  */
-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
 #include "charset.h"
 #include "block.h"
 #include "type-stack.h"
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 30da537ea84..96d38af363c 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -48,9 +48,6 @@
 #include "parser-defs.h"
 #include "language.h"
 #include "f-lang.h"
-#include "bfd.h" /* Required by objfiles.h.  */
-#include "symfile.h" /* Required by objfiles.h.  */
-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
 #include "block.h"
 #include <ctype.h>
 #include <algorithm>
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index 6aa4c426df6..542a06d06d6 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -59,9 +59,6 @@
 #include "language.h"
 #include "c-lang.h"
 #include "go-lang.h"
-#include "bfd.h" /* Required by objfiles.h.  */
-#include "symfile.h" /* Required by objfiles.h.  */
-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
 #include "charset.h"
 #include "block.h"
 #include "expop.h"
diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y
index 6629974a73e..092a8be248d 100644
--- a/gdb/m2-exp.y
+++ b/gdb/m2-exp.y
@@ -43,9 +43,6 @@
 #include "value.h"
 #include "parser-defs.h"
 #include "m2-lang.h"
-#include "bfd.h" /* Required by objfiles.h.  */
-#include "symfile.h" /* Required by objfiles.h.  */
-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
 #include "block.h"
 #include "m2-exp.h"
 
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index b5251b932ef..b086bf73a0e 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -50,11 +50,7 @@
 #include "parser-defs.h"
 #include "language.h"
 #include "p-lang.h"
-#include "bfd.h" /* Required by objfiles.h.  */
-#include "symfile.h" /* Required by objfiles.h.  */
-#include "objfiles.h" /* For have_full_symbols and have_partial_symbols.  */
 #include "block.h"
-#include "completer.h"
 #include "expop.h"
 
 #define parse_type(ps) builtin_type (ps->gdbarch ())
-- 
2.39.1


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

* Re: [PATCH] Remove some unnecessary includes from *-exp.y
  2023-03-18 14:44 [PATCH] Remove some unnecessary includes from *-exp.y Tom Tromey
@ 2023-03-20 15:45 ` Simon Marchi
  2023-03-20 21:22   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2023-03-20 15:45 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 3/18/23 10:44, Tom Tromey wrote:
> I noticed a weird comment in one of the .y files, and then ended up
> removing some unnecessary #includes from these files.

If it builds, it seems fine to me.  Those comments (that tell why an
include is used) almost seem useless to me, as it's nearly impossible to
maintain them.

It's hard to know if something in these files does need one of the
headers you remove, and if you now make them rely on indirect
inclusions.  But again, if it builds, there's no harm done.  They can
always be re-added if a problem relocated to indirect inclusion shows up
later.

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon

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

* Re: [PATCH] Remove some unnecessary includes from *-exp.y
  2023-03-20 15:45 ` Simon Marchi
@ 2023-03-20 21:22   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2023-03-20 21:22 UTC (permalink / raw)
  To: Simon Marchi; +Cc: Tom Tromey, gdb-patches

Simon> If it builds, it seems fine to me.  Those comments (that tell why an
Simon> include is used) almost seem useless to me, as it's nearly impossible to
Simon> maintain them.

Yeah, that is what drew my attention to them.

Simon> It's hard to know if something in these files does need one of the
Simon> headers you remove, and if you now make them rely on indirect
Simon> inclusions.

Also, normally we have headers include their dependencies, so even if
the comments were correct, we'd probably want to patch the header.
This all just looked like copy-paste from ancient times though.

Tom

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

end of thread, other threads:[~2023-03-20 21:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-18 14:44 [PATCH] Remove some unnecessary includes from *-exp.y Tom Tromey
2023-03-20 15:45 ` Simon Marchi
2023-03-20 21:22   ` 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).