summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-12-03 15:14:53 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-12-03 15:14:53 +0800
commit4d411d31deff5c4b2ad7d1689a9219c649843875 (patch)
treeaa86ab9a2cd3c84872e53eeea736997535f11b44
parent9de5d31f93dab36cfb451e9ad724d47311b54424 (diff)
downloadtalos-petitboot-4d411d31deff5c4b2ad7d1689a9219c649843875.tar.gz
talos-petitboot-4d411d31deff5c4b2ad7d1689a9219c649843875.zip
discover/grub2: Fixes for bison 3.x
YYLEX_PARAM is removed in bison 3.0, so we need to pass the scanner param directly through yyparse (rather than referencing parser->scanner). Unfortunately, we don't have the lexer header available at the time we declare yyparse, so we need to pass a void * here. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r--discover/grub2/grub2.c3
-rw-r--r--discover/grub2/parser.y11
2 files changed, 7 insertions, 7 deletions
diff --git a/discover/grub2/grub2.c b/discover/grub2/grub2.c
index 7f63c35..5b3009a 100644
--- a/discover/grub2/grub2.c
+++ b/discover/grub2/grub2.c
@@ -1,5 +1,6 @@
#include <assert.h>
+#include <string.h>
#include <talloc/talloc.h>
#include <url/url.h>
@@ -9,8 +10,6 @@
#include <discover/parser-utils.h>
#include "grub2.h"
-#include "parser.h"
-#include "lexer.h"
static const char *const grub2_conf_files[] = {
"/grub.cfg",
diff --git a/discover/grub2/parser.y b/discover/grub2/parser.y
index 5a4d4f8..0beddd6 100644
--- a/discover/grub2/parser.y
+++ b/discover/grub2/parser.y
@@ -2,6 +2,7 @@
%pure-parser
%lex-param { yyscan_t scanner }
%parse-param { struct grub2_parser *parser }
+%parse-param { void *scanner }
%error-verbose
%{
@@ -9,10 +10,6 @@
#include <log/log.h>
#include "grub2.h"
-#include "parser.h"
-#include "lexer.h"
-
-#define YYLEX_PARAM parser->scanner
void yyerror(struct grub2_parser *parser, const char *fmt, ...);
%}
@@ -63,6 +60,10 @@ void yyerror(struct grub2_parser *parser, const char *fmt, ...);
%start script
%debug
+%{
+#include "lexer.h"
+%}
+
%%
script: statements {
@@ -314,7 +315,7 @@ void grub2_parser_parse(struct grub2_parser *parser, const char *filename,
bufstate = yy_scan_bytes(buf, len - 1, parser->scanner);
yyset_lineno(1, parser->scanner);
- rc = yyparse(parser);
+ rc = yyparse(parser, parser->scanner);
yy_delete_buffer(bufstate, parser->scanner);
OpenPOWER on IntegriCloud