Fix filter parser segmentation fault with bison 3.0
[lttng-tools.git] / src / lib / lttng-ctl / filter / filter-parser.y
index 3f301340dbb4ccff7150d9ce79d4d86046d07563..29e2866a7b0990979703ad5bc0a7434786e20c91 100644 (file)
@@ -40,9 +40,9 @@ LTTNG_HIDDEN
 int filter_parser_debug = 0;
 
 LTTNG_HIDDEN
-int yyparse(struct filter_parser_ctx *parser_ctx);
+int yyparse(struct filter_parser_ctx *parser_ctx, yyscan_t scanner);
 LTTNG_HIDDEN
-int yylex(union YYSTYPE *yyval, struct filter_parser_ctx *parser_ctx);
+int yylex(union YYSTYPE *yyval, yyscan_t scanner);
 LTTNG_HIDDEN
 int yylex_init_extra(struct filter_parser_ctx *parser_ctx, yyscan_t * ptr_yy_globals);
 LTTNG_HIDDEN
@@ -188,7 +188,7 @@ static struct filter_node *make_op_node(struct filter_parser_ctx *scanner,
 }
 
 LTTNG_HIDDEN
-void yyerror(struct filter_parser_ctx *parser_ctx, const char *str)
+void yyerror(struct filter_parser_ctx *parser_ctx, yyscan_t scanner, const char *str)
 {
        fprintf(stderr, "error %s\n", str);
 }
@@ -201,7 +201,7 @@ int yywrap(void)
 
 #define parse_error(parser_ctx, str)                           \
 do {                                                           \
-       yyerror(parser_ctx, YY_("parse error: " str "\n"));     \
+       yyerror(parser_ctx, parser_ctx->scanner, YY_("parse error: " str "\n"));        \
        YYERROR;                                                \
 } while (0)
 
@@ -238,7 +238,7 @@ static void filter_ast_free(struct filter_ast *ast)
 LTTNG_HIDDEN
 int filter_parser_ctx_append_ast(struct filter_parser_ctx *parser_ctx)
 {
-       return yyparse(parser_ctx);
+       return yyparse(parser_ctx, parser_ctx->scanner);
 }
 
 LTTNG_HIDDEN
@@ -301,7 +301,8 @@ void filter_parser_ctx_free(struct filter_parser_ctx *parser_ctx)
 %define api.pure
        /* %locations */
 %parse-param {struct filter_parser_ctx *parser_ctx}
-%lex-param {struct filter_parser_ctx *parser_ctx}
+%parse-param {yyscan_t scanner}
+%lex-param {yyscan_t scanner}
 %start translation_unit
 %token CHARACTER_CONSTANT_START SQUOTE STRING_LITERAL_START DQUOTE
 %token ESCSEQ CHAR_STRING_TOKEN
This page took 0.024845 seconds and 5 git commands to generate.