mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-04-08 10:21:40 +00:00
Add some error checking for attaching identifiers.
This commit is contained in:
parent
0ccf4093e4
commit
01c8aaae8c
1 changed files with 22 additions and 0 deletions
|
@ -221,9 +221,31 @@ dagnode_match (const dagnode_t *n, const daglabel_t *op,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
op_is_identifer (operand_t *op)
|
||||
{
|
||||
while (op->op_type == op_alias)
|
||||
op = op->o.alias;
|
||||
if (op->op_type == op_pointer)
|
||||
return 1;
|
||||
if (op->op_type == op_temp)
|
||||
return 1;
|
||||
if (op->op_type != op_symbol)
|
||||
return 0;
|
||||
if (op->o.symbol->sy_type != sy_var)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
dagnode_attach_label (dagnode_t *n, daglabel_t *l)
|
||||
{
|
||||
if (!l->op)
|
||||
internal_error (0, "attempt to attach operator label to dagnode "
|
||||
"identifers");
|
||||
if (!op_is_identifer (l->op))
|
||||
internal_error (0, "attempt to attach non-identifer label to dagnode "
|
||||
"identifers");
|
||||
if (n->identifiers)
|
||||
n->identifiers->prev = &l->next;
|
||||
l->next = n->identifiers;
|
||||
|
|
Loading…
Reference in a new issue