Commit 4def45d2 authored by Kirill Smelkov's avatar Kirill Smelkov

tracing/runtime: Replace any -> interface{}

Else if a project, that uses go123, is compiled by go1.18 or go1.19,
then go complains that go123 uses `any`, but the language, that go123
requires in it's go.mod, is only 1.14:

    kirr@deca:~/src/wendelin/wendelin.core/wcfs$ go build
    # lab.nexedi.com/kirr/go123/tracing/internal/xruntime
    /home/kirr/go/pkg/mod/lab.nexedi.com/kirr/go123@v0.0.0-20221005052354-179529a7/tracing/internal/xruntime/zruntime_g_go1.19.go:114:12: predeclared any requires go1.18 or later (-lang was set to go1.14; check go.mod)
    /home/kirr/go/pkg/mod/lab.nexedi.com/kirr/go123@v0.0.0-20221005052354-179529a7/tracing/internal/xruntime/zruntime_g_go1.19.go:184:14: predeclared any requires go1.18 or later (-lang was set to go1.14; check go.mod)
    /home/kirr/go/pkg/mod/lab.nexedi.com/kirr/go123@v0.0.0-20221005052354-179529a7/tracing/internal/xruntime/zruntime_g_go1.19.go:185:9: predeclared any requires go1.18 or later (-lang was set to go1.14; check go.mod)

-> Fix that by expanding `any` to what it is aliased to:

    $ go doc builtin.any
    package builtin // import "builtin"

    type any = interface{}
        any is an alias for interface{} and is equivalent to interface{} in all
        ways.

Go123 wants to support older systems, and so we do not want to bump
go123's required language, at least for now.

For the reference: they started to use `any` somewhere in go1.18 (see
070bfdbb "tracing/runtime: Refresh for Go1.18").
parent 179529a7
......@@ -95,20 +95,28 @@ typedef_g_fixed() {
# gen_zruntime - generate zruntime_g_<gover>.go
gen_zruntime() {
out="zruntime_g_$gover.go"
echo >$out "// Code generated by g_typedef; DO NOT EDIT."
echo >>$out
echo >>$out "// +build $gover,!$gomaj.$((gomin+1))"
echo >>$out
echo >>$out "package xruntime"
echo >>$out
echo >>$out 'import "unsafe"'
_gen_zruntime() {
echo "// Code generated by g_typedef; DO NOT EDIT."
echo
echo "// +build $gover,!$gomaj.$((gomin+1))"
echo
echo "package xruntime"
echo
echo 'import "unsafe"'
if (( $govern >= 119 )); then
echo >>$out 'import "sync/atomic"' # instead of runtime/internal/atomic - for atomic.Uint32
echo 'import "sync/atomic"' # instead of runtime/internal/atomic - for atomic.Uint32
fi
echo >>$out
typedef_g_fixed $go >>$out
echo
typedef_g_fixed $go
}
gen_zruntime() {
out="zruntime_g_$gover.go"
# emit with `any` replaced by `interface{}`.
# we do this to avoid bumping lang to go1.18 in go.mod, so that go123
# could still be used with older go compilers.
_gen_zruntime | \
gofmt -r 'any -> interface{}' \
> $out
}
......
// Code generated by g_typedef; DO NOT EDIT.
//go:build go1.10 && !go1.11
// +build go1.10,!go1.11
package xruntime
......@@ -127,7 +128,7 @@ type timer struct {
type guintptr uintptr
type puintptr uintptr
type muintptr uintptr
type uintreg uint // FIXME wrong on amd64p32
type m struct {} // FIXME stub
type sudog struct {} // FIXME stub
type timersBucket struct {} // FIXME stub
type uintreg uint // FIXME wrong on amd64p32
type m struct{} // FIXME stub
type sudog struct{} // FIXME stub
type timersBucket struct{} // FIXME stub
// Code generated by g_typedef; DO NOT EDIT.
//go:build go1.11 && !go1.12
// +build go1.11,!go1.12
package xruntime
......@@ -134,7 +135,7 @@ type ancestorInfo struct {
goid int64 // goroutine id of this goroutine; original goroutine possibly dead
gopc uintptr // pc of go statement that created this goroutine
}
type uintreg uint // FIXME wrong on amd64p32
type m struct {} // FIXME stub
type sudog struct {} // FIXME stub
type timersBucket struct {} // FIXME stub
type uintreg uint // FIXME wrong on amd64p32
type m struct{} // FIXME stub
type sudog struct{} // FIXME stub
type timersBucket struct{} // FIXME stub
// Code generated by g_typedef; DO NOT EDIT.
//go:build go1.12 && !go1.13
// +build go1.12,!go1.13
package xruntime
......@@ -134,7 +135,7 @@ type ancestorInfo struct {
goid int64 // goroutine id of this goroutine; original goroutine possibly dead
gopc uintptr // pc of go statement that created this goroutine
}
type uintreg uint // FIXME wrong on amd64p32
type m struct {} // FIXME stub
type sudog struct {} // FIXME stub
type timersBucket struct {} // FIXME stub
type uintreg uint // FIXME wrong on amd64p32
type m struct{} // FIXME stub
type sudog struct{} // FIXME stub
type timersBucket struct{} // FIXME stub
// Code generated by g_typedef; DO NOT EDIT.
//go:build go1.13 && !go1.14
// +build go1.13,!go1.14
package xruntime
......@@ -135,7 +136,7 @@ type ancestorInfo struct {
goid int64 // goroutine id of this goroutine; original goroutine possibly dead
gopc uintptr // pc of go statement that created this goroutine
}
type uintreg uint // FIXME wrong on amd64p32
type m struct {} // FIXME stub
type sudog struct {} // FIXME stub
type timersBucket struct {} // FIXME stub
type uintreg uint // FIXME wrong on amd64p32
type m struct{} // FIXME stub
type sudog struct{} // FIXME stub
type timersBucket struct{} // FIXME stub
// Code generated by g_typedef; DO NOT EDIT.
//go:build go1.14 && !go1.15
// +build go1.14,!go1.15
package xruntime
......@@ -179,7 +180,7 @@ type ancestorInfo struct {
goid int64 // goroutine id of this goroutine; original goroutine possibly dead
gopc uintptr // pc of go statement that created this goroutine
}
type uintreg uint // FIXME wrong on amd64p32
type m struct {} // FIXME stub
type sudog struct {} // FIXME stub
type timersBucket struct {} // FIXME stub
type uintreg uint // FIXME wrong on amd64p32
type m struct{} // FIXME stub
type sudog struct{} // FIXME stub
type timersBucket struct{} // FIXME stub
// Code generated by g_typedef; DO NOT EDIT.
//go:build go1.15 && !go1.16
// +build go1.15,!go1.16
package xruntime
......@@ -179,7 +180,7 @@ type ancestorInfo struct {
goid int64 // goroutine id of this goroutine; original goroutine possibly dead
gopc uintptr // pc of go statement that created this goroutine
}
type uintreg uint // FIXME wrong on amd64p32
type m struct {} // FIXME stub
type sudog struct {} // FIXME stub
type timersBucket struct {} // FIXME stub
type uintreg uint // FIXME wrong on amd64p32
type m struct{} // FIXME stub
type sudog struct{} // FIXME stub
type timersBucket struct{} // FIXME stub
// Code generated by g_typedef; DO NOT EDIT.
//go:build go1.16 && !go1.17
// +build go1.16,!go1.17
package xruntime
......@@ -181,7 +182,7 @@ type ancestorInfo struct {
goid int64 // goroutine id of this goroutine; original goroutine possibly dead
gopc uintptr // pc of go statement that created this goroutine
}
type uintreg uint // FIXME wrong on amd64p32
type m struct {} // FIXME stub
type sudog struct {} // FIXME stub
type timersBucket struct {} // FIXME stub
type uintreg uint // FIXME wrong on amd64p32
type m struct{} // FIXME stub
type sudog struct{} // FIXME stub
type timersBucket struct{} // FIXME stub
// Code generated by g_typedef; DO NOT EDIT.
//go:build go1.17 && !go1.18
// +build go1.17,!go1.18
package xruntime
......@@ -196,7 +197,7 @@ type ancestorInfo struct {
goid int64 // goroutine id of this goroutine; original goroutine possibly dead
gopc uintptr // pc of go statement that created this goroutine
}
type uintreg uint // FIXME wrong on amd64p32
type m struct {} // FIXME stub
type sudog struct {} // FIXME stub
type timersBucket struct {} // FIXME stub
type uintreg uint // FIXME wrong on amd64p32
type m struct{} // FIXME stub
type sudog struct{} // FIXME stub
type timersBucket struct{} // FIXME stub
// Code generated by g_typedef; DO NOT EDIT.
//go:build go1.18 && !go1.19
// +build go1.18,!go1.19
package xruntime
......@@ -106,7 +107,7 @@ type stack struct {
}
type _panic struct {
argp unsafe.Pointer // pointer to arguments of deferred call run during panic; cannot move - known to liblink
arg any // argument to panic
arg interface{} // argument to panic
link *_panic // link to earlier panic
pc uintptr // where to return to in runtime if this panic is bypassed
sp unsafe.Pointer // where to return to in runtime if this panic is bypassed
......@@ -176,8 +177,8 @@ type timer struct {
// when must be positive on an active timer.
when int64
period int64
f func(any, uintptr)
arg any
f func(interface{}, uintptr)
arg interface{}
seq uintptr
// What to set the when field to in timerModifiedXX status.
......@@ -195,7 +196,7 @@ type ancestorInfo struct {
goid int64 // goroutine id of this goroutine; original goroutine possibly dead
gopc uintptr // pc of go statement that created this goroutine
}
type uintreg uint // FIXME wrong on amd64p32
type m struct {} // FIXME stub
type sudog struct {} // FIXME stub
type timersBucket struct {} // FIXME stub
type uintreg uint // FIXME wrong on amd64p32
type m struct{} // FIXME stub
type sudog struct{} // FIXME stub
type timersBucket struct{} // FIXME stub
// Code generated by g_typedef; DO NOT EDIT.
//go:build go1.19 && !go1.20
// +build go1.19,!go1.20
package xruntime
......@@ -111,7 +112,7 @@ type stack struct {
}
type _panic struct {
argp unsafe.Pointer // pointer to arguments of deferred call run during panic; cannot move - known to liblink
arg any // argument to panic
arg interface{} // argument to panic
link *_panic // link to earlier panic
pc uintptr // where to return to in runtime if this panic is bypassed
sp unsafe.Pointer // where to return to in runtime if this panic is bypassed
......@@ -181,8 +182,8 @@ type timer struct {
// when must be positive on an active timer.
when int64
period int64
f func(any, uintptr)
arg any
f func(interface{}, uintptr)
arg interface{}
seq uintptr
// What to set the when field to in timerModifiedXX status.
......@@ -201,7 +202,7 @@ type ancestorInfo struct {
gopc uintptr // pc of go statement that created this goroutine
}
type goroutineProfileStateHolder atomic.Uint32
type uintreg uint // FIXME wrong on amd64p32
type m struct {} // FIXME stub
type sudog struct {} // FIXME stub
type timersBucket struct {} // FIXME stub
type uintreg uint // FIXME wrong on amd64p32
type m struct{} // FIXME stub
type sudog struct{} // FIXME stub
type timersBucket struct{} // FIXME stub
// Code generated by g_typedef; DO NOT EDIT.
//go:build go1.8 && !go1.9
// +build go1.8,!go1.9
package xruntime
......@@ -135,6 +136,6 @@ type stkbar struct {
savedLRPtr uintptr // location overwritten by stack barrier PC
savedLRVal uintptr // value overwritten at savedLRPtr
}
type uintreg uint // FIXME wrong on amd64p32
type m struct {} // FIXME stub
type sudog struct {} // FIXME stub
type uintreg uint // FIXME wrong on amd64p32
type m struct{} // FIXME stub
type sudog struct{} // FIXME stub
// Code generated by g_typedef; DO NOT EDIT.
//go:build go1.9 && !go1.10
// +build go1.9,!go1.10
package xruntime
......@@ -123,6 +124,6 @@ type timer struct {
type guintptr uintptr
type puintptr uintptr
type muintptr uintptr
type uintreg uint // FIXME wrong on amd64p32
type m struct {} // FIXME stub
type sudog struct {} // FIXME stub
type uintreg uint // FIXME wrong on amd64p32
type m struct{} // FIXME stub
type sudog struct{} // FIXME stub
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment