shithub: scc

Download patch

ref: fee8c92d2df603a2d001eeabb1de5a4e01e1ed40
parent: ffa04f840ae175eb5aef9c272b5d160028b83107
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Jan 16 04:22:19 EST 2017

[cc1] Remove extra level of indentation in copymacro

This extra level had no sense because it could be done directly
with a switch. It seems this code is some modification over some
older version which needed.

--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -190,31 +190,25 @@
 	size_t size;
 
 	for (prevc = '\0'; c = *s; prevc = c, ++s) {
-		if (c != '@') {
-			switch (c) {
-			case '$':
-				while (bp[-1] == ' ')
-					--bp, ++bufsiz;
-				while (s[1] == ' ')
-					++s;
-			case '#':
-				continue;
-			case '\"':
-				for (p = s; *++s != '"'; )
-					/* nothing */;
-				size = s - p + 1;
-				if (size > bufsiz)
-					goto expansion_too_long;
-				memcpy(bp, p, size);
-				bufsiz -= size;
-				bp += size;
-				continue;
-			// case '\'';
-			}
-			if (bufsiz-- == 0)
+		switch (c) {
+		case '$':
+			while (bp[-1] == ' ')
+				--bp, ++bufsiz;
+			while (s[1] == ' ')
+				++s;
+		case '#':
+			break;
+		case '\"':
+			for (p = s; *++s != '"'; )
+				/* nothing */;
+			size = s - p + 1;
+			if (size > bufsiz)
 				goto expansion_too_long;
-			*bp++ = c;
-		} else {
+			memcpy(bp, p, size);
+			bufsiz -= size;
+			bp += size;
+			break;
+		case '@':
 			if (prevc == '#')
 				bufsiz -= 2;
 			arg = arglist[atoi(++s)];
@@ -229,6 +223,12 @@
 				*bp++ = '"';
 			bufsiz -= size;
 			s += 2;
+			break;
+		default:
+			if (bufsiz-- == 0)
+				goto expansion_too_long;
+			*bp++ = c;
+			break;
 		}
 	}
 	*bp = '\0';