Black Lives Matter. Support the Equal Justice Initiative.

Source file test/intrinsic_atomic.go

Documentation: test

     1  // errorcheck -0 -d=ssa/intrinsics/debug
     2  // +build amd64 arm64 mips mipsle mips64 mips64le ppc64 ppc64le riscv64 s390x
     3  
     4  // Copyright 2016 The Go Authors. All rights reserved.
     5  // Use of this source code is governed by a BSD-style
     6  // license that can be found in the LICENSE file.
     7  
     8  package main
     9  
    10  import "sync/atomic"
    11  
    12  var x uint32
    13  
    14  func atomics() {
    15  	_ = atomic.LoadUint32(&x)             // ERROR "intrinsic substitution for LoadUint32"
    16  	atomic.StoreUint32(&x, 1)             // ERROR "intrinsic substitution for StoreUint32"
    17  	atomic.AddUint32(&x, 1)               // ERROR "intrinsic substitution for AddUint32"
    18  	atomic.SwapUint32(&x, 1)              // ERROR "intrinsic substitution for SwapUint32"
    19  	atomic.CompareAndSwapUint32(&x, 1, 2) // ERROR "intrinsic substitution for CompareAndSwapUint32"
    20  }
    21  

View as plain text