OSDN Git Service

* c-parser.c (c_parser_struct_declaration): Handle declaration
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Nov 2010 02:04:13 +0000 (02:04 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 10 Nov 2010 02:04:13 +0000 (02:04 +0000)
specifiers followed by CPP_CLOSE_BRACE.

testsuite:
* gcc.dg/struct-semi-4.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166516 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/struct-semi-4.c [new file with mode: 0644]

index 77b5e7e..f602a02 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-09  Joseph Myers  <joseph@codesourcery.com>
+
+       * c-parser.c (c_parser_struct_declaration): Handle declaration
+       specifiers followed by CPP_CLOSE_BRACE.
+
 2010-11-09  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * config/rs6000/rs6000.md (floatsi<mode>2_lfiwax): Rewrite so
index e7403b2..484dab2 100644 (file)
@@ -2395,7 +2395,8 @@ c_parser_struct_declaration (c_parser *parser)
       return NULL_TREE;
     }
   finish_declspecs (specs);
-  if (c_parser_next_token_is (parser, CPP_SEMICOLON))
+  if (c_parser_next_token_is (parser, CPP_SEMICOLON)
+      || c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
     {
       tree ret;
       if (!specs->type_seen_p)
index 19f58b1..651e921 100644 (file)
@@ -1,3 +1,7 @@
+2010-11-09  Joseph Myers  <joseph@codesourcery.com>
+
+       * gcc.dg/struct-semi-4.c: New test.
+
 2010-11-09  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        * gcc.target/powerpc/ppc-fpconv-11.c: Use -mcpu=power5+, not
diff --git a/gcc/testsuite/gcc.dg/struct-semi-4.c b/gcc/testsuite/gcc.dg/struct-semi-4.c
new file mode 100644 (file)
index 0000000..6f4dc7c
--- /dev/null
@@ -0,0 +1,7 @@
+/* Test for missing semicolons in structures: anonymous structures and
+   similar cases.  */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+struct s { struct { int a; } }; /* { dg-warning "no semicolon" } */
+int *f (struct s *p) { return &p->a; }