aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/fix/egltype.go
diff options
context:
space:
mode:
authorElias Naur <mail@eliasnaur.com>2020-05-30 16:34:23 +0200
committerElias Naur <mail@eliasnaur.com>2020-05-31 09:48:08 +0000
commit7dbbb5bacf4e52bc4efbd3caecdebf6ffb730783 (patch)
treebb6090928a3dba49285dc1dca025b9f09c321cba /src/cmd/fix/egltype.go
parentf1f8f9af9a55d73dfc6603a93bee0559fdc9024d (diff)
downloadgo-7dbbb5bacf4e52bc4efbd3caecdebf6ffb730783.tar.xz
cmd/cgo,cmd/fix,misc/cgo: map the EGLConfig C type to uintptr in Go
Similarly to EGLDisplay, EGLConfig is declared as a pointer but may contain non-pointer values. I believe this is the root cause of https://todo.sr.ht/~eliasnaur/gio/121. Change-Id: I412c4fbc2eef4aa028534d68bda95db98e3a365d Reviewed-on: https://go-review.googlesource.com/c/go/+/235817 Run-TryBot: Elias Naur <mail@eliasnaur.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/fix/egltype.go')
-rw-r--r--src/cmd/fix/egltype.go28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/cmd/fix/egltype.go b/src/cmd/fix/egltype.go
index c8c4f03e97..cb0f7a73de 100644
--- a/src/cmd/fix/egltype.go
+++ b/src/cmd/fix/egltype.go
@@ -9,13 +9,14 @@ import (
)
func init() {
- register(eglFix)
+ register(eglFixDisplay)
+ register(eglFixConfig)
}
-var eglFix = fix{
+var eglFixDisplay = fix{
name: "egl",
date: "2018-12-15",
- f: eglfix,
+ f: eglfixDisp,
desc: `Fixes initializers of EGLDisplay`,
disabled: false,
}
@@ -25,8 +26,27 @@ var eglFix = fix{
// New state:
// type EGLDisplay uintptr
// This fix finds nils initializing these types and replaces the nils with 0s.
-func eglfix(f *ast.File) bool {
+func eglfixDisp(f *ast.File) bool {
return typefix(f, func(s string) bool {
return s == "C.EGLDisplay"
})
}
+
+var eglFixConfig = fix{
+ name: "eglconf",
+ date: "2020-05-30",
+ f: eglfixConfig,
+ desc: `Fixes initializers of EGLConfig`,
+ disabled: false,
+}
+
+// Old state:
+// type EGLConfig unsafe.Pointer
+// New state:
+// type EGLConfig uintptr
+// This fix finds nils initializing these types and replaces the nils with 0s.
+func eglfixConfig(f *ast.File) bool {
+ return typefix(f, func(s string) bool {
+ return s == "C.EGLConfig"
+ })
+}