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

     1  package main
     2  
     3  /*
     4  #warning some warning
     5  
     6  typedef struct {
     7  	int x;
     8  	int y;
     9  } point_t;
    10  
    11  typedef someType noType; // undefined type
    12  
    13  #define SOME_CONST_1 5) // invalid const syntax
    14  #define SOME_CONST_2 6) // const not used (so no error)
    15  #define SOME_CONST_3 1234 // const too large for byte
    16  */
    17  //
    18  //
    19  // #define SOME_CONST_4 8) // after some empty lines
    20  import "C"
    21  
    22  // #warning another warning
    23  import "C"
    24  
    25  // Make sure that errors for the following lines won't change with future
    26  // additions to the CGo preamble.
    27  //line errors.go:100
    28  var (
    29  	// constant too large
    30  	_ C.char = 2 << 10
    31  
    32  	// z member does not exist
    33  	_ C.point_t = C.point_t{z: 3}
    34  
    35  	// constant has syntax error
    36  	_ = C.SOME_CONST_1
    37  
    38  	_ byte = C.SOME_CONST_3
    39  
    40  	_ = C.SOME_CONST_4
    41  )