aboutsummaryrefslogtreecommitdiffhomepage
path: root/cgo/cgo.go
diff options
context:
space:
mode:
authorAyke van Laethem <[email protected]>2023-10-13 16:12:34 +0200
committerRon Evans <[email protected]>2023-10-14 11:35:26 +0200
commitd801d0cd539447322228e9f1daa860774584b4d3 (patch)
treea1a608bd558051b19f05cb2114585489f4cefae9 /cgo/cgo.go
parentc2f1965e0358d3f044bd8f8282ce3942d669ff89 (diff)
downloadtinygo-d801d0cd539447322228e9f1daa860774584b4d3.tar.gz
tinygo-d801d0cd539447322228e9f1daa860774584b4d3.zip
builder: refactor clang include headers
Set -resource-dir in a central place instead of passing the header path around everywhere and adding it using the `-I` flag. I believe this is closer to how Clang is intended to be used. This change was inspired by my attempt to add a Nix flake file to TinyGo.
Diffstat (limited to 'cgo/cgo.go')
-rw-r--r--cgo/cgo.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/cgo/cgo.go b/cgo/cgo.go
index 850007967..f28c30246 100644
--- a/cgo/cgo.go
+++ b/cgo/cgo.go
@@ -165,7 +165,7 @@ func GoBytes(ptr unsafe.Pointer, length C.int) []byte {
// functions), the CFLAGS and LDFLAGS found in #cgo lines, and a map of file
// hashes of the accessed C header files. If there is one or more error, it
// returns these in the []error slice but still modifies the AST.
-func Process(files []*ast.File, dir, importPath string, fset *token.FileSet, cflags []string, clangHeaders string) (*ast.File, []string, []string, []string, map[string][]byte, []error) {
+func Process(files []*ast.File, dir, importPath string, fset *token.FileSet, cflags []string) (*ast.File, []string, []string, []string, map[string][]byte, []error) {
p := &cgoPackage{
currentDir: dir,
importPath: importPath,
@@ -292,9 +292,6 @@ func Process(files []*ast.File, dir, importPath string, fset *token.FileSet, cfl
// have better alternatives anyway.
cflagsForCGo := append([]string{"-D_FORTIFY_SOURCE=0"}, cflags...)
cflagsForCGo = append(cflagsForCGo, p.cflags...)
- if clangHeaders != "" {
- cflagsForCGo = append(cflagsForCGo, "-isystem", clangHeaders)
- }
// Retrieve types such as C.int, C.longlong, etc from C.
p.newCGoFile(nil, -1).readNames(builtinAliasTypedefs, cflagsForCGo, "", func(names map[string]clangCursor) {