diff options
-rw-r--r-- | cc.h | 2 | ||||
-rw-r--r-- | decl.c | 2 | ||||
-rw-r--r-- | expr.c | 12 |
3 files changed, 4 insertions, 12 deletions
@@ -518,7 +518,7 @@ struct type *stringconcat(struct stringlit *, bool); struct expr *expr(struct scope *); struct expr *assignexpr(struct scope *); -struct expr *evalexpr(struct scope *); +struct expr *condexpr(struct scope *); unsigned long long intconstexpr(struct scope *, bool); void delexpr(struct expr *); @@ -247,7 +247,7 @@ tagspec(struct scope *s) next(); attr(NULL, 0); if (consume(TASSIGN)) { - e = evalexpr(s); + e = eval(condexpr(s)); if (e->kind != EXPRCONST || !(e->type->prop & PROPINT)) error(&tok.loc, "expected integer constant expression"); value = e->u.constant.u; @@ -734,8 +734,6 @@ primaryexpr(struct scope *s) return e; } -static struct expr *condexpr(struct scope *); - /* TODO: merge with init.c:designator() */ static void designator(struct scope *s, struct type *t, unsigned long long *offset) @@ -1201,7 +1199,7 @@ binaryexpr(struct scope *s, struct expr *l, int i) return l; } -static struct expr * +struct expr * condexpr(struct scope *s) { struct expr *e, *l, *r; @@ -1257,18 +1255,12 @@ condexpr(struct scope *s) return e; } -struct expr * -evalexpr(struct scope *s) -{ - return eval(condexpr(s)); -} - unsigned long long intconstexpr(struct scope *s, bool allowneg) { struct expr *e; - e = evalexpr(s); + e = eval(condexpr(s)); if (e->kind != EXPRCONST || !(e->type->prop & PROPINT)) error(&tok.loc, "not an integer constant expression"); if (!allowneg && e->type->u.basic.issigned && e->u.constant.u >> 63) |