aboutsummaryrefslogtreecommitdiff
path: root/gcc/gengtype.c
diff options
context:
space:
mode:
authorBasile Starynkevitch <basile@starynkevitch.net>2011-04-19 09:45:18 +0000
committerBasile Starynkevitch <basile@starynkevitch.net>2011-04-19 09:45:18 +0000
commit1059d094c380517f5e8182f8028396e989f8db2d (patch)
treef427734c80d0948a238a706be5a77352265369e2 /gcc/gengtype.c
parent71433c0ab225e866d8907c3bc931c887f1cdd693 (diff)
2011-04-19 Basile Starynkevitch <basile@starynkevitch.net>
* gengtype.h: Updated copyright year. (struct input_file_st): Add inpisplugin field. (type_fileloc): New function. * gengtype.c (write_typed_struct_alloc_def): Add gcc_assert. (write_typed_alloc_defns): Ditto. Don't output for plugin files. (write_typed_alloc_defns): Don't output for plugin files. (input_file_by_name): Clear inpisplugin field. (main): Set inpisplugin field for plugin files. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@172705 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gengtype.c')
-rw-r--r--gcc/gengtype.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/gcc/gengtype.c b/gcc/gengtype.c
index 20c5d45727c..cb0c77b241d 100644
--- a/gcc/gengtype.c
+++ b/gcc/gengtype.c
@@ -4235,6 +4235,7 @@ write_typed_struct_alloc_def (outf_p f,
enum alloc_quantity quantity,
enum alloc_zone zone)
{
+ gcc_assert (UNION_OR_STRUCT_P (s));
write_typed_alloc_def (f, variable_size_p (s), get_type_specifier (s),
s->u.s.tag, allocator_type, quantity, zone);
}
@@ -4269,6 +4270,12 @@ write_typed_alloc_defns (outf_p f,
{
if (!USED_BY_TYPED_GC_P (s))
continue;
+ gcc_assert (UNION_OR_STRUCT_P (s));
+ /* In plugin mode onput output ggc_alloc macro definitions
+ relevant to plugin input files. */
+ if (nb_plugin_files > 0
+ && ((s->u.s.line.file == NULL) || !s->u.s.line.file->inpisplugin))
+ continue;
write_typed_struct_alloc_def (f, s, "", single, any_zone);
write_typed_struct_alloc_def (f, s, "cleared_", single, any_zone);
write_typed_struct_alloc_def (f, s, "vec_", vector, any_zone);
@@ -4287,6 +4294,14 @@ write_typed_alloc_defns (outf_p f,
s = p->type;
if (!USED_BY_TYPED_GC_P (s) || (strcmp (p->name, s->u.s.tag) == 0))
continue;
+ /* In plugin mode onput output ggc_alloc macro definitions
+ relevant to plugin input files. */
+ if (nb_plugin_files > 0)
+ {
+ struct fileloc* filoc = type_fileloc(s);
+ if (!filoc || !filoc->file->inpisplugin)
+ continue;
+ };
write_typed_typedef_alloc_def (f, p, "", single, any_zone);
write_typed_typedef_alloc_def (f, p, "cleared_", single, any_zone);
write_typed_typedef_alloc_def (f, p, "vec_", vector, any_zone);
@@ -4814,6 +4829,7 @@ input_file_by_name (const char* name)
f = XCNEWVAR (input_file, sizeof (input_file)+namlen+2);
f->inpbitmap = 0;
f->inpoutf = NULL;
+ f->inpisplugin = false;
strcpy (f->inpname, name);
slot = htab_find_slot (input_file_htab, f, INSERT);
gcc_assert (slot != NULL);
@@ -4945,8 +4961,11 @@ main (int argc, char **argv)
/* Parse our plugin files and augment the state. */
for (ix = 0; ix < nb_plugin_files; ix++)
- parse_file (get_input_file_name (plugin_files[ix]));
-
+ {
+ input_file* pluginput = plugin_files [ix];
+ pluginput->inpisplugin = true;
+ parse_file (get_input_file_name (pluginput));
+ }
if (hit_error)
return 1;