summaryrefslogtreecommitdiff
path: root/src/cmd/cgo/gcc.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/cgo/gcc.go')
-rw-r--r--src/cmd/cgo/gcc.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/cmd/cgo/gcc.go b/src/cmd/cgo/gcc.go
index e4e56d8dd..a4d83f1e7 100644
--- a/src/cmd/cgo/gcc.go
+++ b/src/cmd/cgo/gcc.go
@@ -66,7 +66,7 @@ func cname(s string) string {
// preamble. Multiple occurrences are concatenated with a separating space,
// even across files.
func (p *Package) ParseFlags(f *File, srcfile string) {
- linesIn := strings.Split(f.Preamble, "\n", -1)
+ linesIn := strings.Split(f.Preamble, "\n")
linesOut := make([]string, 0, len(linesIn))
NextLine:
@@ -78,7 +78,7 @@ NextLine:
}
l = strings.TrimSpace(l[4:])
- fields := strings.Split(l, ":", 2)
+ fields := strings.SplitN(l, ":", 2)
if len(fields) != 2 {
fatalf("%s: bad #cgo line: %s", srcfile, line)
}
@@ -230,9 +230,9 @@ func splitQuoted(s string) (r []string, err os.Error) {
args = append(args, string(arg[:i]))
}
if quote != 0 {
- err = os.ErrorString("unclosed quote")
+ err = os.NewError("unclosed quote")
} else if escaped {
- err = os.ErrorString("unfinished escaping")
+ err = os.NewError("unfinished escaping")
}
return args, err
}
@@ -275,7 +275,7 @@ func (p *Package) loadDefines(f *File) {
b.WriteString(f.Preamble)
stdout := p.gccDefines(b.Bytes())
- for _, line := range strings.Split(stdout, "\n", -1) {
+ for _, line := range strings.Split(stdout, "\n") {
if len(line) < 9 || line[0:7] != "#define" {
continue
}
@@ -397,7 +397,7 @@ func (p *Package) guessKinds(f *File) []*Name {
isConst[i] = true // until proven otherwise
}
- for _, line := range strings.Split(stderr, "\n", -1) {
+ for _, line := range strings.Split(stderr, "\n") {
if len(line) < 9 || line[0:9] != "cgo-test:" {
// the user will see any compiler errors when the code is compiled later.
continue
@@ -697,7 +697,7 @@ func (p *Package) gccMachine() []string {
return nil
}
-const gccTmp = "_obj/_cgo_.o"
+var gccTmp = objDir + "_cgo_.o"
// gccCmd returns the gcc command line to use for compiling
// the input.
@@ -1188,7 +1188,7 @@ func (c *typeConv) Type(dtype dwarf.Type) *Type {
if ss, ok := dwarfToName[s]; ok {
s = ss
}
- s = strings.Join(strings.Split(s, " ", -1), "") // strip spaces
+ s = strings.Join(strings.Split(s, " "), "") // strip spaces
name := c.Ident("_Ctype_" + s)
typedef[name.Name] = t.Go
t.Go = name