diff options
| author | Ian Lance Taylor <iant@golang.org> | 2016-12-13 14:29:57 -0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2016-12-14 00:59:38 +0000 |
| commit | 10f3b090270a979dfbbb48be98973feac61dfc91 (patch) | |
| tree | 4fbfcf2ba0b581008d741f6ebfb00256fa1e56d8 /src | |
| parent | 4284edb999716c408c99e9b5dc56734c31e4dcd5 (diff) | |
| download | go-10f3b090270a979dfbbb48be98973feac61dfc91.tar.xz | |
cmd/cgo: don't strip qualifiers from C void* pointer
Now that we try to handle qualifiers correctly (as of CL 33325), don't
strip them from a void* pointer. Otherwise we break a case like "const
void**", as the "const" qualifier is dropped and the resulting
"void**" triggers a warning from the C compiler.
Fixes #18298.
Change-Id: If51df1889b0f6a907715298c152e6d4584747acb
Reviewed-on: https://go-review.googlesource.com/34370
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src')
| -rw-r--r-- | src/cmd/cgo/gcc.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go index d6c23a70eb..5ea2d941ca 100644 --- a/src/cmd/cgo/gcc.go +++ b/src/cmd/cgo/gcc.go @@ -1729,6 +1729,15 @@ func (c *typeConv) Type(dtype dwarf.Type, pos token.Pos) *Type { if _, ok := base(dt.Type).(*dwarf.VoidType); ok { t.Go = c.goVoidPtr t.C.Set("void*") + dq := dt.Type + for { + if d, ok := dq.(*dwarf.QualType); ok { + t.C.Set(d.Qual + " " + t.C.String()) + dq = d.Type + } else { + break + } + } break } |
