]> Cypherpunks repositories - gostls13.git/commitdiff
dist: fix Plan 9 build
authorDavid du Colombier <0intro@gmail.com>
Wed, 6 Aug 2014 13:11:41 +0000 (06:11 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 6 Aug 2014 13:11:41 +0000 (06:11 -0700)
Since CL 115060044, mkanames declares an empty
array in anames8.c and anames6.c, which is not
valid for the Plan 9 compiler.

char* cnames8[] = {
};

This change makes mkanames not declaring the
cnames array when no C_ constants are found.

LGTM=iant
R=minux, iant
CC=golang-codereviews
https://golang.org/cl/117680043

src/cmd/dist/buildgc.c

index 178fbf9137f166b488379d326cce0fa1eb7a4572..66adf6857c707fc181eadb8add296b63cd4b0ad7 100644 (file)
@@ -69,7 +69,7 @@ gcopnames(char *dir, char *file)
 void
 mkanames(char *dir, char *file)
 {
-       int i, ch;
+       int i, j, ch;
        Buf in, b, out, out2;
        Vec lines;
        char *p;
@@ -108,6 +108,7 @@ mkanames(char *dir, char *file)
        }
        bwritestr(&out, "};\n");
 
+       j=0;
        bprintf(&out2, "char*   cnames%c[] = {\n", ch);
        for(i=0; i<lines.len; i++) {
                if(hasprefix(lines.p[i], "\tC_")) {
@@ -119,10 +120,12 @@ mkanames(char *dir, char *file)
                                *p = '\0';
                        p = lines.p[i] + 3;
                        bwritestr(&out2, bprintf(&b, "\t\"%s\",\n", p));
+                       j++;
                }
        }
        bwritestr(&out2, "};\n");
-       bwriteb(&out, &out2);
+       if(j>0)
+               bwriteb(&out, &out2);
 
        writefile(&out, file, 0);