shithub: scc

Download patch

ref: 3e95097ce623d14228f5fe8f4206efe7d3490a9a
parent: e1ca03524b266b4fd32a8de204c0076552aff7a5
author: Quentin Rameau <[email protected]>
date: Wed Feb 15 13:15:25 EST 2017

[cc1] Remove -o option

It's not necessary, the user can use shell redirection if needed.

--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -478,7 +478,7 @@
 extern int onlycpp, onlyheader;
 extern unsigned curctx;
 extern Symbol *curfun, *zero, *one;
-extern char *infile, *outfile;
+extern char *infile;
 extern unsigned lineno;
 extern char filenam[FILENAME_MAX];
 
--- a/cc1/main.c
+++ b/cc1/main.c
@@ -10,7 +10,7 @@
 #include "../inc/cc.h"
 #include "cc1.h"
 
-char *argv0, *infile, *outfile;
+char *argv0, *infile;
 
 int warnings;
 jmp_buf recover;
@@ -22,13 +22,6 @@
 extern int failure;
 
 static void
-clean(void)
-{
-	if (failure && outfile)
-		remove(outfile);
-}
-
-static void
 defmacro(char *macro)
 {
 	char *p = strchr(macro, '=');
@@ -54,7 +47,6 @@
 	char *cp;
 	int i;
 
-	atexit(clean);
 	ilex();
 	icpp();
 	icode();
@@ -79,9 +71,6 @@
 	case 'd':
 		DBGON();
 		break;
-	case 'o':
-		outfile = EARGF(usage());
-		break;
 	case 'w':
 		warnings = 1;
 		break;
@@ -91,9 +80,6 @@
 
 	if (argc > 1)
 		usage();
-
-	if (outfile && !freopen(outfile, "w", stdout))
-		die("error opening output: %s", strerror(errno));
 
 	for (i = 0; i < uflags.n; ++i)
 		undefmacro(uflags.s[i]);