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

Comments

@mdempsky
Copy link
Member

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

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Contributor

commented Aug 6, 2014

Comment 2:

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

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Aug 6, 2014

Comment 3:

This issue was closed by revision 2b9f3fc.

Status changed to Fixed.

@mdempsky mdempsky added fixed labels Aug 6, 2014

@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 added a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
wheatman added 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
4 participants
You can’t perform that action at this time.