From: Tobias Brunner Date: Tue, 13 May 2014 08:50:36 +0000 (+0200) Subject: settings: Replace deprecated YYLEX_PARAM with %lex-param X-Git-Tag: 5.2.0dr4~1^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=da45f9e994f61324a058def37fbafd5cce75b5f3;p=thirdparty%2Fstrongswan.git settings: Replace deprecated YYLEX_PARAM with %lex-param With Bison 3.x support for YYLEX_PARAM has been removed and %lex-param should be used. Unfortunately, that option does not take expressions. Instead we use a wrapper function that calls the lexer with the proper scanner object, which should also be backward compatible to older Bison versions. --- diff --git a/src/libstrongswan/settings/settings_parser.y b/src/libstrongswan/settings/settings_parser.y index f4a4431c72..b79faf6b78 100644 --- a/src/libstrongswan/settings/settings_parser.y +++ b/src/libstrongswan/settings/settings_parser.y @@ -50,9 +50,13 @@ static void add_section(parser_helper_t *ctx, section_t *section); static void add_setting(parser_helper_t *ctx, kv_t *kv); /** - * Make sure the generated parser code passes the correct object to the lexer + * Make sure to call lexer with the proper context */ -#define YYLEX_PARAM ctx->scanner +#undef yylex +static int yylex(YYSTYPE *lvalp, parser_helper_t *ctx) +{ + return settings_parser_lex(lvalp, ctx->scanner); +} %} %debug @@ -65,7 +69,7 @@ static void add_setting(parser_helper_t *ctx, kv_t *kv); %name-prefix "settings_parser_" /* interact properly with the reentrant lexer */ -%lex-param {void *scanner} +%lex-param {parser_helper_t *ctx} %parse-param {parser_helper_t *ctx} /* types for terminal symbols... (can't use the typedef'd types) */