From 0985a7893a4b5de63a67ebab445892d9fffe275b Mon Sep 17 00:00:00 2001 From: Quentin Carbonneaux Date: Wed, 14 Dec 2022 23:29:59 +0100 Subject: fix bootstrap by renaming constexpr() The addition of C23 keywords made 'constexpr' unusable as a function name. This prevents cproc from bootstrapping. This patch simply renames the problematic function to 'evalexpr'. --- cc.h | 2 +- decl.c | 2 +- expr.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cc.h b/cc.h index 6f2a193..860ca94 100644 --- a/cc.h +++ b/cc.h @@ -487,7 +487,7 @@ struct type *stringconcat(struct stringlit *, _Bool); struct expr *expr(struct scope *); struct expr *assignexpr(struct scope *); -struct expr *constexpr(struct scope *); +struct expr *evalexpr(struct scope *); unsigned long long intconstexpr(struct scope *, _Bool); void delexpr(struct expr *); diff --git a/decl.c b/decl.c index 324e5aa..8ffc058 100644 --- a/decl.c +++ b/decl.c @@ -216,7 +216,7 @@ tagspec(struct scope *s) name = tok.lit; next(); if (consume(TASSIGN)) { - e = constexpr(s); + e = evalexpr(s); if (e->kind != EXPRCONST || !(e->type->prop & PROPINT)) error(&tok.loc, "expected integer constant expression"); i = e->u.constant.u; diff --git a/expr.c b/expr.c index 1423248..04c7325 100644 --- a/expr.c +++ b/expr.c @@ -1232,7 +1232,7 @@ condexpr(struct scope *s) } struct expr * -constexpr(struct scope *s) +evalexpr(struct scope *s) { return eval(condexpr(s), EVALARITH); } @@ -1242,7 +1242,7 @@ intconstexpr(struct scope *s, bool allowneg) { struct expr *e; - e = constexpr(s); + e = evalexpr(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) -- cgit v1.2.3