1
0
mirror of https://github.com/golang/go synced 2024-10-01 13:28:37 -06:00

dist: fix Plan 9 build

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
This commit is contained in:
David du Colombier 2014-08-06 06:11:41 -07:00 committed by Ian Lance Taylor
parent bf13b711bd
commit de1ab89f03

View 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);