bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: typo's in tests/testfiles.at


From: Paul Eggert
Subject: Re: typo's in tests/testfiles.at
Date: Mon, 18 Jul 2005 11:41:24 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

address@hidden writes:

> typo in glr-regression.at line 186 let it return 0 (EOF) at  (fscanf
> (yyin, "%49s", buf) != 1) or (sizeof buf - 1 <= strlen (buf))
> typo in cxx-type.at line 195 should it be `void yyerror()' ?

Thanks for catching those.  I installed the patch enclosed below.

> typo in calc.at line 291 let it return 77 at (exponent<0) error
> typo in calc.at line 318 let it return 77 at (!yyin) error
> typo in calc.at line 325 let it return 77 at (global_result != result)
> typo in glr-regression.at line 205 let it return 77 at fopen() error
> typo in glr-regression.at line 315 let it return 77 at fopen() error
> typo in cxx-type.at line 122 let it return 77 at (argc != 2) or (!freopen
> (argv[1], "r", stdin))
> typo in torture.at line 425 let it return 77 at (argc != 2) error
> line 325: these abort() ? why not just return yyparse() status or 77 ?

None of these should happen in a test run; if they do happen, we
should report an error instead of skipping the test.

> typo in cxx-type.at line 168 let it return 0 (EOF) at (i == sizeof buffer
> - 1)

That means the input cannot be handled by the lexer; it's better to
report an error.  (It shouldn't happen in any of our test cases.)

> typo in actions.at line 344 let it return yyparse() status 1 or 2
> malloc() failure simulation in yyinitGLRStack() in glr.c still returns
> yyparse() 1 instead of 2
> in calc.at let it return something else then 0/1/2
> and exit(77) is used in other places in the at files.

These should be fixed by the patch I just emailed you previously.

> _ There was (once) some gcc issue with `!!getenv()'

Those problems should be absent now that the tests always include
<stdlib.h> before invoking getenv.  Perhaps there might be a problem
with ancient hosts that lacked a proper stdlib.h (GCC 1, maybe?) but
let's not worry about them unless someone actually runs into them.

Thanks again for reporting these problems.

2005-07-18  Paul Eggert  <address@hidden>

        Fix yyerror / yylex test glitches noted by address@hidden
        * tests/cxx-type.at (_AT_TEST_GLR_CXXTYPES): Have yyerror return
        void, not int.
        * tests/glr-regression.at (Badly Collapsed GLR States):
        Likewise.
        (Improper handling of embedded actions and dollar(-N) in GLR parsers):
        yylex should return 0 at EOF rather than aborting.

Index: tests/cxx-type.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/cxx-type.at,v
retrieving revision 1.22
diff -p -u -r1.22 cxx-type.at
--- tests/cxx-type.at   18 Jul 2005 18:09:40 -0000      1.22
+++ tests/cxx-type.at   18 Jul 2005 18:34:21 -0000
@@ -56,7 +56,7 @@ $1
 # define ERROR_PARAMETERS char const *s
 #endif
   int yylex (LEX_PARAMETERS);
-  int yyerror (ERROR_PARAMETERS);
+  void yyerror (ERROR_PARAMETERS);
 %}
 
 %token TYPENAME ID
@@ -191,7 +191,7 @@ yylex (LEX_PARAMETERS)
     }
 }
 
-int
+void
 yyerror (ERROR_PARAMETERS)
 {
 #if YYPURE && YYLSP_NEEDED
Index: tests/glr-regression.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/glr-regression.at,v
retrieving revision 1.11
diff -p -u -r1.11 glr-regression.at
--- tests/glr-regression.at     18 Jul 2005 18:09:40 -0000      1.11
+++ tests/glr-regression.at     18 Jul 2005 18:34:21 -0000
@@ -34,7 +34,7 @@ AT_DATA_GRAMMAR([glr-regr1.y],
 #define YYSTYPE int
 static YYSTYPE exprMerge (YYSTYPE x0, YYSTYPE x1);
 int yylex (void);
-int yyerror (char const *msg);
+void yyerror (char const *msg);
 %}
 
 
@@ -70,7 +70,7 @@ main (void)
   return yyparse ();
 }
 
-int
+void
 yyerror (char const *msg)
 {
   fprintf (stderr, "%s\n", msg);
@@ -184,7 +184,7 @@ yylex (void)
     break;
   }
   if (fscanf (yyin, "%49s", buf) != 1)
-    abort ();
+    return 0;
   if (sizeof buf - 1 <= strlen (buf))
     abort ();
   s = (char *) malloc (strlen (buf) + 1);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]