shithub: scc

Download patch

ref: f83f8e2064258e2d96e94b4702943ddf1b30239e
parent: d40e75a1f12f03a658fe8e89f84e672baf981b97
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Jul 29 06:55:55 EDT 2012

Removed return value in listdcl

After a function is not needed a semi colon. One way of handling this
situation is let to listdcl return a value indicating a function was
declared, or better expect the semi colon in listdcl itself.

--- a/decl.c
+++ b/decl.c
@@ -125,7 +125,7 @@
 		pushtype(*bp);
 }
 
-static unsigned char listdcl(register struct ctype *tp)
+static void listdcl(register struct ctype *tp)
 {
 	do {
 		register  struct ctype *new;
@@ -138,11 +138,10 @@
 				      yytext);
 		} else if (new->type == FTN && yytoken == '{') {
 			compound();
-			return 0;
+			return;
 		}
 	} while (accept(','));
-
-	return 1;
+	expect(';');
 }
 
 unsigned char decl(void)
@@ -151,21 +150,21 @@
 
 	if (accept(';'))
 		return 1;
-	tp = newctype();
 
+	tp = newctype();
 	if (!spec(tp)) {
 		if (curctx != OUTER_CTX)
 			return 0;
 		warning("data definition has no type or storage class");
 	}
-	if (yytoken == ';') {
+	if (accept(';')) {
 		warning_error(options.useless,
 			      "useless type name in empty declaration");
-	} else if (listdcl(tp)) { /* in case of not being a function */
-		expect(';');
+	} else {
+		listdcl(tp);
 	}
-
 	delctype(tp);
+
 	return 1;
 }