diff options
Diffstat (limited to 'bootstrap')
| -rwxr-xr-x | bootstrap/bootstrap.sh | 5 | ||||
| -rwxr-xr-x | bootstrap/cff2 | bin | 473824 -> 477920 bytes | |||
| -rw-r--r-- | bootstrap/parse.c | 22 |
3 files changed, 21 insertions, 6 deletions
diff --git a/bootstrap/bootstrap.sh b/bootstrap/bootstrap.sh index 4a45470..5669fd3 100755 --- a/bootstrap/bootstrap.sh +++ b/bootstrap/bootstrap.sh @@ -44,3 +44,8 @@ echo '========================================================================== echo '=== Building self-hosted compiler using self-hosted compiler squared (cffc) ===' echo '===============================================================================' CFFC=$(dirname "$0")/cff2 make -C ../ clean all + +cd .. +set -x +md5sum bootstrap/cff2 +md5sum cffc diff --git a/bootstrap/cff2 b/bootstrap/cff2 Binary files differindex 5a54715..a70d3e0 100755 --- a/bootstrap/cff2 +++ b/bootstrap/cff2 diff --git a/bootstrap/parse.c b/bootstrap/parse.c index b16ef13..0843940 100644 --- a/bootstrap/parse.c +++ b/bootstrap/parse.c @@ -3218,8 +3218,8 @@ defyield(struct decl *decl, void *arg) { if (!decl->var.ini) fatal(a->P, decl->span, "def must have a value"); fold(decl->var.ini); - //if (!fold(decl->var.ini)) - // fatal(a->P, decl->var.ini->span, "def initializer must be constant expression"); + if (!fold(decl->var.ini)) + fatal(a->P, decl->var.ini->span, "def initializer must be constant expression"); putdecl(a->P, decl->span, decl); if (a->yield) a->yield(decl, a->yarg); @@ -3309,10 +3309,20 @@ parsedecl(decl_yielder_t yield, void *yarg, struct parser *P, bool toplevel) { } else if (lexmatch(P, &tok, TKkw_defmacro)) { if (externp) fatal(P, tok.span, "macro cannot be `extern'"); name = lexexpects(P, TKident, "macro name").str; - decl.t = Dmacro; - decl.name = name; - decl.macro = parsemacro(P); - decl.macro.name = name; + if (lexmatch(P, &tok, '=')) { + // defmacro name = expr + struct expr ex = parseexpr(P); + decl.t = Ddef; + decl.name = name; + decl.var.ini = exprdup(ex); + decl.var.ty = ex.ty; + lexexpect(P, ';'); + } else { + decl.t = Dmacro; + decl.name = name; + decl.macro = parsemacro(P); + decl.macro.name = name; + } } else if (lexmatch(P, &tok, TKkw_enum)) { decl.t = Dtype; if (lexmatch(P, &tok, TKkw_union)) { |