]> Cypherpunks repositories - gostls13.git/commitdiff
5a, 5c, 5l: fix for Plan 9 build
authorLucio De Re <lucio.dere@gmail.com>
Fri, 15 Jul 2011 15:58:28 +0000 (11:58 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 15 Jul 2011 15:58:28 +0000 (11:58 -0400)
5a/a.h:
. Removed <u.h> and <lib.h>.
. Made definition of EOF conditional.

5a/a.y:
. Added <u.h> and <lib.h>.

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

5c/peep.c:
. Removed unnecessary "return 0" statement.

5c/reg.c:
. Added compilation condition around unused code.

5c/swt.c:
. Removed unused "thestring" argument from Bprint() calls.

5l/asm.c:
. Added USED() statements as required.
. Adjusted a few format specifications.
. Added compilation condition around unused code.

5l/l.h:
. Dropped directory prefix from <../5l/5.out.h>.
. Added varargck pragma for "I" and "i".

5l/obj.c:
. Cascaded consecutive "if" statements.
. Dropped unnecessary incrementation and assignments.

5l/pass.c:
. Dropped unnecessary assignment.

5l/prof.c:
. #if 0 converted to #ifdef NOTDEF.

5l/span.c:
. Dropped unnecessary incrementation and assignments.

R=golang-dev
CC=golang-dev, rsc
https://golang.org/cl/4752041

12 files changed:
src/cmd/5a/a.h
src/cmd/5a/a.y
src/cmd/5a/lex.c
src/cmd/5c/peep.c
src/cmd/5c/reg.c
src/cmd/5c/swt.c
src/cmd/5l/asm.c
src/cmd/5l/l.h
src/cmd/5l/obj.c
src/cmd/5l/pass.c
src/cmd/5l/prof.c
src/cmd/5l/span.c

index 550b61dcf361be9fbb72753b9f2057a1966547e5..a2c87cf489d6c593d4dc0e73cefbefbc465f6ec4 100644 (file)
@@ -28,8 +28,6 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
-#include <u.h>
-#include <libc.h>
 #include <bio.h>
 #include "../5l/5.out.h"
 
@@ -54,7 +52,9 @@ typedef       struct  Hist    Hist;
 #define        NSYMB           8192
 #define        BUFSIZ          8192
 #define        HISTSZ          20
+#ifndef        EOF
 #define        EOF             (-1)
+#endif
 #define        IGN             (-2)
 #define        GETC()          ((--fi.c < 0)? filbuf(): *fi.p++ & 0xff)
 #define        NHASH           503
index b39c916ab1e3d723f89bb66d4a1e0c15c95bf7bd..9a0efd5e065249b5f91311fa0ef267ff2b3cb983 100644 (file)
@@ -29,7 +29,9 @@
 // THE SOFTWARE.
 
 %{
+#include <u.h>
 #include <stdio.h>     /* if we don't, bison will, and a.h re-#defines getc */
+#include <libc.h>
 #include "a.h"
 %}
 %union
index 3978f1a6c13353a011bb5ee0660ab33a3b6db96d..ad7ed05ddd90f2a1ddf47c82552a1d2b00cc21ee 100644 (file)
 // THE SOFTWARE.
 
 #define        EXTERN
+#include <u.h>
+#include <libc.h>
 #include "a.h"
 #include "y.tab.h"
-#include <ctype.h>
 
 enum
 {
index c15bf0fc4cd499180a48ca13ffcebb47e5b3a8c7..3a905f0997bff554c43a44e2c1002113395461c0 100644 (file)
@@ -1122,7 +1122,6 @@ copyu(Prog *p, Adr *v, Adr *s)
                                return 3;
                return 0;
        }
-       return 0;
 }
 
 int
index 8c97944184a96df4800ff9795a842a6f9a50474a..847b2b55012d10eff7edbebb249efff8ce33f97b 100644 (file)
@@ -83,6 +83,7 @@ regopt(Prog *p)
        // the disable is unconventionally here because the call is in common code shared by 5c/6c/8c
        return;
 
+#ifdef NOTDEF
        firstr = R;
        lastr = R;
        nvar = 0;
@@ -490,6 +491,7 @@ brk:
                r1->link = freer;
                freer = firstr;
        }
+#endif
 }
 
 void
index 431f0481731962226e2e9a4626d7bcdc4b14fb80..7cbaadba962602d30e9ae63f6dd92ea0751f2efa 100644 (file)
@@ -380,10 +380,10 @@ outcode(void)
                Bprint(&outbuf, "\n");
                Bprint(&outbuf, "$$  // exports\n\n");
                Bprint(&outbuf, "$$  // local types\n\n");
-               Bprint(&outbuf, "$$  // dynimport\n", thestring);
+               Bprint(&outbuf, "$$  // dynimport\n");
                for(i=0; i<ndynimp; i++)
                        Bprint(&outbuf, "dynimport %s %s %s\n", dynimp[i].local, dynimp[i].remote, dynimp[i].path);
-               Bprint(&outbuf, "\n$$  // dynexport\n", thestring);
+               Bprint(&outbuf, "\n$$  // dynexport\n");
                for(i=0; i<ndynexp; i++)
                        Bprint(&outbuf, "dynexport %s %s\n", dynexp[i].local, dynexp[i].remote);
                Bprint(&outbuf, "\n$$\n\n");
index 28de6255a6164485b78f02f7ee74e63bd9b208c3..15b7d974e7d9963e909f558a83135b79694bc32e 100644 (file)
@@ -102,12 +102,15 @@ int       nelfsym = 1;
 void
 adddynrel(Sym *s, Reloc *r)
 {
+       USED(s);
+       USED(r);
        diag("adddynrel: unsupported binary format");
 }
 
 void
 adddynsym(Sym *s)
 {
+       USED(s);
        diag("adddynsym: not implemented");
 }
 
@@ -120,6 +123,9 @@ elfsetupplt(void)
 int
 archreloc(Reloc *r, Sym *s, vlong *val)
 {
+       USED(r);
+       USED(s);
+       USED(val);
        return -1;
 }
 
@@ -452,7 +458,7 @@ asmb(void)
                startva = INITTEXT - fo;        /* va of byte 0 of file */
                
                /* This null SHdr must appear before all others */
-               sh = newElfShdr(elfstr[ElfStrEmpty]);
+               newElfShdr(elfstr[ElfStrEmpty]);
 
                /* program header info */
                pph = newElfPhdr();
@@ -635,11 +641,11 @@ asmb(void)
        cflush();
        if(debug['c']){
                print("textsize=%d\n", textsize);
-               print("datsize=%d\n", segdata.filelen);
-               print("bsssize=%d\n", segdata.len - segdata.filelen);
+               print("datsize=%ulld\n", segdata.filelen);
+               print("bsssize=%ulld\n", segdata.len - segdata.filelen);
                print("symsize=%d\n", symsize);
                print("lcsize=%d\n", lcsize);
-               print("total=%d\n", textsize+segdata.len+symsize+lcsize);
+               print("total=%lld\n", textsize+segdata.len+symsize+lcsize);
        }
 }
 
@@ -1436,6 +1442,7 @@ if(debug['G']) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->name, p-
        out[5] = o6;
        return;
 
+#ifdef NOTDEF
        v = p->pc;
        switch(o->size) {
        default:
@@ -1491,6 +1498,7 @@ if(debug['G']) print("%ux: %s: arm %d\n", (uint32)(p->pc), p->from.sym->name, p-
                lputl(o6);
                break;
        }
+#endif
 }
 
 int32
index 182f3e738b941df5b6c1706067fd6a74951cfedc..dbd6b3cae057075121bf0fc4ee7ffaf48318cb0d 100644 (file)
@@ -31,7 +31,7 @@
 #include       <u.h>
 #include       <libc.h>
 #include       <bio.h>
-#include       "../5l/5.out.h"
+#include       "5.out.h"
 
 enum
 {
@@ -337,9 +337,11 @@ EXTERN     Prog*   prog_modu;
 #pragma        varargck        type    "A"     int
 #pragma        varargck        type    "C"     int
 #pragma        varargck        type    "D"     Adr*
+#pragma        varargck        type    "I"     uchar*
 #pragma        varargck        type    "N"     Adr*
 #pragma        varargck        type    "P"     Prog*
 #pragma        varargck        type    "S"     char*
+#pragma        varargck        type    "i"     char*
 
 int    Aconv(Fmt*);
 int    Cconv(Fmt*);
index dd3a7329a2ca9f63c1ced695f10bb98013956db3..15f4b89cac9afa63159ece85c4929bc4c54626e7 100644 (file)
@@ -151,11 +151,12 @@ main(int argc, char *argv[])
        if(HEADTYPE == -1) {
                if(debug['U'])
                        HEADTYPE = Hnoheader;
-               if(debug['B'])
+               else if(debug['B'])
                        HEADTYPE = Hrisc;
-               if(debug['9'])
+               else if(debug['9'])
                        HEADTYPE = Hplan9x32;
-               HEADTYPE = Hlinux;
+               else
+                       HEADTYPE = Hlinux;
        }
        switch(HEADTYPE) {
        default:
@@ -347,7 +348,6 @@ zaddr(Biobuf *f, Adr *a, Sym *h[])
 
        case D_REGREG:
                a->offset = Bgetc(f);
-               c++;
                break;
 
        case D_CONST2:
@@ -363,7 +363,6 @@ zaddr(Biobuf *f, Adr *a, Sym *h[])
        case D_SCONST:
                a->sval = mal(NSNAME);
                Bread(f, a->sval, NSNAME);
-               c += NSNAME;
                break;
 
        case D_FCONST:
@@ -462,7 +461,6 @@ loop:
                s = lookup(x, r);
                if(x != name)
                        free(x);
-               name = nil;
 
                if(sig != 0){
                        if(s->sig != 0 && s->sig != sig)
index 194a1ed5f3ac783932e9f7b5211f65566e6d42ff..c430494597cd09ba4bf4750bb68e9497bc5bc560 100644 (file)
@@ -246,7 +246,6 @@ patch(void)
 
        for(cursym = textp; cursym != nil; cursym = cursym->next) {
                for(p = cursym->text; p != P; p = p->link) {
-                       a = p->as;
                        if(p->cond != P) {
                                p->cond = brloop(p->cond);
                                if(p->cond != P)
index 48ad2dc594ca3bbc81833d9e558d502fb20777df..225a524353140ffb09231f2f9a63062b6a81baa1 100644 (file)
@@ -36,7 +36,7 @@
 void
 doprof1(void)
 {
-#if 0  // TODO(rsc)
+#ifdef NOTDEF  // TODO(rsc)
        Sym *s;
        int32 n;
        Prog *p, *q;
index eb79f6b5a2b58c94d0efd5673705f0b3c5a4a7d2..d3da0278bfebda58e8d6d2c6d2b8c905cd03d7b1 100644 (file)
@@ -97,8 +97,6 @@ span(void)
 
        bflag = 0;
        c = INITTEXT;
-       op = nil;
-       p = nil;
        otxt = c;
        for(cursym = textp; cursym != nil; cursym = cursym->next) {
                p = cursym->text;
@@ -224,7 +222,6 @@ span(void)
        
                bp = cursym->p;
                for(p = p->link; p != P; p = p->link) {
-                       curp = p;
                        pc = p->pc;
                        curp = p;
                        o = oplook(p);
@@ -234,7 +231,7 @@ span(void)
                                *bp++ = v;
                                *bp++ = v>>8;
                                *bp++ = v>>16;
-                               *bp++ = v>>24;
+                               *bp = v>>24;
                        }
                }
        }
@@ -463,8 +460,6 @@ aclass(Adr *a)
                                print("%D\n", a);
                                return C_GOK;
                        }
-                       s = a->sym;
-                       t = s->type;
                        instoffset = 0; // s.b. unused but just in case
                        return C_ADDR;
 
@@ -520,8 +515,6 @@ aclass(Adr *a)
                switch(a->name) {
                case D_EXTERN:
                case D_STATIC:
-                       s = a->sym;
-                       t = s->type;
                        instoffset = 0; // s.b. unused but just in case
                        return C_ADDR;
                }
@@ -556,7 +549,6 @@ aclass(Adr *a)
                        s = a->sym;
                        if(s == S)
                                break;
-                       t = s->type;
                        instoffset = 0; // s.b. unused but just in case
                        return C_LCON;