Commit de1ab89f authored by David du Colombier's avatar David du Colombier Committed by Ian Lance Taylor

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
parent bf13b711
...@@ -69,7 +69,7 @@ gcopnames(char *dir, char *file) ...@@ -69,7 +69,7 @@ gcopnames(char *dir, char *file)
void void
mkanames(char *dir, char *file) mkanames(char *dir, char *file)
{ {
int i, ch; int i, j, ch;
Buf in, b, out, out2; Buf in, b, out, out2;
Vec lines; Vec lines;
char *p; char *p;
...@@ -108,6 +108,7 @@ mkanames(char *dir, char *file) ...@@ -108,6 +108,7 @@ mkanames(char *dir, char *file)
} }
bwritestr(&out, "};\n"); bwritestr(&out, "};\n");
j=0;
bprintf(&out2, "char* cnames%c[] = {\n", ch); bprintf(&out2, "char* cnames%c[] = {\n", ch);
for(i=0; i<lines.len; i++) { for(i=0; i<lines.len; i++) {
if(hasprefix(lines.p[i], "\tC_")) { if(hasprefix(lines.p[i], "\tC_")) {
...@@ -119,9 +120,11 @@ mkanames(char *dir, char *file) ...@@ -119,9 +120,11 @@ mkanames(char *dir, char *file)
*p = '\0'; *p = '\0';
p = lines.p[i] + 3; p = lines.p[i] + 3;
bwritestr(&out2, bprintf(&b, "\t\"%s\",\n", p)); bwritestr(&out2, bprintf(&b, "\t\"%s\",\n", p));
j++;
} }
} }
bwritestr(&out2, "};\n"); bwritestr(&out2, "};\n");
if(j>0)
bwriteb(&out, &out2); bwriteb(&out, &out2);
writefile(&out, file, 0); writefile(&out, file, 0);
......
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