code review 10150043: cmd/cgo: makes clang happy by not using __gcc_struct__ ... (issue 10150043)

54 views
Skip to first unread message

minu...@gmail.com

unread,
Jun 10, 2013, 10:26:39 AM6/10/13
to golan...@googlegroups.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: golang-dev1,

Message:
Hello golan...@googlegroups.com (cc: golan...@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go/


Description:
cmd/cgo: makes clang happy by not using __gcc_struct__ attribute.

Please review this at https://codereview.appspot.com/10150043/

Affected files:
M src/cmd/cgo/out.go


Index: src/cmd/cgo/out.go
===================================================================
--- a/src/cmd/cgo/out.go
+++ b/src/cmd/cgo/out.go
@@ -488,7 +488,7 @@
// Use __gcc_struct__ to work around http://gcc.gnu.org/PR52991 on x86,
// and http://golang.org/issue/5603.
extraAttr := ""
- if goarch == "amd64" || goarch == "386" {
+ if !strings.Contains(p.gccName(), "clang") && (goarch == "amd64" ||
goarch == "386") {
extraAttr = ", __gcc_struct__"
}
fmt.Fprintf(fgcc, "\t%s __attribute__((__packed__%v)) *a = v;\n", ctype,
extraAttr)


ia...@golang.org

unread,
Jun 10, 2013, 1:01:29 PM6/10/13
to minu...@gmail.com, golan...@googlegroups.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
LGTM

Doesn't this mean that we are going to have the same bug with clang in
the future?

https://codereview.appspot.com/10150043/

minux

unread,
Jun 10, 2013, 2:37:35 PM6/10/13
to minu...@gmail.com, golan...@googlegroups.com, ia...@golang.org, re...@codereview-hr.appspotmail.com
On Tue, Jun 11, 2013 at 1:01 AM, <ia...@golang.org> wrote:
Doesn't this mean that we are going to have the same bug with clang in
the future?
Haha, good question for clang developers.
i can only imagine clang introduces a clang_struct attribute.... oh...

btw, why does the GCC PR remain unfixed for so long (there is even a patch
on the bugzilla)?

minu...@gmail.com

unread,
Jun 10, 2013, 2:51:11 PM6/10/13
to minu...@gmail.com, golan...@googlegroups.com, ia...@golang.org, re...@codereview-hr.appspotmail.com
*** Submitted as
https://code.google.com/p/go/source/detail?r=578baa4acf63 ***

cmd/cgo: makes clang happy by not using __gcc_struct__ attribute.

R=golang-dev, iant
CC=golang-dev
https://codereview.appspot.com/10150043


https://codereview.appspot.com/10150043/

Ian Lance Taylor

unread,
Jun 10, 2013, 3:35:35 PM6/10/13
to minux, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
On Mon, Jun 10, 2013 at 11:37 AM, minux <minu...@gmail.com> wrote:
>
> btw, why does the GCC PR remain unfixed for so long (there is even a patch
> on the bugzilla)?

I don't know why it hasn't been fixed. The patch in the bugzilla
entry seems to be wrong, but I'm still surprised that the GCC Windows
maintainers haven't pushed harder on this. Part of the problem is of
course that most GCC developers do not use Windows.

Ian
Reply all
Reply to author
Forward
0 new messages