I have this grammar which is supposed to generate java byte code out of java code. I know this warning has been addressed before in many questions but I couldn't find a problem similar to mine. it displays out this warning for this two rules in particular:
statement_list:
{
$<stmt_type>$.next = $<stmt_type>0.next;
}
statement
|
{
$<stmt_type>$.next = strdup(genLabel().c_str()); //generate label for statement and assign it to statement list next
}
statement_list
{
$<stmt_type>$.next = $<stmt_type>0.next;
fout<<$<stmt_type>1.next<<":"<<endl; //mark statement with statement list next label
}
statement
;
and this one
b_expression:
expression RELA_OP expression
{$$ = $<bexpr_type>0;relaCast(string($2),$$.nTrue,$$.nFalse);}
|{/* addding some strings to this action */ } b_expression BOOL_OP b_expression
I need here to mark every statement with its next before parsing it to use it in code generation. when I remove the semantic actions from statement_list its error goes away, but I didn't try the same for b_expression.