# Torturing Bison. -*- Autotest -*-
-# Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007 Free Software Foundation,
-# Inc.
+
+# Copyright (C) 2001-2002, 2004-2007, 2009-2012 Free Software
+# Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#include <stdio.h>
#include <stdlib.h>
-static int yylex (void);
-static void yyerror (const char *msg);
+]AT_YYLEX_DECLARE[
+]AT_YYERROR_DECLARE[
%}
%union
{
#include <stdio.h>
#include <stdlib.h>
-static int yylex (void);
-static void yyerror (const char *msg);
+]AT_YYLEX_DECLARE[
+]AT_YYERROR_DECLARE[
%}
%token
# include <stdlib.h>
# include <assert.h>
-static int yylex (void);
-static void yyerror (const char *msg);
+]AT_YYLEX_DECLARE[
+]AT_YYERROR_DECLARE[
%}
%union
{
# ------------------------------------------------
# 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],
[[%{
#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
%%
exp: WAIT_FOR_EOF exp | ;
%%
-static void
-yyerror (const char *msg)
-{
- fprintf (stderr, "%s\n", msg);
-}
-
+]AT_YYERROR_DEFINE[
static int
yylex (void)
{
}
}
]])
+AT_BISON_OPTION_POPDEFS([$2])
AT_BISON_CHECK([-o input.c input.y])
AT_COMPILE([input])
])
# 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"]])
[[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"]])