summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-10 02:04:13 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2010-11-10 02:04:13 +0000
commita25b333d8554e5937be5adc417f6300d4d62f1e4 (patch)
tree85614d17dea3ab509620a7f846f00f9d16e586d0
parent65a06b62c41c410a0b689156edd3b57feaaa0215 (diff)
downloadgcc-a25b333d8554e5937be5adc417f6300d4d62f1e4.tar.gz
* c-parser.c (c_parser_struct_declaration): Handle declaration
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
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-parser.c3
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/struct-semi-4.c7
4 files changed, 18 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 77b5e7e93b1..f602a02a36c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/c-parser.c b/gcc/c-parser.c
index e7403b2b182..484dab27f1b 100644
--- a/gcc/c-parser.c
+++ b/gcc/c-parser.c
@@ -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)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 19f58b119a9..651e921278b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..6f4dc7c0a7f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/struct-semi-4.c
@@ -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; }