1
0
mirror of https://github.com/golang/go synced 2024-11-25 04:07:55 -07:00

godefs: fix handling of negative constants

R=r
CC=golang-dev
https://golang.org/cl/849041
This commit is contained in:
Russ Cox 2010-03-30 10:42:13 -07:00
parent 00f9f0c056
commit 5b257732ac

View File

@ -294,8 +294,14 @@ Continue:
Bprint(bout, "// Constants\n");
if(ncon > 0) {
Bprint(bout, lang->constbegin);
for(i=0; i<ncon; i++)
for(i=0; i<ncon; i++) {
// Go can handle negative constants,
// but C enums may not be able to.
if(lang == &go)
Bprint(bout, lang->constfmt, con[i].name, con[i].value);
else
Bprint(bout, lang->constfmt, con[i].name, con[i].value & 0xFFFFFFFF);
}
Bprint(bout, lang->constend);
}
Bprint(bout, "\n");