mirror of
https://github.com/golang/go
synced 2024-11-22 09:14:40 -07:00
misc/cgo: gofmt
Change-Id: I5d02279d0593a8368b2f249a6b53650b89aed7b7 Reviewed-on: https://go-review.googlesource.com/c/go/+/482275 Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
c1ac63e973
commit
7b1e0bb79c
3
misc/cgo/life/testdata/life.go
vendored
3
misc/cgo/life/testdata/life.go
vendored
@ -20,8 +20,9 @@ func Run(gen, x, y int, a []int32) {
|
||||
// Keep the channels visible from Go.
|
||||
var chans [4]chan bool
|
||||
|
||||
//export GoStart
|
||||
// Double return value is just for testing.
|
||||
//
|
||||
//export GoStart
|
||||
func GoStart(i, xdim, ydim, xstart, xend, ystart, yend C.int, a *C.int, n *C.int) (int, int) {
|
||||
c := make(chan bool, int(C.MYCONST))
|
||||
go func() {
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin
|
||||
// +build darwin
|
||||
|
||||
package issue24161arg
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin
|
||||
// +build darwin
|
||||
|
||||
package issue24161arg
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin
|
||||
// +build darwin
|
||||
|
||||
package issue24161e0
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin
|
||||
// +build darwin
|
||||
|
||||
package issue24161e1
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin
|
||||
// +build darwin
|
||||
|
||||
package issue24161e2
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin
|
||||
// +build darwin
|
||||
|
||||
package issue24161res
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build gccgo
|
||||
// +build gccgo
|
||||
|
||||
package issue9400
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build gc
|
||||
// +build gc
|
||||
|
||||
package issue9400
|
||||
|
@ -39,6 +39,7 @@ import (
|
||||
// RunGoroutines starts some goroutines that don't do anything.
|
||||
// The idea is to get some threads going, so that a signal will be delivered
|
||||
// to a thread started by Go.
|
||||
//
|
||||
//export RunGoroutines
|
||||
func RunGoroutines() {
|
||||
for i := 0; i < 4; i++ {
|
||||
@ -50,6 +51,7 @@ func RunGoroutines() {
|
||||
}
|
||||
|
||||
// Block blocks the current thread while running Go code.
|
||||
//
|
||||
//export Block
|
||||
func Block() {
|
||||
select {}
|
||||
@ -58,6 +60,7 @@ func Block() {
|
||||
var P *byte
|
||||
|
||||
// TestSEGV makes sure that an invalid address turns into a run-time Go panic.
|
||||
//
|
||||
//export TestSEGV
|
||||
func TestSEGV() {
|
||||
defer func() {
|
||||
@ -72,11 +75,13 @@ func TestSEGV() {
|
||||
}
|
||||
|
||||
// Noop ensures that the Go runtime is initialized.
|
||||
//
|
||||
//export Noop
|
||||
func Noop() {
|
||||
}
|
||||
|
||||
// Raise SIGPIPE.
|
||||
//
|
||||
//export GoRaiseSIGPIPE
|
||||
func GoRaiseSIGPIPE() {
|
||||
C.CRaiseSIGPIPE()
|
||||
|
@ -17,6 +17,7 @@ import (
|
||||
var sigioChan chan os.Signal
|
||||
|
||||
// CatchSIGIO starts catching SIGIO signals.
|
||||
//
|
||||
//export CatchSIGIO
|
||||
func CatchSIGIO() {
|
||||
sigioChan = make(chan os.Signal, 1)
|
||||
@ -24,12 +25,14 @@ func CatchSIGIO() {
|
||||
}
|
||||
|
||||
// ResetSIGIO stops catching SIGIO signals.
|
||||
//
|
||||
//export ResetSIGIO
|
||||
func ResetSIGIO() {
|
||||
signal.Reset(syscall.SIGIO)
|
||||
}
|
||||
|
||||
// SawSIGIO reports whether we saw a SIGIO.
|
||||
//
|
||||
//export SawSIGIO
|
||||
func SawSIGIO() C.int {
|
||||
select {
|
||||
@ -41,6 +44,7 @@ func SawSIGIO() C.int {
|
||||
}
|
||||
|
||||
// ProvokeSIGPIPE provokes a kernel-initiated SIGPIPE.
|
||||
//
|
||||
//export ProvokeSIGPIPE
|
||||
func ProvokeSIGPIPE() {
|
||||
r, w, err := os.Pipe()
|
||||
|
@ -25,6 +25,7 @@ import (
|
||||
var sigioCount int32
|
||||
|
||||
// Catch SIGIO.
|
||||
//
|
||||
//export GoCatchSIGIO
|
||||
func GoCatchSIGIO() {
|
||||
c := make(chan os.Signal, 1)
|
||||
@ -37,12 +38,14 @@ func GoCatchSIGIO() {
|
||||
}
|
||||
|
||||
// Raise SIGIO.
|
||||
//
|
||||
//export GoRaiseSIGIO
|
||||
func GoRaiseSIGIO(p *C.pthread_t) {
|
||||
C.CRaiseSIGIO(p)
|
||||
}
|
||||
|
||||
// Return the number of SIGIO signals seen.
|
||||
//
|
||||
//export SIGIOCount
|
||||
func SIGIOCount() C.int {
|
||||
return C.int(atomic.LoadInt32(&sigioCount))
|
||||
|
@ -1,29 +1,30 @@
|
||||
// Copyright 2022 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
|
||||
|
||||
// #include <complex.h>
|
||||
import "C"
|
||||
|
||||
//export exportComplex64
|
||||
func exportComplex64(v complex64) complex64 {
|
||||
return v
|
||||
}
|
||||
|
||||
//export exportComplex128
|
||||
func exportComplex128(v complex128) complex128 {
|
||||
return v
|
||||
}
|
||||
|
||||
//export exportComplexfloat
|
||||
func exportComplexfloat(v C.complexfloat) C.complexfloat {
|
||||
return v
|
||||
}
|
||||
|
||||
//export exportComplexdouble
|
||||
func exportComplexdouble(v C.complexdouble) C.complexdouble {
|
||||
return v
|
||||
}
|
||||
|
||||
func main() {}
|
||||
// Copyright 2022 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
|
||||
|
||||
// #include <complex.h>
|
||||
import "C"
|
||||
|
||||
//export exportComplex64
|
||||
func exportComplex64(v complex64) complex64 {
|
||||
return v
|
||||
}
|
||||
|
||||
//export exportComplex128
|
||||
func exportComplex128(v complex128) complex128 {
|
||||
return v
|
||||
}
|
||||
|
||||
//export exportComplexfloat
|
||||
func exportComplexfloat(v C.complexfloat) C.complexfloat {
|
||||
return v
|
||||
}
|
||||
|
||||
//export exportComplexdouble
|
||||
func exportComplexdouble(v C.complexdouble) C.complexdouble {
|
||||
return v
|
||||
}
|
||||
|
||||
func main() {}
|
||||
|
1
misc/cgo/testcshared/testdata/libgo2/dup2.go
vendored
1
misc/cgo/testcshared/testdata/libgo2/dup2.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin || dragonfly || freebsd || (linux && !arm64 && !riscv64) || netbsd || openbsd
|
||||
// +build darwin dragonfly freebsd linux,!arm64,!riscv64 netbsd openbsd
|
||||
|
||||
package main
|
||||
|
1
misc/cgo/testcshared/testdata/libgo2/dup3.go
vendored
1
misc/cgo/testcshared/testdata/libgo2/dup3.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build (linux && arm64) || (linux && riscv64)
|
||||
// +build linux,arm64 linux,riscv64
|
||||
|
||||
package main
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
|
||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||
|
||||
package main
|
||||
|
@ -15,6 +15,7 @@ import (
|
||||
// RunGoroutines starts some goroutines that don't do anything.
|
||||
// The idea is to get some threads going, so that a signal will be delivered
|
||||
// to a thread started by Go.
|
||||
//
|
||||
//export RunGoroutines
|
||||
func RunGoroutines() {
|
||||
for i := 0; i < 4; i++ {
|
||||
@ -28,6 +29,7 @@ func RunGoroutines() {
|
||||
var P *byte
|
||||
|
||||
// TestSEGV makes sure that an invalid address turns into a run-time Go panic.
|
||||
//
|
||||
//export TestSEGV
|
||||
func TestSEGV() {
|
||||
defer func() {
|
||||
|
@ -17,6 +17,7 @@ import (
|
||||
var sigioChan chan os.Signal
|
||||
|
||||
// CatchSIGIO starts catching SIGIO signals.
|
||||
//
|
||||
//export CatchSIGIO
|
||||
func CatchSIGIO() {
|
||||
sigioChan = make(chan os.Signal, 1)
|
||||
@ -24,12 +25,14 @@ func CatchSIGIO() {
|
||||
}
|
||||
|
||||
// ResetSIGIO stops catching SIGIO signals.
|
||||
//
|
||||
//export ResetSIGIO
|
||||
func ResetSIGIO() {
|
||||
signal.Reset(syscall.SIGIO)
|
||||
}
|
||||
|
||||
// SawSIGIO returns whether we saw a SIGIO within a brief pause.
|
||||
//
|
||||
//export SawSIGIO
|
||||
func SawSIGIO() C.int {
|
||||
select {
|
||||
|
1
misc/cgo/testgodefs/testdata/anonunion.go
vendored
1
misc/cgo/testgodefs/testdata/anonunion.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
1
misc/cgo/testgodefs/testdata/bitfields.go
vendored
1
misc/cgo/testgodefs/testdata/bitfields.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
1
misc/cgo/testgodefs/testdata/fieldtypedef.go
vendored
1
misc/cgo/testgodefs/testdata/fieldtypedef.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
1
misc/cgo/testgodefs/testdata/issue37479.go
vendored
1
misc/cgo/testgodefs/testdata/issue37479.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
1
misc/cgo/testgodefs/testdata/issue37621.go
vendored
1
misc/cgo/testgodefs/testdata/issue37621.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
1
misc/cgo/testgodefs/testdata/issue38649.go
vendored
1
misc/cgo/testgodefs/testdata/issue38649.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
1
misc/cgo/testgodefs/testdata/issue39534.go
vendored
1
misc/cgo/testgodefs/testdata/issue39534.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
1
misc/cgo/testgodefs/testdata/issue48396.go
vendored
1
misc/cgo/testgodefs/testdata/issue48396.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
1
misc/cgo/testgodefs/testdata/issue8478.go
vendored
1
misc/cgo/testgodefs/testdata/issue8478.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
//
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
15
misc/cgo/testplugin/testdata/issue18676/main.go
vendored
15
misc/cgo/testplugin/testdata/issue18676/main.go
vendored
@ -3,13 +3,14 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// The bug happened like this:
|
||||
// 1) The main binary adds an itab for *json.UnsupportedValueError / error
|
||||
// (concrete type / interface type). This itab goes in hash bucket 0x111.
|
||||
// 2) The plugin adds that same itab again. That makes a cycle in the itab
|
||||
// chain rooted at hash bucket 0x111.
|
||||
// 3) The main binary then asks for the itab for *dynamodbstreamsevt.Event /
|
||||
// json.Unmarshaler. This itab happens to also live in bucket 0x111.
|
||||
// The lookup code goes into an infinite loop searching for this itab.
|
||||
// 1. The main binary adds an itab for *json.UnsupportedValueError / error
|
||||
// (concrete type / interface type). This itab goes in hash bucket 0x111.
|
||||
// 2. The plugin adds that same itab again. That makes a cycle in the itab
|
||||
// chain rooted at hash bucket 0x111.
|
||||
// 3. The main binary then asks for the itab for *dynamodbstreamsevt.Event /
|
||||
// json.Unmarshaler. This itab happens to also live in bucket 0x111.
|
||||
// The lookup code goes into an infinite loop searching for this itab.
|
||||
//
|
||||
// The code is carefully crafted so that the two itabs are both from the
|
||||
// same bucket, and so that the second itab doesn't exist in
|
||||
// the itab hashmap yet (so the entire linked list must be searched).
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
@ -20,8 +20,9 @@ func Run(gen, x, y int, a []int32) {
|
||||
// Keep the channels visible from Go.
|
||||
var chans [4]chan bool
|
||||
|
||||
//export GoStart
|
||||
// Double return value is just for testing.
|
||||
//
|
||||
//export GoStart
|
||||
func GoStart(i, xdim, ydim, xstart, xend, ystart, yend C.int, a *C.int, n *C.int) (int, int) {
|
||||
c := make(chan bool, int(C.MYCONST))
|
||||
go func() {
|
||||
|
2
misc/cgo/testplugin/testdata/method3/p/p.go
vendored
2
misc/cgo/testplugin/testdata/method3/p/p.go
vendored
@ -8,7 +8,7 @@ type T int
|
||||
|
||||
func (T) m() { println("m") }
|
||||
|
||||
type I interface { m() }
|
||||
type I interface{ m() }
|
||||
|
||||
func F() {
|
||||
i.m()
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
3
misc/cgo/testsanitizers/testdata/msan6.go
vendored
3
misc/cgo/testsanitizers/testdata/msan6.go
vendored
@ -32,6 +32,7 @@ import "C"
|
||||
|
||||
// allocateStack extends the stack so that stack copying doesn't
|
||||
// confuse the msan data structures.
|
||||
//
|
||||
//go:noinline
|
||||
func allocateStack(i int) int {
|
||||
if i == 0 {
|
||||
@ -43,6 +44,7 @@ func allocateStack(i int) int {
|
||||
// F1 marks a chunk of stack as uninitialized.
|
||||
// C.f returns an uninitialized struct on the stack, so msan will mark
|
||||
// the stack as uninitialized.
|
||||
//
|
||||
//go:noinline
|
||||
func F1() uintptr {
|
||||
s := C.f()
|
||||
@ -51,6 +53,7 @@ func F1() uintptr {
|
||||
|
||||
// F2 allocates a struct on the stack and converts it to an empty interface,
|
||||
// which will call msanread and see that the data appears uninitialized.
|
||||
//
|
||||
//go:noinline
|
||||
func F2() interface{} {
|
||||
return C.S{}
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build gccgo
|
||||
// +build gccgo
|
||||
|
||||
package depBase
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build gc
|
||||
// +build gc
|
||||
|
||||
package depBase
|
||||
|
9
misc/cgo/testshared/testdata/issue25065/a.go
vendored
9
misc/cgo/testshared/testdata/issue25065/a.go
vendored
@ -3,10 +3,11 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package issue25065 has a type with a method that is
|
||||
// 1) referenced in a method expression
|
||||
// 2) not called
|
||||
// 3) not converted to an interface
|
||||
// 4) is a value method but the reference is to the pointer method
|
||||
// 1. referenced in a method expression
|
||||
// 2. not called
|
||||
// 3. not converted to an interface
|
||||
// 4. is a value method but the reference is to the pointer method
|
||||
//
|
||||
// These cases avoid the call to makefuncsym from typecheckfunc, but we
|
||||
// still need to call makefuncsym somehow or the symbol will not be defined.
|
||||
package issue25065
|
||||
|
1
misc/cgo/testso/testdata/cgoso_unix.go
vendored
1
misc/cgo/testso/testdata/cgoso_unix.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build aix || dragonfly || freebsd || linux || netbsd || solaris
|
||||
// +build aix dragonfly freebsd linux netbsd solaris
|
||||
|
||||
package cgosotest
|
||||
|
1
misc/cgo/testso/testdata/main.go
vendored
1
misc/cgo/testso/testdata/main.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
1
misc/cgo/testsovar/testdata/main.go
vendored
1
misc/cgo/testsovar/testdata/main.go
vendored
@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build ignore
|
||||
// +build ignore
|
||||
|
||||
package main
|
||||
|
Loading…
Reference in New Issue
Block a user