ref: 2abe6624ece4d3033742aac950ee949c47d94927
parent: 91b6945dbc23941cf41afcd59e02fe2eafaee132
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Apr 23 13:20:24 EDT 2016
[cc2] Add a ONOP statement for every label This nop statement helps to have some statement in the same position where the label is set. We do not depend of being the last statement or setting some variable for the next statement.
--- a/cc2/parser.c
+++ b/cc2/parser.c
@@ -569,20 +569,6 @@
}
static void
-labeldcl(void)
-{
- Node *np;
- Symbol *sym;
-
- np = pop();
- sym = np->u.sym;
- delnode(np);
- nextline();
- stmtp->label = sym;
- sym->u.nlabel = stmtp;
-}
-
-static void
addstmt(Node *np)
{
if (!curfun->u.nlabel)
@@ -590,6 +576,20 @@
else
stmtp->stmt = np;
stmtp = np;
+}
+
+static void
+labeldcl(void)
+{
+ Node *np;
+ Symbol *sym;
+
+ np = pop();
+ np->op = ONOP;
+ sym = np->u.sym;
+ sym->kind = SLABEL;
+ np->label = sym;
+ addstmt(np);
}
static void