]> git.saurik.com Git - bison.git/blobdiff - tests/torture.at
tests: support api.prefix.
[bison.git] / tests / torture.at
index 91b3b1b93e1183381b3a0002de9055ac6660577c..313df345ed494f3c81e0c43ea1ff75a9d13201e8 100644 (file)
@@ -1,5 +1,6 @@
 # Torturing Bison.                                    -*- Autotest -*-
-# Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2009 Free Software
+
+# Copyright (C) 2001-2002, 2004-2007, 2009-2012 Free Software
 # Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
@@ -41,7 +42,8 @@ esac])
 # Create FILE-NAME, containing a self checking parser for a huge
 # triangular grammar.
 m4_define([AT_DATA_TRIANGULAR_GRAMMAR],
-[AT_DATA([[gengram.pl]],
+[AT_BISON_OPTION_PUSHDEFS
+AT_DATA([[gengram.pl]],
 [[#! /usr/bin/perl -w
 
 use strict;
@@ -55,8 +57,8 @@ print <<EOF;
 #include <stdio.h>
 #include <stdlib.h>
 
-static int yylex (void);
-static void yyerror (const char *msg);
+]AT_YYLEX_DECLARE[
+]AT_YYERROR_DECLARE[
 %}
 %union
 {
@@ -126,6 +128,7 @@ main (void)
 }
 EOF
 ]])
+AT_BISON_OPTION_POPDEFS
 
 AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout])
 mv stdout $1
@@ -156,7 +159,8 @@ AT_CLEANUP
 # Create FILE-NAME, containing a self checking parser for a huge
 # horizontal grammar.
 m4_define([AT_DATA_HORIZONTAL_GRAMMAR],
-[AT_DATA([[gengram.pl]],
+[AT_BISON_OPTION_PUSHDEFS
+AT_DATA([[gengram.pl]],
 [[#! /usr/bin/perl -w
 
 use strict;
@@ -170,8 +174,8 @@ print <<EOF;
 #include <stdio.h>
 #include <stdlib.h>
 
-static int yylex (void);
-static void yyerror (const char *msg);
+]AT_YYLEX_DECLARE[
+]AT_YYERROR_DECLARE[
 %}
 
 %token
@@ -222,6 +226,7 @@ EOF
 
 AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout])
 mv stdout $1
+AT_BISON_OPTION_POPDEFS
 ])
 
 
@@ -262,7 +267,8 @@ AT_CLEANUP
 # Create FILE-NAME, containing a self checking parser for a grammar
 # requiring SIZE lookahead tokens.
 m4_define([AT_DATA_LOOKAHEAD_TOKENS_GRAMMAR],
-[AT_DATA([[gengram.pl]],
+[AT_BISON_OPTION_PUSHDEFS
+AT_DATA([[gengram.pl]],
 [[#! /usr/bin/perl -w
 
 use strict;
@@ -277,8 +283,8 @@ print <<EOF;
 # include <stdlib.h>
 # include <assert.h>
 
-static int yylex (void);
-static void yyerror (const char *msg);
+]AT_YYLEX_DECLARE[
+]AT_YYERROR_DECLARE[
 %}
 %union
 {
@@ -362,6 +368,7 @@ EOF
 
 AT_CHECK([perl -w ./gengram.pl $2 || exit 77], 0, [stdout])
 mv stdout $1
+AT_BISON_OPTION_POPDEFS
 ])
 
 
@@ -389,7 +396,8 @@ AT_CLEANUP
 # ------------------------------------------------
 # A parser specialized in torturing the stack size.
 m4_define([AT_DATA_STACK_TORTURE],
-[# A grammar of parens growing the stack thanks to right recursion.
+[AT_BISON_OPTION_PUSHDEFS([$2])
+# A grammar of parens growing the stack thanks to right recursion.
 # exp:
 AT_DATA([input.y],
 [[%{
@@ -398,8 +406,8 @@ AT_DATA([input.y],
 #include <stdio.h>
 #include <stdlib.h>
 ]$1[
-  static int yylex (void);
-  static void yyerror (const char *msg);
+  ]AT_YYLEX_DECLARE[
+  ]AT_YYERROR_DECLARE[
 %}
 ]$2[
 %error-verbose
@@ -408,12 +416,7 @@ AT_DATA([input.y],
 %%
 exp: WAIT_FOR_EOF exp | ;
 %%
-static void
-yyerror (const char *msg)
-{
-  fprintf (stderr, "%s\n", msg);
-}
-
+]AT_YYERROR_DEFINE[
 static int
 yylex (void)
 {
@@ -461,6 +464,7 @@ main (int argc, const char **argv)
   }
 }
 ]])
+AT_BISON_OPTION_POPDEFS([$2])
 AT_BISON_CHECK([-o input.c input.y])
 AT_COMPILE([input])
 ])
@@ -496,7 +500,7 @@ AT_PARSER_CHECK([./input 10000], 2, [], [ignore],
 # just helps guarantee we don't let the YYSTACK_USE_ALLOCA feature affect
 # push parsers.
 AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
-[[%define api.push-pull "both"
+[[%define api.push-pull both
 ]])
 AT_PARSER_CHECK([./input 20], 0, [], [ignore],
                 [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
@@ -534,7 +538,7 @@ AT_PARSER_CHECK([./input 10000], 2, [], [ignore],
                 [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])
 
 AT_DATA_STACK_TORTURE([AT_USE_ALLOCA],
-[[%define api.push-pull "both"
+[[%define api.push-pull both
 ]])
 AT_PARSER_CHECK([./input 20], 0, [], [ignore],
                 [[VALGRIND_OPTS="$VALGRIND_OPTS --log-fd=1"]])