github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/cgo/testdata/errors.out.go (about)

     1  // CGo errors:
     2  //     testdata/errors.go:4:2: warning: some warning
     3  //     testdata/errors.go:11:9: error: unknown type name 'someType'
     4  //     testdata/errors.go:22:5: warning: another warning
     5  //     testdata/errors.go:13:23: unexpected token ), expected end of expression
     6  //     testdata/errors.go:19:26: unexpected token ), expected end of expression
     7  
     8  // Type checking errors after CGo processing:
     9  //     testdata/errors.go:102: cannot use 2 << 10 (untyped int constant 2048) as C.char value in variable declaration (overflows)
    10  //     testdata/errors.go:105: unknown field z in struct literal
    11  //     testdata/errors.go:108: undefined: C.SOME_CONST_1
    12  //     testdata/errors.go:110: cannot use C.SOME_CONST_3 (untyped int constant 1234) as byte value in variable declaration (overflows)
    13  //     testdata/errors.go:112: undefined: C.SOME_CONST_4
    14  
    15  package main
    16  
    17  import "unsafe"
    18  
    19  var _ unsafe.Pointer
    20  
    21  //go:linkname C.CString runtime.cgo_CString
    22  func C.CString(string) *C.char
    23  
    24  //go:linkname C.GoString runtime.cgo_GoString
    25  func C.GoString(*C.char) string
    26  
    27  //go:linkname C.__GoStringN runtime.cgo_GoStringN
    28  func C.__GoStringN(*C.char, uintptr) string
    29  
    30  func C.GoStringN(cstr *C.char, length C.int) string {
    31  	return C.__GoStringN(cstr, uintptr(length))
    32  }
    33  
    34  //go:linkname C.__GoBytes runtime.cgo_GoBytes
    35  func C.__GoBytes(unsafe.Pointer, uintptr) []byte
    36  
    37  func C.GoBytes(ptr unsafe.Pointer, length C.int) []byte {
    38  	return C.__GoBytes(ptr, uintptr(length))
    39  }
    40  
    41  type (
    42  	C.char      uint8
    43  	C.schar     int8
    44  	C.uchar     uint8
    45  	C.short     int16
    46  	C.ushort    uint16
    47  	C.int       int32
    48  	C.uint      uint32
    49  	C.long      int32
    50  	C.ulong     uint32
    51  	C.longlong  int64
    52  	C.ulonglong uint64
    53  )
    54  type C.struct_point_t struct {
    55  	x C.int
    56  	y C.int
    57  }
    58  type C.point_t = C.struct_point_t
    59  
    60  const C.SOME_CONST_3 = 1234