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: inconsistent mapping of void* to *byte under -{c,go}defs #8478

Closed
mdempsky opened this issue Aug 6, 2014 · 3 comments
Closed

cmd/cgo: inconsistent mapping of void* to *byte under -{c,go}defs #8478

mdempsky opened this issue Aug 6, 2014 · 3 comments
Milestone

Comments

@mdempsky
Copy link
Member

mdempsky commented Aug 6, 2014

As of revision 0015a25415455c390ae135bef7de2d5e2b10ee88:

$ cat test.go
// +build ignore

package test

/*
typedef struct {
        void *p;
        void **q;
        void ***r;
} s;
*/
import "C"

type S C.s

$ go tool cgo -cdefs test.go
// Created by cgo -cdefs - DO NOT EDIT
// cgo -cdefs test.go


typedef struct S S;

#pragma pack on

struct S {
        byte    *p;
        byte    **q;
        void    ***r;
};


#pragma pack off

$ go tool cgo -godefs test.go
// Created by cgo -godefs - DO NOT EDIT
// cgo -godefs test.go

package test

type S struct {
        P       *byte
        Q       **byte
        R       **unsafe.Pointer
}


At a minimum, this seems inconsistent to me, and we can simplify cmd/cgo somewhat
(namely eliminating typeConv.todoFlds) if we're okay with simply always mapping
"void *" to "*byte".  I've looked over the uses of -cdefs and
-godefs in the runtime and syscall packages, and I don't see any types that should
change as a consequence of this.
@mdempsky
Copy link
Member Author

mdempsky commented Aug 6, 2014

Comment 1:

To clarify, this isn't a recent change in behavior or anything: cgo -{c,go}defs from Go
1.3 produces the same output as above.

@ianlancetaylor
Copy link
Contributor

Comment 2:

Labels changed: added repo-main, release-go1.4.

@ianlancetaylor
Copy link
Contributor

Comment 3:

This issue was closed by revision 2b9f3fc.

Status changed to Fixed.

@rsc rsc added this to the Go1.4 milestone Apr 14, 2015
@rsc rsc removed the release-go1.4 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants