]> git.saurik.com Git - bison.git/blobdiff - tests/cxx-type.at
(ATTRIBUTE_UNUSED): Remove, since it infringes on
[bison.git] / tests / cxx-type.at
index f9c093c55581fa3b867fec49471590b80ed0b503..e551ad019a54d5e67cc1a8ffb4ad756df45e96ef 100644 (file)
@@ -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
@@ -82,7 +82,7 @@ prog :
 
 stmt : expr ';'  $2    { $$ = ]$[1; }
      | decl      $3
-     | error ';'       { $$ = "<error>"; }
+     | error ';'       { static char error_msg[] = "<error>"; $$ = error_msg; }
      | '@'             { YYACCEPT; }
      ;
 
@@ -115,8 +115,8 @@ main (int argc, char **argv)
   if (argc != 2)
     abort ();
   if (!freopen (argv[1], "r", stdin))
-    abort ();
-  exit (yyparse ());
+    return 3;
+  return yyparse ();
 }
 
 int
@@ -178,9 +178,10 @@ yylex (LEX_PARAMETERS)
              }
            else
              {
+               static char empty_string[] = "";
                colNum += 1;
                tok = c;
-               yylval = "";
+               yylval = empty_string;
              }
 #if YYLSP_NEEDED
            yylloc.last_column = colNum-1;
@@ -191,7 +192,7 @@ yylex (LEX_PARAMETERS)
     }
 }
 
-int
+void
 yyerror (ERROR_PARAMETERS)
 {
 #if YYPURE && YYLSP_NEEDED
@@ -200,7 +201,6 @@ yyerror (ERROR_PARAMETERS)
     abort ();
 #endif
   fprintf (stderr, "%s\n", s);
-  return 0;
 }
 
 
@@ -319,60 +319,60 @@ m4_define([_AT_VERBOSE_GLR_STDERR],
 AT_SETUP([GLR: Resolve ambiguity, impure, no locations])
 _AT_TEST_GLR_CXXTYPES([],
                       [%dprec 1], [%dprec 2])
-AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
                 _AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Resolve ambiguity, impure, locations])
 _AT_TEST_GLR_CXXTYPES([%locations],[%dprec 1],[%dprec 2])
-AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
                 _AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Resolve ambiguity, pure, no locations])
 _AT_TEST_GLR_CXXTYPES([%pure-parser],
                       [%dprec 1], [%dprec 2])
-AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
                 _AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Resolve ambiguity, pure, locations])
 _AT_TEST_GLR_CXXTYPES([%pure-parser %locations],
                       [%dprec 1], [%dprec 2])
-AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
                 _AT_RESOLVED_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Merge conflicting parses, impure, no locations])
 _AT_TEST_GLR_CXXTYPES([],
                       [%merge <stmtMerge>], [%merge <stmtMerge>])
-AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
                 _AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Merge conflicting parses, impure, locations])
 _AT_TEST_GLR_CXXTYPES([%locations],
                       [%merge <stmtMerge>], [%merge <stmtMerge>])
-AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
                 _AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Merge conflicting parses, pure, no locations])
 _AT_TEST_GLR_CXXTYPES([%pure-parser],
                       [%merge <stmtMerge>], [%merge <stmtMerge>])
-AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
                 _AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR)
 AT_CLEANUP
 AT_SETUP([GLR: Merge conflicting parses, pure, locations])
 _AT_TEST_GLR_CXXTYPES([%pure-parser %locations],
                       [%merge <stmtMerge>],[%merge <stmtMerge>])
-AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
                 _AT_AMBIG_GLR_OUTPUT_WITH_LOC, _AT_GLR_STDERR)
 AT_CLEANUP
 
 AT_SETUP([GLR: Verbose messages, resolve ambiguity, impure, no locations])
 _AT_TEST_GLR_CXXTYPES([%error-verbose],
                       [%merge <stmtMerge>], [%merge <stmtMerge>])
-AT_PARSER_CHECK([[./types test-input | sed 's/  *$//']], 0,
+AT_PARSER_CHECK([[./types test-input]], 0,
                _AT_AMBIG_GLR_OUTPUT, _AT_VERBOSE_GLR_STDERR)
 AT_CLEANUP