~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to src/cmd/cgo/gcc.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
// preamble. Multiple occurrences are concatenated with a separating space,
67
67
// even across files.
68
68
func (p *Package) ParseFlags(f *File, srcfile string) {
69
 
        linesIn := strings.Split(f.Preamble, "\n", -1)
 
69
        linesIn := strings.Split(f.Preamble, "\n")
70
70
        linesOut := make([]string, 0, len(linesIn))
71
71
 
72
72
NextLine:
78
78
                }
79
79
 
80
80
                l = strings.TrimSpace(l[4:])
81
 
                fields := strings.Split(l, ":", 2)
 
81
                fields := strings.SplitN(l, ":", 2)
82
82
                if len(fields) != 2 {
83
83
                        fatalf("%s: bad #cgo line: %s", srcfile, line)
84
84
                }
230
230
                args = append(args, string(arg[:i]))
231
231
        }
232
232
        if quote != 0 {
233
 
                err = os.ErrorString("unclosed quote")
 
233
                err = os.NewError("unclosed quote")
234
234
        } else if escaped {
235
 
                err = os.ErrorString("unfinished escaping")
 
235
                err = os.NewError("unfinished escaping")
236
236
        }
237
237
        return args, err
238
238
}
275
275
        b.WriteString(f.Preamble)
276
276
        stdout := p.gccDefines(b.Bytes())
277
277
 
278
 
        for _, line := range strings.Split(stdout, "\n", -1) {
 
278
        for _, line := range strings.Split(stdout, "\n") {
279
279
                if len(line) < 9 || line[0:7] != "#define" {
280
280
                        continue
281
281
                }
397
397
                isConst[i] = true // until proven otherwise
398
398
        }
399
399
 
400
 
        for _, line := range strings.Split(stderr, "\n", -1) {
 
400
        for _, line := range strings.Split(stderr, "\n") {
401
401
                if len(line) < 9 || line[0:9] != "cgo-test:" {
402
402
                        // the user will see any compiler errors when the code is compiled later.
403
403
                        continue
697
697
        return nil
698
698
}
699
699
 
700
 
const gccTmp = "_obj/_cgo_.o"
 
700
var gccTmp = objDir + "_cgo_.o"
701
701
 
702
702
// gccCmd returns the gcc command line to use for compiling
703
703
// the input.
1188
1188
                        if ss, ok := dwarfToName[s]; ok {
1189
1189
                                s = ss
1190
1190
                        }
1191
 
                        s = strings.Join(strings.Split(s, " ", -1), "") // strip spaces
 
1191
                        s = strings.Join(strings.Split(s, " "), "") // strip spaces
1192
1192
                        name := c.Ident("_Ctype_" + s)
1193
1193
                        typedef[name.Name] = t.Go
1194
1194
                        t.Go = name