From e3f3f940a09ee99e952be43fd3b19c969cf229d0 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Wed, 27 Jan 2016 15:58:52 -0500 Subject: [PATCH] runtime/cgo: add cgo build tag to C files This makes "CGO_ENABLED=0 go list runtime/cgo" work, which fixes the current cmd/go test failure. Change-Id: Ia55ce3ba1dbb09f618ae5f4c8547722670360f59 Reviewed-on: https://go-review.googlesource.com/19001 Run-TryBot: Russ Cox Reviewed-by: Brad Fitzpatrick --- src/runtime/cgo/gcc_darwin_amd64.c | 2 ++ src/runtime/cgo/gcc_libinit.c | 1 + src/runtime/cgo/gcc_setenv.c | 1 + src/runtime/cgo/gcc_util.c | 2 ++ 4 files changed, 6 insertions(+) diff --git a/src/runtime/cgo/gcc_darwin_amd64.c b/src/runtime/cgo/gcc_darwin_amd64.c index dc679acab9d..b70c83345f5 100644 --- a/src/runtime/cgo/gcc_darwin_amd64.c +++ b/src/runtime/cgo/gcc_darwin_amd64.c @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build cgo + #include /* for strerror */ #include #include diff --git a/src/runtime/cgo/gcc_libinit.c b/src/runtime/cgo/gcc_libinit.c index c3e94f58d2c..5b9558aabc8 100644 --- a/src/runtime/cgo/gcc_libinit.c +++ b/src/runtime/cgo/gcc_libinit.c @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build cgo // +build darwin dragonfly freebsd linux netbsd solaris // +build !ppc64,!ppc64le diff --git a/src/runtime/cgo/gcc_setenv.c b/src/runtime/cgo/gcc_setenv.c index ca29dcb05f2..c976ac3d37c 100644 --- a/src/runtime/cgo/gcc_setenv.c +++ b/src/runtime/cgo/gcc_setenv.c @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build cgo // +build darwin dragonfly freebsd linux netbsd openbsd solaris #include "libcgo.h" diff --git a/src/runtime/cgo/gcc_util.c b/src/runtime/cgo/gcc_util.c index 143734e94b0..d5efec396bd 100644 --- a/src/runtime/cgo/gcc_util.c +++ b/src/runtime/cgo/gcc_util.c @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build cgo + #include "libcgo.h" /* Stub for calling malloc from Go */