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

     1  package main
     2  
     3  /*
     4  // this name doesn't exist
     5  #cgo  NOFLAGS: -foo
     6  
     7  // unknown flag
     8  #cgo CFLAGS: -fdoes-not-exist -DNOTDEFINED
     9  
    10  #cgo CFLAGS: -DFOO
    11  
    12  #cgo CFLAGS: -Iinclude
    13  #include "foo.h"
    14  
    15  #if defined(FOO)
    16  #define BAR 3
    17  #else
    18  #define BAR 5
    19  #endif
    20  
    21  #if defined(NOTDEFINED)
    22  #warning flag must not be defined
    23  #endif
    24  
    25  // Check Compiler flags
    26  #cgo LDFLAGS: -lc
    27  
    28  // This flag is not valid ldflags
    29  #cgo LDFLAGS: -does-not-exists
    30  
    31  */
    32  import "C"
    33  
    34  var (
    35  	_ = C.BAR
    36  	_ = C.FOO_H
    37  )