/* does the node represent an atom? */
#define ATOMIC(n) ((n) == IDENTIFIER || (n) == NUMBER || (n) == STRING)
/* does the node reference a statement label? */
-#define SLABELREF(n) ((n) == GO || (n) == OG)
+#define SLABELREF(n) ((n) == GO)
/* does the node reference a block label? */
-#define BLABELREF(n) ((n) == PERFORM)
+#define BLABELREF(n) ((n) == PERFORM || (n) == END || (n) == OG)
/* does the node set a variable? */
#define VARSET(n) ((n) == LET || (n) == READ || (n) == ITERATE)
/* does the (non-VARSET) node refer to its left operand as a variable? */
/* mark labels */
recursive_apply(tree, r_mark_labels);
- /* check for label/variable consistency */
- for_symbols(lp)
- if ((lp->blabelref || lp->blabeldef) + (lp->slabelref || lp->slabeldef) + (lp->assigned || lp->used) > 1)
- die("%s has conflicting uses\n", lp->node->u.string);
- else if (lp->blabelref && !lp->blabeldef)
- die("block label %s used but not defined\n", lp->node->u.string);
- else if (!lp->blabelref && lp->blabeldef)
- warn("block label %s defined but never used\n",lp->node->u.string);
- else if (lp->slabelref && !lp->slabeldef)
- die("statement label %s used but not defined\n",lp->node->u.string);
- else if (!lp->slabelref && lp->slabeldef)
- warn("statement label %s defined but never used\n", lp->node->u.string);
- else if (lp->used && !lp->assigned)
- warn("variable %s used but not set\n", lp->node->u.string);
- else if (!lp->used && lp->assigned)
- warn("variable %s set but not used\n", lp->node->u.string);
-
/* describe all labels and variables */
if (verbose >= DEBUG_CHECKDUMP)
{
lp->node->u.string, lp->assigned, lp->used);
}
+ /* check for label/variable consistency */
+ for_symbols(lp)
+ if ((lp->blabelref || lp->blabeldef) + (lp->slabelref || lp->slabeldef) + (lp->assigned || lp->used) > 1)
+ die("%s has conflicting uses\n", lp->node->u.string);
+ else if (lp->blabelref && !lp->blabeldef)
+ die("block label %s used but not defined\n", lp->node->u.string);
+ else if (!lp->blabelref && lp->blabeldef)
+ warn("block label %s defined but never used\n",lp->node->u.string);
+ else if (lp->slabelref && !lp->slabeldef)
+ die("statement label %s used but not defined\n",lp->node->u.string);
+ else if (!lp->slabelref && lp->slabeldef)
+ warn("statement label %s defined but never used\n", lp->node->u.string);
+ else if (lp->used && !lp->assigned)
+ warn("variable %s used but not set\n", lp->node->u.string);
+ else if (!lp->used && lp->assigned)
+ warn("variable %s set but not used\n", lp->node->u.string);
+
return(FALSE);
}