diff options
author | Basile Starynkevitch <basile@starynkevitch.net> | 2009-10-05 15:59:11 +0000 |
---|---|---|
committer | Basile Starynkevitch <bstarynk@gcc.gnu.org> | 2009-10-05 15:59:11 +0000 |
commit | c802b1cf7d8298fbacb5248ca2d5cdc11fa276ed (patch) | |
tree | 3240d406d5845a99fa293c7201c131ca04555c81 /gcc | |
parent | a9cc44581ac57b7138d7dea22fe4acc7c8a9f1ed (diff) | |
download | gcc-c802b1cf7d8298fbacb5248ca2d5cdc11fa276ed.zip gcc-c802b1cf7d8298fbacb5248ca2d5cdc11fa276ed.tar.gz gcc-c802b1cf7d8298fbacb5248ca2d5cdc11fa276ed.tar.bz2 |
gengtype.c (write_types): Moved call to write_func_for_structure into seperate loops.
2009-10-05 Basile Starynkevitch <basile@starynkevitch.net>
Rafael Espindola <espindola@google.com>
* gengtype.c (write_types): Moved call to write_func_for_structure
into seperate loops.
Co-Authored-By: Rafael Avila de Espindola <espindola@google.com>
From-SVN: r152455
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/gengtype.c | 50 |
2 files changed, 45 insertions, 12 deletions
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 <basile@starynkevitch.net> + Rafael Espindola <espindola@google.com> + + * gengtype.c (write_types): Moved call to write_func_for_structure + into seperate loops. + 2009-10-05 Richard Guenther <rguenther@suse.de> 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-<plugin>.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; |