Hi, I'm trying to get 100% coverage on my bison grammar actions using gcov.
I noticed i'm having difficulty getting the %destructor actions to be called, which made me realize that perhaps I've got more of them than are necessary. (ie. Bison will never invoke them). According to the manual, a Bison grammar rule has the following general form: result: components…; where result is the nonterminal symbol that this rule describes, and components are various terminal and nonterminal symbols that are put together by this rule (see Symbols). I have two questions regarding when the %destructor action is called regarding the following grammar. result_list: { $$ = NULL; }; result_list: result_list COMMA result { $$ = append_gdbmi_result ($1, $3); }; result: opt_variable list { ... }; list: OPEN_BRACKET CLOSED_BRACKET { $$ = NULL; }; list: OPEN_BRACKET result result_list CLOSED_BRACKET { $$ = append_gdbmi_result($2, $3); }; 1. Is %destructor ever called for list? I see that list itself can fail to parse, which shouldn't cause it's destructor to be called. However, if list itself is successful, then the next level up result will always be successful (I believe). 2. Once a rule returns successfully (for example a list rule), if result then returns successfully, would that rule out the destructor ever being called for list in this example? If result could somehow fail from it's caller, the %destructor for result would override the %destructor for list which result called. Correct? It would be really nice if Bison could tell you all the symbols that need a potential %destructor, does it do that? Thanks, Bob Rossi _______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison