aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2004-10-26 22:01:51 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2004-10-26 22:01:51 +0100
commit663174d3f5b4114e970566789a0a5840642c9ad7 (patch)
tree27131b16b103bcceb7957c8f4449fd9bdff56e04
parent9d069a4f02afe4e9831989733beda6373263925b (diff)
downloadgcc-663174d3f5b4114e970566789a0a5840642c9ad7.zip
gcc-663174d3f5b4114e970566789a0a5840642c9ad7.tar.gz
gcc-663174d3f5b4114e970566789a0a5840642c9ad7.tar.bz2
c-parse.in (datadef): Use pedwarn rather than error and warning for diagnostic in case of no...
* c-parse.in (datadef): Use pedwarn rather than error and warning for diagnostic in case of no declaration specifiers. testsuite: * gcc.dg/decl-nospec-1.c, gcc.dg/decl-nospec-2.c, gcc.dg/decl-nospec-3.c: New tests. From-SVN: r89605
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-parse.in6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/decl-nospec-1.c8
-rw-r--r--gcc/testsuite/gcc.dg/decl-nospec-2.c8
-rw-r--r--gcc/testsuite/gcc.dg/decl-nospec-3.c8
6 files changed, 35 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a99bb00..2851099 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-26 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * c-parse.in (datadef): Use pedwarn rather than error and warning
+ for diagnostic in case of no declaration specifiers.
+
2004-10-26 Richard Sandiford <rsandifo@redhat.com>
PR bootstrap/15747
diff --git a/gcc/c-parse.in b/gcc/c-parse.in
index e1146b0..1affab4 100644
--- a/gcc/c-parse.in
+++ b/gcc/c-parse.in
@@ -407,11 +407,7 @@ save_obstack_position:
datadef:
setspecs notype_initdecls ';'
- { if (pedantic)
- error ("ISO C forbids data definition with no type or storage class");
- else
- warning ("data definition has no type or storage class");
-
+ { pedwarn ("data definition has no type or storage class");
POP_DECLSPEC_STACK; }
| declspecs_nots setspecs notype_initdecls ';'
{ POP_DECLSPEC_STACK; }
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 4496f97..5dc3407 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-26 Joseph S. Myers <jsm@polyomino.org.uk>
+
+ * gcc.dg/decl-nospec-1.c, gcc.dg/decl-nospec-2.c,
+ gcc.dg/decl-nospec-3.c: New tests.
+
2004-10-26 Ziemowit Laski <zlaski@apple.com>
* objc.dg/super-class-3.m: New test.
diff --git a/gcc/testsuite/gcc.dg/decl-nospec-1.c b/gcc/testsuite/gcc.dg/decl-nospec-1.c
new file mode 100644
index 0000000..20067c1
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/decl-nospec-1.c
@@ -0,0 +1,8 @@
+/* Data definition with no type or storage class should receive a
+ pedwarn, rather than a warning which becomes an error with
+ -pedantic. Test with no options. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+foo(); /* { dg-warning "warning: data definition has no type or storage class" } */
diff --git a/gcc/testsuite/gcc.dg/decl-nospec-2.c b/gcc/testsuite/gcc.dg/decl-nospec-2.c
new file mode 100644
index 0000000..86e68c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/decl-nospec-2.c
@@ -0,0 +1,8 @@
+/* Data definition with no type or storage class should receive a
+ pedwarn, rather than a warning which becomes an error with
+ -pedantic. Test with -pedantic. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "-pedantic" } */
+
+foo(); /* { dg-warning "warning: data definition has no type or storage class" } */
diff --git a/gcc/testsuite/gcc.dg/decl-nospec-3.c b/gcc/testsuite/gcc.dg/decl-nospec-3.c
new file mode 100644
index 0000000..6c04e94
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/decl-nospec-3.c
@@ -0,0 +1,8 @@
+/* Data definition with no type or storage class should receive a
+ pedwarn, rather than a warning which becomes an error with
+ -pedantic. Test with -pedantic-errors. */
+/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
+/* { dg-do compile } */
+/* { dg-options "-pedantic-errors" } */
+
+foo(); /* { dg-error "error: data definition has no type or storage class" } */