mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
emit.c:
fix a missing else (should convert to switch) expr.c: fix address_expr for binary expressions fix unary .
This commit is contained in:
parent
f9149a0d6c
commit
b56d7f3248
2 changed files with 18 additions and 12 deletions
|
@ -350,7 +350,7 @@ emit_sub_expr (expr_t *e, def_t *dest)
|
||||||
dest = PR_GetTempDef (e->e.expr.type, pr_scope);
|
dest = PR_GetTempDef (e->e.expr.type, pr_scope);
|
||||||
dest->users += 2;
|
dest->users += 2;
|
||||||
}
|
}
|
||||||
} if (e->e.expr.op == '.') {
|
} else if (e->e.expr.op == '.') {
|
||||||
if (!dest
|
if (!dest
|
||||||
&& (e->e.expr.e1->type != ex_pointer
|
&& (e->e.expr.e1->type != ex_pointer
|
||||||
|| !(e->e.expr.e1->e.pointer.val > 0
|
|| !(e->e.expr.e1->e.pointer.val > 0
|
||||||
|
|
|
@ -1331,8 +1331,15 @@ unary_expr (int op, expr_t *e)
|
||||||
case '.':
|
case '.':
|
||||||
if (extract_type (e) != ev_pointer)
|
if (extract_type (e) != ev_pointer)
|
||||||
return error (e, "invalid type for unary .");
|
return error (e, "invalid type for unary .");
|
||||||
e = new_unary_expr ('.', e);
|
if (e->type == ex_expr && e->e.expr.op == '&'
|
||||||
e->e.expr.type = get_type (e->e.expr.e1)->aux_type;
|
&& (extract_type (e->e.expr.e1) == ev_entity
|
||||||
|
|| extract_type (e->e.expr.e1) == ev_pointer)) {
|
||||||
|
e->e.expr.op = '.';
|
||||||
|
e->e.expr.type = e->e.expr.type->aux_type;
|
||||||
|
} else {
|
||||||
|
e = new_unary_expr ('.', e);
|
||||||
|
e->e.expr.type = get_type (e->e.expr.e1)->aux_type;
|
||||||
|
}
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
error (e, "internal error");
|
error (e, "internal error");
|
||||||
|
@ -1619,16 +1626,15 @@ address_expr (expr_t *e1, expr_t *e2, type_t *t)
|
||||||
break;
|
break;
|
||||||
case ex_expr:
|
case ex_expr:
|
||||||
if (e1->e.expr.op == '.') {
|
if (e1->e.expr.op == '.') {
|
||||||
expr_t *e = e1->e.expr.e1;
|
e = e1;
|
||||||
|
e->e.expr.op = '&';
|
||||||
type = get_type (e);
|
e->e.expr.type = pointer_type (e->e.expr.type);
|
||||||
if (type->type == ev_entity || type->type == ev_pointer) {
|
print_expr (e);puts("");
|
||||||
e->e.expr.type = pointer_type (type);
|
printf ("%s %s\n", pr_type_name[e->e.expr.type->type],
|
||||||
e->e.expr.op = '&';
|
pr_type_name[e->e.expr.type->aux_type->type]);
|
||||||
return e;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return error (e, "invalid type for unary &");
|
return error (e1, "invalid type for unary &");
|
||||||
case ex_uexpr:
|
case ex_uexpr:
|
||||||
if (e1->e.expr.op == '.') {
|
if (e1->e.expr.op == '.') {
|
||||||
e = e1->e.expr.e1;
|
e = e1->e.expr.e1;
|
||||||
|
|
Loading…
Reference in a new issue