[2/3] Don't include symtab.h from expression.h

Message ID 20190323055144.6335-3-tom@tromey.com
State New, archived
Headers

Commit Message

Tom Tromey March 23, 2019, 5:51 a.m. UTC
  expression.h includes symtab.h, but apparently only for the
declaration of struct block.  This patch changes it to foward-declare
the structure, and remove the include.

gdb/ChangeLog
2019-03-22  Tom Tromey  <tom@tromey.com>

	* expression.h: Don't include symtab.h.
	(struct block): Forward declare.
---
 gdb/ChangeLog    | 5 +++++
 gdb/expression.h | 4 +---
 2 files changed, 6 insertions(+), 3 deletions(-)
  

Comments

Kevin Buettner March 24, 2019, 10:32 p.m. UTC | #1
On Fri, 22 Mar 2019 23:51:43 -0600
Tom Tromey <tom@tromey.com> wrote:

> expression.h includes symtab.h, but apparently only for the
> declaration of struct block.  This patch changes it to foward-declare
> the structure, and remove the include.
> 
> gdb/ChangeLog
> 2019-03-22  Tom Tromey  <tom@tromey.com>
> 
> 	* expression.h: Don't include symtab.h.
> 	(struct block): Forward declare.

Okay.

(I wasn't sure I liked this at first, but I see that a number of other header
files forward-declare struct block too.)

Kevin
  

Patch

diff --git a/gdb/expression.h b/gdb/expression.h
index 9104ce61c0f..68ba7c7bca3 100644
--- a/gdb/expression.h
+++ b/gdb/expression.h
@@ -20,9 +20,7 @@ 
 #if !defined (EXPRESSION_H)
 #define EXPRESSION_H 1
 
-
-#include "symtab.h"		/* Needed for "struct block" type.  */
-
+struct block;
 
 /* Definitions for saved C expressions.  */