]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: gc never permits C files; gccgo always does
authorIan Lance Taylor <iant@golang.org>
Sat, 13 Dec 2014 16:48:44 +0000 (08:48 -0800)
committerIan Lance Taylor <iant@golang.org>
Thu, 18 Dec 2014 16:16:10 +0000 (16:16 +0000)
Change-Id: I513665626ec0866f32036c26207dc234c17acea1
Reviewed-on: https://go-review.googlesource.com/1540
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
src/cmd/go/pkg.go

index b71feb7a67faa7c9f8021e297cc0463f5504a02d..23154f91207699882ba98179f7a58dddcf0a28b1 100644 (file)
@@ -629,9 +629,8 @@ func (p *Package) load(stk *importStack, bp *build.Package, err error) *Package
        }
        p.Target = p.target
 
-       // Check for C code compiled with Plan 9 C compiler.
-       // No longer allowed except in runtime and runtime/cgo, for now.
-       if len(p.CFiles) > 0 && !p.usesCgo() && (!p.Standard || p.ImportPath != "runtime") {
+       // The gc toolchain only permits C source files with cgo.
+       if len(p.CFiles) > 0 && !p.usesCgo() && buildContext.Compiler == "gc" {
                p.Error = &PackageError{
                        ImportStack: stk.copy(),
                        Err:         fmt.Sprintf("C source files not allowed when not using cgo: %s", strings.Join(p.CFiles, " ")),