Commit cfefe6a7 authored by Keith Randall's avatar Keith Randall

cmd/dist: allow assembly code to use enumerated constants.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11056044
parent 8124a02c
......@@ -234,10 +234,11 @@ ok:
// Gobuf 24 sched;
// 'Y' 48 stack0;
// }
// StackMin = 128;
// into output like
// #define g_sched 24
// #define g_stack0 48
//
// #define const_StackMin 128
aggr = nil;
splitlines(&lines, bstr(&in));
for(i=0; i<lines.len; i++) {
......@@ -265,6 +266,12 @@ ok:
p[xstrlen(p)-1] = '\0';
bwritestr(&out, bprintf(&b, "#define %s_%s %s\n", aggr, fields.p[n-1], fields.p[n-2]));
}
if(fields.len == 3 && streq(fields.p[1], "=")) { // generated from enumerated constants
p = fields.p[2];
if(p[xstrlen(p)-1] == ';')
p[xstrlen(p)-1] = '\0';
bwritestr(&out, bprintf(&b, "#define const_%s %s\n", fields.p[0], p));
}
}
// Some #defines that are used for .c files.
......
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