Commit 4c6280b0 authored by Lucio De Re's avatar Lucio De Re Committed by Russ Cox

6a, 6c, 6l: fix for Plan 9 build

6a/a.h:
. Dropped <u.h> and <libc.h>.
. Made definition of EOF conditional.

6a/a.y:
. Added <u.h> and <libc.h>.

6a/lex.c:
. Added <u.h> and <libc.h>.
. Dropped <ctype.h> (now in <u.h>).

6c/gc.h:
. Added varargck pragma for "lD".

6c/swt.c:
. Dropped unused "thestring" argument in Bprint() calls.

6l/Makefile:
. Dropped unneeded directory prefix.

6l/l.h:
. Dropped unneeded directory prefix.
. Added varargck pragma for "I" and "i".

6l/obj.c:
. Dropped unneeded assignment.
. Dropped unreachable goto statement.

6l/pass.c:
. Dropped assignments flagged as unused.

6l/prof.c:
. Replaced "#if 0" with "#ifdef NOTDEF".

6l/span.c:
. Dropped unused incrementation.
. Added USED() as required.
. Dropped unreachable "return" statement.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4747044
parent 5ea4d73b
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE. // THE SOFTWARE.
#include <u.h>
#include <libc.h>
#include <bio.h> #include <bio.h>
#include "../6l/6.out.h" #include "../6l/6.out.h"
...@@ -57,7 +55,9 @@ typedef struct Gen2 Gen2; ...@@ -57,7 +55,9 @@ typedef struct Gen2 Gen2;
#define NSYMB 500 #define NSYMB 500
#define BUFSIZ 8192 #define BUFSIZ 8192
#define HISTSZ 20 #define HISTSZ 20
#ifndef EOF
#define EOF (-1) #define EOF (-1)
#endif
#define IGN (-2) #define IGN (-2)
#define GETC() ((--fi.c < 0)? filbuf(): *fi.p++ & 0xff) #define GETC() ((--fi.c < 0)? filbuf(): *fi.p++ & 0xff)
#define NHASH 503 #define NHASH 503
......
...@@ -29,7 +29,9 @@ ...@@ -29,7 +29,9 @@
// THE SOFTWARE. // THE SOFTWARE.
%{ %{
#include <u.h>
#include <stdio.h> /* if we don't, bison will, and a.h re-#defines getc */ #include <stdio.h> /* if we don't, bison will, and a.h re-#defines getc */
#include <libc.h>
#include "a.h" #include "a.h"
%} %}
%union { %union {
......
...@@ -29,9 +29,10 @@ ...@@ -29,9 +29,10 @@
// THE SOFTWARE. // THE SOFTWARE.
#define EXTERN #define EXTERN
#include <u.h>
#include <libc.h>
#include "a.h" #include "a.h"
#include "y.tab.h" #include "y.tab.h"
#include <ctype.h>
enum enum
{ {
......
...@@ -398,6 +398,7 @@ void shiftit(Type*, Node*, Node*); ...@@ -398,6 +398,7 @@ void shiftit(Type*, Node*, Node*);
#pragma varargck type "A" int #pragma varargck type "A" int
#pragma varargck type "B" Bits #pragma varargck type "B" Bits
#pragma varargck type "D" Adr* #pragma varargck type "D" Adr*
#pragma varargck type "lD" Adr*
#pragma varargck type "P" Prog* #pragma varargck type "P" Prog*
#pragma varargck type "R" int #pragma varargck type "R" int
#pragma varargck type "S" char* #pragma varargck type "S" char*
......
...@@ -238,10 +238,10 @@ outcode(void) ...@@ -238,10 +238,10 @@ outcode(void)
Bprint(&b, "\n"); Bprint(&b, "\n");
Bprint(&b, "$$ // exports\n\n"); Bprint(&b, "$$ // exports\n\n");
Bprint(&b, "$$ // local types\n\n"); Bprint(&b, "$$ // local types\n\n");
Bprint(&b, "$$ // dynimport\n", thestring); Bprint(&b, "$$ // dynimport\n");
for(i=0; i<ndynimp; i++) for(i=0; i<ndynimp; i++)
Bprint(&b, "dynimport %s %s %s\n", dynimp[i].local, dynimp[i].remote, dynimp[i].path); Bprint(&b, "dynimport %s %s %s\n", dynimp[i].local, dynimp[i].remote, dynimp[i].path);
Bprint(&b, "\n$$ // dynexport\n", thestring); Bprint(&b, "\n$$ // dynexport\n");
for(i=0; i<ndynexp; i++) for(i=0; i<ndynexp; i++)
Bprint(&b, "dynexport %s %s\n", dynexp[i].local, dynexp[i].remote); Bprint(&b, "dynexport %s %s\n", dynexp[i].local, dynexp[i].remote);
Bprint(&b, "\n$$\n\n"); Bprint(&b, "\n$$\n\n");
......
...@@ -30,7 +30,7 @@ OFILES=\ ...@@ -30,7 +30,7 @@ OFILES=\
HFILES=\ HFILES=\
l.h\ l.h\
../6l/6.out.h\ 6.out.h\
../ld/lib.h\ ../ld/lib.h\
../ld/elf.h\ ../ld/elf.h\
../ld/macho.h\ ../ld/macho.h\
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <u.h> #include <u.h>
#include <libc.h> #include <libc.h>
#include <bio.h> #include <bio.h>
#include "../6l/6.out.h" #include "6.out.h"
#ifndef EXTERN #ifndef EXTERN
#define EXTERN extern #define EXTERN extern
...@@ -301,9 +301,11 @@ EXTERN union ...@@ -301,9 +301,11 @@ EXTERN union
#pragma varargck type "A" uint #pragma varargck type "A" uint
#pragma varargck type "D" Adr* #pragma varargck type "D" Adr*
#pragma varargck type "I" uchar*
#pragma varargck type "P" Prog* #pragma varargck type "P" Prog*
#pragma varargck type "R" int #pragma varargck type "R" int
#pragma varargck type "S" char* #pragma varargck type "S" char*
#pragma varargck type "i" char*
EXTERN int32 HEADR; EXTERN int32 HEADR;
EXTERN int32 HEADTYPE; EXTERN int32 HEADTYPE;
......
...@@ -455,7 +455,6 @@ loop: ...@@ -455,7 +455,6 @@ loop:
s = lookup(x, r); s = lookup(x, r);
if(x != name) if(x != name)
free(x); free(x);
name = nil;
if(debug['S'] && r == 0) if(debug['S'] && r == 0)
sig = 1729; sig = 1729;
...@@ -724,7 +723,6 @@ loop: ...@@ -724,7 +723,6 @@ loop:
lastp = p; lastp = p;
goto loop; goto loop;
} }
goto loop;
eof: eof:
diag("truncated object file: %s", pn); diag("truncated object file: %s", pn);
......
...@@ -402,8 +402,6 @@ dostkoff(void) ...@@ -402,8 +402,6 @@ dostkoff(void)
pmorestack[i] = symmorestack[i]->text; pmorestack[i] = symmorestack[i]->text;
} }
autoffset = 0;
deltasp = 0;
for(cursym = textp; cursym != nil; cursym = cursym->next) { for(cursym = textp; cursym != nil; cursym = cursym->next) {
if(cursym->text == nil || cursym->text->link == nil) if(cursym->text == nil || cursym->text->link == nil)
continue; continue;
...@@ -415,7 +413,6 @@ dostkoff(void) ...@@ -415,7 +413,6 @@ dostkoff(void)
autoffset = 0; autoffset = 0;
q = P; q = P;
q1 = P;
if((p->from.scale & NOSPLIT) && autoffset >= StackSmall) if((p->from.scale & NOSPLIT) && autoffset >= StackSmall)
diag("nosplit func likely to overflow stack"); diag("nosplit func likely to overflow stack");
...@@ -471,7 +468,6 @@ dostkoff(void) ...@@ -471,7 +468,6 @@ dostkoff(void)
p = appendp(p); p = appendp(p);
p->as = ANOP; p->as = ANOP;
q1->pcond = p; q1->pcond = p;
q1 = P;
} }
if(autoffset < StackBig) { // do we need to call morestack? if(autoffset < StackBig) { // do we need to call morestack?
...@@ -611,7 +607,6 @@ dostkoff(void) ...@@ -611,7 +607,6 @@ dostkoff(void)
p = appendp(p); p = appendp(p);
p->as = ANOP; p->as = ANOP;
q1->pcond = p; q1->pcond = p;
q1 = P;
} }
for(; p != P; p = p->link) { for(; p != P; p = p->link) {
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
void void
doprof1(void) doprof1(void)
{ {
#if 0 #ifdef NOTDEF
Sym *s; Sym *s;
int32 n; int32 n;
Prog *p, *q; Prog *p, *q;
......
...@@ -94,7 +94,7 @@ span1(Sym *s) ...@@ -94,7 +94,7 @@ span1(Sym *s)
*bp++ = v; *bp++ = v;
*bp++ = v>>8; *bp++ = v>>8;
*bp++ = v>>16; *bp++ = v>>16;
*bp++ = v>>24; *bp = v>>24;
} }
} }
p->comefrom = P; p->comefrom = P;
...@@ -706,6 +706,7 @@ asmandsz(Adr *a, int r, int rex, int m64) ...@@ -706,6 +706,7 @@ asmandsz(Adr *a, int r, int rex, int m64)
int t, scale; int t, scale;
Reloc rel; Reloc rel;
USED(m64);
rex &= (0x40 | Rxr); rex &= (0x40 | Rxr);
v = a->offset; v = a->offset;
t = a->type; t = a->type;
...@@ -732,7 +733,6 @@ asmandsz(Adr *a, int r, int rex, int m64) ...@@ -732,7 +733,6 @@ asmandsz(Adr *a, int r, int rex, int m64)
*andptr++ = (0 << 6) | (4 << 0) | (r << 3); *andptr++ = (0 << 6) | (4 << 0) | (r << 3);
asmidx(a->scale, a->index, t); asmidx(a->scale, a->index, t);
goto putrelv; goto putrelv;
return;
} }
if(v == 0 && rel.siz == 0 && t != D_BP && t != D_R13) { if(v == 0 && rel.siz == 0 && t != D_BP && t != D_R13) {
*andptr++ = (0 << 6) | (4 << 0) | (r << 3); *andptr++ = (0 << 6) | (4 << 0) | (r << 3);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment