diff options
| -rw-r--r-- | gcc/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/c-parse.in | 6 | ||||
| -rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/decl-nospec-1.c | 8 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/decl-nospec-2.c | 8 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/decl-nospec-3.c | 8 |
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" } */ |
