Commit 5b257732 authored by Russ Cox's avatar Russ Cox

godefs: fix handling of negative constants

R=r
CC=golang-dev
https://golang.org/cl/849041
parent 00f9f0c0
......@@ -294,8 +294,14 @@ Continue:
Bprint(bout, "// Constants\n");
if(ncon > 0) {
Bprint(bout, lang->constbegin);
for(i=0; i<ncon; i++)
Bprint(bout, lang->constfmt, con[i].name, con[i].value & 0xFFFFFFFF);
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");
......
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