From 2d82317df0ed13093bf5ffb60fd6ca356b3ca776 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Fri, 29 Apr 2005 14:42:27 -0700 Subject: [PATCH] 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 From-SVN: r99020 --- gcc/ChangeLog | 7 ++++++ gcc/gengtype.c | 67 +++++++++++++++++--------------------------------- 2 files changed, 29 insertions(+), 45 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 534dba62dc0..4c5843aba37 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2005-04-29 Richard Henderson + Daniel Jacobowitz + + * 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 * tree.c (build_block): Removed unused 'tags' argument. diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 0ff0c116e62..042f92f886b 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"); -- 2.30.2