shithub: riscv

Download patch

ref: 8ca102d42ed7b1c0ef687365ec32dca2ebd18faa
parent: 34cf2725d2f8af3db84b77711af7b2559aa131fd
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue May 12 19:18:48 EDT 2020

cc: dont export gethunk(), hunk, nhunk and thunk

--- a/sys/src/cmd/1a/lex.c
+++ b/sys/src/cmd/1a/lex.c
@@ -653,7 +653,6 @@
 	iostack = I;
 	iofree = I;
 	peekc = IGN;
-	nhunk = 0;
 	for(i=0; i<NHASH; i++)
 		hash[i] = S;
 	for(i=0; itab[i].name; i++) {
--- a/sys/src/cmd/1l/obj.c
+++ b/sys/src/cmd/1l/obj.c
@@ -250,7 +250,6 @@
 		Bprint(&bso, "%5.2f cpu time\n", cputime());
 		Bprint(&bso, "%ld data statements\n", ndata);
 		Bprint(&bso, "%ld symbols\n", nsymbol);
-		Bprint(&bso, "%zud memory used\n", thunk);
 		Bprint(&bso, "%d sizeof adr\n", sizeof(Adr));
 		Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
 	}
--- a/sys/src/cmd/2a/lex.c
+++ b/sys/src/cmd/2a/lex.c
@@ -658,7 +658,6 @@
 	iostack = I;
 	iofree = I;
 	peekc = IGN;
-	nhunk = 0;
 	for(i=0; i<NHASH; i++)
 		hash[i] = S;
 	for(i=0; itab[i].name; i++) {
--- a/sys/src/cmd/2l/obj.c
+++ b/sys/src/cmd/2l/obj.c
@@ -252,7 +252,6 @@
 		Bprint(&bso, "%ld+%ld = %ld data statements\n",
 			ndata, ncase, ndata+ncase);
 		Bprint(&bso, "%ld symbols\n", nsymbol);
-		Bprint(&bso, "%zud memory used\n", thunk);
 		Bprint(&bso, "%d sizeof adr\n", sizeof(Adr));
 		Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
 	}
--- a/sys/src/cmd/5a/a.h
+++ b/sys/src/cmd/5a/a.h
@@ -147,7 +147,6 @@
 void	dodefine(char*);
 void	prfile(long);
 void	linehist(char*, int);
-void	gethunk(void);
 void	yyerror(char*, ...);
 int	yyparse(void);
 void	setinclude(char*);
--- a/sys/src/cmd/5a/lex.c
+++ b/sys/src/cmd/5a/lex.c
@@ -411,7 +411,6 @@
 	iostack = I;
 	iofree = I;
 	peekc = IGN;
-	nhunk = 0;
 	for(i=0; i<NHASH; i++)
 		hash[i] = S;
 	for(i=0; itab[i].name; i++) {
--- a/sys/src/cmd/5l/obj.c
+++ b/sys/src/cmd/5l/obj.c
@@ -281,7 +281,6 @@
 out:
 	if(debug['v']) {
 		Bprint(&bso, "%5.2f cpu time\n", cputime());
-		Bprint(&bso, "%zud memory used\n", thunk);
 		Bprint(&bso, "%d sizeof adr\n", sizeof(Adr));
 		Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
 	}
--- a/sys/src/cmd/6a/lex.c
+++ b/sys/src/cmd/6a/lex.c
@@ -992,7 +992,6 @@
 	iostack = I;
 	iofree = I;
 	peekc = IGN;
-	nhunk = 0;
 	for(i=0; i<NHASH; i++)
 		hash[i] = S;
 	for(i=0; itab[i].name; i++) {
--- a/sys/src/cmd/6l/obj.c
+++ b/sys/src/cmd/6l/obj.c
@@ -341,7 +341,6 @@
 	if(debug['v']) {
 		Bprint(&bso, "%5.2f cpu time\n", cputime());
 		Bprint(&bso, "%ld symbols\n", nsymbol);
-		Bprint(&bso, "%zud memory used\n", thunk);
 		Bprint(&bso, "%d sizeof adr\n", sizeof(Adr));
 		Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
 	}
--- a/sys/src/cmd/7a/lex.c
+++ b/sys/src/cmd/7a/lex.c
@@ -740,7 +740,6 @@
 	iostack = I;
 	iofree = I;
 	peekc = IGN;
-	nhunk = 0;
 	for(i=0; i<NHASH; i++)
 		hash[i] = S;
 	for(i=0; itab[i].name; i++) {
--- a/sys/src/cmd/8a/lex.c
+++ b/sys/src/cmd/8a/lex.c
@@ -858,7 +858,6 @@
 	iostack = I;
 	iofree = I;
 	peekc = IGN;
-	nhunk = 0;
 	for(i=0; i<NHASH; i++)
 		hash[i] = S;
 	for(i=0; itab[i].name; i++) {
--- a/sys/src/cmd/8l/obj.c
+++ b/sys/src/cmd/8l/obj.c
@@ -338,7 +338,6 @@
 	if(debug['v']) {
 		Bprint(&bso, "%5.2f cpu time\n", cputime());
 		Bprint(&bso, "%ld symbols\n", nsymbol);
-		Bprint(&bso, "%zud memory used\n", thunk);
 		Bprint(&bso, "%d sizeof adr\n", sizeof(Adr));
 		Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
 	}
--- a/sys/src/cmd/cc/compat
+++ b/sys/src/cmd/cc/compat
@@ -78,11 +78,11 @@
 
 extern char end[];
 
-char*	hunk = end;
-long	nhunk;
-uintptr	thunk;
+static char*	hunk = end;
+static long	nhunk;
+static uintptr	thunk;
 
-void
+static void
 gethunk(void)
 {
 	long nh;
--- a/sys/src/cmd/cc/compat.h
+++ b/sys/src/cmd/cc/compat.h
@@ -24,11 +24,5 @@
 EXTERN	int	myfork(void);
 EXTERN	int	mypipe(int*);
 
-EXTERN	void	gethunk(void);
-
-EXTERN	char*	hunk;
-EXTERN	long	nhunk;
-EXTERN	uintptr	thunk;
-
 EXTERN	void*	alloc(long n);
 EXTERN	void*	allocn(void *p, long on, long n);
--- a/sys/src/cmd/cc/lex.c
+++ b/sys/src/cmd/cc/lex.c
@@ -1228,7 +1228,6 @@
 	iostack = I;
 	iofree = I;
 	peekc = IGN;
-	nhunk = 0;
 
 	types[TXXX] = T;
 	types[TCHAR] = typ(TCHAR, T);
--- a/sys/src/cmd/cc/macbody
+++ b/sys/src/cmd/cc/macbody
@@ -246,7 +246,7 @@
 	if(isspace(c))
 		if(c != '\n')
 			c = getnsc();
-	base = hunk;
+	base = alloc(1);
 	len = 1;
 	ischr = 0;
 	for(;;) {
--- a/sys/src/cmd/ka/lex.c
+++ b/sys/src/cmd/ka/lex.c
@@ -465,7 +465,6 @@
 	iostack = I;
 	iofree = I;
 	peekc = IGN;
-	nhunk = 0;
 	for(i=0; i<NHASH; i++)
 		hash[i] = S;
 	for(i=0; itab[i].name; i++) {
--- a/sys/src/cmd/kl/obj.c
+++ b/sys/src/cmd/kl/obj.c
@@ -194,7 +194,6 @@
 out:
 	if(debug['v']) {
 		Bprint(&bso, "%5.2f cpu time\n", cputime());
-		Bprint(&bso, "%zud memory used\n", thunk);
 		Bprint(&bso, "%d sizeof adr\n", sizeof(Adr));
 		Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
 	}
--- a/sys/src/cmd/qa/lex.c
+++ b/sys/src/cmd/qa/lex.c
@@ -667,7 +667,6 @@
 	iostack = I;
 	iofree = I;
 	peekc = IGN;
-	nhunk = 0;
 	for(i=0; i<NHASH; i++)
 		hash[i] = S;
 	for(i=0; itab[i].name; i++) {
--- a/sys/src/cmd/ql/obj.c
+++ b/sys/src/cmd/ql/obj.c
@@ -273,7 +273,6 @@
 out:
 	if(debug['v']) {
 		Bprint(&bso, "%5.2f cpu time\n", cputime());
-		Bprint(&bso, "%zud memory used\n", thunk);
 		Bprint(&bso, "%d sizeof adr\n", sizeof(Adr));
 		Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
 	}
--- a/sys/src/cmd/va/lex.c
+++ b/sys/src/cmd/va/lex.c
@@ -444,7 +444,6 @@
 	iostack = I;
 	iofree = I;
 	peekc = IGN;
-	nhunk = 0;
 	for(i=0; i<NHASH; i++)
 		hash[i] = S;
 	for(i=0; itab[i].name; i++) {
--- a/sys/src/cmd/vl/obj.c
+++ b/sys/src/cmd/vl/obj.c
@@ -240,7 +240,6 @@
 out:
 	if(debug['v']) {
 		Bprint(&bso, "%5.2f cpu time\n", cputime());
-		Bprint(&bso, "%zud memory used\n", thunk);
 		Bprint(&bso, "%d sizeof adr\n", sizeof(Adr));
 		Bprint(&bso, "%d sizeof prog\n", sizeof(Prog));
 	}