aboutsummaryrefslogtreecommitdiff
path: root/src/parse.cff
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-31 15:37:27 +0200
committerlemon <lsof@mailbox.org>2022-08-31 15:37:27 +0200
commita582666135ad4bb1e0f5119e1b5c6bbf68044394 (patch)
treecd25e851daab76a204a5ac08ed3057bd7e978aa7 /src/parse.cff
parentf3b25bc63e6d3c44729ed9aa9e730099cd865449 (diff)
self hosting !!! with some workarounds though .
Diffstat (limited to 'src/parse.cff')
-rw-r--r--src/parse.cff13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/parse.cff b/src/parse.cff
index 45803bf..b1dca70 100644
--- a/src/parse.cff
+++ b/src/parse.cff
@@ -316,9 +316,9 @@ fn lex(P *Parser) Tok {
if ep.tepl {
arg.toks[0].loc = tok.loc;
}
- P.curexpan = memcpy(xmalloc(sizeof Expan), &Expan {
- P.curexpan, {}, arg.toks,
- }, sizeof Expan);
+ let old = P.curexpan;
+ P.curexpan = xcalloc(sizeof Expan, 1);
+ *P.curexpan = { old, {}, arg.toks };
return lex(P);
}
}
@@ -1031,7 +1031,8 @@ fn parseexpandtepl(P *Parser, tepl *Tepl) *const Type {
P.curexpan, args[0::nparam], tepl.toks, tname, tok.loc, #{tepl?} #t,
};
++P.expanno;
- P.curexpan = memcpy(xmalloc(sizeof Expan), &expan, sizeof Expan);
+ P.curexpan = xcalloc(sizeof Expan,1);
+ *P.curexpan = expan;
ty = parseagg(P, loc, tepl.kind, tname, &decl);
}
P.peektok = :None;
@@ -1415,8 +1416,8 @@ fn parseexpandmacro(P *Parser, loc Loc, mac *Macro) void {
P.peektok = :None;
expan.toks = c.body;
++P.expanno;
- P.curexpan = memcpy(xmalloc(sizeof Expan), &expan, sizeof Expan);
-
+ P.curexpan = xmalloc(sizeof Expan);
+ *P.curexpan = expan;
}
fn parseblock0(P *Parser) Block;