internal/fakecgo: move setg and call5 out of autogenerated files (#378)
setg_trampoline and call5 function signatures don't need to live in autogenerated files, as they don't depend on any input from gen.go. This will make future enchancements to autogenerated code a bit easier. Updates #343
- commit
- 490ca620d07bdc5e5c20b515833129951039b559
- author
- Quim Muntal · · 2025-12-17 15:51 UTC
- committer
- GitHub · · 2025-12-17 15:51 UTC
- parent
- 58d7177
- signature
- GPG Unverified
B5690EEEBB952194The key is unknown
3 files · +14 -12
A internal/fakecgo/fakecgo.go +14 -0
| @@ -0,0 +1,14 @@ | |||
| 1 | + | // SPDX-License-Identifier: Apache-2.0 | |
| 2 | + | // SPDX-FileCopyrightText: 2025 The Ebitengine Authors | |
| 3 | + | ||
| 4 | + | //go:build !cgo && (darwin || freebsd || linux || netbsd) | |
| 5 | + | ||
| 6 | + | package fakecgo | |
| 7 | + | ||
| 8 | + | import _ "unsafe" | |
| 9 | + | ||
| 10 | + | // setg_trampoline calls setg with the G provided | |
| 11 | + | func setg_trampoline(setg uintptr, G uintptr) | |
| 12 | + | ||
| 13 | + | // call5 takes fn the C function and 5 arguments and calls the function with those arguments | |
| 14 | + | func call5(fn, a1, a2, a3, a4, a5 uintptr) uintptr | |
| @@ -0,0 +1,14 @@ | |||||
| 1 | + | // SPDX-License-Identifier: Apache-2.0 | |||
| 2 | + | // SPDX-FileCopyrightText: 2025 The Ebitengine Authors | |||
| 3 | + | ||||
| 4 | + | //go:build !cgo && (darwin || freebsd || linux || netbsd) | |||
| 5 | + | ||||
| 6 | + | package fakecgo | |||
| 7 | + | ||||
| 8 | + | import _ "unsafe" | |||
| 9 | + | ||||
| 10 | + | // setg_trampoline calls setg with the G provided | |||
| 11 | + | func setg_trampoline(setg uintptr, G uintptr) | |||
| 12 | + | ||||
| 13 | + | // call5 takes fn the C function and 5 arguments and calls the function with those arguments | |||
| 14 | + | func call5(fn, a1, a2, a3, a4, a5 uintptr) uintptr | |||
M internal/fakecgo/gen.go +0 -6
| @@ -29,12 +29,6 @@ import ( | |||
| 29 | 29 | "unsafe" | |
| 30 | 30 | ) | |
| 31 | 31 | ||
| 32 | - | // setg_trampoline calls setg with the G provided | |
| 33 | - | func setg_trampoline(setg uintptr, G uintptr) | |
| 34 | - | ||
| 35 | - | // call5 takes fn the C function and 5 arguments and calls the function with those arguments | |
| 36 | - | func call5(fn, a1, a2, a3, a4, a5 uintptr) uintptr | |
| 37 | - | ||
| 38 | 32 | {{ range . -}} | |
| 39 | 33 | //go:nosplit | |
| 40 | 34 | //go:norace | |
| @@ -29,12 +29,6 @@ import ( | |||||
| 29 | "unsafe" | 29 | "unsafe" | ||
| 30 | ) | 30 | ) | ||
| 31 | 31 | ||||
| 32 | - | // setg_trampoline calls setg with the G provided | |||
| 33 | - | func setg_trampoline(setg uintptr, G uintptr) | |||
| 34 | - | ||||
| 35 | - | // call5 takes fn the C function and 5 arguments and calls the function with those arguments | |||
| 36 | - | func call5(fn, a1, a2, a3, a4, a5 uintptr) uintptr | |||
| 37 | - | ||||
| 38 | {{ range . -}} | 32 | {{ range . -}} | ||
| 39 | //go:nosplit | 33 | //go:nosplit | ||
| 40 | //go:norace | 34 | //go:norace | ||
M internal/fakecgo/zsymbols.go +0 -6
| @@ -12,12 +12,6 @@ import ( | |||
| 12 | 12 | "unsafe" | |
| 13 | 13 | ) | |
| 14 | 14 | ||
| 15 | - | // setg_trampoline calls setg with the G provided | |
| 16 | - | func setg_trampoline(setg uintptr, G uintptr) | |
| 17 | - | ||
| 18 | - | // call5 takes fn the C function and 5 arguments and calls the function with those arguments | |
| 19 | - | func call5(fn, a1, a2, a3, a4, a5 uintptr) uintptr | |
| 20 | - | ||
| 21 | 15 | //go:nosplit | |
| 22 | 16 | //go:norace | |
| 23 | 17 | func malloc(size uintptr) unsafe.Pointer { | |
| @@ -12,12 +12,6 @@ import ( | |||||
| 12 | "unsafe" | 12 | "unsafe" | ||
| 13 | ) | 13 | ) | ||
| 14 | 14 | ||||
| 15 | - | // setg_trampoline calls setg with the G provided | |||
| 16 | - | func setg_trampoline(setg uintptr, G uintptr) | |||
| 17 | - | ||||
| 18 | - | // call5 takes fn the C function and 5 arguments and calls the function with those arguments | |||
| 19 | - | func call5(fn, a1, a2, a3, a4, a5 uintptr) uintptr | |||
| 20 | - | ||||
| 21 | //go:nosplit | 15 | //go:nosplit | ||
| 22 | //go:norace | 16 | //go:norace | ||
| 23 | func malloc(size uintptr) unsafe.Pointer { | 17 | func malloc(size uintptr) unsafe.Pointer { | ||