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: cannot build goyaml using clang #4857

Closed
fsouza opened this issue Feb 20, 2013 · 8 comments

Comments

@fsouza
Copy link
Contributor

commented Feb 20, 2013

% go version
go version devel +dd18b993ba95 Wed Feb 20 12:34:16 2013 +0400 darwin/amd64
% echo $CC
/usr/local/bin/clang
% $CC --version
clang version 3.2 (tags/RELEASE_32/final)
Target: x86_64-apple-darwin12.2.0
Thread model: posix
% cd $GOPATH/src/launchpad.net/goyaml
% go build
# launchpad.net/goyaml
decode.go:34:7: warning: incompatible pointer types assigning to 'const struct
<anonymous struct at decode.go:32:9> *' from 'const struct <anonymous struct at
decode.go:34:16> *' [-Wincompatible-pointer-types]
        a->r = (const struct {yaml_char_t* anchor; }*) event_alias((void*)a->p0);
             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
decode.go:44:7: warning: incompatible pointer types assigning to 'const struct
<anonymous struct at decode.go:42:9> *' from 'const struct <anonymous struct at
decode.go:44:16> *' [-Wincompatible-pointer-types]
        a->r = (const struct {yaml_char_t* anchor; yaml_char_t* tag; int implicit; yaml_mapping_style_t style; }*) event_mapping_start((void*)a->p0);
             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
decode.go:54:7: warning: incompatible pointer types assigning to 'const struct
<anonymous struct at decode.go:52:9> *' from 'const struct <anonymous struct at
decode.go:54:16> *' [-Wincompatible-pointer-types]
        a->r = (const struct {yaml_char_t* anchor; yaml_char_t* tag; yaml_char_t* value; size_t length; int plain_implicit; int quoted_implicit; yaml_scalar_style_t style; }*) event_scalar((void*)a->p0);
             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
decode.go:64:7: warning: incompatible pointer types assigning to 'const struct
<anonymous struct at decode.go:62:9> *' from 'const struct <anonymous struct at
decode.go:64:16> *' [-Wincompatible-pointer-types]
        a->r = (const struct {yaml_char_t* anchor; yaml_char_t* tag; int implicit; yaml_sequence_style_t style; }*) event_sequence_start((void*)a->p0);
             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
# launchpad.net/goyaml
decode.go:139: p.event.start_mark undefined (type C.yaml_event_t has no field or method
start_mark)
decode.go:140: p.event.start_mark undefined (type C.yaml_event_t has no field or method
start_mark)
encode.go:49: e.emitter.open_ended undefined (type C.yaml_emitter_t has no field or
method open_ended)

I'm using CL 7351044, so all.bash pass. I'm able build some other cgo packages. clang
from tip reports the same errors.

It works with gcc.
@minux

This comment has been minimized.

Copy link
Member

commented Feb 20, 2013

Comment 1:

those 4 warnings should be fixed by adding -Wno-incompatible-pointer-types to
goyaml's // cgo: CFLAGS.
the undefined field error seems a genuine bug.

Labels changed: added priority-later, removed priority-triage.

Status changed to Accepted.

@davecheney

This comment has been minimized.

Copy link
Contributor

commented Feb 21, 2013

Comment 2:

This issue probably belongs on the goyaml tracker. Assigning to myself as a reminder.

Owner changed to @davecheney.

Status changed to Started.

@fsouza

This comment has been minimized.

Copy link
Contributor Author

commented Feb 23, 2013

Comment 3:

I don't believe that this issue belongs to goyaml tracker. Anyway, I will try something
later.
@rsc

This comment has been minimized.

Copy link
Contributor

commented Mar 12, 2013

Comment 4:

[The time for maybe has passed.]

Labels changed: removed go1.1maybe.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented May 28, 2013

Comment 5:

Issue #5579 has been merged into this issue.

@gopherbot

This comment has been minimized.

Copy link

commented May 29, 2013

Comment 6 by kballard:

I'm assuming the warning comes from the fact that there's two separate anonymous structs
(that happen to have the same representation). Seems to me the cgo generation should
perhaps get rid of the second anonymous struct (in the cast) and just use
__typeof__(a->r).
@minux

This comment has been minimized.

Copy link
Member

commented May 29, 2013

Comment 7:

https://golang.org/cl/9649045/

Owner changed to @minux.

@minux

This comment has been minimized.

Copy link
Member

commented Jun 2, 2013

Comment 8:

This issue was closed by revision 5b097e7.

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.
Projects
None yet
6 participants
You can’t perform that action at this time.