]> git.ipfire.org Git - thirdparty/gcc.git/commit
Make gengtype more robust against user error
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 29 Oct 2013 01:16:05 +0000 (01:16 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Tue, 29 Oct 2013 01:16:05 +0000 (01:16 +0000)
commit32fe52714e42a391c6a7a1ac18bb0a57a80ecb5b
tree456914960b33f804e0e0a01a2caaa7e312150c73
parent1ed5a6cc504ef8089f1431590c2fbca15b6a2475
Make gengtype more robust against user error

* doc/gty.texi ("Inheritance and GTY"): Make it clear that
to use autogenerated markers for a class-hierarchy, every class
must have a GTY marker.
* gengtype.h (struct type): Add linked list of subclasses to
the "s" member of the union.
(add_subclass): New decl.
* gengtype-state.c (read_state_struct_type): Set up subclass
linked list.
* gengtype.c (get_ultimate_base_class): New.
(add_subclass): New.
(new_structure): Set up subclass linked list.
(set_gc_used_type): Propagate usage information to subclasses.
(output_mangled_typename): Use get_ultimate_base_class.
(walk_subclasses): Use the subclass linked list, avoiding an
O(N^2) when writing out all types.
(walk_type): Issue an error if the base class is missing a tag,
rather than generating bogus C code.  Add a gcc_unreachable
default case, in case people omit tags from concrete subclasses,
or get the values wrong.
(write_func_for_structure): Issue an error for subclasses for
which the base doesn't have a "desc", since otherwise the
autogenerated routines for the base would silently fail to visit
any subclass fields.
(write_root): Use get_ultimate_base_class, tweaking constness of
tp to match that function's signature.

From-SVN: r204148
gcc/ChangeLog
gcc/doc/gty.texi
gcc/gengtype-state.c
gcc/gengtype.c
gcc/gengtype.h