diff options
author | Basile Starynkevitch <basile@starynkevitch.net> | 2009-09-22 21:00:09 +0000 |
---|---|---|
committer | Rafael Espindola <espindola@gcc.gnu.org> | 2009-09-22 21:00:09 +0000 |
commit | 0182d01649c1bebd6d912bc87945f1f22d5ce601 (patch) | |
tree | fac708cb168bf8782958d44f718295e0b522e571 /gcc | |
parent | d40a19da1370ab4930788ede0a5c9e9171a16656 (diff) | |
download | gcc-0182d01649c1bebd6d912bc87945f1f22d5ce601.zip gcc-0182d01649c1bebd6d912bc87945f1f22d5ce601.tar.gz gcc-0182d01649c1bebd6d912bc87945f1f22d5ce601.tar.bz2 |
gengtype.c (write_types, [...]): Add the output_header argument.
2009-09-22 Basile Starynkevitch <basile@starynkevitch.net>
Rafael Avila de Espindola <espindola@google.com>
* gengtype.c (write_types, write_local): Add the output_header
argument. Update all callers.
Co-Authored-By: Rafael Avila de Espindola <espindola@google.com>
From-SVN: r152046
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gengtype.c | 64 |
2 files changed, 39 insertions, 31 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5a3554c..9ec0799 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-09-22 Basile Starynkevitch <basile@starynkevitch.net> + Rafael Avila de Espindola <espindola@google.com> + + * gengtype.c (write_types, write_local): Add the output_header + argument. Update all callers. + 2009-09-22 Dodji Seketeli <dodji@redhat.com> * dwarf2out.c (template_parameter_pack_die, diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 69fa68d..0ee9c48 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -1876,14 +1876,16 @@ static void write_func_for_structure const struct write_types_data *wtd); static void write_types_process_field (type_p f, const struct walk_type_data *d); -static void write_types (type_p structures, +static void write_types (outf_p output_header, + type_p structures, type_p param_structs, const struct write_types_data *wtd); static void write_types_local_process_field (type_p f, const struct walk_type_data *d); static void write_local_func_for_structure (type_p orig_s, type_p s, type_p * param); -static void write_local (type_p structures, +static void write_local (outf_p output_header, + type_p structures, type_p param_structs); static void write_enum_defn (type_p structures, type_p param_structs); static int contains_scalar_p (type_p t); @@ -2698,12 +2700,12 @@ write_func_for_structure (type_p orig_s, type_p s, type_p *param, /* Write out marker routines for STRUCTURES and PARAM_STRUCTS. */ static void -write_types (type_p structures, type_p param_structs, +write_types (outf_p output_header, type_p structures, type_p param_structs, const struct write_types_data *wtd) { type_p s; - oprintf (header_file, "\n/* %s*/\n", wtd->comment); + oprintf (output_header, "\n/* %s*/\n", wtd->comment); for (s = structures; s; s = s->next) if (s->gc_used == GC_POINTED_TO || s->gc_used == GC_MAYBE_POINTED_TO) @@ -2714,13 +2716,13 @@ write_types (type_p structures, type_p param_structs, && s->u.s.line.file == NULL) continue; - oprintf (header_file, "#define gt_%s_", wtd->prefix); - output_mangled_typename (header_file, s); - oprintf (header_file, "(X) do { \\\n"); - oprintf (header_file, + oprintf (output_header, "#define gt_%s_", wtd->prefix); + output_mangled_typename (output_header, s); + oprintf (output_header, "(X) do { \\\n"); + oprintf (output_header, " if (X != NULL) gt_%sx_%s (X);\\\n", wtd->prefix, s->u.s.tag); - oprintf (header_file, + oprintf (output_header, " } while (0)\n"); for (opt = s->u.s.opt; opt; opt = opt->next) @@ -2730,7 +2732,7 @@ write_types (type_p structures, type_p param_structs, if (t->kind == TYPE_STRUCT || t->kind == TYPE_UNION || t->kind == TYPE_LANG_STRUCT) - oprintf (header_file, + oprintf (output_header, "#define gt_%sx_%s gt_%sx_%s\n", wtd->prefix, s->u.s.tag, wtd->prefix, t->u.s.tag); else @@ -2742,7 +2744,7 @@ write_types (type_p structures, type_p param_structs, continue; /* Declare the marker procedure only once. */ - oprintf (header_file, + oprintf (output_header, "extern void gt_%sx_%s (void *);\n", wtd->prefix, s->u.s.tag); @@ -2770,9 +2772,9 @@ write_types (type_p structures, type_p param_structs, type_p stru = s->u.param_struct.stru; /* Declare the marker procedure. */ - oprintf (header_file, "extern void gt_%s_", wtd->prefix); - output_mangled_typename (header_file, s); - oprintf (header_file, " (void *);\n"); + oprintf (output_header, "extern void gt_%s_", wtd->prefix); + output_mangled_typename (output_header, s); + oprintf (output_header, " (void *);\n"); if (stru->u.s.line.file == NULL) { @@ -2887,13 +2889,13 @@ write_local_func_for_structure (type_p orig_s, type_p s, type_p *param) /* Write out local marker routines for STRUCTURES and PARAM_STRUCTS. */ static void -write_local (type_p structures, type_p param_structs) +write_local (outf_p output_header, type_p structures, type_p param_structs) { type_p s; - if (!header_file) + if (!output_header) return; - oprintf (header_file, "\n/* Local pointer-walking routines. */\n"); + oprintf (output_header, "\n/* Local pointer-walking routines. */\n"); for (s = structures; s; s = s->next) if (s->gc_used == GC_POINTED_TO || s->gc_used == GC_MAYBE_POINTED_TO) @@ -2911,11 +2913,11 @@ write_local (type_p structures, type_p param_structs) || t->kind == TYPE_UNION || t->kind == TYPE_LANG_STRUCT) { - oprintf (header_file, "#define gt_pch_p_"); - output_mangled_typename (header_file, s); - oprintf (header_file, " gt_pch_p_"); - output_mangled_typename (header_file, t); - oprintf (header_file, "\n"); + oprintf (output_header, "#define gt_pch_p_"); + output_mangled_typename (output_header, s); + oprintf (output_header, " gt_pch_p_"); + output_mangled_typename (output_header, t); + oprintf (output_header, "\n"); } else error_at_line (&s->u.s.line, @@ -2926,9 +2928,9 @@ write_local (type_p structures, type_p param_structs) continue; /* Declare the marker procedure only once. */ - oprintf (header_file, "extern void gt_pch_p_"); - output_mangled_typename (header_file, s); - oprintf (header_file, + oprintf (output_header, "extern void gt_pch_p_"); + output_mangled_typename (output_header, s); + oprintf (output_header, "\n (void *, void *, gt_pointer_operator, void *);\n"); if (s->kind == TYPE_LANG_STRUCT) @@ -2948,9 +2950,9 @@ write_local (type_p structures, type_p param_structs) type_p stru = s->u.param_struct.stru; /* Declare the marker procedure. */ - oprintf (header_file, "extern void gt_pch_p_"); - output_mangled_typename (header_file, s); - oprintf (header_file, + oprintf (output_header, "extern void gt_pch_p_"); + output_mangled_typename (output_header, s); + oprintf (output_header, "\n (void *, void *, gt_pointer_operator, void *);\n"); if (stru->u.s.line.file == NULL) @@ -3689,9 +3691,9 @@ main (int argc, char **argv) open_base_files (); write_enum_defn (structures, param_structs); - write_types (structures, param_structs, &ggc_wtd); - write_types (structures, param_structs, &pch_wtd); - write_local (structures, param_structs); + write_types (header_file, structures, param_structs, &ggc_wtd); + write_types (header_file, structures, param_structs, &pch_wtd); + write_local (header_file, structures, param_structs); write_roots (variables); write_rtx_next (); close_output_files (); |