From mboxrd@z Thu Jan 1 00:00:00 1970 From: jtc@redback.com (J.T. Conklin) To: gdb-patches@sourceware.cygnus.com Subject: [RFC]: More include file cleanup Date: Tue, 20 Mar 2001 15:11:00 -0000 Message-id: <5m8zm09gtr.fsf@jtc.redback.com> X-SW-Source: 2001-03/msg00395.html Enclosed is a yet another patch in my quest to clean up GDB's include file scheme. I've built the targets that can be extracted from the MAINTAINERS files on a i386-netbsd1.3 host, and I'm presently doing the same on a sparc-sun-solaris2.7 host. If it succeeds, and I have no reason to believe it won't, I'd like to commit it. I'm enclosing the diffs for review. --jtc 2001-03-19 J.T. Conklin * arch-utils.c (#include "gdbthread.h"): Removed. (#include "symfile.h"): Removed. (XMALLOC): Removed unused macro. * breakpoint.c (tbreak_command): Removed local declaration. (awatch_command, do_enable_breakpoint, set_breakpoint_count): Remove duplicate declarations. (bpstat_should_step, bpstat_have_active_hw_watchpoints) (remove_solib_event_breakpoints): Fix indentation botch. * c-typeprint.c (#include "command.h"): Removed. (#include "gdbcmd.h"): Removed. * ch-exp.c (ch_terminal_match_float_literal, parse_expr) (parse_primval, parse_untyped_expr, parse_opt_untyped_expr): Removed duplicate declarations. * ch-typeprint.c (#include "command.h"): Removed. (#include "gdbcmd.h"): Removed. * corefile.c (#include "frame.h"): Removed (#include "symfile.h"): Removed. (#include "language.h"): Removed. * dbxread.c (#include "command.h"): Removed. * environ.c (#include "gdbcore.h"): Removed. * event-loop.c (#include "top.h"): Removed. * f-typeprint.c (#include "command.h"): Removed. (#include "gdbcmd.h"): Removed. (#include "language.h"): Removed. (#include "typeprint.h"): Removed. (#include "frame.h"): Removed. * gdbtypes.h (print_type_scalar): Removed declaration. * infcmd.c (#include "completer.h"): Removed. * language.c (#include "frame.h"): Removed. * m2-typeprint.c (#include "command.h"): Removed. (#include "gdbcmd.h"): Removed. (#include "language.h"): Removed. * m2-valprint.c (#include "valprint.h"): Removed. * p-typeprint.c (#include "command.h"): Removed. (#include "gdbcmd.h"): Removed. * p-valprint.c (#include "typeprint.h"): Removed. * parse.c (#include "linespec.h"): Removed. * regcache.c (#include "frame.h"): Removed. * remote.c (#include "frame.h"): Removed. (getpkt_sane): Make static. * source.c (#include "completer.h"): Removed. * stack.c (#include "symfile.h"): Removed. (#include "objfiles.h"): Removed. * symfile.c (#include "completer.h"): Removed. * tracepoint.c (#include "completer.h"): Removed. * values.c (#include "frame.h"): Removed. * varobj.c (#include "valprint.h"): Removed. * wrapper.c (#include "frame.h"): Removed. * memattr.c (create_mem_region): Removed unused variable. * remote-nrom.c: Removed spurious semicolon after init_nrom_ops. Index: arch-utils.c =================================================================== RCS file: /cvs/src/src/gdb/arch-utils.c,v retrieving revision 1.22 diff -c -r1.22 arch-utils.c *** arch-utils.c 2001/03/07 02:57:08 1.22 --- arch-utils.c 2001/03/20 19:47:31 *************** *** 35,55 **** #include "gdbcore.h" #include "gdbcmd.h" #include "target.h" - #include "gdbthread.h" #include "annotate.h" - #include "symfile.h" /* for overlay functions */ #endif #include "version.h" #include "floatformat.h" - - /* Convenience macro for allocting typesafe memory. */ - - #ifndef XMALLOC - #define XMALLOC(TYPE) (TYPE*) xmalloc (sizeof (TYPE)) - #endif - /* Use the program counter to determine the contents and size of a breakpoint instruction. If no target-dependent macro --- 35,46 ---- Index: breakpoint.c =================================================================== RCS file: /cvs/src/src/gdb/breakpoint.c,v retrieving revision 1.29 diff -c -r1.29 breakpoint.c *** breakpoint.c 2001/03/20 18:16:10 1.29 --- breakpoint.c 2001/03/20 19:47:35 *************** *** 85,92 **** static void break_at_finish_command (char *, int); static void break_at_finish_at_depth_command (char *, int); - void tbreak_command (char *, int); - static void tbreak_at_finish_command (char *, int); static void break_command_1 (char *, int, int); --- 85,90 ---- *************** *** 210,227 **** /* Prototypes for exported functions. */ - static void awatch_command (char *, int); - - static void do_enable_breakpoint (struct breakpoint *, enum bpdisp); - /* If FALSE, gdb will not use hardware support for watchpoints, even if such is available. */ static int can_use_hw_watchpoints; void _initialize_breakpoint (void); - void set_breakpoint_count (int); - extern int addressprint; /* Print machine addresses? */ static int internal_breakpoint_number = -1; --- 208,219 ---- *************** *** 2980,2986 **** struct breakpoint *b; ALL_BREAKPOINTS (b) if (b->enable == enabled && b->type == bp_watchpoint) ! return 1; return 0; } --- 2972,2978 ---- struct breakpoint *b; ALL_BREAKPOINTS (b) if (b->enable == enabled && b->type == bp_watchpoint) ! return 1; return 0; } *************** *** 2995,3001 **** ((b->type == bp_hardware_watchpoint) || (b->type == bp_read_watchpoint) || (b->type == bp_access_watchpoint))) ! return 1; return 0; } --- 2987,2993 ---- ((b->type == bp_hardware_watchpoint) || (b->type == bp_read_watchpoint) || (b->type == bp_access_watchpoint))) ! return 1; return 0; } *************** *** 3950,3956 **** ALL_BREAKPOINTS_SAFE (b, temp) if (b->type == bp_shlib_event) ! delete_breakpoint (b); } struct breakpoint * --- 3942,3948 ---- ALL_BREAKPOINTS_SAFE (b, temp) if (b->type == bp_shlib_event) ! delete_breakpoint (b); } struct breakpoint * Index: c-typeprint.c =================================================================== RCS file: /cvs/src/src/gdb/c-typeprint.c,v retrieving revision 1.6 diff -c -r1.6 c-typeprint.c *** c-typeprint.c 2001/03/07 02:57:08 1.6 --- c-typeprint.c 2001/03/20 19:47:35 *************** *** 29,36 **** #include "value.h" #include "gdbcore.h" #include "target.h" - #include "command.h" - #include "gdbcmd.h" #include "language.h" #include "demangle.h" #include "c-lang.h" --- 29,34 ---- Index: ch-exp.c =================================================================== RCS file: /cvs/src/src/gdb/ch-exp.c,v retrieving revision 1.8 diff -c -r1.8 ch-exp.c *** ch-exp.c 2001/03/14 16:42:29 1.8 --- ch-exp.c 2001/03/20 19:47:36 *************** *** 148,160 **** static enum ch_terminal match_character_literal (void); static enum ch_terminal match_string_literal (void); static enum ch_terminal match_float_literal (void); - static enum ch_terminal match_float_literal (void); static int decode_integer_literal (LONGEST *, char **); static int decode_integer_value (int, char **, LONGEST *); static char *match_simple_name_string (void); static void growbuf_by_size (int); static void parse_untyped_expr (void); static void parse_if_expression (void); static void parse_else_alternative (void); static void parse_then_alternative (void); static void parse_expr (void); --- 148,161 ---- static enum ch_terminal match_character_literal (void); static enum ch_terminal match_string_literal (void); static enum ch_terminal match_float_literal (void); static int decode_integer_literal (LONGEST *, char **); static int decode_integer_value (int, char **, LONGEST *); static char *match_simple_name_string (void); static void growbuf_by_size (int); + static void parse_case_label (void); static void parse_untyped_expr (void); static void parse_if_expression (void); + static void parse_if_expression_body (void); static void parse_else_alternative (void); static void parse_then_alternative (void); static void parse_expr (void); *************** *** 177,189 **** #endif static void parse_unary_call (void); static int parse_opt_untyped_expr (void); - static void parse_case_label (void); static int expect (enum ch_terminal, char *); - static void parse_expr (void); - static void parse_primval (void); - static void parse_untyped_expr (void); - static int parse_opt_untyped_expr (void); - static void parse_if_expression_body (void); static enum ch_terminal ch_lex (void); INLINE static enum ch_terminal PEEK_TOKEN (void); static enum ch_terminal peek_token_ (int); --- 178,184 ---- Index: ch-typeprint.c =================================================================== RCS file: /cvs/src/src/gdb/ch-typeprint.c,v retrieving revision 1.4 diff -c -r1.4 ch-typeprint.c *** ch-typeprint.c 2001/03/07 02:57:08 1.4 --- ch-typeprint.c 2001/03/20 19:47:36 *************** *** 28,35 **** #include "value.h" #include "gdbcore.h" #include "target.h" - #include "command.h" - #include "gdbcmd.h" #include "language.h" #include "ch-lang.h" #include "typeprint.h" --- 28,33 ---- Index: corefile.c =================================================================== RCS file: /cvs/src/src/gdb/corefile.c,v retrieving revision 1.11 diff -c -r1.11 corefile.c *** corefile.c 2001/03/06 08:21:06 1.11 --- corefile.c 2001/03/20 19:47:36 *************** *** 25,45 **** #include #include #include - #include "frame.h" /* required by inferior.h */ #include "inferior.h" #include "symtab.h" #include "command.h" #include "gdbcmd.h" - #include "symfile.h" #include "bfd.h" #include "target.h" #include "gdbcore.h" #include "dis-asm.h" - #include "language.h" #include "gdb_stat.h" - #include "symfile.h" - #include "objfiles.h" - #include "completer.h" /* Local function declarations. */ --- 25,39 ---- Index: dbxread.c =================================================================== RCS file: /cvs/src/src/gdb/dbxread.c,v retrieving revision 1.15 diff -c -r1.15 dbxread.c *** dbxread.c 2001/03/07 02:57:08 1.15 --- dbxread.c 2001/03/20 19:47:38 *************** *** 46,52 **** #include "gdb_stat.h" #include "symtab.h" #include "breakpoint.h" - #include "command.h" #include "target.h" #include "gdbcore.h" /* for bfd stuff */ #include "libaout.h" /* FIXME Secret internal BFD stuff for a.out */ --- 46,51 ---- Index: environ.c =================================================================== RCS file: /cvs/src/src/gdb/environ.c,v retrieving revision 1.4 diff -c -r1.4 environ.c *** environ.c 2001/03/06 08:21:07 1.4 --- environ.c 2001/03/20 19:47:38 *************** *** 23,29 **** #include "defs.h" #include "environ.h" #include "gdb_string.h" - #include "gdbcore.h" /* Return a new environment object. */ --- 23,28 ---- Index: event-loop.c =================================================================== RCS file: /cvs/src/src/gdb/event-loop.c,v retrieving revision 1.14 diff -c -r1.14 event-loop.c *** event-loop.c 2001/03/20 00:54:42 1.14 --- event-loop.c 2001/03/20 19:47:38 *************** *** 20,26 **** Boston, MA 02111-1307, USA. */ #include "defs.h" - #include "top.h" #include "event-loop.h" #include "event-top.h" --- 20,25 ---- Index: f-typeprint.c =================================================================== RCS file: /cvs/src/src/gdb/f-typeprint.c,v retrieving revision 1.4 diff -c -r1.4 f-typeprint.c *** f-typeprint.c 2001/03/07 02:57:08 1.4 --- f-typeprint.c 2001/03/20 19:47:38 *************** *** 30,41 **** #include "value.h" #include "gdbcore.h" #include "target.h" - #include "command.h" - #include "gdbcmd.h" - #include "language.h" #include "f-lang.h" - #include "typeprint.h" - #include "frame.h" /* ??? */ #include "gdb_string.h" #include --- 30,36 ---- Index: gdbtypes.h =================================================================== RCS file: /cvs/src/src/gdb/gdbtypes.h,v retrieving revision 1.8 diff -c -r1.8 gdbtypes.h *** gdbtypes.h 2001/03/06 08:21:07 1.8 --- gdbtypes.h 2001/03/20 19:47:39 *************** *** 1125,1132 **** extern void maintenance_print_type (char *, int); - /* typeprint.c */ - - extern void print_type_scalar (struct type *, LONGEST, struct ui_file *); - #endif /* GDBTYPES_H */ --- 1125,1128 ---- Index: infcmd.c =================================================================== RCS file: /cvs/src/src/gdb/infcmd.c,v retrieving revision 1.24 diff -c -r1.24 infcmd.c *** infcmd.c 2001/03/13 23:31:13 1.24 --- infcmd.c 2001/03/20 19:47:40 *************** *** 41,47 **** #endif #include "event-top.h" #include "parser-defs.h" - #include "completer.h" /* Functions exported for general use: */ --- 41,46 ---- Index: language.c =================================================================== RCS file: /cvs/src/src/gdb/language.c,v retrieving revision 1.14 diff -c -r1.14 language.c *** language.c 2001/03/06 08:21:09 1.14 --- language.c 2001/03/20 19:47:40 *************** *** 37,43 **** #include "gdbtypes.h" #include "value.h" #include "gdbcmd.h" - #include "frame.h" #include "expression.h" #include "language.h" #include "target.h" --- 37,42 ---- Index: m2-typeprint.c =================================================================== RCS file: /cvs/src/src/gdb/m2-typeprint.c,v retrieving revision 1.4 diff -c -r1.4 m2-typeprint.c *** m2-typeprint.c 2001/03/07 02:57:08 1.4 --- m2-typeprint.c 2001/03/20 19:47:40 *************** *** 27,35 **** #include "value.h" #include "gdbcore.h" #include "target.h" - #include "command.h" - #include "gdbcmd.h" - #include "language.h" #include "m2-lang.h" #include --- 27,32 ---- Index: m2-valprint.c =================================================================== RCS file: /cvs/src/src/gdb/m2-valprint.c,v retrieving revision 1.4 diff -c -r1.4 m2-valprint.c *** m2-valprint.c 2001/03/07 02:57:08 1.4 --- m2-valprint.c 2001/03/20 19:47:40 *************** *** 22,28 **** #include "defs.h" #include "symtab.h" #include "gdbtypes.h" - #include "valprint.h" #include "m2-lang.h" /* FIXME: For now, just explicitly declare c_val_print and use it instead */ --- 22,27 ---- Index: memattr.c =================================================================== RCS file: /cvs/src/src/gdb/memattr.c,v retrieving revision 1.2 diff -c -r1.2 memattr.c *** memattr.c 2001/01/24 21:01:02 1.2 --- memattr.c 2001/03/20 19:47:40 *************** *** 34,40 **** create_mem_region (CORE_ADDR lo, CORE_ADDR hi, const struct mem_attrib *attrib) { ! struct mem_region *n, *p, *new; if (lo > hi) { --- 34,40 ---- create_mem_region (CORE_ADDR lo, CORE_ADDR hi, const struct mem_attrib *attrib) { ! struct mem_region *n, *new; if (lo > hi) { Index: p-typeprint.c =================================================================== RCS file: /cvs/src/src/gdb/p-typeprint.c,v retrieving revision 1.4 diff -c -r1.4 p-typeprint.c *** p-typeprint.c 2001/03/07 02:57:08 1.4 --- p-typeprint.c 2001/03/20 19:47:42 *************** *** 29,36 **** #include "value.h" #include "gdbcore.h" #include "target.h" - #include "command.h" - #include "gdbcmd.h" #include "language.h" #include "p-lang.h" #include "typeprint.h" --- 29,34 ---- Index: p-valprint.c =================================================================== RCS file: /cvs/src/src/gdb/p-valprint.c,v retrieving revision 1.3 diff -c -r1.3 p-valprint.c *** p-valprint.c 2000/12/15 01:01:48 1.3 --- p-valprint.c 2001/03/20 19:47:44 *************** *** 31,36 **** --- 31,37 ---- #include "gdbcore.h" #include "demangle.h" #include "valprint.h" + #include "typeprint.h" #include "language.h" #include "target.h" #include "annotate.h" Index: parse.c =================================================================== RCS file: /cvs/src/src/gdb/parse.c,v retrieving revision 1.13 diff -c -r1.13 parse.c *** parse.c 2001/03/06 08:21:11 1.13 --- parse.c 2001/03/20 19:47:46 *************** *** 42,48 **** #include "command.h" #include "language.h" #include "parser-defs.h" - #include "linespec.h" #include "gdbcmd.h" #include "symfile.h" /* for overlay functions */ #include "inferior.h" /* for NUM_PSEUDO_REGS. NOTE: replace --- 42,47 ---- Index: regcache.c =================================================================== RCS file: /cvs/src/src/gdb/regcache.c,v retrieving revision 1.20 diff -c -r1.20 regcache.c *** regcache.c 2001/03/13 23:31:14 1.20 --- regcache.c 2001/03/20 19:47:46 *************** *** 20,26 **** Boston, MA 02111-1307, USA. */ #include "defs.h" - #include "frame.h" #include "inferior.h" #include "target.h" #include "gdbarch.h" --- 20,25 ---- Index: remote-nrom.c =================================================================== RCS file: /cvs/src/src/gdb/remote-nrom.c,v retrieving revision 1.5 diff -c -r1.5 remote-nrom.c *** remote-nrom.c 2001/03/06 08:21:12 1.5 --- remote-nrom.c 2001/03/20 19:47:47 *************** *** 328,334 **** nrom_ops.to_sections = NULL; nrom_ops.to_sections_end = NULL; nrom_ops.to_magic = OPS_MAGIC; ! }; void _initialize_remote_nrom (void) --- 328,334 ---- nrom_ops.to_sections = NULL; nrom_ops.to_sections_end = NULL; nrom_ops.to_magic = OPS_MAGIC; ! } void _initialize_remote_nrom (void) Index: remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.42 diff -c -r1.42 remote.c *** remote.c 2001/03/19 21:01:06 1.42 --- remote.c 2001/03/20 19:47:51 *************** *** 25,31 **** #include "gdb_string.h" #include #include - #include "frame.h" #include "inferior.h" #include "bfd.h" #include "symfile.h" --- 25,30 ---- *************** *** 3986,3992 **** executing user code to stop. If FOREVER == 0, this function is allowed to time out gracefully and return an indication of this to the caller. */ ! int getpkt_sane (char *buf, long sizeof_buf, int forever) --- 3985,3991 ---- executing user code to stop. If FOREVER == 0, this function is allowed to time out gracefully and return an indication of this to the caller. */ ! static int getpkt_sane (char *buf, long sizeof_buf, int forever) Index: source.c =================================================================== RCS file: /cvs/src/src/gdb/source.c,v retrieving revision 1.10 diff -c -r1.10 source.c *** source.c 2001/03/06 08:21:17 1.10 --- source.c 2001/03/20 19:47:52 *************** *** 40,46 **** #include "annotate.h" #include "gdbtypes.h" #include "linespec.h" - #include "completer.h" #ifdef UI_OUT #include "ui-out.h" #endif --- 40,45 ---- Index: stack.c =================================================================== RCS file: /cvs/src/src/gdb/stack.c,v retrieving revision 1.16 diff -c -r1.16 stack.c *** stack.c 2001/03/13 23:31:14 1.16 --- stack.c 2001/03/20 19:47:53 *************** *** 35,42 **** #include "demangle.h" #include "inferior.h" #include "annotate.h" - #include "symfile.h" - #include "objfiles.h" #ifdef UI_OUT #include "ui-out.h" #endif --- 35,40 ---- Index: symfile.c =================================================================== RCS file: /cvs/src/src/gdb/symfile.c,v retrieving revision 1.29 diff -c -r1.29 symfile.c *** symfile.c 2001/03/20 00:54:42 1.29 --- symfile.c 2001/03/20 19:47:55 *************** *** 37,43 **** #include "inferior.h" /* for write_pc */ #include "gdb-stabs.h" #include "obstack.h" - #include "completer.h" #include #include --- 37,42 ---- Index: tracepoint.c =================================================================== RCS file: /cvs/src/src/gdb/tracepoint.c,v retrieving revision 1.18 diff -c -r1.18 tracepoint.c *** tracepoint.c 2001/03/06 08:21:17 1.18 --- tracepoint.c 2001/03/20 19:47:56 *************** *** 32,38 **** #include "tracepoint.h" #include "remote.h" #include "linespec.h" - #include "completer.h" #include "regcache.h" #include "ax.h" --- 32,37 ---- Index: values.c =================================================================== RCS file: /cvs/src/src/gdb/values.c,v retrieving revision 1.13 diff -c -r1.13 values.c *** values.c 2001/03/06 08:21:18 1.13 --- values.c 2001/03/20 19:47:56 *************** *** 26,32 **** #include "gdbtypes.h" #include "value.h" #include "gdbcore.h" - #include "frame.h" #include "command.h" #include "gdbcmd.h" #include "target.h" --- 26,31 ---- Index: varobj.c =================================================================== RCS file: /cvs/src/src/gdb/varobj.c,v retrieving revision 1.16 diff -c -r1.16 varobj.c *** varobj.c 2001/01/26 19:47:19 1.16 --- varobj.c 2001/03/20 19:47:57 *************** *** 20,26 **** #include "value.h" #include "expression.h" #include "frame.h" - #include "valprint.h" #include "language.h" #include "wrapper.h" #include "gdbcmd.h" --- 20,25 ---- Index: wrapper.c =================================================================== RCS file: /cvs/src/src/gdb/wrapper.c,v retrieving revision 1.11 diff -c -r1.11 wrapper.c *** wrapper.c 2001/03/06 08:21:18 1.11 --- wrapper.c 2001/03/20 19:47:57 *************** *** 18,24 **** #include "defs.h" #include "value.h" - #include "frame.h" #include "wrapper.h" /* Use this struct to pass arguments to wrapper routines. We assume --- 18,23 ---- -- J.T. Conklin RedBack Networks