Skip to content

Commit eb5b3e7

Browse files
author
mark
committed
libiberty: Don't update and remove did_subs field from demangler structs.
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@247054 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 0b97e55 commit eb5b3e7

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

Diff for: libiberty/ChangeLog

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
2017-04-21 Mark Wielaard <mark@klomp.org>
2+
3+
* cp-demangle.h (struct d_info): Remove did_subs field.
4+
* cp-demangle.c (struct d_info_checkpoint): Likewise.
5+
(d_template_param): Don't update did_subs.
6+
(d_substitution): Likewise.
7+
(d_checkpoint): Don't assign did_subs.
8+
(d_backtrack): Likewise.
9+
(cplus_demangle_init_info): Don't initialize did_subs.
10+
111
2017-03-27 Pedro Alves <palves@redhat.com>
212

313
* cp-demint.c (cplus_demangle_fill_component): Handle

Diff for: libiberty/cp-demangle.c

-8
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,6 @@ struct d_info_checkpoint
316316
const char *n;
317317
int next_comp;
318318
int next_sub;
319-
int did_subs;
320319
int expansion;
321320
};
322321

@@ -3075,8 +3074,6 @@ d_template_param (struct d_info *di)
30753074
if (param < 0)
30763075
return NULL;
30773076

3078-
++di->did_subs;
3079-
30803077
return d_make_template_param (di, param);
30813078
}
30823079

@@ -3846,8 +3843,6 @@ d_substitution (struct d_info *di, int prefix)
38463843
if (id >= (unsigned int) di->next_sub)
38473844
return NULL;
38483845

3849-
++di->did_subs;
3850-
38513846
return di->subs[id];
38523847
}
38533848
else
@@ -3912,7 +3907,6 @@ d_checkpoint (struct d_info *di, struct d_info_checkpoint *checkpoint)
39123907
checkpoint->n = di->n;
39133908
checkpoint->next_comp = di->next_comp;
39143909
checkpoint->next_sub = di->next_sub;
3915-
checkpoint->did_subs = di->did_subs;
39163910
checkpoint->expansion = di->expansion;
39173911
}
39183912

@@ -3922,7 +3916,6 @@ d_backtrack (struct d_info *di, struct d_info_checkpoint *checkpoint)
39223916
di->n = checkpoint->n;
39233917
di->next_comp = checkpoint->next_comp;
39243918
di->next_sub = checkpoint->next_sub;
3925-
di->did_subs = checkpoint->did_subs;
39263919
di->expansion = checkpoint->expansion;
39273920
}
39283921

@@ -6159,7 +6152,6 @@ cplus_demangle_init_info (const char *mangled, int options, size_t len,
61596152
chars in the mangled string. */
61606153
di->num_subs = len;
61616154
di->next_sub = 0;
6162-
di->did_subs = 0;
61636155

61646156
di->last_name = NULL;
61656157

Diff for: libiberty/cp-demangle.h

-4
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,6 @@ struct d_info
111111
int next_sub;
112112
/* The number of available entries in the subs array. */
113113
int num_subs;
114-
/* The number of substitutions which we actually made from the subs
115-
array, plus the number of template parameter references we
116-
saw. */
117-
int did_subs;
118114
/* The last name we saw, for constructors and destructors. */
119115
struct demangle_component *last_name;
120116
/* A running total of the length of large expansions from the

0 commit comments

Comments
 (0)