diff options
author | Jason Merrill <jason@redhat.com> | 2016-11-10 11:49:08 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-11-10 11:49:08 -0500 |
commit | 98a32a4c844e96d0ca734ce33e3912b22820921d (patch) | |
tree | 0bcce0ee88da460e483f1eb3ce1440db69fa2fc2 | |
parent | dd18c8c32a865a5432338d1959afefa42bebb718 (diff) | |
download | gcc-98a32a4c844e96d0ca734ce33e3912b22820921d.zip gcc-98a32a4c844e96d0ca734ce33e3912b22820921d.tar.gz gcc-98a32a4c844e96d0ca734ce33e3912b22820921d.tar.bz2 |
gengtype.c (new_structure): Append to structures list.
* gengtype.c (new_structure): Append to structures list.
(find_structure): Likewise.
From-SVN: r242040
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/gengtype.c | 13 |
2 files changed, 11 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1e13f59..4a380cb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-11-10 Jason Merrill <jason@redhat.com> + + * gengtype.c (new_structure): Append to structures list. + (find_structure): Likewise. + 2016-11-10 Jim Wilson <jim.wilson@linaro.org> * tree-loop-distribution.c (pg_add_dependence_edges): Return 2 if diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 760f985..a579547 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -744,10 +744,11 @@ new_structure (const char *name, enum typekind kind, struct fileloc *pos, type_p s = NULL; lang_bitmap bitmap = get_lang_bitmap (pos->file); bool isunion = (kind == TYPE_UNION); + type_p *p = &structures; gcc_assert (union_or_struct_p (kind)); - for (si = structures; si != NULL; si = si->next) + for (si = structures; si != NULL; p = &si->next, si = *p) if (strcmp (name, si->u.s.tag) == 0 && UNION_P (si) == isunion) { type_p ls = NULL; @@ -793,8 +794,7 @@ new_structure (const char *name, enum typekind kind, struct fileloc *pos, type_count++; s = XCNEW (struct type); s->state_number = -type_count; - s->next = structures; - structures = s; + *p = s; } if (s->u.s.lang_struct && (s->u.s.lang_struct->u.s.bitmap & bitmap)) @@ -829,21 +829,20 @@ find_structure (const char *name, enum typekind kind) { type_p s; bool isunion = (kind == TYPE_UNION); + type_p *p = &structures; gcc_assert (kind == TYPE_UNDEFINED || union_or_struct_p (kind)); - for (s = structures; s != NULL; s = s->next) + for (s = structures; s != NULL; p = &s->next, s = *p) if (strcmp (name, s->u.s.tag) == 0 && UNION_P (s) == isunion) return s; type_count++; s = XCNEW (struct type); - s->next = structures; s->state_number = -type_count; - structures = s; s->kind = kind; s->u.s.tag = name; - structures = s; + *p = s; return s; } |