shithub: scc

Download patch

ref: 5eb6c9dd70e390d3a92f27b40d4d0cb7aa0ae03e
parent: f883b8ec98db46ad0d718ab8618fcafe39ec6278
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed May 28 10:05:56 EDT 2014

Remove some unneded gotos

These gotos are not needed at all, and they can be substituted by
direct call to exit.

--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -345,11 +345,8 @@
 	if (!(tp = sym->type))
 		tp = sym->type = mktype(NULL, tag, 0);
 	if (tp->op != tag)
-		goto bad_tag;
+		error("'%s' defined as wrong kind of tag", yytext);
 	return tp;
-
-bad_tag:
-	error("'%s' defined as wrong kind of tag", yytext);
 }
 
 static Type *
@@ -363,7 +360,7 @@
 	tp = newtag(tag);
 	if (accept('{')) {
 		if (tp->defined)
-			goto redefined;
+			error("redefinition of struct/union '%s'", yytext);
 		tp->defined = 1;
 		while (!accept('}'))
 			fielddcl(tp);
@@ -370,9 +367,6 @@
 	}
 
 	return tp;
-
-redefined:
-	error("redefinition of struct/union '%s'", yytext);
 }
 
 static Type *