shithub: scc

Download patch

ref: 52a8cb1286def724462a79e2fcb097b22b37de42
parent: 590028289b23769e95ed571dbe676de4d9687ac2
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Jun 23 04:51:56 EDT 2016

[cc1] Simplify comment()

--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -166,18 +166,14 @@
 	c = -1;
 repeat:
 	do {
-		if (!c)
-			goto unterminated;
-	} while (!eof && (c = readchar()) != type);
+		if (!c || eof) {
+			errorp("unterminated comment");
+			return;
+		}
+	} while ((c = readchar()) != type);
 
-	if (eof)
-		goto unterminated;
 	if (type == '*' && (c = readchar()) != '/')
 		goto repeat;
-	return;
-
-unterminated:
-	errorp("unterminated comment");
 }
 
 static int