]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cgo: revert CL 49490 "fix for function taking pointer typedef"
authorIan Lance Taylor <iant@golang.org>
Tue, 6 Feb 2018 23:11:59 +0000 (15:11 -0800)
committerIan Lance Taylor <iant@golang.org>
Wed, 7 Feb 2018 01:20:30 +0000 (01:20 +0000)
CL 49490 fixed a warning when compiling the C code generated by cgo,
but it introduced typedef conflicts in Go code that cgo is supposed to
avoid.

Original CL description:

    cmd/cgo: fix for function taking pointer typedef

    Fixes #19832

Updates #19832
Fixes #23720

Change-Id: I22a732db31be0b4f7248c105277ab8ee44ef6cfb
Reviewed-on: https://go-review.googlesource.com/92455
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
misc/cgo/test/issue19832.go [deleted file]
src/cmd/cgo/gcc.go

diff --git a/misc/cgo/test/issue19832.go b/misc/cgo/test/issue19832.go
deleted file mode 100644 (file)
index 4458777..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2015 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// Issue 19832. Functions taking a pointer typedef were being expanded and triggering a compiler error.
-
-package cgotest
-
-// typedef struct { int i; } *PS;
-// void T19832(PS p) {}
-import "C"
-import "testing"
-
-func test19832(t *testing.T) {
-       C.T19832(nil)
-}
index 4f16fe0e319916e745ed055084d1b5e70a65a987..2ebe9066992785348d33e386624bde2364e188a6 100644 (file)
@@ -2250,12 +2250,6 @@ func (c *typeConv) FuncArg(dtype dwarf.Type, pos token.Pos) *Type {
                                break
                        }
 
-                       // If we already know the typedef for t just use that.
-                       // See issue 19832.
-                       if def := typedef[t.Go.(*ast.Ident).Name]; def != nil {
-                               break
-                       }
-
                        t = c.Type(ptr, pos)
                        if t == nil {
                                return nil