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]

FYI: remove some dead code


I'm checking this in on the trunk.

This removes some dead code.  TYPE_CODE_TEMPLATE and
TYPE_CODE_TEMPLATE_ARG are dead because nothing ever creates
types using these.  The corresponding fields in cplus_struct_type
are dead because nothing ever sets or uses them.

Built and regtested on x86-64 (compile farm).

Tom

2010-02-19  Tom Tromey  <tromey@redhat.com>

	* p-typeprint.c (pascal_type_print_varspec_prefix): Update.
	* m2-typeprint.c (m2_print_type): Update.
	* gdbtypes.c (recursive_dump_type): Update.
	(copy_type_recursive): Update.
	* c-typeprint.c (c_type_print_varspec_prefix): Update.
	(c_type_print_base): Update.
	* gdbtypes.h (TYPE_CODE_TEMPLATE, TYPE_CODE_TEMPLATE_ARG):
	Remove.
	(struct cplus_struct_type) <ntemplate_args>: Remove.
	<struct template_arg>: Remove.
	<is_dynamic>: Move earlier.
	(TYPE_TEMPLATE_ARGS): Remove.
	(TYPE_NTEMPLATE_ARGS): Remove.
	(TYPE_TEMPLATE_ARG): Remove.

diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index ed98381..3a0aa59 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -292,7 +292,6 @@ c_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
     case TYPE_CODE_STRING:
     case TYPE_CODE_BITSTRING:
     case TYPE_CODE_COMPLEX:
-    case TYPE_CODE_TEMPLATE:
     case TYPE_CODE_NAMESPACE:
     case TYPE_CODE_DECFLOAT:
       /* These types need no prefix.  They are listed here so that
@@ -616,7 +615,6 @@ c_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
     case TYPE_CODE_STRING:
     case TYPE_CODE_BITSTRING:
     case TYPE_CODE_COMPLEX:
-    case TYPE_CODE_TEMPLATE:
     case TYPE_CODE_NAMESPACE:
     case TYPE_CODE_DECFLOAT:
       /* These types do not need a suffix.  They are listed so that
@@ -1100,25 +1098,6 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
       fprintf_filtered (stream, _("<range type>"));
       break;
 
-    case TYPE_CODE_TEMPLATE:
-      /* Called on "ptype t" where "t" is a template.
-         Prints the template header (with args), e.g.:
-         template <class T1, class T2> class "
-         and then merges with the struct/union/class code to
-         print the rest of the definition. */
-      c_type_print_modifier (type, stream, 0, 1);
-      fprintf_filtered (stream, "template <");
-      for (i = 0; i < TYPE_NTEMPLATE_ARGS (type); i++)
-	{
-	  struct template_arg templ_arg;
-	  templ_arg = TYPE_TEMPLATE_ARG (type, i);
-	  fprintf_filtered (stream, "class %s", templ_arg.name);
-	  if (i < TYPE_NTEMPLATE_ARGS (type) - 1)
-	    fprintf_filtered (stream, ", ");
-	}
-      fprintf_filtered (stream, "> class ");
-      goto struct_union;
-
     case TYPE_CODE_NAMESPACE:
       fputs_filtered ("namespace ", stream);
       fputs_filtered (TYPE_TAG_NAME (type), stream);
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 46846c4..3269a8c 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2755,12 +2755,6 @@ recursive_dump_type (struct type *type, int spaces)
     case TYPE_CODE_TYPEDEF:
       printf_filtered ("(TYPE_CODE_TYPEDEF)");
       break;
-    case TYPE_CODE_TEMPLATE:
-      printf_filtered ("(TYPE_CODE_TEMPLATE)");
-      break;
-    case TYPE_CODE_TEMPLATE_ARG:
-      printf_filtered ("(TYPE_CODE_TEMPLATE_ARG)");
-      break;
     case TYPE_CODE_NAMESPACE:
       printf_filtered ("(TYPE_CODE_NAMESPACE)");
       break;
@@ -3123,7 +3117,6 @@ copy_type_recursive (struct objfile *objfile,
     TYPE_FLOATFORMAT (new_type) = TYPE_FLOATFORMAT (type);
   else if (TYPE_CODE (type) == TYPE_CODE_STRUCT
 	   || TYPE_CODE (type) == TYPE_CODE_UNION
-	   || TYPE_CODE (type) == TYPE_CODE_TEMPLATE
 	   || TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
     INIT_CPLUS_SPECIFIC (new_type);
 
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 643fa03..2859ce9 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -131,8 +131,6 @@ enum type_code
     TYPE_CODE_COMPLEX,		/* Complex float */
 
     TYPE_CODE_TYPEDEF,
-    TYPE_CODE_TEMPLATE,		/* C++ template */
-    TYPE_CODE_TEMPLATE_ARG,	/* C++ template arg */
 
     TYPE_CODE_NAMESPACE,	/* C++ namespace.  */
 
@@ -685,10 +683,12 @@ struct cplus_struct_type
 
     short nfn_fields_total;
 
-    /* Number of template arguments, placed here for better struct
-       packing.  */
-
-    short ntemplate_args;
+    /* One if this struct is a dynamic class, as defined by the
+       Itanium C++ ABI: if it requires a virtual table pointer,
+       because it or any of its base classes have one or more virtual
+       member functions or virtual base classes.  Minus one if not
+       dynamic.  Zero if not yet computed.  */
+    int is_dynamic : 2;
 
     /* For derived classes, the number of base classes is given by n_baseclasses
        and virtual_field_bits is a bit vector containing one bit per base class.
@@ -806,20 +806,6 @@ struct cplus_struct_type
       }
      *fn_fieldlists;
 
-    /* If this "struct type" describes a template, then it 
-     * has arguments. "template_args" points to an array of
-     * template arg descriptors, of length "ntemplate_args".
-     * The only real information in each of these template arg descriptors
-     * is a name. "type" will typically just point to a "struct type" with
-     * the placeholder TYPE_CODE_TEMPLATE_ARG type.
-     */
-    struct template_arg
-      {
-	char *name;
-	struct type *type;
-      }
-     *template_args;
-
     /* Pointer to information about enclosing scope, if this is a
      * local type.  If it is not a local type, this is NULL
      */
@@ -829,13 +815,6 @@ struct cplus_struct_type
 	int line;
       }
      *localtype_ptr;
-
-    /* One if this struct is a dynamic class, as defined by the
-       Itanium C++ ABI: if it requires a virtual table pointer,
-       because it or any of its base classes have one or more virtual
-       member functions or virtual base classes.  Minus one if not
-       dynamic.  Zero if not yet computed.  */
-    int is_dynamic : 2;
   };
 
 /* Struct used in computing virtual base list */
@@ -909,7 +888,6 @@ extern void allocate_gnat_aux_type (struct type *);
 #define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code
 #define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields
 #define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields
-#define TYPE_TEMPLATE_ARGS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->template_args
 
 #define TYPE_INDEX_TYPE(type) TYPE_FIELD_TYPE (type, 0)
 #define TYPE_RANGE_DATA(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.bounds
@@ -941,7 +919,6 @@ extern void allocate_gnat_aux_type (struct type *);
 #define TYPE_FN_FIELDS(thistype) TYPE_CPLUS_SPECIFIC(thistype)->fn_fields
 #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_SPECIFIC_FIELD(thistype) \
   TYPE_MAIN_TYPE(thistype)->type_specific_field
 #define	TYPE_TYPE_SPECIFIC(thistype) TYPE_MAIN_TYPE(thistype)->type_specific
@@ -1004,7 +981,6 @@ extern void allocate_gnat_aux_type (struct type *);
 #define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
 #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_FIELD_PRIVATE_BITS(thistype) \
   TYPE_CPLUS_SPECIFIC(thistype)->private_field_bits
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index 46a35bb..53e3ddc 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -146,9 +146,6 @@ m2_print_type (struct type *type, char *varstring, struct ui_file *stream,
       m2_range (type, stream, show, level);
       break;
 
-    case TYPE_CODE_TEMPLATE:
-      break;
-
     default:
       m2_type_name (type, stream);
       break;
diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c
index ef7f2ee..7ea1f12 100644
--- a/gdb/p-typeprint.c
+++ b/gdb/p-typeprint.c
@@ -289,7 +289,6 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
     case TYPE_CODE_BITSTRING:
     case TYPE_CODE_COMPLEX:
     case TYPE_CODE_TYPEDEF:
-    case TYPE_CODE_TEMPLATE:
       /* These types need no prefix.  They are listed here so that
          gcc -Wall will reveal any types that haven't been handled.  */
       break;
@@ -404,7 +403,6 @@ pascal_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
     case TYPE_CODE_BITSTRING:
     case TYPE_CODE_COMPLEX:
     case TYPE_CODE_TYPEDEF:
-    case TYPE_CODE_TEMPLATE:
       /* These types do not need a suffix.  They are listed so that
          gcc -Wall will report types that may not have been considered.  */
       break;


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