libiberty: Don't update and remove did_subs field from demangler structs.
authorMark Wielaard <mark@klomp.org>
Fri, 21 Apr 2017 09:01:44 +0000 (09:01 +0000)
committerMark Wielaard <mark@gcc.gnu.org>
Fri, 21 Apr 2017 09:01:44 +0000 (09:01 +0000)
The d_info field did_subs was used for estimating the string output
size. It was no longer used when the malloc-less callback interface
was introduced in 2007 (svn r121305). But the field was still updated.
When backtracking was introduced in 2013 (svn r205292) did_subs was
also added to the d_info_checkpoint struct. But except for updating
the field it was still not used.

Since it is never used just stop updating the field and remove it
from the two structs.

libiberty/ChangeLog:

* cp-demangle.h (struct d_info): Remove did_subs field.
* cp-demangle.c (struct d_info_checkpoint): Likewise.
(d_template_param): Don't update did_subs.
(d_substitution): Likewise.
(d_checkpoint): Don't assign did_subs.
(d_backtrack): Likewise.
(cplus_demangle_init_info): Don't initialize did_subs.

From-SVN: r247054

libiberty/ChangeLog
libiberty/cp-demangle.c
libiberty/cp-demangle.h

index f6318e2acf214d15d1abbdac7b478fdacef82894..67ba6e7675a5c56e8357856bb78807929d004b4c 100644 (file)
@@ -1,3 +1,13 @@
+2017-04-21  Mark Wielaard  <mark@klomp.org>
+
+       * cp-demangle.h (struct d_info): Remove did_subs field.
+       * cp-demangle.c (struct d_info_checkpoint): Likewise.
+       (d_template_param): Don't update did_subs.
+       (d_substitution): Likewise.
+       (d_checkpoint): Don't assign did_subs.
+       (d_backtrack): Likewise.
+       (cplus_demangle_init_info): Don't initialize did_subs.
+
 2017-03-27  Pedro Alves  <palves@redhat.com>
 
        * cp-demint.c (cplus_demangle_fill_component): Handle
index 04832ff6830ab341c63480974dea848ef4c65f4f..2c7d5c5faabe7a8a77096f0a94480024bdba3011 100644 (file)
@@ -316,7 +316,6 @@ struct d_info_checkpoint
   const char *n;
   int next_comp;
   int next_sub;
-  int did_subs;
   int expansion;
 };
 
@@ -3075,8 +3074,6 @@ d_template_param (struct d_info *di)
   if (param < 0)
     return NULL;
 
-  ++di->did_subs;
-
   return d_make_template_param (di, param);
 }
 
@@ -3846,8 +3843,6 @@ d_substitution (struct d_info *di, int prefix)
       if (id >= (unsigned int) di->next_sub)
        return NULL;
 
-      ++di->did_subs;
-
       return di->subs[id];
     }
   else
@@ -3912,7 +3907,6 @@ d_checkpoint (struct d_info *di, struct d_info_checkpoint *checkpoint)
   checkpoint->n = di->n;
   checkpoint->next_comp = di->next_comp;
   checkpoint->next_sub = di->next_sub;
-  checkpoint->did_subs = di->did_subs;
   checkpoint->expansion = di->expansion;
 }
 
@@ -3922,7 +3916,6 @@ d_backtrack (struct d_info *di, struct d_info_checkpoint *checkpoint)
   di->n = checkpoint->n;
   di->next_comp = checkpoint->next_comp;
   di->next_sub = checkpoint->next_sub;
-  di->did_subs = checkpoint->did_subs;
   di->expansion = checkpoint->expansion;
 }
 
@@ -6159,7 +6152,6 @@ cplus_demangle_init_info (const char *mangled, int options, size_t len,
      chars in the mangled string.  */
   di->num_subs = len;
   di->next_sub = 0;
-  di->did_subs = 0;
 
   di->last_name = NULL;
 
index a2657755f11d5359794857eb43e61bbd1656ae49..d4a4ab604d84bd38d7d7b6724a34a2c3732351e5 100644 (file)
@@ -111,10 +111,6 @@ struct d_info
   int next_sub;
   /* The number of available entries in the subs array.  */
   int num_subs;
-  /* The number of substitutions which we actually made from the subs
-     array, plus the number of template parameter references we
-     saw.  */
-  int did_subs;
   /* The last name we saw, for constructors and destructors.  */
   struct demangle_component *last_name;
   /* A running total of the length of large expansions from the