scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 65e7f64721c6c48fd0e750b1d3eda32094110507
parent 0b39941d7622ebf6733e8d626c4b57404383d42f
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 11 May 2015 10:26:18 +0200

Fix discard()

Diffstat:
Mcc1/lex.c | 11++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/cc1/lex.c b/cc1/lex.c @@ -553,7 +553,8 @@ discard(void) extern jmp_buf recover; char c; - for (c = yytoken; ; c = *input->p++) { + input->begin = input->p; + for (c = yytoken; ; c = *input->begin++) { switch (safe) { case END_COMP: if (c == '}') @@ -572,13 +573,9 @@ discard(void) goto jump; break; } - if (*input->p == '\0') - fill(); - if (!input) - break; + if (!fill()) + exit(-1); } - - c = EOFTOK; jump: yytoken = c; longjmp(recover, 1);