sync/atomic: add missing leak tests for And & Or

Theses tests were forgot because when CL 462298 was originally written
And & Or atomics were not available in go.
Git were smart enough to rebase over And's & Or's addition.
After most reviews and before merging it were pointed I should
make theses new intrinsics noescape.
When doing this last minute addition I forgot to add tests.

Change-Id: I457f98315c0aee91d5743058ab76f256856cb782
Reviewed-on: https://go-review.googlesource.com/c/go/+/633416
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Jorropo 2024-12-04 04:50:29 +01:00 committed by Daniel Martí
parent 4c3aa5d324
commit d241ea8d5c
2 changed files with 34 additions and 0 deletions

View File

@ -18,6 +18,16 @@ func AddUintptr(x *uintptr) { // ERROR "x does not escape$"
atomic.AddUintptr(x, 42)
}
func AndInt32(x *int32) { // ERROR "x does not escape$"
atomic.AndInt32(x, 42)
}
func AndUint32(x *uint32) { // ERROR "x does not escape$"
atomic.AndUint32(x, 42)
}
func AndUintptr(x *uintptr) { // ERROR "x does not escape$"
atomic.AndUintptr(x, 42)
}
func CompareAndSwapInt32(x *int32) { // ERROR "x does not escape$"
atomic.CompareAndSwapInt32(x, 42, 42)
}
@ -38,6 +48,16 @@ func LoadUintptr(x *uintptr) { // ERROR "x does not escape$"
atomic.LoadUintptr(x)
}
func OrInt32(x *int32) { // ERROR "x does not escape$"
atomic.OrInt32(x, 42)
}
func OrUint32(x *uint32) { // ERROR "x does not escape$"
atomic.OrUint32(x, 42)
}
func OrUintptr(x *uintptr) { // ERROR "x does not escape$"
atomic.OrUintptr(x, 42)
}
func StoreInt32(x *int32) { // ERROR "x does not escape$"
atomic.StoreInt32(x, 42)
}

View File

@ -17,6 +17,13 @@ func AddUint64(x *uint64) { // ERROR "x does not escape$"
atomic.AddUint64(x, 42)
}
func AndInt64(x *int64) { // ERROR "x does not escape$"
atomic.AndInt64(x, 42)
}
func AndUint64(x *uint64) { // ERROR "x does not escape$"
atomic.AndUint64(x, 42)
}
func CompareAndSwapInt64(x *int64) { // ERROR "x does not escape$"
atomic.CompareAndSwapInt64(x, 42, 42)
}
@ -31,6 +38,13 @@ func LoadUint64(x *uint64) { // ERROR "x does not escape$"
atomic.LoadUint64(x)
}
func OrInt64(x *int64) { // ERROR "x does not escape$"
atomic.OrInt64(x, 42)
}
func OrUint64(x *uint64) { // ERROR "x does not escape$"
atomic.OrUint64(x, 42)
}
func StoreInt64(x *int64) { // ERROR "x does not escape$"
atomic.StoreInt64(x, 42)
}