mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
Mark alias def chains as a bug.
This commit is contained in:
parent
5f676c367f
commit
ec98e3e206
3 changed files with 24 additions and 0 deletions
|
@ -139,11 +139,20 @@ alias_def (def_t *def, type_t *type)
|
|||
{
|
||||
def_t *alias;
|
||||
|
||||
|
||||
if (def->alias) {
|
||||
expr_t e;
|
||||
e.file = def->file;
|
||||
e.line = def->line;
|
||||
bug (&e, "aliasing an alias def");
|
||||
}
|
||||
ALLOC (16384, def_t, defs, alias);
|
||||
alias->return_addr = __builtin_return_address (0);
|
||||
alias->offset = def->offset;
|
||||
alias->type = type;
|
||||
alias->alias = def;
|
||||
alias->line = pr.source_line;
|
||||
alias->file = pr.source_file;
|
||||
return alias;
|
||||
}
|
||||
|
||||
|
|
|
@ -132,8 +132,15 @@ add_statement_def_ref (def_t *def, dstatement_t *st, int field)
|
|||
if (def) {
|
||||
int st_ofs = st - pr.code->code;
|
||||
int offset_reloc = 0;
|
||||
int alias_depth = 0;
|
||||
expr_t alias_depth_expr;
|
||||
|
||||
while (def->alias) {
|
||||
if (!alias_depth) {
|
||||
alias_depth_expr.file = def->file;
|
||||
alias_depth_expr.line = def->line;
|
||||
}
|
||||
alias_depth++;
|
||||
//FIXME it seems there is a bug somewhere creating chains
|
||||
//of aliases
|
||||
def_t *a = def;
|
||||
|
@ -141,6 +148,10 @@ add_statement_def_ref (def_t *def, dstatement_t *st, int field)
|
|||
def = def->alias;
|
||||
free_def (a);
|
||||
}
|
||||
if (alias_depth > 1) {
|
||||
bug (&alias_depth_expr, "alias chain detected: %d %s",
|
||||
alias_depth, def->name);
|
||||
}
|
||||
if (offset_reloc)
|
||||
reloc_op_def_ofs (def, st_ofs, field);
|
||||
else
|
||||
|
|
|
@ -870,6 +870,10 @@ new_alias_expr (type_t *type, expr_t *expr)
|
|||
|
||||
alias = new_unary_expr ('A', expr);
|
||||
alias->e.expr.type = type;
|
||||
if (expr->type == ex_uexpr && expr->e.expr.op == 'A')
|
||||
bug (alias, "aliasing an alias expression");
|
||||
alias->file = expr->file;
|
||||
alias->line = expr->line;
|
||||
return alias;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue