Support empty structs in gengtype
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 5 Nov 2013 18:55:22 +0000 (18:55 +0000)
committerDavid Malcolm <dmalcolm@gcc.gnu.org>
Tue, 5 Nov 2013 18:55:22 +0000 (18:55 +0000)
gcc/
* gengtype-parse.c (struct_field_seq): Support empty structs.

From-SVN: r204411

gcc/ChangeLog
gcc/gengtype-parse.c

index 9ad90d7..4ff3f05 100644 (file)
@@ -1,3 +1,7 @@
+2013-11-05  David Malcolm  <dmalcolm@redhat.com>
+
+       * gengtype-parse.c (struct_field_seq): Support empty structs.
+
 2013-11-05  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/t-rtems (MULTILIB_MATCHES): Fix option typos.
index f480503..8328e3a 100644 (file)
@@ -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);
 }