shithub: scc

Download patch

ref: 051a76e14d0004c2646546c79792f4536f6218d7
parent: 4dba5596398fe88df1210f15d0a1ccb68604c2da
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat Sep 9 06:21:35 EDT 2017

[cc1] Avoid inclusion of stdio.h in every file

Due to several definitions in cc1.h it was needed to include
stdio.h in every file of cc1, but checking that stdin is defined
we can avoid the inclusion.

--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -361,6 +361,7 @@
 	unsigned char token;
 };
 
+#ifdef stdin
 struct input {
 	char flags;
 	unsigned lineno;
@@ -370,6 +371,7 @@
 	char *line, *begin, *p;
 	struct input *next;
 };
+#endif
 
 /* error.c */
 extern void error(char *fmt, ...);
@@ -481,7 +483,7 @@
 extern Symbol *curfun, *zero, *one;
 extern char *infile;
 extern unsigned lineno;
-extern char filenam[FILENAME_MAX];
+extern char filenam[];
 
 extern Type *voidtype, *pvoidtype, *booltype,
             *uchartype,   *chartype, *schartype,
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -1,6 +1,5 @@
 static char sccsid[] = "@(#) ./cc1/decl.c";
 #include <stdarg.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -1,6 +1,5 @@
 static char sccsid[] = "@(#) ./cc1/expr.c";
 #include <assert.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
--- a/cc1/fold.c
+++ b/cc1/fold.c
@@ -1,6 +1,5 @@
 static char sccsid[] = "@(#) ./cc1/fold.c";
 #include <assert.h>
-#include <stdio.h>
 #include <stdlib.h>
 
 #include "../inc/scc.h"
--- a/cc1/init.c
+++ b/cc1/init.c
@@ -1,6 +1,5 @@
 static char sccsid[] = "@(#) ./cc1/init.c";
 #include <stdint.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
--- a/cc1/main.c
+++ b/cc1/main.c
@@ -1,6 +1,5 @@
 static char sccsid[] = "@(#) ./cc1/main.c";
 #include <setjmp.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
@@ -1,7 +1,6 @@
 static char sccsid[] = "@(#) ./cc1/stmt.c";
 #include <stddef.h>
 #include <setjmp.h>
-#include <stdio.h>
 
 #include <cstd.h>
 #include "../inc/scc.h"
--- a/cc1/target/amd64-sysv/arch.c
+++ b/cc1/target/amd64-sysv/arch.c
@@ -1,5 +1,4 @@
 static char sccsid[] = "@(#) ./cc1/arch/amd64-sysv/arch.c";
-#include <stdio.h>
 
 #include "../../../inc/scc.h"
 #include "../../cc1.h"
--- a/cc1/target/i386-sysv/arch.c
+++ b/cc1/target/i386-sysv/arch.c
@@ -1,5 +1,4 @@
 static char sccsid[] = "@(#) ./cc1/arch/i386-sysv/arch.c";
-#include <stdio.h>
 
 #include "../../../inc/scc.h"
 #include "../../cc1.h"
--- a/cc1/target/z80-scc/arch.c
+++ b/cc1/target/z80-scc/arch.c
@@ -1,5 +1,4 @@
 static char sccsid[] = "@(#) ./cc1/arch/z80/arch.c";
-#include <stdio.h>
 
 #include "../../../inc/scc.h"
 #include "../../cc1.h"
--- a/cc1/types.c
+++ b/cc1/types.c
@@ -1,7 +1,6 @@
 static char sccsid[] = "@(#) ./cc1/types.c";
 #include <assert.h>
 #include <inttypes.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>