]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Replace two deprecated parser generator directives
authorTobias Brunner <tobias@strongswan.org>
Mon, 14 Dec 2020 10:36:21 +0000 (11:36 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 15 Dec 2020 09:42:43 +0000 (10:42 +0100)
There is a conflict between Flex's bison-bridge and Bison's api.prefix
options.  Apparently, the former was added without consulting the Bison
devs and requires YYSTYPE, which is not added to the header anymore by
the latter.  Instead, we just provide the proper definition of yyflex()
manually (as recommended by the Bison docs), so the option is not
required anymore.

src/libstrongswan/settings/settings_lexer.l
src/libstrongswan/settings/settings_parser.y
src/starter/parser/lexer.l
src/starter/parser/parser.y

index e8c2b9884b96fb2506ee93f54e3061daae9e2a03..cd9b5ff5edb8bfaf54ffb9ca84e346a6ad2d61d6 100644 (file)
@@ -37,8 +37,8 @@ static void include_files(parser_helper_t *ctx);
 /* due to that disable interactive mode, which requires isatty() */
 %option never-interactive
 
-/* don't use global variables, and interact properly with bison */
-%option reentrant bison-bridge
+/* don't use global variables */
+%option reentrant
 
 /* maintain the line number */
 %option yylineno
index cc1c917756aaa0ca66d252bd7519f2d215032f84..a541e6b9c945069c9d7a768a7db5228855ae343f 100644 (file)
@@ -55,20 +55,27 @@ static void add_references(parser_helper_t *ctx, array_t *references);
  * Make sure to call lexer with the proper context
  */
 #undef yylex
-static int yylex(YYSTYPE *lvalp, parser_helper_t *ctx)
+static int yylex(SETTINGS_PARSER_STYPE *yylval, parser_helper_t *ctx)
 {
-       return settings_parser_lex(lvalp, ctx->scanner);
+       return settings_parser_lex(yylval, ctx->scanner);
 }
 
 %}
 %debug
 
 /* generate verbose error messages */
-%error-verbose
+%define parse.error verbose
 /* generate a reentrant parser */
 %define api.pure
 /* prefix function/variable declarations */
-%name-prefix "settings_parser_"
+%define api.prefix {settings_parser_}
+/* make sure flex uses the right definition */
+%code provides
+{
+       #define YY_DECL \
+               int settings_parser_lex(SETTINGS_PARSER_STYPE *yylval, void *yyscanner)
+       YY_DECL;
+}
 
 /* interact properly with the reentrant lexer */
 %lex-param {parser_helper_t *ctx}
index 1faec953e28c01f745130ddaaab68df4eb8b7992..c856af77d3ac58b314d1aa1e53335c2ed36095cd 100644 (file)
@@ -38,8 +38,8 @@ static void include_files(parser_helper_t *ctx);
 /* due to that disable interactive mode, which requires isatty() */
 %option never-interactive
 
-/* don't use global variables, and interact properly with bison */
-%option reentrant bison-bridge
+/* don't use global variables */
+%option reentrant
 
 /* maintain the line number */
 %option yylineno
index 1371fe931dbff4077587306138ee7aa1a64511dc..09325d9758141e30b0f79d46f0f8fade647fc1fa 100644 (file)
@@ -48,20 +48,27 @@ static void conf_parser_error(parser_helper_t *ctx, const char *s);
  * Make sure to call lexer with the proper context
  */
 #undef yylex
-static int yylex(YYSTYPE *lvalp, parser_helper_t *ctx)
+static int yylex(CONF_PARSER_STYPE *yylval, parser_helper_t *ctx)
 {
-       return conf_parser_lex(lvalp, ctx->scanner);
+       return conf_parser_lex(yylval, ctx->scanner);
 }
 
 %}
 %debug
 
 /* generate verbose error messages */
-%error-verbose
+%define parse.error verbose
 /* generate a reentrant parser */
 %define api.pure
 /* prefix function/variable declarations */
-%name-prefix "conf_parser_"
+%define api.prefix {conf_parser_}
+/* make sure flex uses the right definition */
+%code provides
+{
+       #define YY_DECL \
+               int conf_parser_lex(CONF_PARSER_STYPE *yylval, void *yyscanner)
+       YY_DECL;
+}
 
 /* interact properly with the reentrant lexer */
 %lex-param {parser_helper_t *ctx}