-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: C Structs with the same field definitions are used interchangeably in generated prototypes #31891
Comments
Change https://golang.org/cl/181857 mentions this issue: |
Thank you for filing this change @kesmit13 and welcome to the Go project! Since Ian on CL https://golang.org/cl/181857 added this to wait-release, I shall accordingly move the milestone to Go1.14 so perhaps please except a fix to land after August 2019. |
CL 181857 broke the translation of certain C types when using cmd/cgo -godefs. Updates golang#31891 Fixes golang#37479 Fixes golang#37621 Change-Id: I301a749ec89585789cb0d213593bb8b7341beb88
Change https://golang.org/cl/226341 mentions this issue: |
CL 181857 broke the translation of certain C types using cmd/cgo -godefs because it stores each typedef, array and qualified type with their parent type name in the translation cache. Fix this by only considering the parent type for typedefs of anonymous structs which is the only case where types might become ambiguous. Updates #31891 Fixes #37479 Fixes #37621 Change-Id: I301a749ec89585789cb0d213593bb8b7341beb88 Reviewed-on: https://go-review.googlesource.com/c/go/+/226341 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Change https://golang.org/cl/226497 mentions this issue: |
Change https://golang.org/cl/228102 mentions this issue: |
For #31891 Fixes #38408 Change-Id: Ie7498c2cab728ae798e66e7168425e16b063520e Reviewed-on: https://go-review.googlesource.com/c/go/+/228102 Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Change https://golang.org/cl/228107 mentions this issue: |
…struct For #31891 For #38408 Fixes #38426 Change-Id: Ie7498c2cab728ae798e66e7168425e16b063520e Reviewed-on: https://go-review.googlesource.com/c/go/+/228102 Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> (cherry picked from commit 33ff63d) Reviewed-on: https://go-review.googlesource.com/c/go/+/228107 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
If I use the following struct definitions in functions exported by cgo, the
struct names get mixed up in the generated h file.
Input h File
Exported Function Definitions
What did you expect to see?
I expected the generated prototypes to look like the following.
What did you see instead?
There are the prototypes that were generated instead.
Observation
I suspected that some sort of hashing was being used to alias structs that
had the same fields, so I added a unique field to each of the structs in the
input header file and that did solve the problem.
The text was updated successfully, but these errors were encountered: