-@c Copyright (C) 2002, 2003
+@c Copyright (C) 2002, 2003, 2004
@c Free Software Foundation, Inc.
@c This is part of the GCC manual.
@c For copying conditions, see the file gcc.texi.
@item
In a structure definition, before the open brace;
@item
-In a global variable declaration, after the keyword @code{static} or
+In a global variable declaration, after the keyword @code{static} or
@code{extern}; and
@item
In a structure field definition, before the name of the field.
@itemx default
The type machinery needs to be told which field of a @code{union} is
-currently active. This is done by giving each field a constant @code{tag}
-value, and then specifying a discriminator using @code{desc}. For example,
+currently active. This is done by giving each field a constant
+@code{tag} value, and then specifying a discriminator using @code{desc}.
+The value of the expression given by @code{desc} is compared against
+each @code{tag} value, each of which should be different. If no
+@code{tag} is matched, the field marked with @code{default} is used if
+there is one, otherwise no field in the union will be marked.
+
+In the @code{desc} option, the ``current structure'' is the union that
+it discriminates. Use @code{%1} to mean the structure containing it.
+(There are no escapes available to the @code{tag} option, since it's
+supposed to be a constant.)
+
+For example,
@smallexample
struct tree_binding GTY(())
@{
union tree_binding_u @{
tree GTY ((tag ("0"))) scope;
struct cp_binding_level * GTY ((tag ("1"))) level;
- @} GTY ((desc ("BINDING_HAS_LEVEL_P ((tree)&%0)"))) scope;
+ @} GTY ((desc ("BINDING_HAS_LEVEL_P ((tree)&%0)"))) xscope;
tree value;
@};
@end smallexample
-In the @code{desc} option, the ``current structure'' is the union that
-it discriminates. Use @code{%1} to mean the structure containing it.
-(There are no escapes available to the @code{tag} option, since it's
-supposed to be a constant.)
-
-Each @code{tag} should be different. If no @code{tag} is matched,
-the field marked with @code{default} is used if there is one, otherwise
-no field in the union will be marked.
+In this example, the value of BINDING_HAS_LEVEL_P when applied to a
+@code{struct tree_binding *} is presumed to be 0 or 1. If 1, the type
+mechanism will treat the field @code{level} as being present and if 0,
+will treat the field @code{scope} as being present.
@findex param_is
@findex use_param
@enumerate
@item
You need to add the file to the list of source files the type
-machinery scans. There are three cases:
+machinery scans. There are three cases:
@enumerate a
@item
For a back-end file, this is usually done
automatically; if not, you should add it to @code{target_gtfiles} in
-the appropriate port's entries in @file{config.gcc}.
+the appropriate port's entries in @file{config.gcc}.
@item
For files shared by all front ends, this is done by adding the
filename to the @code{GTFILES} variable in @file{Makefile.in}.
-@item
+@item
For any other file used by a front end, this is done by adding the
filename to the @code{gtfiles} variable defined in
@file{config-lang.in}. For C, the file is @file{c-config-lang.in}.
file, it needs to be included by the same file that includes
@file{gtype-@var{lang}.h}. For other header files, it needs to be
included in @file{gtype-desc.c}, which is a generated file, so add it to
-@code{ifiles} in @code{open_base_file} in @file{gengtype.c}.
+@code{ifiles} in @code{open_base_file} in @file{gengtype.c}.
For source files that aren't header files, the machinery will generate a
header file that should be included in the source file you just changed.