From c09a5da157585d171ad896e9862db00d505e4363 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 21 Jan 2022 23:30:59 +0100 Subject: [PATCH] wrc: Add a workaround for older bison versions. Bison < 3.6 doesn't apply api.prefix to YYEMPTY. Signed-off-by: Alexandre Julliard --- tools/widl/parser.y | 3 +-- tools/wrc/parser.y | 9 ++++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index e16e30e98a9..b708faff6a6 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -483,8 +483,7 @@ typedecl: cppquote: tCPPQUOTE '(' aSTRING ')' { $$ = $3; } ; -import_start: tIMPORT aSTRING ';' { assert(yychar == PARSER_EMPTY); - $$ = xmalloc(sizeof(struct _import_t)); +import_start: tIMPORT aSTRING ';' { $$ = xmalloc(sizeof(struct _import_t)); $$->name = $2; $$->import_performed = do_import($2); if (!$$->import_performed) yychar = aEOF; diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y index 944cffd0064..cc5dc2935a9 100644 --- a/tools/wrc/parser.y +++ b/tools/wrc/parser.y @@ -199,6 +199,9 @@ static resource_t *build_fontdirs(resource_t *tail); static resource_t *build_fontdir(resource_t **fnt, int nfnt); static int rsrcid_to_token(int lookahead); +/* bison >= 3.6 applies api.prefix also to YYEMPTY */ +#define YYEMPTY (-2) + %} %define api.prefix {parser_} @@ -490,11 +493,11 @@ resource * want_id because we already have a lookahead that * cannot be undone. */ - if(yychar != PARSER_EMPTY && yychar != tNL) + if(yychar != YYEMPTY && yychar != tNL) dont_want_id = 1; if(yychar == tNL) - yychar = PARSER_EMPTY; /* Could use 'yyclearin', but we already need the*/ + yychar = YYEMPTY; /* Could use 'yyclearin', but we already need the*/ /* direct access to yychar in rule 'usrcvt' below. */ else if(yychar == tIDENT) parser_warning("LANGUAGE statement not delimited with newline; next identifier might be wrong\n"); @@ -2725,7 +2728,7 @@ static int rsrcid_to_token(int lookahead) int token; /* Get a token if we don't have one yet */ - if(lookahead == PARSER_EMPTY) + if(lookahead == YYEMPTY) lookahead = yylex(); /* Only numbers are possibly interesting */