]> Cypherpunks.ru repositories - gostls13.git/commitdiff
misc/cgo: gofmt
authorIan Lance Taylor <iant@golang.org>
Tue, 4 Apr 2023 20:59:06 +0000 (13:59 -0700)
committerGopher Robot <gobot@golang.org>
Mon, 10 Apr 2023 22:32:33 +0000 (22:32 +0000)
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>

40 files changed:
misc/cgo/life/testdata/life.go
misc/cgo/test/issue24161arg/def.go
misc/cgo/test/issue24161arg/use.go
misc/cgo/test/issue24161e0/main.go
misc/cgo/test/issue24161e1/main.go
misc/cgo/test/issue24161e2/main.go
misc/cgo/test/issue24161res/restype.go
misc/cgo/test/issue9400/gccgo.go
misc/cgo/test/issue9400/stubs.go
misc/cgo/testcarchive/testdata/libgo2/libgo2.go
misc/cgo/testcarchive/testdata/libgo3/libgo3.go
misc/cgo/testcarchive/testdata/libgo4/libgo4.go
misc/cgo/testcshared/testdata/issue36233/issue36233.go
misc/cgo/testcshared/testdata/libgo2/dup2.go
misc/cgo/testcshared/testdata/libgo2/dup3.go
misc/cgo/testcshared/testdata/libgo2/libgo2.go
misc/cgo/testcshared/testdata/libgo4/libgo4.go
misc/cgo/testcshared/testdata/libgo5/libgo5.go
misc/cgo/testgodefs/testdata/anonunion.go
misc/cgo/testgodefs/testdata/bitfields.go
misc/cgo/testgodefs/testdata/fieldtypedef.go
misc/cgo/testgodefs/testdata/issue37479.go
misc/cgo/testgodefs/testdata/issue37621.go
misc/cgo/testgodefs/testdata/issue38649.go
misc/cgo/testgodefs/testdata/issue39534.go
misc/cgo/testgodefs/testdata/issue48396.go
misc/cgo/testgodefs/testdata/issue8478.go
misc/cgo/testplugin/testdata/issue18676/main.go
misc/cgo/testplugin/testdata/issue22295.pkg/main.go
misc/cgo/testplugin/testdata/issue25756/plugin/life.go
misc/cgo/testplugin/testdata/method3/p/p.go
misc/cgo/testplugin/testdata/unnamed1/main.go
misc/cgo/testplugin/testdata/unnamed2/main.go
misc/cgo/testsanitizers/testdata/msan6.go
misc/cgo/testshared/testdata/depBase/gccgo.go
misc/cgo/testshared/testdata/depBase/stubs.go
misc/cgo/testshared/testdata/issue25065/a.go
misc/cgo/testso/testdata/cgoso_unix.go
misc/cgo/testso/testdata/main.go
misc/cgo/testsovar/testdata/main.go

index 70701cc12131afc968b0bc1a2aa0aad4652a7aa9..72311404dfd62ac85475bd8ee6d76eb63dd42c6e 100644 (file)
@@ -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() {
index d33479a891d7a44e1f77340c7a7dc386ba125789..06126143e52ef51c82774b8733c865d3e8375e00 100644 (file)
@@ -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
index 3e749440131ae3c74bae2641268b33db6ced7846..a776ce0584eae5ed5f73f5957770cabf66b4a5fd 100644 (file)
@@ -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
index efe53458d8709c9dfc0ffe2b42094d001335e6a8..4b139552e2c107be31872c39331ac6345ecd015b 100644 (file)
@@ -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
index 82bf172b7d79481f7b620ecbb6e80b9698d7161c..1b30b9a9fc3201dad45ff3cf0375823bfb945141 100644 (file)
@@ -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
index 82d2ec1296cca16845bb3d69ede14e628c6bc25f..4a7e1033e3759f7d9dc276eace5064977a240db4 100644 (file)
@@ -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
index e5719f22a401a0a9839b1201e10db9e16664b6f8..cb33f3c8aa36e16a5a5c7ed11ca2b4895bf7877d 100644 (file)
@@ -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
index a9b62b07a044045989e0eac4a8769db6fc30c925..e1e805cb5c411000f1e5650ed3df58ff27cdbb03 100644 (file)
@@ -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
index e431c5a28a0172538158f4dd4021d91ccfb9a862..56bd6f44cbc05455fbb164cd8c445f6246947228 100644 (file)
@@ -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
index 35c89ae92bbff744bc1be569d75f2639bcb279dd..b2e7731a45d77a5ab664d134407315597e7f0727 100644 (file)
@@ -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()
index 3725f7ab0ffe39519db02827fd02e8dd71d5ec98..136695b09be8e9dcde3bec1ad1b20a16b36ff48c 100644 (file)
@@ -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()
index 8cc1895f99f5af31f95d351d83e03710627fd7b4..c81d3af4ea3b97e3b81d9f5d84a1f7ecd642981d 100644 (file)
@@ -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))
index d0d1e5d50ae375bee9fa6ff444ebaba475d7ecab..433bf5ce559811dada9d1921d9ee8acdadb22948 100644 (file)
@@ -1,29 +1,30 @@
-// Copyright 2022 The Go Authors. All rights reserved.\r
-// Use of this source code is governed by a BSD-style\r
-// license that can be found in the LICENSE file.\r
-package main\r
-\r
-// #include <complex.h>\r
-import "C"\r
-\r
-//export exportComplex64\r
-func exportComplex64(v complex64) complex64 {\r
-       return v\r
-}\r
-\r
-//export exportComplex128\r
-func exportComplex128(v complex128) complex128 {\r
-       return v\r
-}\r
-\r
-//export exportComplexfloat\r
-func exportComplexfloat(v C.complexfloat) C.complexfloat {\r
-       return v\r
-}\r
-\r
-//export exportComplexdouble\r
-func exportComplexdouble(v C.complexdouble) C.complexdouble {\r
-       return v\r
-}\r
-\r
-func main() {}\r
+// 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() {}
index d343aa54d9a8779450092461213c8d748d26fb84..dc03633db6f5a334f75d9fd2e07876f6602098bb 100644 (file)
@@ -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
index 459f0dc196874fbf53db87bf2d976f21d18c4043..705cdbc4fdeffe15133d20ca4fcaf7fce48f0b91 100644 (file)
@@ -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
index e57c93b77d739b5e7ddf180e33234854088b55ff..d8a6c487035776c180658775873ca575ea41d34e 100644 (file)
@@ -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
index ab40b75e78a649f945bdf8f6831c9d32793d3ade..9c30c8585a33336a21710ae1b070b43dc43438f5 100644 (file)
@@ -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() {
index 94e5d21c14a83c3019ef4ba09b17fc3222e7e7be..4ca44e58948064d60144adc80d4c915fd8792f94 100644 (file)
@@ -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 {
index 18840f2577c2313498af26f3572f1357a2d4f138..9e9daa662513f9c5594df5727564c7e1e1411625 100644 (file)
@@ -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
index 6a9724dcd155494196b1968929f9e6315294ec6b..a7f26dd6d26949cff878ce63696a1d91c89e0c8e 100644 (file)
@@ -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
index 45c0bf865301bc5dc2b92b258cdd00285f0bc617..50562538b230f2601e199edee6305b9c2bdad1ef 100644 (file)
@@ -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
index a210eb5bc5b45a9c16c3c97a859c172622af2850..ba7185b81f9b63b50165927cb995b01866acdaf3 100644 (file)
@@ -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
index d5ace3f6d6da7d4155418279d89f3d09208933fb..515f0c089f4038f878919e75e8706beba0b5ff16 100644 (file)
@@ -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
index 6af74d60582fe9b59336db95e4c612b9999b3f0d..5ef00eb5fe9ba790094d96272be017d97b069dc6 100644 (file)
@@ -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
index 9899ba167341574d84eb7063c3d73d65a53cb260..e310a81266d97ad981ebb728d584cca2b345fe07 100644 (file)
@@ -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
index d4c192403fde5058e55eec55475896775bc7bdaa..27c03940b7ab0a06a5a127b1bdfb0a24d3db7d28 100644 (file)
@@ -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
index 232144617118a36fe7022a9caa30e76e5522f781..ec3bdcf43ba7fc49dee6686c29d1ace7a5fc5a98 100644 (file)
@@ -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
index b1dadbedf22d84e87e997ef6310db8316e58cbdb..471f3d969ce84e22142c2e6433b3b56ba8493fc4 100644 (file)
@@ -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).
index 6cb186e100354ff5335824ed3cd94b9f35cd5c7e..eb6064be80b3c6c73c2b84c83abfadc036857392 100644 (file)
@@ -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
index 675a192fc103e55809d98842f2f39ae422f5acf4..468bc6fab6d463989b63ee119f4e2c5b1dc91098 100644 (file)
@@ -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() {
index 3846bc07f50a4cb20d07be49a02849eb865db341..f72f7c715cfab25312b5b097ff0176d78ba7cbd5 100644 (file)
@@ -8,7 +8,7 @@ type T int
 
 func (T) m() { println("m") }
 
-type I interface { m() }
+type I interface{ m() }
 
 func F() {
        i.m()
index dd1777b4184a819e0b7b4bd84065da2315efca32..1629f18e01898f3e6e877af50ab86dc5b985844f 100644 (file)
@@ -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
index 757436f250b3351b0024d30c50fe7ec6503bb212..35e9f381f9ced830b2f691348c29b087a9fa21b3 100644 (file)
@@ -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
index 003989c2beaba2511a0677f870468b237bb9e522..e96e8f9ead57f73a0e593324a1dba7d2f84ed624 100644 (file)
@@ -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{}
index 2b02a1e83b7a53dcb9c217a9ad95147c6cb7fd46..2c829989e0a87d5eb10f395f880743c2f7825b9d 100644 (file)
@@ -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
index c77953803bd51338a3d245ecf3fe2dfaa9836b8a..aca7a85f69fbd38ae602c264c244411d6b5de458 100644 (file)
@@ -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
index 979350ff24c9ceb11d6c1c73c86bbb2a04baa0ee..646de4e52faf1901f7bb9c76a415d043d48ad990 100644 (file)
@@ -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
index 1860694f1ed4ed42c120062edfdfd1ad885ae33c..5164af5b3fbb745929a1a7f59a901e68651bf2fc 100644 (file)
@@ -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
index 963d45121e4409721a698d1024366e1b1f8063f4..5e2d6eff862a5befc77a71b0b4d405848daf524f 100644 (file)
@@ -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
index 87b52cef6001947d0bd92a696a4646c5fee67ee4..462e99389d19b335f18e445a512894d548a7d4cd 100644 (file)
@@ -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