summaryrefslogtreecommitdiff
blob: 56d441a351e65205571bfc583f9f990c977b0948 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
From 095b0bf0a730d46d301c0e2fb2e7af40caeb2c9b Mon Sep 17 00:00:00 2001
From: Elias Pipping <pipping@users.sourceforge.net>
Date: Mon, 6 Aug 2012 15:13:23 -0400
Subject: [PATCH] Fix two tests to pass under bison 2.6

Given that bison is moving forward with the %parse-param instead of
YYPARSE_PARAM syntax, it makes sense to switch over to using the new style
declaration. In particular, this means that flex scanners that use bison
features will now require bison 2.6 or higher.

Signed-off-by: Will Estes <westes575@gmail.com>
---
 tests/test-bison-yylloc/main.c   |    2 --
 tests/test-bison-yylloc/parser.y |    6 +++---
 tests/test-bison-yylval/main.c   |    2 --
 tests/test-bison-yylval/parser.y |    6 ++----
 4 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/tests/test-bison-yylloc/main.c b/tests/test-bison-yylloc/main.c
index 082c88c..24568a9 100644
--- a/tests/test-bison-yylloc/main.c
+++ b/tests/test-bison-yylloc/main.c
@@ -24,8 +24,6 @@
 #include "parser.h"
 #include "scanner.h"
 
-extern int testparse(yyscan_t);
-
 int main ( int argc, char** argv )
 {
     yyscan_t scanner;
diff --git a/tests/test-bison-yylloc/parser.y b/tests/test-bison-yylloc/parser.y
index aaee976..e8f4e56 100644
--- a/tests/test-bison-yylloc/parser.y
+++ b/tests/test-bison-yylloc/parser.y
@@ -21,6 +21,8 @@
  * PURPOSE.
  */
 
+%parse-param { void* scanner }
+
 /* 
    How to compile:
    bison --defines --output-file="parser.c" --name-prefix="test" parser.y
@@ -32,10 +34,8 @@
 #include "config.h"
 
 #define YYERROR_VERBOSE 1
-#define YYPARSE_PARAM scanner
 #define YYLEX_PARAM   scanner
 
-int yyerror(char* msg);
 extern int testget_lineno(void*);
 
 
@@ -89,7 +89,7 @@ line:
 
 %%
 
-int yyerror(char* msg) {
+int yyerror(void* scanner, char* msg) {
     fprintf(stderr,"%s\n",msg);
     return 0;
 }
diff --git a/tests/test-bison-yylval/main.c b/tests/test-bison-yylval/main.c
index 165e672..30c4314 100644
--- a/tests/test-bison-yylval/main.c
+++ b/tests/test-bison-yylval/main.c
@@ -24,8 +24,6 @@
 #include "parser.h"
 #include "scanner.h"
 
-extern int testparse(yyscan_t);
-
 int main ( int argc, char** argv )
 {
     yyscan_t scanner;
diff --git a/tests/test-bison-yylval/parser.y b/tests/test-bison-yylval/parser.y
index 77bac87..0ffdb89 100644
--- a/tests/test-bison-yylval/parser.y
+++ b/tests/test-bison-yylval/parser.y
@@ -25,6 +25,7 @@
    How to compile:
    bison --defines --output-file="parser.c" --name-prefix="test" parser.y
  */
+%parse-param { void* scanner }
 %{
 #include <stdio.h>
 #include <stdlib.h>
@@ -32,11 +33,8 @@
 #include "config.h"
 
 #define YYERROR_VERBOSE 1
-#define YYPARSE_PARAM scanner
 #define YYLEX_PARAM   scanner
 
-int yyerror(char* msg);
-
 
 /* A dummy function. A check against seg-faults in yylval->str. */
 int process_text(char* s) {
@@ -76,7 +74,7 @@ starttag:  LT      TAGNAME GT { process_text($2); free($2);} ;
 endtag:    LTSLASH TAGNAME GT { process_text($2);free($2);} ;
 %%
 
-int yyerror(char* msg) {
+int yyerror(void* scanner, char* msg) {
     fprintf(stderr,"%s\n",msg);
     return 0;
 }
-- 
1.7.9.7