From 99e03f5661881f2676f06af6edc0c4c4d295ac98 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 16 Mar 2024 15:11:53 +0100 Subject: [PATCH] hook up bison destructors for state objects this doesn't help much yet since the state objects themselves also leak all memory they are given. Change-Id: I80245b0c747308e80923e7f18ce4e1a4898f93b0 --- src/libexpr/parser.y | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index 5424d8741..26e4bac02 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -59,6 +59,8 @@ using namespace nix; #define CUR_POS state->at(*yylocp) +// otherwise destructors cause compiler errors +#pragma GCC diagnostic ignored "-Wswitch-enum" void yyerror(YYLTYPE * loc, yyscan_t scanner, ParserState * state, const char * error) { @@ -94,7 +96,18 @@ void yyerror(YYLTYPE * loc, yyscan_t scanner, ParserState * state, const char * std::vector>> * ind_string_parts; } -%type start expr expr_function expr_if expr_op +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } +%destructor { delete $$; } + +%type start +%type expr expr_function expr_if expr_op %type expr_select expr_simple expr_app %type expr_list %type binds @@ -132,7 +145,7 @@ void yyerror(YYLTYPE * loc, yyscan_t scanner, ParserState * state, const char * %% -start: expr { state->result = $1; }; +start: expr { state->result = $1; $$ = 0; }; expr: expr_function;