shithub: scc

Download patch

ref: a1254513235f39ea3816072cf50c0a46f6155e67
parent: 671acae249562120edaec2fb6ff24411ef9be84c
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Jan 17 15:53:55 EST 2016

Reduce indentation in initlist()

--- a/cc1/init.c
+++ b/cc1/init.c
@@ -105,34 +105,34 @@
 		}
 		switch (tp->op) {
 		case ARY:
-			if (tp->defined && n >= tp->n.elem) {
-				if (!toomany)
-					warn("excess elements in array initializer");
-				toomany = 1;
-				sym = NULL;
-			}
 			newtp = tp->type;
+			if (!tp->defined || n < tp->n.elem)
+				break;
+			if (!toomany)
+				warn("excess elements in array initializer");
+			toomany = 1;
+			sym = NULL;
 			break;
 		case STRUCT:
-			if (n >= tp->n.elem) {
-				if (!toomany)
-					warn("excess elements in struct initializer");
-				toomany = 1;
-				sym = NULL;
-			} else {
+			if (n < tp->n.elem) {
 				sym = tp->p.fields[n];
 				newtp = sym->type;
+				break;
 			}
+			if (!toomany)
+				warn("excess elements in struct initializer");
+			toomany = 1;
+			sym = NULL;
 			break;
 		default:
 			newtp = tp;
 			warn("braces around scalar initializer");
-			if (n > 0) {
-				if (!toomany)
-					warn("excess elements in scalar initializer");
-				toomany = 1;
-				sym = NULL;
-			}
+			if (n <= 0)
+				break;
+			if (!toomany)
+				warn("excess elements in scalar initializer");
+			toomany = 1;
+			sym = NULL;
 			break;
 		}
 		if (accept('{'))