shithub: scc

Download patch

ref: 797f25e748cafa8718533af9d9a22642f2992de9
parent: 1c9aa7e9dfda3ae749639a390e08515a71a01842
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Jan 19 04:57:54 EST 2017

[cc1] Improve error handling in string()

--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -515,12 +515,16 @@
 	*bp++ = '"';
 repeat:
 	for (++input->p; (c = *input->p) != '"'; ++input->p) {
-		if (c == '\0')
-			error("missing terminating '\"' character");
+		if (c == '\0') {
+			errorp("missing terminating '\"' character");
+			break;
+		}
 		if (c == '\\')
 			c = escape();
-		if (bp == &yytext[STRINGSIZ+1])
+		if (bp == &yytext[STRINGSIZ+1]) {
+			/* TODO: proper error handling here */
 			error("string too long");
+		}
 		*bp++ = c;
 	}