shithub: scc

Download patch

ref: d8b440c914ba19c96d8c8ec6eaaa10bf90352987
parent: c7315dfa1117bafcb193d4fbd9cdaa27d08e932d
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Oct 31 17:43:36 EDT 2013

Reduce indentation in sqpecifier

At the moment we know we are not going to continue reading specifiers
we can go out of the loop and the switch, and it will help us to reduce
the ciclomatic complexity.

--- a/decl.c
+++ b/decl.c
@@ -217,32 +217,36 @@
 			}
 			/* it is not a type name */
 		default:
-			if (!tp->defined) {
-				if (!store->defined &&
-				    !qlf->defined   &&
-				    curctx != CTX_OUTER &&
-				    nested_tags == 0) {
-					return false;
-				}
-				warn(options.implicit,
-				     "type defaults to 'int' in declaration");
+			goto check_type;
+		}
+	}
+
+check_type:
+	if (!tp->defined) {
+		if (!store->defined &&
+		    !qlf->defined &&
+		    curctx != CTX_OUTER &&
+		    nested_tags == 0) {
+			return false;
+		}
+		warn(options.implicit,
+		     "type defaults to 'int' in declaration");
+	}
+	if (nested_tags > 0 && (qlf->defined || store->defined))
+		error("type qualifer or store specifier in field declaration");
+
+	if (!tp->c_signed && !tp->c_unsigned) {
+		switch (tp->type) {
+		case CHAR:
+			if (!options.charsign) {
+		case BOOL:	tp->c_unsigned = 1;
+				break;
 			}
-			if (nested_tags > 0 && (qlf->defined || store->defined))
-				error("type qualifer or store specifier in field declaration");
-			if (!tp->c_signed && !tp->c_unsigned) {
-				switch (tp->type) {
-				case CHAR:
-					if (!options.charsign) {
-				case BOOL:	tp->c_unsigned = 1;
-						break;
-					}
-				case INT: case SHORT: case LONG: case LLONG:
-					tp->c_signed = 1;
-				}
-			}
-			return true;
+		case INT: case SHORT: case LONG: case LLONG:
+			tp->c_signed = 1;
 		}
 	}
+	return true;
 }
 
 static void