]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.10] cmd/cgo: stop expanding typedefs once we reach __builtin...
authorKeith Randall <khr@golang.org>
Wed, 1 Aug 2018 04:31:19 +0000 (21:31 -0700)
committerIan Lance Taylor <iant@golang.org>
Wed, 8 Aug 2018 00:28:44 +0000 (00:28 +0000)
Expanding __builtin types (__builtin_va_list, particularly) leads
to problems because they are expanded by the compiler itself - the
expansions are not generated by anything in a .h file. The types
a __builtin type expand to are thus very confusing to cgo.

See CL 126275.

Fixes #25036.

Change-Id: I66eb6a4f27f652f1b934ba702f580f6daa62a566
Reviewed-on: https://go-review.googlesource.com/127156
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-on: https://go-review.googlesource.com/128096

src/cmd/cgo/gcc.go

index ef926ee8c1f6a741921e8876687e4370a9f0772c..765fa87447c4cb700369ca8b797fd29e8f00098e 100644 (file)
@@ -627,6 +627,10 @@ func (p *Package) recordTypedefs1(dtype dwarf.Type, visited map[dwarf.Type]bool)
        visited[dtype] = true
        switch dt := dtype.(type) {
        case *dwarf.TypedefType:
+               if strings.HasPrefix(dt.Name, "__builtin") {
+                       // Don't look inside builtin types. There be dragons.
+                       return
+               }
                if !p.typedefs[dt.Name] {
                        p.typedefs[dt.Name] = true
                        p.typedefList = append(p.typedefList, dt.Name)