This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fix gengtype unaligned access, final
- From: Richard Henderson <rth at twiddle dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 29 Apr 2005 18:51:46 -0700
- Subject: fix gengtype unaligned access, final
Committed.
r~
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.
Index: gengtype.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gengtype.c,v
retrieving revision 1.72
diff -u -p -d -r1.72 gengtype.c
--- gengtype.c 13 Mar 2005 18:09:53 -0000 1.72
+++ gengtype.c 29 Apr 2005 21:39:41 -0000
@@ -1976,6 +1976,25 @@ write_types_process_field (type_p f, con
}
}
+/* 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,
{
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,
{
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,
{
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");