Commit c802b1cf by Basile Starynkevitch Committed by Basile Starynkevitch

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
parent a9cc4458
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> 2009-10-05 Richard Guenther <rguenther@suse.de>
PR lto/41281 PR lto/41281
...@@ -141,8 +141,7 @@ static void oprintf (outf_p o, const char *S, ...) ...@@ -141,8 +141,7 @@ static void oprintf (outf_p o, const char *S, ...)
static outf_p output_files; static outf_p output_files;
/* The plugin input files and their number; in that case only /* The plugin input files and their number; in that case only
corresponding gt-<plugin>.h are generated in the current a single file is produced. */
directory. */
static char** plugin_files; static char** plugin_files;
static size_t nb_plugin_files; static size_t nb_plugin_files;
/* the generated plugin output name & file */ /* the generated plugin output name & file */
...@@ -2719,6 +2718,9 @@ write_types (outf_p output_header, type_p structures, type_p param_structs, ...@@ -2719,6 +2718,9 @@ write_types (outf_p output_header, type_p structures, type_p param_structs,
type_p s; type_p s;
oprintf (output_header, "\n/* %s*/\n", wtd->comment); 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) for (s = structures; s; s = s->next)
if (s->gc_used == GC_POINTED_TO if (s->gc_used == GC_POINTED_TO
|| s->gc_used == GC_MAYBE_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, ...@@ -2767,21 +2769,11 @@ write_types (outf_p output_header, type_p structures, type_p param_structs,
s->u.s.tag); s->u.s.tag);
continue; 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) for (s = param_structs; s; s = s->next)
if (s->gc_used == GC_POINTED_TO) if (s->gc_used == GC_POINTED_TO)
{ {
type_p * param = s->u.param_struct.param;
type_p stru = s->u.param_struct.stru; type_p stru = s->u.param_struct.stru;
/* Declare the marker procedure. */ /* Declare the marker procedure. */
...@@ -2795,7 +2787,41 @@ write_types (outf_p output_header, type_p structures, type_p param_structs, ...@@ -2795,7 +2787,41 @@ write_types (outf_p output_header, type_p structures, type_p param_structs,
s->u.s.tag); s->u.s.tag);
continue; 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) if (stru->kind == TYPE_LANG_STRUCT)
{ {
type_p ss; type_p ss;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment