aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/fix/egltype.go
diff options
context:
space:
mode:
authorElias Naur <elias.naur@gmail.com>2018-12-15 17:03:37 +0100
committerElias Naur <elias.naur@gmail.com>2018-12-15 19:27:41 +0000
commitd50390ce7253e2caac9931bc83b49b32cdcd9698 (patch)
tree0262379f7af5272f72beb2450f4c3247b0b37cdf /src/cmd/fix/egltype.go
parent26985ed4a58665d25a256e3b63b353972fc3aab0 (diff)
downloadgo-d50390ce7253e2caac9931bc83b49b32cdcd9698.tar.xz
cmd/fix,cmd/cgo,misc/cgo: map the EGLDisplay C type to uintptr in Go
Similar to to macOS' CF* types and JNI's jobject and derived types, the EGLDisplay type is declared as a pointer but can contain non-pointers (see #27054). Fix it the same way: map EGLDisplay to uintptr in Go. Fixes #27054 RELNOTE=yes Change-Id: I6136f8f8162687c5493b30ed324e29efe55a8fd7 Reviewed-on: https://go-review.googlesource.com/c/154417 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/fix/egltype.go')
-rw-r--r--src/cmd/fix/egltype.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/cmd/fix/egltype.go b/src/cmd/fix/egltype.go
new file mode 100644
index 0000000000..c8c4f03e97
--- /dev/null
+++ b/src/cmd/fix/egltype.go
@@ -0,0 +1,32 @@
+// Copyright 2018 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.
+
+package main
+
+import (
+ "go/ast"
+)
+
+func init() {
+ register(eglFix)
+}
+
+var eglFix = fix{
+ name: "egl",
+ date: "2018-12-15",
+ f: eglfix,
+ desc: `Fixes initializers of EGLDisplay`,
+ disabled: false,
+}
+
+// Old state:
+// type EGLDisplay unsafe.Pointer
+// New state:
+// type EGLDisplay uintptr
+// This fix finds nils initializing these types and replaces the nils with 0s.
+func eglfix(f *ast.File) bool {
+ return typefix(f, func(s string) bool {
+ return s == "C.EGLDisplay"
+ })
+}