This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Testcases update for new C parser, batch 2


This patch contains the remaining testcase changes to account for the
new C parser that don't need to be applied together with the new
parser itself: that is, which add alternatives to existing diagnostic
patterns rather than adding or removing diagnostics altogether.

The modified tests pass on mainline.  Applied to mainline.

With an untested version of the new parser slightly modified from that
last sent (to avoid extra syntax error messages at EOF when EOF is
reached in error recovery), the new parser's different error recovery
should just add two error messages and remove one in the testsuite.
Those I consider reasonable differences in diagnostics that can be
dealt with by changing the tests at the same time as replacing the old
parser.  When the old parser is replaced,
gcc.dg/noncompile/920923-1.c's

/* This test case contains a large number of syntactic errors.  We
   believe the intent of the test is that the compiler simply not
   crash.  The set of error messages reported is different when the C
   parser is generated with bison 1.50 than 1.35.  It is not worth
   attempting to prevent this.  Instead, we use a single dg-error with
   a regexp that will match _all_ the errors indiscriminately.  The
   old error/warning/etc markers are kept around for reference, but
   disabled.

   Revisit after new (recursive descent) parser is implemented for C.
   -- zw 2002-10-17  */

can also be addressed as the errors produced will then be predictable.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

2004-11-05  Joseph S. Myers  <joseph@codesourcery.com>

	* gcc.dg/20040910-1.c, gcc.dg/cpp/digraph2.c,
	gcc.dg/cpp/direct2.c, gcc.dg/cpp/direct2s.c,
	gcc.dg/cpp/separate-1.c, gcc.dg/noncompile/951123-1.c,
	gcc.dg/noncompile/971104-1.c, gcc.dg/noncompile/990416-1.c: Adjust
	expected messages for new parser.

diff -rupN GCC.orig/gcc/testsuite/gcc.dg/20040910-1.c GCC/gcc/testsuite/gcc.dg/20040910-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/20040910-1.c	2004-10-31 10:17:58.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/20040910-1.c	2004-11-05 13:37:22.000000000 +0000
@@ -1,2 +1,2 @@
 /* Tests error recovery for invalid code.  */
-__attribute__((foo)  int f (){} /* { dg-error "(parse|syntax) error before 'int'" } */
+__attribute__((foo)  int f (){} /* { dg-error "(parse error|syntax error|expected '\\)') before 'int'" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/digraph2.c GCC/gcc/testsuite/gcc.dg/cpp/digraph2.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/digraph2.c	2003-02-04 00:27:55.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/digraph2.c	2004-11-05 13:37:54.000000000 +0000
@@ -9,7 +9,7 @@
 int main (int argc, char *argv[])
 {
   return 0;
-%>				/* { dg-error "(parse|syntax) error" } */
+%>				/* { dg-error "parse error|syntax error|expected" } */
 
 /* Place this after main () so we get to test both the compiler above
    and the preprocessor below.  */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/direct2.c GCC/gcc/testsuite/gcc.dg/cpp/direct2.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/direct2.c	2004-10-27 10:35:06.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/direct2.c	2004-11-04 16:50:32.000000000 +0000
@@ -12,21 +12,21 @@
 
 HASH include "somerandomfile" /*{ dg-error "stray" "non-include" }*/
 /*{ dg-bogus "No such" "don't execute non-include" { target *-*-* } 13 }*/
-int resync_parser_1; /*{ dg-error "parse|syntax" "" }*/
+int resync_parser_1; /*{ dg-error "parse|syntax|expected" "" }*/
 
-HASHINCLUDE <somerandomfile> /*{ dg-error "stray" "non-include 2" }*/
+HASHINCLUDE <somerandomfile> /*{ dg-error "stray|expected" "non-include 2" }*/
 /*{ dg-bogus "No such" "don't execute non-include 2" { target *-*-* } 17 }*/
 int resync_parser_2;
 
 void g1 ()
 {
-HASH define X 1 /* { dg-error "stray|undeclared|parse|syntax|for each" "# from macro" } */
+HASH define X 1 /* { dg-error "stray|undeclared|parse|syntax|expected|for each" "# from macro" } */
   int resync_parser_3;
 }
 
 void g2 ()
 {
-HASHDEFINE  Y 1 /* { dg-error "stray|undeclared|parse|syntax|for each" "#define from macro" } */
+HASHDEFINE  Y 1 /* { dg-error "stray|undeclared|parse|syntax|expected|for each" "#define from macro" } */
   int resync_parser_4;
 }
 
@@ -42,5 +42,5 @@ void f ()
 #define slashstar /##*
 #define starslash *##/
 
-slashstar starslash /* { dg-error "(parse|syntax) error" "not a comment" } */
+slashstar starslash /* { dg-error "parse error|syntax error|expected" "not a comment" } */
 /* { dg-warning "does not give" "paste warning(s)" { target *-*-* } 45 } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/direct2s.c GCC/gcc/testsuite/gcc.dg/cpp/direct2s.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/direct2s.c	2004-10-27 10:35:06.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/direct2s.c	2004-11-04 16:50:53.000000000 +0000
@@ -14,21 +14,21 @@
 
 HASH include "somerandomfile" /*{ dg-error "stray" "non-include" }*/
 /*{ dg-bogus "No such" "don't execute non-include" { target *-*-* } 15 }*/
-int resync_parser_1; /*{ dg-error "parse|syntax" "" }*/
+int resync_parser_1; /*{ dg-error "parse|syntax|expected" "" }*/
 
-HASHINCLUDE <somerandomfile> /*{ dg-error "stray" "non-include 2" }*/
+HASHINCLUDE <somerandomfile> /*{ dg-error "stray|expected" "non-include 2" }*/
 /*{ dg-bogus "No such" "don't execute non-include 2" { target *-*-* } 18 }*/
 int resync_parser_2;
 
 void g1 ()
 {
-HASH define X 1 /* { dg-error "stray|undeclared|parse|syntax|for each" "# from macro" } */
+HASH define X 1 /* { dg-error "stray|undeclared|parse|syntax|expected|for each" "# from macro" } */
   int resync_parser_3;
 }
 
 void g2 ()
 {
-HASHDEFINE  Y 1 /* { dg-error "stray|undeclared|parse|syntax|for each" "#define from macro" } */
+HASHDEFINE  Y 1 /* { dg-error "stray|undeclared|parse|syntax|expected|for each" "#define from macro" } */
   int resync_parser_4;
 }
 
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/cpp/separate-1.c GCC/gcc/testsuite/gcc.dg/cpp/separate-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/cpp/separate-1.c	2003-09-14 13:52:56.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/cpp/separate-1.c	2004-11-05 15:46:25.000000000 +0000
@@ -8,8 +8,8 @@
 
 #define FOO()
 
-int FOO( /* { dg-error "(parse|syntax) error" "error on this line" } */
+int FOO( /* { dg-error "parse error|syntax error|expected" "error on this line" } */
 	), bar;
 
-int baz FOO /* { dg-error "(parse|syntax) error" "error on this line" } */
+int baz FOO /* { dg-error "parse error|syntax error|expected" "error on this line" } */
 ; /* { dg-warning "no type or storage class" "warning on this line" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/noncompile/951123-1.c GCC/gcc/testsuite/gcc.dg/noncompile/951123-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/noncompile/951123-1.c	2003-02-04 00:27:55.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/noncompile/951123-1.c	2004-11-05 13:38:28.000000000 +0000
@@ -1,2 +1,2 @@
 struct S { int a; int b[2]; };
-struct S x = { 0, [0]; };    /* { dg-error "array index|near|(parse|syntax)" } */
+struct S x = { 0, [0]; };    /* { dg-error "array index|near|parse|syntax|expected" } */
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/noncompile/971104-1.c GCC/gcc/testsuite/gcc.dg/noncompile/971104-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/noncompile/971104-1.c	2004-08-03 08:19:04.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/noncompile/971104-1.c	2004-11-05 15:46:43.000000000 +0000
@@ -24,6 +24,6 @@ static void up(int sem){
     printf("%s had processes sleeping on it!\n",
     ({ "MUTEX     ", "BARB_SEM 1", "BARB_SEM 2", "CUST_SEM 1",
        "CUST_SEM 2", "WAIT_SEM 1", "WAIT_SEM 2", "WAIT_SEM 3",
-       "WAIT_SEM 4"}	 /* { dg-error "(parse|syntax) error" } */
+       "WAIT_SEM 4"}	 /* { dg-error "parse error|syntax error|expected" } */
 	[( sb.sem_num )]) );
 }
diff -rupN GCC.orig/gcc/testsuite/gcc.dg/noncompile/990416-1.c GCC/gcc/testsuite/gcc.dg/noncompile/990416-1.c
--- GCC.orig/gcc/testsuite/gcc.dg/noncompile/990416-1.c	2004-08-03 08:19:04.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/noncompile/990416-1.c	2004-11-05 15:46:55.000000000 +0000
@@ -2,7 +2,7 @@ extern void *memcpy (void *, const void 
 typedef int word_type;
    
 static void
-copy_reg (unsigned int reg, frame_state *udata,	/* { dg-error "parse|syntax" } */
+copy_reg (unsigned int reg, frame_state *udata,	/* { dg-error "parse|syntax|expected" } */
 	  frame_state *target_udata)
 {  
   word_type *preg = get_reg_addr (reg, udata, 0);	/* { dg-error "undeclared|function|without a cast" } */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]