Commit f032eefd authored by Russ Cox's avatar Russ Cox

cmd/cgo, cmd/go, go/build: sort flag lists

CFLAGS comes before CPPFLAGS.
Also fix one typo CPPCFLAGS.

Cleanup for CL 8248043.

R=golang-dev, iant, alberto.garcia.hierro
CC=golang-dev
https://golang.org/cl/9965045
parent 63a707e3
...@@ -24,7 +24,7 @@ the C parts of the package. For example: ...@@ -24,7 +24,7 @@ the C parts of the package. For example:
// #include <errno.h> // #include <errno.h>
import "C" import "C"
CPPFLAGS, CFLAGS, CXXFLAGS and LDFLAGS may be defined with pseudo #cgo directives CFLAGS, CPPFLAGS, CXXFLAGS and LDFLAGS may be defined with pseudo #cgo directives
within these comments to tweak the behavior of gcc. Values defined within these comments to tweak the behavior of gcc. Values defined
in multiple directives are concatenated together. Options prefixed in multiple directives are concatenated together. Options prefixed
by $GOOS, $GOARCH, or $GOOS/$GOARCH are only defined in matching by $GOOS, $GOARCH, or $GOOS/$GOARCH are only defined in matching
...@@ -44,7 +44,7 @@ For example: ...@@ -44,7 +44,7 @@ For example:
// #include <png.h> // #include <png.h>
import "C" import "C"
The CGO_CPPFLAGS, CGO_CFLAGS, CGO_CXXFLAGS and CGO_LDFLAGS environment variables are added The CGO_CFLAGS, CGO_CPPFLAGS, CGO_CXXFLAGS and CGO_LDFLAGS environment variables are added
to the flags derived from these directives. Package-specific flags should to the flags derived from these directives. Package-specific flags should
be set using the directives, not the environment variables, so that builds be set using the directives, not the environment variables, so that builds
work in unmodified environments. work in unmodified environments.
......
...@@ -321,13 +321,13 @@ which calls strings.Join. The struct being passed to the template is: ...@@ -321,13 +321,13 @@ which calls strings.Join. The struct being passed to the template is:
CXXFiles []string // .cc, .cxx and .cpp source files CXXFiles []string // .cc, .cxx and .cpp source files
HFiles []string // .h, .hh, .hpp and .hxx source files HFiles []string // .h, .hh, .hpp and .hxx source files
SFiles []string // .s source files SFiles []string // .s source files
SysoFiles []string // .syso object files to add to archive
SwigFiles []string // .swig files SwigFiles []string // .swig files
SwigCXXFiles []string // .swigcxx files SwigCXXFiles []string // .swigcxx files
SysoFiles []string // .syso object files to add to archive
// Cgo directives // Cgo directives
CgoCPPFLAGS []string // cgo: flags for C preprocessor
CgoCFLAGS []string // cgo: flags for C compiler CgoCFLAGS []string // cgo: flags for C compiler
CgoCPPFLAGS []string // cgo: flags for C preprocessor
CgoCXXFLAGS []string // cgo: flags for C++ compiler CgoCXXFLAGS []string // cgo: flags for C++ compiler
CgoLDFLAGS []string // cgo: flags for linker CgoLDFLAGS []string // cgo: flags for linker
CgoPkgConfig []string // cgo: pkg-config names CgoPkgConfig []string // cgo: pkg-config names
......
...@@ -49,13 +49,13 @@ which calls strings.Join. The struct being passed to the template is: ...@@ -49,13 +49,13 @@ which calls strings.Join. The struct being passed to the template is:
CXXFiles []string // .cc, .cxx and .cpp source files CXXFiles []string // .cc, .cxx and .cpp source files
HFiles []string // .h, .hh, .hpp and .hxx source files HFiles []string // .h, .hh, .hpp and .hxx source files
SFiles []string // .s source files SFiles []string // .s source files
SysoFiles []string // .syso object files to add to archive
SwigFiles []string // .swig files SwigFiles []string // .swig files
SwigCXXFiles []string // .swigcxx files SwigCXXFiles []string // .swigcxx files
SysoFiles []string // .syso object files to add to archive
// Cgo directives // Cgo directives
CgoCPPFLAGS []string // cgo: flags for C preprocessor
CgoCFLAGS []string // cgo: flags for C compiler CgoCFLAGS []string // cgo: flags for C compiler
CgoCPPFLAGS []string // cgo: flags for C preprocessor
CgoCXXFLAGS []string // cgo: flags for C++ compiler CgoCXXFLAGS []string // cgo: flags for C++ compiler
CgoLDFLAGS []string // cgo: flags for linker CgoLDFLAGS []string // cgo: flags for linker
CgoPkgConfig []string // cgo: pkg-config names CgoPkgConfig []string // cgo: pkg-config names
......
...@@ -43,13 +43,13 @@ type Package struct { ...@@ -43,13 +43,13 @@ type Package struct {
CXXFiles []string `json:",omitempty"` // .cc, .cpp and .cxx source files CXXFiles []string `json:",omitempty"` // .cc, .cpp and .cxx source files
HFiles []string `json:",omitempty"` // .h, .hh, .hpp and .hxx source files HFiles []string `json:",omitempty"` // .h, .hh, .hpp and .hxx source files
SFiles []string `json:",omitempty"` // .s source files SFiles []string `json:",omitempty"` // .s source files
SysoFiles []string `json:",omitempty"` // .syso system object files added to package
SwigFiles []string `json:",omitempty"` // .swig files SwigFiles []string `json:",omitempty"` // .swig files
SwigCXXFiles []string `json:",omitempty"` // .swigcxx files SwigCXXFiles []string `json:",omitempty"` // .swigcxx files
SysoFiles []string `json:",omitempty"` // .syso system object files added to package
// Cgo directives // Cgo directives
CgoCPPFLAGS []string `json:",omitempty"` // cgo: flags for C preprocessor
CgoCFLAGS []string `json:",omitempty"` // cgo: flags for C compiler CgoCFLAGS []string `json:",omitempty"` // cgo: flags for C compiler
CgoCPPFLAGS []string `json:",omitempty"` // cgo: flags for C preprocessor
CgoCXXFLAGS []string `json:",omitempty"` // cgo: flags for C++ compiler CgoCXXFLAGS []string `json:",omitempty"` // cgo: flags for C++ compiler
CgoLDFLAGS []string `json:",omitempty"` // cgo: flags for linker CgoLDFLAGS []string `json:",omitempty"` // cgo: flags for linker
CgoPkgConfig []string `json:",omitempty"` // cgo: pkg-config names CgoPkgConfig []string `json:",omitempty"` // cgo: pkg-config names
...@@ -104,11 +104,11 @@ func (p *Package) copyBuild(pp *build.Package) { ...@@ -104,11 +104,11 @@ func (p *Package) copyBuild(pp *build.Package) {
p.CXXFiles = pp.CXXFiles p.CXXFiles = pp.CXXFiles
p.HFiles = pp.HFiles p.HFiles = pp.HFiles
p.SFiles = pp.SFiles p.SFiles = pp.SFiles
p.SysoFiles = pp.SysoFiles
p.SwigFiles = pp.SwigFiles p.SwigFiles = pp.SwigFiles
p.SwigCXXFiles = pp.SwigCXXFiles p.SwigCXXFiles = pp.SwigCXXFiles
p.CgoCPPFLAGS = pp.CgoCPPFLAGS p.SysoFiles = pp.SysoFiles
p.CgoCFLAGS = pp.CgoCFLAGS p.CgoCFLAGS = pp.CgoCFLAGS
p.CgoCPPFLAGS = pp.CgoCPPFLAGS
p.CgoCXXFLAGS = pp.CgoCXXFLAGS p.CgoCXXFLAGS = pp.CgoCXXFLAGS
p.CgoLDFLAGS = pp.CgoLDFLAGS p.CgoLDFLAGS = pp.CgoLDFLAGS
p.CgoPkgConfig = pp.CgoPkgConfig p.CgoPkgConfig = pp.CgoPkgConfig
......
...@@ -356,13 +356,13 @@ type Package struct { ...@@ -356,13 +356,13 @@ type Package struct {
CXXFiles []string // .cc, .cpp and .cxx source files CXXFiles []string // .cc, .cpp and .cxx source files
HFiles []string // .h, .hh, .hpp and .hxx source files HFiles []string // .h, .hh, .hpp and .hxx source files
SFiles []string // .s source files SFiles []string // .s source files
SysoFiles []string // .syso system object files to add to archive
SwigFiles []string // .swig files SwigFiles []string // .swig files
SwigCXXFiles []string // .swigcxx files SwigCXXFiles []string // .swigcxx files
SysoFiles []string // .syso system object files to add to archive
// Cgo directives // Cgo directives
CgoCPPFLAGS []string // Cgo CPPFLAGS directives
CgoCFLAGS []string // Cgo CFLAGS directives CgoCFLAGS []string // Cgo CFLAGS directives
CgoCPPFLAGS []string // Cgo CPPFLAGS directives
CgoCXXFLAGS []string // Cgo CXXFLAGS directives CgoCXXFLAGS []string // Cgo CXXFLAGS directives
CgoLDFLAGS []string // Cgo LDFLAGS directives CgoLDFLAGS []string // Cgo LDFLAGS directives
CgoPkgConfig []string // Cgo pkg-config directives CgoPkgConfig []string // Cgo pkg-config directives
...@@ -857,7 +857,7 @@ func (ctxt *Context) shouldBuild(content []byte) bool { ...@@ -857,7 +857,7 @@ func (ctxt *Context) shouldBuild(content []byte) bool {
} }
// saveCgo saves the information from the #cgo lines in the import "C" comment. // saveCgo saves the information from the #cgo lines in the import "C" comment.
// These lines set CPPCFLAGS, CFLAGS, CXXFLAGS and LDFLAGS and pkg-config directives // These lines set CFLAGS, CPPFLAGS, CXXFLAGS and LDFLAGS and pkg-config directives
// that affect the way cgo's C code is built. // that affect the way cgo's C code is built.
// //
// TODO(rsc): This duplicates code in cgo. // TODO(rsc): This duplicates code in cgo.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment