c-parse.in (datadef): Use pedwarn rather than error and warning for diagnostic in...
authorJoseph Myers <jsm@polyomino.org.uk>
Tue, 26 Oct 2004 21:01:51 +0000 (22:01 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Tue, 26 Oct 2004 21:01:51 +0000 (22:01 +0100)
* 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

gcc/ChangeLog
gcc/c-parse.in
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/decl-nospec-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/decl-nospec-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/decl-nospec-3.c [new file with mode: 0644]

index a99bb0051eb13bb22852680ebff95f5322a32e85..2851099342c106c443a9cd100e9da908fdb493da 100644 (file)
@@ -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
index e1146b0a49df3de2d6dd2a2b158ba27668ee6d52..1affab4e7b8f29d138bbc6fcf9055aef21a432b9 100644 (file)
@@ -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; }
index 4496f97ce8733ae9501eea5709c4199e6ae4bb28..5dc3407411b4bbda2645c76e5f58daa556db0b28 100644 (file)
@@ -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 (file)
index 0000000..20067c1
--- /dev/null
@@ -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 (file)
index 0000000..86e68c0
--- /dev/null
@@ -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 (file)
index 0000000..6c04e94
--- /dev/null
@@ -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" } */