]> Cypherpunks repositories - gostls13.git/commitdiff
go/build: recognize '.sx' as equivalent of '.S'
authorUmang Parmar <umangjparmar@gmail.com>
Sun, 20 Oct 2019 11:25:56 +0000 (11:25 +0000)
committerIan Lance Taylor <iant@golang.org>
Sun, 20 Oct 2019 21:15:11 +0000 (21:15 +0000)
On case insensitive filesystems, '.S' is interpreted as '.s' so,
providing option to use '.sx' extension for '.S' files as an alternative.

Fixes #32434

Change-Id: Ie2f7e5e2f3f12690ce18659e30ca94252a8f7bfc
GitHub-Last-Rev: dcca989ec41ddc1d06ea509b78dce7d70bc996ed
GitHub-Pull-Request: golang/go#32557
Reviewed-on: https://go-review.googlesource.com/c/go/+/181699
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/cgo/doc.go
src/cmd/go/alldocs.go
src/cmd/go/internal/help/helpdoc.go
src/go/build/build.go

index 5c9c8674c23bd1737dedc5ea27961e5e13e3d14e..8c3bf81bf78925ec0b1bf35ef3cc4bd955c3c4f3 100644 (file)
@@ -99,7 +99,7 @@ Will be expanded to:
 
 When the Go tool sees that one or more Go files use the special import
 "C", it will look for other non-Go files in the directory and compile
-them as part of the Go package. Any .c, .s, or .S files will be
+them as part of the Go package. Any .c, .s, .S or .sx files will be
 compiled with the C compiler. Any .cc, .cpp, or .cxx files will be
 compiled with the C++ compiler. Any .f, .F, .for or .f90 files will be
 compiled with the fortran compiler. Any .h, .hh, .hpp, or .hxx files will
index 2561f5b2f8d6379a30e3c35f02e6b2167e170cfd..51b8fccb4552524de1346eea99329131b6e2e1dc 100644 (file)
 // extension will be passed to SWIG. Any file with a .swigcxx extension
 // will be passed to SWIG with the -c++ option.
 //
-// When either cgo or SWIG is used, go build will pass any .c, .m, .s,
-// or .S files to the C compiler, and any .cc, .cpp, .cxx files to the C++
+// When either cgo or SWIG is used, go build will pass any .c, .m, .s, .S
+// or .sx files to the C compiler, and any .cc, .cpp, .cxx files to the C++
 // compiler. The CC or CXX environment variables may be set to determine
 // the C or C++ compiler, respectively, to use.
 //
 //     .m
 //             Objective-C source files. Only useful with cgo, and always
 //             compiled with the OS-native compiler.
-//     .s, .S
+//     .s, .S, .sx
 //             Assembler source files.
 //             If the package uses cgo or SWIG, these will be assembled with the
 //             OS-native assembler (typically gcc (sic)); otherwise they
index dfb89d4910bf7c8dc3ee2eff9bd6e1705c627f32..1dc892cb325b872de04508fd721bf18876d9f2cf 100644 (file)
@@ -21,8 +21,8 @@ http://swig.org/. When running go build, any file with a .swig
 extension will be passed to SWIG. Any file with a .swigcxx extension
 will be passed to SWIG with the -c++ option.
 
-When either cgo or SWIG is used, go build will pass any .c, .m, .s,
-or .S files to the C compiler, and any .cc, .cpp, .cxx files to the C++
+When either cgo or SWIG is used, go build will pass any .c, .m, .s, .S
+or .sx files to the C compiler, and any .cc, .cpp, .cxx files to the C++
 compiler. The CC or CXX environment variables may be set to determine
 the C or C++ compiler, respectively, to use.
        `,
@@ -645,7 +645,7 @@ the extension of the file name. These extensions are:
        .m
                Objective-C source files. Only useful with cgo, and always
                compiled with the OS-native compiler.
-       .s, .S
+       .s, .S, .sx
                Assembler source files.
                If the package uses cgo or SWIG, these will be assembled with the
                OS-native assembler (typically gcc (sic)); otherwise they
index deeda35c2acf399e86d3efccd09d73e30b4beb08..c763db4f86aa2eee6e035cb7a416bbf23c987300 100644 (file)
@@ -773,7 +773,7 @@ Found:
        }
 
        var badGoError error
-       var Sfiles []string // files with ".S" (capital S)
+       var Sfiles []string // files with ".S"(capital S)/.sx(capital s equivalent for case insensitive filesystems)
        var firstFile, firstCommentFile string
        imported := make(map[string][]token.Position)
        testImported := make(map[string][]token.Position)
@@ -827,7 +827,7 @@ Found:
                case ".s":
                        p.SFiles = append(p.SFiles, name)
                        continue
-               case ".S":
+               case ".S", ".sx":
                        Sfiles = append(Sfiles, name)
                        continue
                case ".swig":
@@ -967,7 +967,7 @@ Found:
        p.TestImports, p.TestImportPos = cleanImports(testImported)
        p.XTestImports, p.XTestImportPos = cleanImports(xTestImported)
 
-       // add the .S files only if we are using cgo
+       // add the .S/.sx files only if we are using cgo
        // (which means gcc will compile them).
        // The standard assemblers expect .s files.
        if len(p.CgoFiles) > 0 {
@@ -1274,7 +1274,7 @@ func (ctxt *Context) matchFile(dir, name string, allTags map[string]bool, binary
        }
 
        switch ext {
-       case ".go", ".c", ".cc", ".cxx", ".cpp", ".m", ".s", ".h", ".hh", ".hpp", ".hxx", ".f", ".F", ".f90", ".S", ".swig", ".swigcxx":
+       case ".go", ".c", ".cc", ".cxx", ".cpp", ".m", ".s", ".h", ".hh", ".hpp", ".hxx", ".f", ".F", ".f90", ".S", ".sx", ".swig", ".swigcxx":
                // tentatively okay - read to make sure
        case ".syso":
                // binary, no reading