summaryrefslogtreecommitdiffstats
path: root/vendor/modernc.org/cc/v3
diff options
context:
space:
mode:
authorWim <wim@42.be>2022-04-25 23:50:10 +0200
committerGitHub <noreply@github.com>2022-04-25 23:50:10 +0200
commit67adad3e08fe17d5f7e87468ea47aa76e1662255 (patch)
tree91314fac90d39254e66ae794decfcd21c10a7b20 /vendor/modernc.org/cc/v3
parent2fca3c756373577eab4e0120ccce62eecc1f5ad8 (diff)
downloadmatterbridge-msglm-67adad3e08fe17d5f7e87468ea47aa76e1662255.tar.gz
matterbridge-msglm-67adad3e08fe17d5f7e87468ea47aa76e1662255.tar.bz2
matterbridge-msglm-67adad3e08fe17d5f7e87468ea47aa76e1662255.zip
Update dependencies (#1813)
Diffstat (limited to 'vendor/modernc.org/cc/v3')
-rw-r--r--vendor/modernc.org/cc/v3/Makefile2
-rw-r--r--vendor/modernc.org/cc/v3/abi_platforms.go24
-rw-r--r--vendor/modernc.org/cc/v3/cc.go76
3 files changed, 102 insertions, 0 deletions
diff --git a/vendor/modernc.org/cc/v3/Makefile b/vendor/modernc.org/cc/v3/Makefile
index 61962ecd..68e39907 100644
--- a/vendor/modernc.org/cc/v3/Makefile
+++ b/vendor/modernc.org/cc/v3/Makefile
@@ -70,8 +70,10 @@ build_all_targets:
GOOS=linux GOARCH=riscv64 go build -v ./...
GOOS=linux GOARCH=s390x go build -v ./...
GOOS=netbsd GOARCH=amd64 go build -v ./...
+ GOOS=openbsd GOARCH=amd64 go build -v ./...
GOOS=windows GOARCH=386 go build -v ./...
GOOS=windows GOARCH=amd64 go build -v ./...
+ GOOS=windows GOARCH=arm64 go build -v ./...
devbench:
date 2>&1 | tee log-devbench
diff --git a/vendor/modernc.org/cc/v3/abi_platforms.go b/vendor/modernc.org/cc/v3/abi_platforms.go
index b393c2da..883225a6 100644
--- a/vendor/modernc.org/cc/v3/abi_platforms.go
+++ b/vendor/modernc.org/cc/v3/abi_platforms.go
@@ -29,6 +29,7 @@ var (
{"openbsd", "amd64"}: true,
{"windows", "386"}: true,
{"windows", "amd64"}: true,
+ {"windows", "arm64"}: true,
}
)
@@ -213,6 +214,29 @@ var abiTypes = map[[2]string]map[Kind]ABIType{
Decimal64: {8, 8, 8},
Decimal128: {16, 16, 16},
},
+ // clang version 14.0.0 (https://github.com/llvm/llvm-project.git 329fda39c507e8740978d10458451dcdb21563be)
+ // Target: aarch64-w64-windows-gnu
+ {"windows", "arm64"}: {
+ Void: {1, 1, 1},
+ Bool: {1, 1, 1},
+ Char: {1, 1, 1},
+ SChar: {1, 1, 1},
+ UChar: {1, 1, 1},
+ Short: {2, 2, 2},
+ UShort: {2, 2, 2},
+ Enum: {4, 4, 4},
+ Int: {4, 4, 4},
+ UInt: {4, 4, 4},
+ Long: {4, 4, 4},
+ ULong: {4, 4, 4},
+ LongLong: {8, 8, 8},
+ ULongLong: {8, 8, 8},
+ Ptr: {8, 8, 8},
+ Function: {8, 8, 8},
+ Float: {4, 4, 4},
+ Double: {8, 8, 8},
+ LongDouble: {8, 8, 8},
+ },
// $ i686-w64-mingw32-gcc main.c && wine a.exe
{"windows", "386"}: {
Void: {1, 1, 1},
diff --git a/vendor/modernc.org/cc/v3/cc.go b/vendor/modernc.org/cc/v3/cc.go
index cc8e90c4..dc8f98a3 100644
--- a/vendor/modernc.org/cc/v3/cc.go
+++ b/vendor/modernc.org/cc/v3/cc.go
@@ -792,6 +792,14 @@ func (c *context) openFile(name string, sys bool) (io.ReadCloser, error) {
// Execution of HostConfig is not free, so caching of the results is
// recommended.
func HostConfig(cpp string, opts ...string) (predefined string, includePaths, sysIncludePaths []string, err error) {
+ if predefined, includePaths, sysIncludePaths, err = hostConfigv3(cpp, opts...); err == nil {
+ return predefined, includePaths, sysIncludePaths, nil
+ }
+
+ return hostConfigv4(opts)
+}
+
+func hostConfigv3(cpp string, opts ...string) (predefined string, includePaths, sysIncludePaths []string, err error) {
if cpp == "" {
cpp = "cpp"
}
@@ -843,6 +851,74 @@ func HostConfig(cpp string, opts ...string) (predefined string, includePaths, sy
return "", nil, nil, fmt.Errorf("failed parsing %s -v output", cpp)
}
+func hostConfigv4(opts []string) (predefined string, includePaths, sysIncludePaths []string, err error) {
+ for _, cc := range []string{os.Getenv("CC"), "cc", "gcc"} {
+ if cc == "" {
+ continue
+ }
+
+ cc, err = exec.LookPath(cc)
+ if err != nil {
+ continue
+ }
+
+ args := append(opts, "-dM", "-E", "-")
+ pre, err := exec.Command(cc, args...).CombinedOutput()
+ if err != nil {
+ continue
+ }
+
+ sep := "\n"
+ if env("GOOS", runtime.GOOS) == "windows" {
+ sep = "\r\n"
+ }
+ a := strings.Split(string(pre), sep)
+ w := 0
+ for _, v := range a {
+ if strings.HasPrefix(v, "#") {
+ a[w] = v
+ w++
+ }
+ }
+ predefined = strings.Join(a[:w], "\n")
+ args = append(opts, "-v", "-E", "-")
+ out, err := exec.Command(cc, args...).CombinedOutput()
+ if err != nil {
+ continue
+ }
+
+ a = strings.Split(string(out), sep)
+ for i := 0; i < len(a); {
+ switch a[i] {
+ case "#include \"...\" search starts here:":
+ loop:
+ for i = i + 1; i < len(a); {
+ switch v := a[i]; {
+ case strings.HasPrefix(v, "#") || v == "End of search list.":
+ break loop
+ default:
+ includePaths = append(includePaths, strings.TrimSpace(v))
+ i++
+ }
+ }
+ case "#include <...> search starts here:":
+ for i = i + 1; i < len(a); {
+ switch v := a[i]; {
+ case strings.HasPrefix(v, "#") || v == "End of search list.":
+ return predefined, includePaths, sysIncludePaths, nil
+ default:
+ sysIncludePaths = append(sysIncludePaths, strings.TrimSpace(v))
+ i++
+ }
+ }
+ default:
+ i++
+ }
+ }
+ }
+ return "", nil, nil, fmt.Errorf("cannot determine C compiler configuration")
+}
+
func env(key, val string) string {
if s := os.Getenv(key); s != "" {
return s