Error check fragment rules which don't emit anything.

This commit is contained in:
David Given 2016-09-29 22:14:11 +02:00
parent 0d246c0d73
commit b27758b7de

View file

@ -1014,6 +1014,15 @@ static void emitinsndata(Rule rules)
print("}\n\n"); print("}\n\n");
} }
else
{
/* This instruction has no code; make sure it's not a fragment. */
if (r->lhs->is_fragment)
{
yylineno = r->lineno;
yyerror("rule is a fragment, but doesn't emit anything");
}
}
r = r->link; r = r->link;
} }