]> Cypherpunks.ru repositories - gostls13.git/commit
[dev.cmdgo] cmd: support space and quotes in CC and CXX
authorJay Conrod <jayconrod@google.com>
Wed, 14 Jul 2021 23:57:24 +0000 (16:57 -0700)
committerJay Conrod <jayconrod@google.com>
Fri, 30 Jul 2021 17:08:28 +0000 (17:08 +0000)
commit52e970b1c86f18806232adb0e1f42636645d21ff
treee987a5ba5830265f322419bf7306f03127351ab7
parent3a69cef65a856afd1f8b9d5c22e6729d0f4d84ac
[dev.cmdgo] cmd: support space and quotes in CC and CXX

The CC and CXX environment variables now support spaces and quotes
(both double and single). This fixes two issues: first, if CC is a
single path that contains spaces (like 'c:\Program
Files\gcc\bin\gcc.exe'), that should now work if the space is quoted
or escaped (#41400). Second, if CC or CXX has multiple arguments (like
'gcc -O2'), they are now split correctly, and the arguments are passed
before other arguments when invoking the C compiler. Previously,
strings.Fields was used to split arguments, and the arguments were
placed later in the command line. (#43078).

Fixes golang/go#41400
Fixes golang/go#43078

Change-Id: I2d5d89ddb19c94adef65982a8137b01f037d5c11
Reviewed-on: https://go-review.googlesource.com/c/go/+/334732
Trust: Jay Conrod <jayconrod@google.com>
Trust: Michael Matloob <matloob@golang.org>
Run-TryBot: Jay Conrod <jayconrod@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Matloob <matloob@golang.org>
14 files changed:
src/cmd/cgo/gcc.go
src/cmd/cgo/main.go
src/cmd/compile/internal/ssa/stmtlines_test.go
src/cmd/dist/buildtool.go
src/cmd/go/internal/envcmd/env.go
src/cmd/go/internal/work/exec.go
src/cmd/go/internal/work/gc.go
src/cmd/go/internal/work/init.go
src/cmd/go/script_test.go
src/cmd/go/testdata/script/cgo_path_space_quote.txt [new file with mode: 0644]
src/cmd/internal/dwarf/dwarf.go
src/cmd/link/dwarf_test.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/main.go