diff options
author | Ayke van Laethem <[email protected]> | 2022-09-22 13:39:51 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2022-10-19 22:23:19 +0200 |
commit | 2b7f56220210198dc850df7d03017d7908bb119c (patch) | |
tree | c6caf479f9afed2d026f828b603b9984406494b6 /builder/musl.go | |
parent | 08a51535d43dfc2ee11ec239f87f3321ddd8f469 (diff) | |
download | tinygo-2b7f56220210198dc850df7d03017d7908bb119c.tar.gz tinygo-2b7f56220210198dc850df7d03017d7908bb119c.zip |
ci: add support for LLVM 15
This commit switches to LLVM 15 everywhere by default, while still
keeping LLVM 14 support.
Diffstat (limited to 'builder/musl.go')
-rw-r--r-- | builder/musl.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/builder/musl.go b/builder/musl.go index bdfdc4a8a..a65a920b7 100644 --- a/builder/musl.go +++ b/builder/musl.go @@ -6,10 +6,12 @@ import ( "os" "path/filepath" "regexp" + "strconv" "strings" "github.com/tinygo-org/tinygo/compileopts" "github.com/tinygo-org/tinygo/goenv" + "tinygo.org/x/go-llvm" ) var Musl = Library{ @@ -77,7 +79,7 @@ var Musl = Library{ cflags: func(target, headerPath string) []string { arch := compileopts.MuslArchitecture(target) muslDir := filepath.Join(goenv.Get("TINYGOROOT"), "lib/musl") - return []string{ + cflags := []string{ "-std=c99", // same as in musl "-D_XOPEN_SOURCE=700", // same as in musl // Musl triggers some warnings and we don't want to show any @@ -104,6 +106,12 @@ var Musl = Library{ "-I" + muslDir + "/include", "-fno-stack-protector", } + llvmMajor, _ := strconv.Atoi(strings.SplitN(llvm.Version, ".", 2)[0]) + if llvmMajor >= 15 { + // This flag was added in Clang 15. It is not present in LLVM 14. + cflags = append(cflags, "-Wno-deprecated-non-prototype") + } + return cflags }, sourceDir: func() string { return filepath.Join(goenv.Get("TINYGOROOT"), "lib/musl/src") }, librarySources: func(target string) ([]string, error) { |