aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2005-04-29 14:42:27 -0700
committerRichard Henderson <rth@gcc.gnu.org>2005-04-29 14:42:27 -0700
commit2d82317df0ed13093bf5ffb60fd6ca356b3ca776 (patch)
tree95e869414cd56d97221294d797de9f2f5ddb9c7e
parent22e8617b22bcfc266823ac39eb24ade40c10f5b1 (diff)
downloadgcc-2d82317df0ed13093bf5ffb60fd6ca356b3ca776.zip
gcc-2d82317df0ed13093bf5ffb60fd6ca356b3ca776.tar.gz
gcc-2d82317df0ed13093bf5ffb60fd6ca356b3ca776.tar.bz2
gengtype.c (write_func_for_structure): Split out ...
* gengtype.c (write_func_for_structure): Split out ... (output_type_enum): ... new function. Fix thinko accessing TYPE_PARAM_STRUCT data. Co-Authored-By: Daniel Jacobowitz <dan@codesourcery.com> From-SVN: r99020
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/gengtype.c67
2 files changed, 29 insertions, 45 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 534dba6..4c5843a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2005-04-29 Richard Henderson <rth@redhat.com>
+ Daniel Jacobowitz <dan@codesourcery.com>
+
+ * gengtype.c (write_func_for_structure): Split out ...
+ (output_type_enum): ... new function. Fix thinko accessing
+ TYPE_PARAM_STRUCT data.
+
2005-04-29 Tom Tromey <tromey@redhat.com>
* tree.c (build_block): Removed unused 'tags' argument.
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 0ff0c11..042f92f 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -1976,6 +1976,25 @@ write_types_process_field (type_p f, const struct walk_type_data *d)
}
}
+/* A subroutine of write_func_for_structure. Write the enum tag for S. */
+
+static void
+output_type_enum (outf_p of, type_p s)
+{
+ if (s->kind == TYPE_PARAM_STRUCT && s->u.s.line.file != NULL)
+ {
+ oprintf (of, ", gt_e_");
+ output_mangled_typename (of, s);
+ }
+ else if (UNION_OR_STRUCT_P (s) && s->u.s.line.file != NULL)
+ {
+ oprintf (of, ", gt_ggc_e_");
+ output_mangled_typename (of, s);
+ }
+ else
+ oprintf (of, ", gt_types_enum_last");
+}
+
/* For S, a structure that's part of ORIG_S, and using parameters
PARAM, write out a routine that:
- Takes a parameter, a void * but actually of type *S
@@ -2050,21 +2069,7 @@ write_func_for_structure (type_p orig_s, type_p s, type_p *param,
{
oprintf (d.of, ", x, gt_%s_", wtd->param_prefix);
output_mangled_typename (d.of, orig_s);
-
- if (orig_s->u.p->kind == TYPE_PARAM_STRUCT
- && orig_s->u.p->u.s.line.file != NULL)
- {
- oprintf (d.of, ", gt_e_");
- output_mangled_typename (d.of, orig_s);
- }
- else if (UNION_OR_STRUCT_P (orig_s)
- && orig_s->u.s.line.file != NULL)
- {
- oprintf (d.of, ", gt_ggc_e_");
- output_mangled_typename (d.of, orig_s);
- }
- else
- oprintf (d.of, ", gt_types_enum_last");
+ output_type_enum (d.of, orig_s);
}
oprintf (d.of, "))\n");
}
@@ -2075,21 +2080,7 @@ write_func_for_structure (type_p orig_s, type_p s, type_p *param,
{
oprintf (d.of, ", xlimit, gt_%s_", wtd->param_prefix);
output_mangled_typename (d.of, orig_s);
-
- if (orig_s->u.p->kind == TYPE_PARAM_STRUCT
- && orig_s->u.p->u.s.line.file != NULL)
- {
- oprintf (d.of, ", gt_e_");
- output_mangled_typename (d.of, orig_s);
- }
- else if (UNION_OR_STRUCT_P (orig_s)
- && orig_s->u.s.line.file != NULL)
- {
- oprintf (d.of, ", gt_ggc_e_");
- output_mangled_typename (d.of, orig_s);
- }
- else
- oprintf (d.of, ", gt_types_enum_last");
+ output_type_enum (d.of, orig_s);
}
oprintf (d.of, "))\n");
oprintf (d.of, " xlimit = (");
@@ -2115,21 +2106,7 @@ write_func_for_structure (type_p orig_s, type_p s, type_p *param,
{
oprintf (d.of, ", xprev, gt_%s_", wtd->param_prefix);
output_mangled_typename (d.of, orig_s);
-
- if (orig_s->u.p->kind == TYPE_PARAM_STRUCT
- && orig_s->u.p->u.s.line.file != NULL)
- {
- oprintf (d.of, ", gt_e_");
- output_mangled_typename (d.of, orig_s);
- }
- else if (UNION_OR_STRUCT_P (orig_s)
- && orig_s->u.s.line.file != NULL)
- {
- oprintf (d.of, ", gt_ggc_e_");
- output_mangled_typename (d.of, orig_s);
- }
- else
- oprintf (d.of, ", gt_types_enum_last");
+ output_type_enum (d.of, orig_s);
}
oprintf (d.of, ");\n");
oprintf (d.of, " }\n");