aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2013-10-29 01:16:05 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2013-10-29 01:16:05 +0000
commit32fe52714e42a391c6a7a1ac18bb0a57a80ecb5b (patch)
tree456914960b33f804e0e0a01a2caaa7e312150c73 /gcc/doc
parent1ed5a6cc504ef8089f1431590c2fbca15b6a2475 (diff)
downloadgcc-32fe52714e42a391c6a7a1ac18bb0a57a80ecb5b.zip
gcc-32fe52714e42a391c6a7a1ac18bb0a57a80ecb5b.tar.gz
gcc-32fe52714e42a391c6a7a1ac18bb0a57a80ecb5b.tar.bz2
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
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/gty.texi7
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/doc/gty.texi b/gcc/doc/gty.texi
index 090f6a6..a64d110 100644
--- a/gcc/doc/gty.texi
+++ b/gcc/doc/gty.texi
@@ -497,6 +497,13 @@ The base class and its discriminator must be identified using the ``desc''
option. Each concrete subclass must use the ``tag'' option to identify
which value of the discriminator it corresponds to.
+Every class in the hierarchy must have a @code{GTY(())} marker, as
+gengtype will only attempt to parse classes that have such a marker
+@footnote{Classes lacking such a marker will not be identified as being
+part of the hierarchy, and so the marking routines will not handle them,
+leading to a assertion failure within the marking routines due to an
+unknown tag value (assuming that assertions are enabled).}.
+
@smallexample
class GTY((desc("%h.kind"), tag("0"))) example_base
@{