Skip to content
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

cmd/cgo: -godefs mishandles enum value #39534

Closed
ianlancetaylor opened this issue Jun 11, 2020 · 4 comments
Closed

cmd/cgo: -godefs mishandles enum value #39534

ianlancetaylor opened this issue Jun 11, 2020 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@ianlancetaylor
Copy link
Contributor

Reduced test case:

package p

// enum { IFF_UP = 0x1 };
import "C"

const IFF_UP = C.IFF_UP

Running go tool cgo -godefs x.go with Go 1.14 produces

const IFF_UP = 0x1

With tip it produces

const IFF_UP = int32

Although -godefs is not seriously supported, we shouldn't break it like this.

This may be due to https://golang.org/cl/230037. CC @mdempsky

@ianlancetaylor ianlancetaylor added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Jun 11, 2020
@ianlancetaylor ianlancetaylor added this to the Go1.15 milestone Jun 11, 2020
@mdempsky
Copy link
Member

I can look into it, unless you're already doing that.

@ianlancetaylor
Copy link
Contributor Author

I'm looking at it. I have a fix.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/237558 mentions this issue: cmd/cgo: in -godefs mode, don't change constant to type

@tklauser
Copy link
Member

Thanks a lot for fixing this @ianlancetaylor. Just noticed the same behavior while trying to re-generate x/sys/unix with go1.15beta1.

@golang golang locked and limited conversation to collaborators Jun 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants