This is the mail archive of the gdb-patches@sourceware.org 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]

[ob] Garbage collect unused macros


I was looking at something else and noticed that
symbol_init_demangled_name was unused.  I got out my trusty grep,
searched for defined but unused macros, and deleted the ones that I couldn't
think of even a flimsy reason to keep.

Aren't there scripts somewhere for detecting unused macros and
functions?  If someone knows I'd appreciate a pointer.

Tested by compiling on x86_64-linux and committed.

-- 
Daniel Jacobowitz
CodeSourcery

2008-05-03  Daniel Jacobowitz  <dan@codesourcery.com>

	* alpha-tdep.h (ALPHA_REGISTER_BYTES): Delete.
	* arm-tdep.h (STATUS_REGISTER_SIZE): Delete.
	* breakpoint.c (args_for_catchpoint_enable, current_exception_event):
	Delete.
	* c-typeprint.c (c_type_print_base): Delete handling of template
	instantiations.
	* cp-support.h (METHOD_PTR_IS_VIRTUAL, METHOD_PTR_FROM_VOFFSET)
	(METHOD_PTR_TO_VOFFSET): Delete.
	* defs.h (QUIT_FIXME): Delete.
	* f-lang.h (DEFAULT_DOTMAIN_NAME_IN_MF77, DEFAULT_MAIN_NAME_IN_MF77)
	(DEFAULT_DOTMAIN_NAME_IN_XLF_BUGGY, DEFAULT_DOTMAIN_NAME_IN_XLF): Delete.
	* gdbtypes.h (struct cplus_struct_type): Delete is_inlined,
	ninstantiations, and instantiations.
	(TYPE_INSTANTIATIONS, TYPE_NINSTANTIATIONS, TYPE_INSTANTIATION)
	(TYPE_FN_FIELD_INLINED): Delete.
	* srec.h (SREC_BINARY): Delete.
	* symtab.c (symbol_init_demangled_name): Delete.
	* symtab.h (SYMBOL_INIT_DEMANGLED_NAME, symbol_init_demangled_name)
	(SYMBOL_OBJFILE, struct exception_event_record, CURRENT_EXCEPTION_KIND)
	(CURRENT_EXCEPTION_CATCH_SAL, CURRENT_EXCEPTION_CATCH_LINE)
	(CURRENT_EXCEPTION_CATCH_FILE, CURRENT_EXCEPTION_CATCH_PC)
	(CURRENT_EXCEPTION_THROW_SAL, CURRENT_EXCEPTION_THROW_LINE)
	(CURRENT_EXCEPTION_THROW_FILE, CURRENT_EXCEPTION_THROW_PC): Delete.
	* target.h (enum thread_control_capabilities): Delete tc_switch.
	(target_can_switch_threads): Delete.

Index: alpha-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.h,v
retrieving revision 1.33
diff -u -p -r1.33 alpha-tdep.h
--- alpha-tdep.h	1 Jan 2008 22:53:09 -0000	1.33
+++ alpha-tdep.h	3 May 2008 22:14:14 -0000
@@ -30,10 +30,6 @@ struct regcache;
 /* Number of machine registers.  */
 #define ALPHA_NUM_REGS 67
 
-/* Total amount of space needed to store our copies of the machine's
-   register state.  */
-#define ALPHA_REGISTER_BYTES (ALPHA_NUM_REGS * 8)
-
 /* Register numbers of various important registers.  Note that most of
    these values are "real" register numbers, and correspond to the
    general registers of the machine.  */
Index: arm-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.h,v
retrieving revision 1.31
diff -u -p -r1.31 arm-tdep.h
--- arm-tdep.h	1 May 2008 18:30:50 -0000	1.31
+++ arm-tdep.h	3 May 2008 22:14:14 -0000
@@ -68,11 +68,6 @@ enum gdb_regnum {
    bits.  DWORD aligned they use 96 bits.  */
 #define FP_REGISTER_SIZE	12
 
-/* Status registers are the same size as general purpose registers.
-   Used for documentation purposes and code readability in this
-   header.  */
-#define STATUS_REGISTER_SIZE	4
-
 /* Number of machine registers.  The only define actually required 
    is gdbarch_num_regs.  The other definitions are used for documentation
    purposes and code readability.  */
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.319
diff -u -p -r1.319 breakpoint.c
--- breakpoint.c	3 May 2008 06:13:21 -0000	1.319
+++ breakpoint.c	3 May 2008 22:14:15 -0000
@@ -141,13 +141,6 @@ static enum print_stop_action print_it_t
 
 static enum print_stop_action print_bp_stop_message (bpstat bs);
 
-typedef struct
-  {
-    enum exception_event_kind kind;
-    int enable_p;
-  }
-args_for_catchpoint_enable;
-
 static int watchpoint_check (void *);
 
 static void maintenance_info_breakpoints (char *, int);
@@ -323,9 +316,6 @@ struct bp_location *bp_location_chain;
 
 int breakpoint_count;
 
-/* Pointer to current exception event record */
-static struct exception_event_record *current_exception_event;
-
 /* This function returns a pointer to the string representation of the
    pathname of the dynamically-linked library that has just been
    loaded.
Index: c-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/c-typeprint.c,v
retrieving revision 1.41
diff -u -p -r1.41 c-typeprint.c
--- c-typeprint.c	1 Jan 2008 22:53:09 -0000	1.41
+++ c-typeprint.c	3 May 2008 22:14:15 -0000
@@ -1043,8 +1043,6 @@ c_type_print_base (struct type *type, st
 			       TYPE_LOCALTYPE_FILE (type),
 			       TYPE_LOCALTYPE_LINE (type));
 	}
-      if (TYPE_CODE (type) == TYPE_CODE_TEMPLATE)
-	goto go_back;
       break;
 
     case TYPE_CODE_ENUM:
@@ -1127,22 +1125,7 @@ c_type_print_base (struct type *type, st
 	    fprintf_filtered (stream, ", ");
 	}
       fprintf_filtered (stream, "> class ");
-      /* Yuck, factor this out to a subroutine so we can call
-         it and return to the point marked with the "goback:" label... - RT */
       goto struct_union;
-    go_back:
-      if (TYPE_NINSTANTIATIONS (type) > 0)
-	{
-	  fprintf_filtered (stream, _("\ntemplate instantiations:\n"));
-	  for (i = 0; i < TYPE_NINSTANTIATIONS (type); i++)
-	    {
-	      fprintf_filtered (stream, "  ");
-	      c_type_print_base (TYPE_INSTANTIATION (type, i), stream, 0, level);
-	      if (i < TYPE_NINSTANTIATIONS (type) - 1)
-		fprintf_filtered (stream, "\n");
-	    }
-	}
-      break;
 
     case TYPE_CODE_NAMESPACE:
       fputs_filtered ("namespace ", stream);
Index: cp-support.h
===================================================================
RCS file: /cvs/src/src/gdb/cp-support.h,v
retrieving revision 1.21
diff -u -p -r1.21 cp-support.h
--- cp-support.h	1 Jan 2008 22:53:09 -0000	1.21
+++ cp-support.h	3 May 2008 22:14:15 -0000
@@ -127,10 +127,4 @@ extern char *cp_comp_to_string (struct d
 
 extern struct cmd_list_element *maint_cplus_cmd_list;
 
-/* Pointer to member function.  Depends on compiler implementation.  */
-
-#define METHOD_PTR_IS_VIRTUAL(ADDR)  ((ADDR) & 0x80000000)
-#define METHOD_PTR_FROM_VOFFSET(OFFSET) (0x80000000 + (OFFSET))
-#define METHOD_PTR_TO_VOFFSET(ADDR) (~0x80000000 & (ADDR))
-
 #endif /* CP_SUPPORT_H */
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.222
diff -u -p -r1.222 defs.h
--- defs.h	1 May 2008 23:09:14 -0000	1.222
+++ defs.h	3 May 2008 22:14:15 -0000
@@ -152,16 +152,10 @@ extern void quit (void);
    [kingdon].  A profile analyzing the current situtation is
    needed. */
 
-#ifdef QUIT
-/* do twice to force compiler warning */
-#define QUIT_FIXME "FIXME"
-#define QUIT_FIXME "ignoring redefinition of QUIT"
-#else
 #define QUIT { \
   if (quit_flag) quit (); \
   if (deprecated_interactive_hook) deprecated_interactive_hook (); \
 }
-#endif
 
 /* Languages represented in the symbol table and elsewhere.
    This should probably be in language.h, but since enum's can't
Index: f-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/f-lang.h,v
retrieving revision 1.10
diff -u -p -r1.10 f-lang.h
--- f-lang.h	1 Jan 2008 22:53:09 -0000	1.10
+++ f-lang.h	3 May 2008 22:14:15 -0000
@@ -104,8 +104,3 @@ extern int f77_get_dynamic_lowerbound (s
 extern void f77_get_dynamic_array_length (struct type *);
 
 extern int calc_f77_array_dims (struct type *);
-
-#define DEFAULT_DOTMAIN_NAME_IN_MF77            ".MAIN_"
-#define DEFAULT_MAIN_NAME_IN_MF77               "MAIN_"
-#define DEFAULT_DOTMAIN_NAME_IN_XLF_BUGGY       ".main "
-#define DEFAULT_DOTMAIN_NAME_IN_XLF             ".main"
Index: gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.86
diff -u -p -r1.86 gdbtypes.h
--- gdbtypes.h	22 Apr 2008 11:03:41 -0000	1.86
+++ gdbtypes.h	3 May 2008 22:14:15 -0000
@@ -683,11 +683,8 @@ struct cplus_struct_type
 	       to reconstruct the rest of the fields).  */
 	    unsigned int is_stub:1;
 
-	    /* C++ method that is inlined */
-	    unsigned int is_inlined:1;
-
 	    /* Unused.  */
-	    unsigned int dummy:3;
+	    unsigned int dummy:4;
 
 	    /* Index into that baseclass's virtual function table,
 	       minus 2; else if static: VOFFSET_STATIC; else: 0.  */
@@ -717,14 +714,6 @@ struct cplus_struct_type
       }
      *template_args;
 
-    /* If this "struct type" describes a template, it has a list
-     * of instantiations. "instantiations" is a pointer to an array
-     * of type's, one representing each instantiation. There
-     * are "ninstantiations" elements in this array.
-     */
-    short ninstantiations;
-    struct type **instantiations;
-
     /* Pointer to information about enclosing scope, if this is a
      * local type.  If it is not a local type, this is NULL
      */
@@ -784,7 +773,6 @@ extern void allocate_cplus_struct_type (
 #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields
 #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->fields
 #define TYPE_TEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->template_args
-#define TYPE_INSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->instantiations
 
 #define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0)
 #define TYPE_LOW_BOUND(range_type) TYPE_FIELD_BITPOS (range_type, 0)
@@ -812,7 +800,6 @@ extern void allocate_cplus_struct_type (
 #define TYPE_NFN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields
 #define TYPE_NFN_FIELDS_TOTAL(thistype) TYPE_CPLUS_SPECIFIC(thistype)->nfn_fields_total
 #define TYPE_NTEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->ntemplate_args
-#define TYPE_NINSTANTIATIONS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->ninstantiations
 #define TYPE_DECLARED_TYPE(thistype) TYPE_CPLUS_SPECIFIC(thistype)->declared_type
 #define	TYPE_TYPE_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific
 #define TYPE_CPLUS_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific.cplus_stuff
@@ -849,7 +836,6 @@ extern void allocate_cplus_struct_type (
 #define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE(TYPE_FIELD(thistype,n))
 #define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE(TYPE_FIELD(thistype,n))!=0)
 #define TYPE_TEMPLATE_ARG(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->template_args[n]
-#define TYPE_INSTANTIATION(thistype, n) TYPE_CPLUS_SPECIFIC(thistype)->instantiations[n]
 
 #define TYPE_FIELD_PRIVATE_BITS(thistype) \
   TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
@@ -908,7 +894,6 @@ extern void allocate_cplus_struct_type (
 #define TYPE_FN_FIELD_ARTIFICIAL(thisfn, n) ((thisfn)[n].is_artificial)
 #define TYPE_FN_FIELD_ABSTRACT(thisfn, n) ((thisfn)[n].is_abstract)
 #define TYPE_FN_FIELD_STUB(thisfn, n) ((thisfn)[n].is_stub)
-#define TYPE_FN_FIELD_INLINED(thisfn, n) ((thisfn)[n].is_inlined)
 #define TYPE_FN_FIELD_FCONTEXT(thisfn, n) ((thisfn)[n].fcontext)
 #define TYPE_FN_FIELD_VOFFSET(thisfn, n) ((thisfn)[n].voffset-2)
 #define TYPE_FN_FIELD_VIRTUAL_P(thisfn, n) ((thisfn)[n].voffset > 1)
Index: srec.h
===================================================================
RCS file: /cvs/src/src/gdb/srec.h,v
retrieving revision 1.9
diff -u -p -r1.9 srec.h
--- srec.h	1 Jan 2008 22:53:13 -0000	1.9
+++ srec.h	3 May 2008 22:14:15 -0000
@@ -33,5 +33,3 @@ void load_srec (struct serial *desc, con
 #define SREC_ALL (SREC_2_BYTE_ADDR | SREC_3_BYTE_ADDR | SREC_4_BYTE_ADDR \
 		  | ((SREC_2_BYTE_ADDR | SREC_3_BYTE_ADDR | SREC_4_BYTE_ADDR) \
 		     << SREC_TERM_SHIFT))
-
-#define SREC_BINARY	0x00000040	/* Supports binary form of S-records */
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.178
diff -u -p -r1.178 symtab.c
--- symtab.c	3 May 2008 00:37:34 -0000	1.178
+++ symtab.c	3 May 2008 22:14:16 -0000
@@ -627,40 +627,6 @@ symbol_set_names (struct general_symbol_
     gsymbol->language_specific.cplus_specific.demangled_name = NULL;
 }
 
-/* Initialize the demangled name of GSYMBOL if possible.  Any required space
-   to store the name is obtained from the specified obstack.  The function
-   symbol_set_names, above, should be used instead where possible for more
-   efficient memory usage.  */
-
-void
-symbol_init_demangled_name (struct general_symbol_info *gsymbol,
-                            struct obstack *obstack)
-{
-  char *mangled = gsymbol->name;
-  char *demangled = NULL;
-
-  demangled = symbol_find_demangled_name (gsymbol, mangled);
-  if (gsymbol->language == language_cplus
-      || gsymbol->language == language_java
-      || gsymbol->language == language_objc)
-    {
-      if (demangled)
-	{
-	  gsymbol->language_specific.cplus_specific.demangled_name
-	    = obsavestring (demangled, strlen (demangled), obstack);
-	  xfree (demangled);
-	}
-      else
-	gsymbol->language_specific.cplus_specific.demangled_name = NULL;
-    }
-  else
-    {
-      /* Unknown language; just clean up quietly.  */
-      if (demangled)
-	xfree (demangled);
-    }
-}
-
 /* Return the source code name of a symbol.  In languages where
    demangling is necessary, this is the demangled name.  */
 
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.116
diff -u -p -r1.116 symtab.h
--- symtab.h	3 May 2008 00:37:35 -0000	1.116
+++ symtab.h	3 May 2008 22:14:16 -0000
@@ -157,8 +157,8 @@ extern CORE_ADDR symbol_overlayed_addres
 /* Note that all the following SYMBOL_* macros are used with the
    SYMBOL argument being either a partial symbol, a minimal symbol or
    a full symbol.  All three types have a ginfo field.  In particular
-   the SYMBOL_INIT_LANGUAGE_SPECIFIC, SYMBOL_INIT_DEMANGLED_NAME,
-   SYMBOL_DEMANGLED_NAME macros cannot be entirely substituted by
+   the SYMBOL_INIT_LANGUAGE_SPECIFIC, SYMBOL_DEMANGLED_NAME, etc.
+   macros cannot be entirely substituted by
    functions, unless the callers are changed to pass in the ginfo
    field only, instead of the SYMBOL parameter.  */
 
@@ -182,11 +182,6 @@ extern CORE_ADDR symbol_overlayed_addres
 extern void symbol_init_language_specific (struct general_symbol_info *symbol,
 					   enum language language);
 
-#define SYMBOL_INIT_DEMANGLED_NAME(symbol,obstack) \
-  (symbol_init_demangled_name (&(symbol)->ginfo, (obstack)))
-extern void symbol_init_demangled_name (struct general_symbol_info *symbol,
-					struct obstack *obstack);
-
 #define SYMBOL_SET_NAMES(symbol,linkage_name,len,objfile) \
   symbol_set_names (&(symbol)->ginfo, linkage_name, len, objfile)
 extern void symbol_set_names (struct general_symbol_info *symbol,
@@ -666,7 +661,6 @@ struct symbol
 #define SYMBOL_LINE(symbol)		(symbol)->line
 #define SYMBOL_SYMTAB(symbol)		(symbol)->symtab
 #define SYMBOL_BASEREG(symbol)		(symbol)->aux_value.basereg
-#define SYMBOL_OBJFILE(symbol)          (symbol)->aux_value.objfile
 #define SYMBOL_OPS(symbol)              (symbol)->ops
 #define SYMBOL_LOCATION_BATON(symbol)   (symbol)->aux_value.ptr
 
@@ -1243,27 +1237,6 @@ enum exception_event_kind
   EX_EVENT_CATCH
 };
 
-/* Type for returning info about an exception */
-struct exception_event_record
-{
-  enum exception_event_kind kind;
-  struct symtab_and_line throw_sal;
-  struct symtab_and_line catch_sal;
-  /* This may need to be extended in the future, if
-     some platforms allow reporting more information,
-     such as point of rethrow, type of exception object,
-     type expected by catch clause, etc. */
-};
-
-#define CURRENT_EXCEPTION_KIND       (current_exception_event->kind)
-#define CURRENT_EXCEPTION_CATCH_SAL  (current_exception_event->catch_sal)
-#define CURRENT_EXCEPTION_CATCH_LINE (current_exception_event->catch_sal.line)
-#define CURRENT_EXCEPTION_CATCH_FILE (current_exception_event->catch_sal.symtab->filename)
-#define CURRENT_EXCEPTION_CATCH_PC   (current_exception_event->catch_sal.pc)
-#define CURRENT_EXCEPTION_THROW_SAL  (current_exception_event->throw_sal)
-#define CURRENT_EXCEPTION_THROW_LINE (current_exception_event->throw_sal.line)
-#define CURRENT_EXCEPTION_THROW_FILE (current_exception_event->throw_sal.symtab->filename)
-#define CURRENT_EXCEPTION_THROW_PC   (current_exception_event->throw_sal.pc)
 
 
 /* Given a pc value, return line number it is in.  Second arg nonzero means
Index: target.h
===================================================================
RCS file: /cvs/src/src/gdb/target.h,v
retrieving revision 1.118
diff -u -p -r1.118 target.h
--- target.h	2 May 2008 11:07:25 -0000	1.118
+++ target.h	3 May 2008 22:14:16 -0000
@@ -69,7 +69,6 @@ enum thread_control_capabilities
   {
     tc_none = 0,		/* Default: can't control thread execution.  */
     tc_schedlock = 1,		/* Can lock the thread scheduler.  */
-    tc_switch = 2		/* Can switch the running thread on demand.  */
   };
 
 /* Stuff for target_wait.  */
@@ -925,15 +924,11 @@ int target_follow_fork (int follow_child
      (current_target.to_has_execution)
 
 /* Can the target support the debugger control of thread execution?
-   a) Can it lock the thread scheduler?
-   b) Can it switch the currently running thread?  */
+   Can it lock the thread scheduler?  */
 
 #define target_can_lock_scheduler \
      (current_target.to_has_thread_control & tc_schedlock)
 
-#define target_can_switch_threads \
-     (current_target.to_has_thread_control & tc_switch)
-
 /* Can the target support asynchronous execution? */
 #define target_can_async_p() (current_target.to_can_async_p ())
 


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