shithub: scc

Download patch

ref: 18b97e92164b317b6d8f846912b3f043745ed479
parent: 6982da79fb531a963361ae875bbfd3012acaaf00
author: Quentin Rameau <[email protected]>
date: Wed Jun 1 15:44:34 EDT 2016

[driver] add S flag for stopping after assembly output

--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -42,7 +42,7 @@
 
 char *argv0;
 static char *arch;
-static int Eflag, kflag;
+static int Eflag, Sflag, kflag;
 
 static void
 terminate(void)
@@ -159,13 +159,17 @@
 			ADDARG(tool, file);
 			break;
 		case CC2:
-			out = (!arch || strcmp(arch, "qbe")) ? AS : QBE;
-			if (out != QBE)
-				keepfile = kflag;
+			if (!arch || strcmp(arch, "qbe")) {
+				out = Sflag ? NR_TOOLS : AS;
+				keepfile = (Sflag || kflag);
+			} else {
+				out = QBE;
+				keepfile = Sflag;
+			}
 			break;
 		case QBE:
-			out = AS;
-			keepfile = kflag;
+			out = Sflag ? NR_TOOLS : AS;
+			keepfile = (Sflag || kflag);
 			break;
 		case AS:
 			out = NR_TOOLS;
@@ -207,6 +211,9 @@
 	case 'E':
 		Eflag = 1;
 		ADDARG(CC1, "-E");
+		break;
+	case 'S':
+		Sflag = 1;
 		break;
 	case 'k':
 		kflag = 1;