diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2020-05-20 12:22:30 -0700 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2020-05-20 12:22:30 -0700 |
commit | 6ea22d950fd7246c9159a3601819ae23d03e8dcd (patch) | |
tree | 483f6df6536ec6e81913641a405d7a6ae3ffefa4 /sys/cmd/cc/lex.c | |
parent | 57eb0c15a10dfcd9816b84166106a1aa32323325 (diff) |
fix: truncate infinite recursion caused by self referential macros
Diffstat (limited to 'sys/cmd/cc/lex.c')
-rw-r--r-- | sys/cmd/cc/lex.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/cmd/cc/lex.c b/sys/cmd/cc/lex.c index 8ce4e79..4cc1259 100644 --- a/sys/cmd/cc/lex.c +++ b/sys/cmd/cc/lex.c @@ -635,8 +635,8 @@ Dispatch: } sym = lookup(&lx->sym, tok.val.s); - if (sym) { - io = makeio(); + if (sym && ((uintptr)sym->name != (uintptr)lx->io->path)) { + io = makeio(sym->name); printf("EXPANDING MACRO %s\n", sym->name); io->buf.end += expandmacro(lx, sym, io->b); *io->buf.end++ = EOF; |