shithub: scc

Download patch

ref: 65e7f64721c6c48fd0e750b1d3eda32094110507
parent: 0b39941d7622ebf6733e8d626c4b57404383d42f
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon May 11 06:26:18 EDT 2015

Fix discard()

--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -553,7 +553,8 @@
 	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 @@
 				goto jump;
 			break;
 		}
-		if (*input->p == '\0')
-			fill();
-		if (!input)
-			break;
+		if (!fill())
+			exit(-1);
 	}
-
-	c = EOFTOK;
 jump:
 	yytoken = c;
 	longjmp(recover, 1);