This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] gengtype: support empty GTY-marked structs
- From: David Malcolm <dmalcolm at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 05 Nov 2013 11:20:20 -0500
- Subject: [PATCH] gengtype: support empty GTY-marked structs
- Authentication-results: sourceware.org; auth=none
I'm attaching a patch which allows gengtype to handle GTY-marked structs
that have no fields. These are useful for supporting the "have a
subclass for every gimple code" idea from:
http://gcc.gnu.org/ml/gcc-patches/2013-11/msg00057.html
(and am bootstrapping a patch that does that, which needed this one for
gengtype to cope).
Successfully bootstrapped®tested on x86_64-unknown-linux-gnu.
OK for trunk?
commit 030c6bd6856ee175adf7cf60cb44b2f2091360d0
Author: David Malcolm <dmalcolm@redhat.com>
Date: Mon Nov 4 21:21:23 2013 -0500
gengtype: support empty structs
gcc/
* gengtype-parse.c (struct_field_seq): Support empty structs.
diff --git a/gcc/gengtype-parse.c b/gcc/gengtype-parse.c
index f480503..8328e3a 100644
--- a/gcc/gengtype-parse.c
+++ b/gcc/gengtype-parse.c
@@ -730,7 +730,7 @@ declarator (type_p ty, const char **namep, options_p *optsp,
(
type bitfield ';'
| type declarator bitfield? ( ',' declarator bitfield? )+ ';'
- )+
+ )*
Knows that such declarations must end with a close brace (or,
erroneously, at EOF).
@@ -744,7 +744,7 @@ struct_field_seq (void)
const char *name;
bool another;
- do
+ while (token () != '}' && token () != EOF_TOKEN)
{
ty = type (&opts, true);
@@ -787,7 +787,6 @@ struct_field_seq (void)
}
while (another);
}
- while (token () != '}' && token () != EOF_TOKEN);
return nreverse_pairs (f);
}