From c802b1cf7d8298fbacb5248ca2d5cdc11fa276ed Mon Sep 17 00:00:00 2001 From: Basile Starynkevitch Date: Mon, 5 Oct 2009 15:59:11 +0000 Subject: gengtype.c (write_types): Moved call to write_func_for_structure into seperate loops. 2009-10-05 Basile Starynkevitch Rafael Espindola * gengtype.c (write_types): Moved call to write_func_for_structure into seperate loops. Co-Authored-By: Rafael Avila de Espindola From-SVN: r152455 --- gcc/ChangeLog | 7 +++++++ gcc/gengtype.c | 50 ++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 45 insertions(+), 12 deletions(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f3efe24..95a8b70 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ + +2009-10-05 Basile Starynkevitch + Rafael Espindola + + * gengtype.c (write_types): Moved call to write_func_for_structure + into seperate loops. + 2009-10-05 Richard Guenther PR lto/41281 diff --git a/gcc/gengtype.c b/gcc/gengtype.c index bb06736..e5b43dd 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -141,8 +141,7 @@ static void oprintf (outf_p o, const char *S, ...) static outf_p output_files; /* The plugin input files and their number; in that case only - corresponding gt-.h are generated in the current - directory. */ + a single file is produced. */ static char** plugin_files; static size_t nb_plugin_files; /* the generated plugin output name & file */ @@ -2719,6 +2718,9 @@ write_types (outf_p output_header, type_p structures, type_p param_structs, type_p s; oprintf (output_header, "\n/* %s*/\n", wtd->comment); + /* We first emit the macros and the declarations. Functions' code is + emitted afterwards. This is needed in plugin mode. */ + oprintf (output_header, "/* macros and declarations */\n"); for (s = structures; s; s = s->next) if (s->gc_used == GC_POINTED_TO || s->gc_used == GC_MAYBE_POINTED_TO) @@ -2767,21 +2769,11 @@ write_types (outf_p output_header, type_p structures, type_p param_structs, s->u.s.tag); continue; } - - if (s->kind == TYPE_LANG_STRUCT) - { - type_p ss; - for (ss = s->u.s.lang_struct; ss; ss = ss->next) - write_func_for_structure (s, ss, NULL, wtd); - } - else - write_func_for_structure (s, s, NULL, wtd); } for (s = param_structs; s; s = s->next) if (s->gc_used == GC_POINTED_TO) { - type_p * param = s->u.param_struct.param; type_p stru = s->u.param_struct.stru; /* Declare the marker procedure. */ @@ -2795,7 +2787,41 @@ write_types (outf_p output_header, type_p structures, type_p param_structs, s->u.s.tag); continue; } + } + + /* At last we emit the functions code. */ + oprintf (output_header, "\n/* functions code */\n"); + for (s = structures; s; s = s->next) + if (s->gc_used == GC_POINTED_TO + || s->gc_used == GC_MAYBE_POINTED_TO) + { + options_p opt; + if (s->gc_used == GC_MAYBE_POINTED_TO + && s->u.s.line.file == NULL) + continue; + for (opt = s->u.s.opt; opt; opt = opt->next) + if (strcmp (opt->name, "ptr_alias") == 0) + break; + if (opt) + continue; + + if (s->kind == TYPE_LANG_STRUCT) + { + type_p ss; + for (ss = s->u.s.lang_struct; ss; ss = ss->next) + write_func_for_structure (s, ss, NULL, wtd); + } + else + write_func_for_structure (s, s, NULL, wtd); + } + for (s = param_structs; s; s = s->next) + if (s->gc_used == GC_POINTED_TO) + { + type_p *param = s->u.param_struct.param; + type_p stru = s->u.param_struct.stru; + if (stru->u.s.line.file == NULL) + continue; if (stru->kind == TYPE_LANG_STRUCT) { type_p ss; -- cgit v1.1