New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
godefs makes EPOLLET constant negative #835
Labels
Comments
If this is an issue with godefs, the following change: diff -r 1c0adc2fd1d7 src/cmd/godefs/main.c --- a/src/cmd/godefs/main.c Wed Jun 23 15:27:51 2010 +0100 +++ b/src/cmd/godefs/main.c Fri Jun 25 12:26:32 2010 +0100 @@ -295,12 +295,7 @@ if(ncon > 0) { Bprint(bout, lang->constbegin); 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->constfmt, con[i].name, con[i].value & 0xFFFFFFFF); } Bprint(bout, lang->constend); } Changes this: adg:~/go/src/pkg/syscall$ ./mkerrors.sh | grep EPOLLET EPOLLET = -0x80000000; to this: adg:~/go/src/pkg/syscall$ ./mkerrors.sh | grep EPOLLET EPOLLET = 0x80000000; This would appear to fix the problem (please confirm), but I'm not sure if this would introduce other issues. Russ? Owner changed to r...@golang.org. |
If you dig through the history here we've gone back and forth a few times. There are some negative constants (like -1) that make more sense as -1 than as 0xffffffff (which assumes 32-bit uses, among other things). It's not really clear what to do here. The problem is C being imprecise and not being able to translate that easily into Go. Status changed to Accepted. |
This issue was closed by revision 879a1c6. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: