Message ID | 1380044971-11810-2-git-send-email-dmalcolm@redhat.com |
---|---|
State | New |
Headers | show |
On 09/24/13 11:49, David Malcolm wrote: > Classes containing access-control keywords such as "public:" > confuse struct_field_seq, leading it to call consume_until_eos > i.e. ignore text until after the next semicolon. > > This leads to the first field after an access-control keyword > being ignored by gengtype. This can be seen in: > http://gcc.gnu.org/ml/gcc-patches/2013-09/msg01532.html > where the autogenerated marking function erroneously omitted the > traversal of the "callees" field of cgraph_node *. > > This patch fixes up struct_field_seq to gracefully ignore such > keywords, thus fixing gengtype so that it does not erroneouly omit > fields of such a class. > > * gengtype-parse.c (struct_field_seq): Ignore access-control > keywords ("public:" etc). OK. Jeff
On Tue, 2013-10-15 at 12:36 -0600, Jeff Law wrote: > On 09/24/13 11:49, David Malcolm wrote: [...] > > * gengtype-parse.c (struct_field_seq): Ignore access-control > > keywords ("public:" etc). > OK. Thanks; committed to trunk as r203708.
diff --git a/gcc/gengtype-parse.c b/gcc/gengtype-parse.c index 68d372e..e5204c1 100644 --- a/gcc/gengtype-parse.c +++ b/gcc/gengtype-parse.c @@ -733,6 +733,17 @@ struct_field_seq (void) { ty = type (&opts, true); + /* Ignore access-control keywords ("public:" etc). */ + while (!ty && token () == IGNORABLE_CXX_KEYWORD) + { + const char *keyword = advance (); + if (strcmp (keyword, "public:") != 0 + && strcmp (keyword, "private:") != 0 + && strcmp (keyword, "protected:") != 0) + break; + ty = type (&opts, true); + } + if (!ty || token () == ':') { consume_until_eos ();