This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch/obish] Do not include "gdb_obstack.h" in "symtab.h"


Hello,

The file "symtab.h" contains an unnecessary #include "gdb_obstack.h" in "symtab.h". It can be replaced by an opaque ``struct obstack;'' declaration.

Problem is, many many .c files were relying on that include indirectly including <string.h> vis .c -> "symtab.h" -> "gdb_obstack.h" -> "obstack.h" -> <string.h>.

The attached removes the redundant include and then attempts to repair the damage by adding #include "gdb_string.h" where needed. There could easily be other cases so take care (fixing them is obvious).
http://sources.redhat.com/gdb/current/onlinedocs/gdbint_13.html#SEC123

committed,
Andrew
2002-07-30  Andrew Cagney  <ac131313@redhat.com>

	* symtab.h: Replace #include "gdb_obstack.h" with opaque
	declaration.
	* cli/cli-cmds.c, cli/cli-script.c: Include "gdb_string.h".
	* gnu-v3-abi.c, arc-tdep.c, cli/cli-decode.c: Ditto.
	* avr-tdep.c, mon960-rom.c, i960-tdep.c: Ditto.
	* arch-utils.c, cli/cli-setshow.c: Unconditionally include
	"gdb_string.h".
	* Makefile.in (cli-script.o, cli-cmds.o): Update dependencies.
	(gnu-v3-abi.o, cli-setshow.o, i960-tdep.o): Ditto.
	(cli-decode.o, mi-cmd-var.o, mi-cmd-disas.o): Ditto.
	(avr-tdep.o, mon960-rom.o): Ditto.
	(aout_stabs_gnu_h): Define.
	(symtab_h): Remove $(gdb_obstack_h).

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.226
diff -u -r1.226 Makefile.in
--- Makefile.in	29 Jul 2002 22:55:26 -0000	1.226
+++ Makefile.in	30 Jul 2002 13:32:08 -0000
@@ -568,6 +568,7 @@
 # non-binary-compatible way, it is a real pain to remake the right stuff
 # without these dependencies -kingdon, 13 Mar 1994)
 aout_aout64_h =	$(INCLUDE_DIR)/aout/aout64.h
+aout_stabs_gnu_h =	$(INCLUDE_DIR)/aout/stabs_gnu.h
 getopt_h =	$(INCLUDE_DIR)/getopt.h
 floatformat_h =	$(INCLUDE_DIR)/floatformat.h
 bfd_h =		$(BFD_DIR)/bfd.h
@@ -669,7 +670,7 @@
 source_h =	source.h
 stabsread_h =	stabsread.h
 symfile_h =	symfile.h
-symtab_h =	symtab.h $(gdb_obstack_h)
+symtab_h =	symtab.h
 target_h =      target.h $(bfd_h) $(symtab_h) $(dcache_h) $(memattr_h)
 terminal_h =	terminal.h
 top_h =		top.h
@@ -1316,7 +1317,7 @@
 	nbsd-tdep.h
 
 avr-tdep.o: avr-tdep.c $(defs_h) $(gdbcmd_h) $(gdbcore_h) $(inferior_h) \
-	$(symfile_h) $(regcache_h) $(arch_utils_h)
+	$(symfile_h) $(arch_utils_h) $(regcache_h) $(gdb_string_h)
 
 bcache.o: bcache.c $(defs_h) $(gdb_obstack_h) $(bcache_h) $(gdb_string_h)
 
@@ -1625,7 +1626,8 @@
 gnu-v2-abi.o: gnu-v2-abi.c $(defs_h) $(gdb_string_h) $(symtab_h) \
 	$(gdbtypes_h) $(value_h) $(demangle_h) $(cp_abi_h) 
 
-gnu-v3-abi.o: gnu-v2-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(demangle_h)
+gnu-v3-abi.o: gnu-v3-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(demangle_h) \
+	$(gdb_assert_h) $(gdb_string_h)
  
 h8300-tdep.o: h8300-tdep.c $(defs_h) $(frame_h) $(symtab_h) $(dis_asm_h) \
 	$(gdbcmd_h) $(gdbtypes_h) $(gdbcore_h) $(gdb_string_h) $(value_h) \
@@ -1696,9 +1698,8 @@
 i387-tdep.o: i387-tdep.c $(floatformat_h) $(defs_h) $(gdbcore_h) \
 	$(inferior_h) $(language_h) $(regcache_h) $(doublest_h) i386-tdep.h
 
-i960-tdep.o: i960-tdep.c $(floatformat_h) $(defs_h) $(expression_h) \
-	$(frame_h) $(gdbtypes_h) $(symtab_h) $(value_h) $(gdbcore_h) \
-	$(regcache_h)
+i960-tdep.o: i960-tdep.c $(defs_h) $(symtab_h) $(value_h) $(frame_h) \
+	$(floatformat_h) $(target_h) $(gdbcore_h) $(inferior_h) $(regcache_h)
 
 ia64-linux-nat.o: ia64-linux-nat.c  $(defs_h) $(inferior_h) $(target_h) \
 	$(gdbcore_h) $(regcache_h)
@@ -2129,8 +2130,9 @@
 signals.o: signals/signals.c $(defs_h) $(target_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $<
 
-mon960-rom.o: mon960-rom.c $(monitor_h) $(bfd_h) $(gdb_wait_h) $(defs_h) \
-	$(gdbcmd_h) $(inferior_h) $(target_h) $(serial_h) $(terminal_h)
+mon960-rom.o: mon960-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
+	$(serial_h) $(srec_h) $(xmodem_h) $(symtab_h) $(symfile_h) \
+	$(inferior_h)
 
 solib.o: solib.c $(command_h) $(defs_h) $(gdbcore_h) $(inferior_h) \
 	$(objfiles_h) $(gdb_regex_h) $(symfile_h) $(target_h) $(gdb_string_h) \
@@ -2358,28 +2360,29 @@
 # Need to explicitly specify the compile rule as make will do nothing
 # or try to compile the object file into the cli directory.
 
-cli-cmds.o: $(srcdir)/cli/cli-cmds.c  $(cli_cmds_h) $(cli_decode_h) \
-		$(cli_script_h) $(cli_setshow_h) $(top_h) $(completer_h) \
-		 $(defs_h) $(target_h) $(gdb_wait_h) $(gdb_regex_h) $(ui_out_h)
+cli-cmds.o: $(srcdir)/cli/cli-cmds.c $(defs_h) $(completer_h) $(target_h) \
+		$(gdb_wait_h) $(gdb_regex_h) $(gdb_string_h) $(filenames_h) \
+		$(ui_out_h) $(top_h) $(cli_cli_decode_h) $(cli_cli_script_h) \
+		$(cli_cli_setshow_h) $(cli_cli_cmds_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-cmds.c
 
-cli-decode.o: $(srcdir)/cli/cli-decode.c $(cli_decode_h) \
-		$(cli_cmds_h) $(defs_h) $(ui_out_h) \
-		$(symtab_h) $(gdb_regex_h)
+cli-decode.o: $(srcdir)/cli/cli-decode.c $(defs_h) $(symtab_h) $(gdb_regex_h) \
+		$(gdb_string_h) $(ui_out_h) $(cli_cli_cmds_h) \
+		$(cli_cli_decode_h) $(gdb_assert_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-decode.c
 
 cli-dump.o: $(srcdir)/cli/cli-dump.c $(defs_h) $(gdb_string_h) $(command_h) \
 	$(value_h) $(gdbcmd_h) $(completer_h) $(cli_dump_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-dump.c
 
-cli-setshow.o: $(srcdir)/cli/cli-setshow.c $(cli_setshow_h) \
-		$(cli_decode_h) $(cli_cmds_h) $(defs_h) \
-		$(value_h) $(ui_out_h)
+cli-setshow.o: $(srcdir)/cli/cli-setshow.c $(defs_h) $(value_h) \
+		$(gdb_string_h) $(ui_out_h) $(cli_cli_decode_h) \
+		$(cli_cli_cmds_h) $(cli_cli_setshow_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-setshow.c
 
-cli-script.o: $(srcdir)/cli/cli-script.c $(cli_script_h) \
-		$(cli_cmds_h) $(cli_decode_h) $(top_h) \
-		$(defs_h) $(value_h) $(language_h) $(ui_out_h)
+cli-script.o: $(srcdir)/cli//cli-script.c $(defs_h) $(value_h) $(language_h) \
+		$(ui_out_h) $(top_h) $(cli_cli_cmds_h) $(cli_cli_decode_h) \
+		$(cli_cli_script_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-script.c
 
 cli-utils.o: $(srcdir)/cli/cli-utils.c $(cli_utils_h) $(defs_h)
@@ -2399,8 +2402,8 @@
 
 mi-cmds.o: $(srcdir)/mi/mi-cmds.c $(defs_h) $(top_h) $(mi_cmds_h) $(ui_out_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmds.c
-mi-cmd-var.o: $(srcdir)/mi/mi-cmd-var.c $(defs_h) $(top_h) $(mi_cmds_h) \
-		$(ui_out_h) $(varobj_h)
+mi-cmd-var.o: $(srcdir)/mi/mi-cmd-var.c $(defs_h) $(mi_cmds_h) $(ui_out_h) \
+		$(mi_out_h) $(varobj_h) $(value_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-var.c
 mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c $(defs_h) $(top_h) $(mi_cmds_h) \
 		$(ui_out_h) $(frame_h) $(value_h) $(target_h)
@@ -2409,8 +2412,8 @@
 		$(ui_out_h) $(mi_out_h) $(breakpoint_h) $(gdb_string_h) \
 		$(gdb_events_h) $(mi_getopt_h) $(gdb_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-break.c
-mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(mi_cmds_h) \
-		$(ui_out_h) $(value_h) $(target_h)
+mi-cmd-disas.o: $(srcdir)/mi/mi-cmd-disas.c $(defs_h) $(target_h) $(value_h) \
+		$(mi_cmds_h) $(mi_getopt_h) $(ui_out_h) $(gdb_string_h)
 	$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-disas.c
 mi-main.o: $(srcdir)/mi/mi-main.c $(defs_h) $(top_h) $(mi_cmds_h) $(ui_out_h) \
 		$(mi_console_h) $(mi_getopt_h) $(event_loop_h) $(event_top_h) \
Index: arc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arc-tdep.c,v
retrieving revision 1.11
diff -u -r1.11 arc-tdep.c
--- arc-tdep.c	22 Apr 2002 02:18:59 -0000	1.11
+++ arc-tdep.c	30 Jul 2002 13:32:08 -0000
@@ -27,6 +27,7 @@
 #include "symtab.h"
 #include "gdbcmd.h"
 #include "regcache.h"
+#include "gdb_string.h"
 
 /* Local functions */
 
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.62
diff -u -r1.62 arch-utils.c
--- arch-utils.c	3 Jul 2002 21:27:55 -0000	1.62
+++ arch-utils.c	30 Jul 2002 13:32:09 -0000
@@ -29,7 +29,6 @@
 #else
 /* Just include everything in sight so that the every old definition
    of macro is visible. */
-#include "gdb_string.h"
 #include "symtab.h"
 #include "frame.h"
 #include "inferior.h"
@@ -40,6 +39,7 @@
 #include "target.h"
 #include "annotate.h"
 #endif
+#include "gdb_string.h"
 #include "regcache.h"
 #include "gdb_assert.h"
 #include "sim-regno.h"
Index: avr-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/avr-tdep.c,v
retrieving revision 1.4
diff -u -r1.4 avr-tdep.c
--- avr-tdep.c	17 Jun 2002 23:32:27 -0000	1.4
+++ avr-tdep.c	30 Jul 2002 13:32:09 -0000
@@ -31,6 +31,7 @@
 #include "symfile.h"
 #include "arch-utils.h"
 #include "regcache.h"
+#include "gdb_string.h"
 
 /* AVR Background:
 
Index: gnu-v3-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-v3-abi.c,v
retrieving revision 1.12
diff -u -r1.12 gnu-v3-abi.c
--- gnu-v3-abi.c	11 Jul 2002 13:50:49 -0000	1.12
+++ gnu-v3-abi.c	30 Jul 2002 13:32:09 -0000
@@ -25,6 +25,7 @@
 #include "cp-abi.h"
 #include "demangle.h"
 #include "gdb_assert.h"
+#include "gdb_string.h"
 
 static struct cp_abi_ops gnu_v3_abi_ops;
 
Index: i960-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/i960-tdep.c,v
retrieving revision 1.10
diff -u -r1.10 i960-tdep.c
--- i960-tdep.c	24 Apr 2002 13:48:28 -0000	1.10
+++ i960-tdep.c	30 Jul 2002 13:32:09 -0000
@@ -32,6 +32,7 @@
 #include "gdbcore.h"
 #include "inferior.h"
 #include "regcache.h"
+#include "gdb_string.h"
 
 static CORE_ADDR next_insn (CORE_ADDR memaddr,
 			    unsigned int *pword1, unsigned int *pword2);
Index: mon960-rom.c
===================================================================
RCS file: /cvs/src/src/gdb/mon960-rom.c,v
retrieving revision 1.6
diff -u -r1.6 mon960-rom.c
--- mon960-rom.c	11 Jul 2001 17:52:32 -0000	1.6
+++ mon960-rom.c	30 Jul 2002 13:32:09 -0000
@@ -30,6 +30,7 @@
 #include "symtab.h"
 #include "symfile.h"		/* for generic_load */
 #include "inferior.h"		/* for write_pc() */
+#include "gdb_string.h"
 
 #define USE_GENERIC_LOAD
 
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.36
diff -u -r1.36 symtab.h
--- symtab.h	29 Jul 2002 22:55:26 -0000	1.36
+++ symtab.h	30 Jul 2002 13:32:10 -0000
@@ -23,9 +23,8 @@
 #if !defined (SYMTAB_H)
 #define SYMTAB_H 1
 
-/* Some definitions and declarations to go with use of obstacks.  */
-
-#include "gdb_obstack.h"
+/* Opaque declarations.  */
+struct obstack;
 
 /* Don't do this; it means that if some .o's are compiled with GNU C
    and some are not (easy to do accidentally the way we configure
Index: cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.19
diff -u -r1.19 cli-cmds.c
--- cli/cli-cmds.c	12 Apr 2002 22:31:23 -0000	1.19
+++ cli/cli-cmds.c	30 Jul 2002 13:32:10 -0000
@@ -24,6 +24,7 @@
 #include "target.h"	 /* For baud_rate, remote_debug and remote_timeout */
 #include "gdb_wait.h"		/* For shell escape implementation */
 #include "gdb_regex.h"		/* Used by apropos_command */
+#include "gdb_string.h"
 #include "filenames.h"		/* for DOSish file names */
 
 #include "ui-out.h"
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.27
diff -u -r1.27 cli-decode.c
--- cli/cli-decode.c	3 Jul 2002 17:35:21 -0000	1.27
+++ cli/cli-decode.c	30 Jul 2002 13:32:10 -0000
@@ -22,6 +22,7 @@
 #include "symtab.h"
 #include <ctype.h>
 #include "gdb_regex.h"
+#include "gdb_string.h"
 
 #include "ui-out.h"
 
Index: cli/cli-script.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-script.c,v
retrieving revision 1.12
diff -u -r1.12 cli-script.c
--- cli/cli-script.c	12 Apr 2002 22:31:23 -0000	1.12
+++ cli/cli-script.c	30 Jul 2002 13:32:11 -0000
@@ -27,6 +27,7 @@
 #include <ctype.h>
 
 #include "ui-out.h"
+#include "gdb_string.h"
 
 #include "top.h"
 #include "cli/cli-cmds.h"
Index: cli/cli-setshow.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.8
diff -u -r1.8 cli-setshow.c
--- cli/cli-setshow.c	15 Jun 2002 18:45:32 -0000	1.8
+++ cli/cli-setshow.c	30 Jul 2002 13:32:11 -0000
@@ -20,9 +20,7 @@
 #include "defs.h"
 #include "value.h"
 #include <ctype.h>
-#if 0
 #include "gdb_string.h"
-#endif
 
 #include "ui-out.h"
 
Index: mi/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/mi/ChangeLog,v
retrieving revision 1.67
diff -u -r1.67 ChangeLog
--- mi/ChangeLog	17 Jun 2002 17:30:57 -0000	1.67
+++ mi/ChangeLog	30 Jul 2002 13:32:11 -0000
@@ -1,3 +1,9 @@
+2002-07-29  Andrew Cagney  <ac131313@redhat.com>
+
+
+	* mi-cmd-var.c: Include "gdb_string.h".
+	* mi-cmd-disas.c: Ditto.
+
 2002-06-17  Keith Seitz  <keiths@redhat.com>
 
 	* gdbmi.texinfo: Update command examples with real MI behavior.
Index: mi/mi-cmd-disas.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-disas.c,v
retrieving revision 1.17
diff -u -r1.17 mi-cmd-disas.c
--- mi/mi-cmd-disas.c	15 Apr 2002 02:24:40 -0000	1.17
+++ mi/mi-cmd-disas.c	30 Jul 2002 13:32:12 -0000
@@ -25,6 +25,7 @@
 #include "mi-cmds.h"
 #include "mi-getopt.h"
 #include "ui-out.h"
+#include "gdb_string.h"
 
 /* Disassemble functions. FIXME: these do not really belong here. We
    should get rid of all the duplicate code in gdb that does the same
Index: mi/mi-cmd-var.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-var.c,v
retrieving revision 1.11
diff -u -r1.11 mi-cmd-var.c
--- mi/mi-cmd-var.c	19 Mar 2002 02:51:08 -0000	1.11
+++ mi/mi-cmd-var.c	30 Jul 2002 13:32:12 -0000
@@ -28,6 +28,7 @@
 #include "varobj.h"
 #include "value.h"
 #include <ctype.h>
+#include "gdb_string.h"
 
 extern int varobjdebug;		/* defined in varobj.c */
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]