1
0
mirror of https://github.com/golang/go synced 2024-09-30 16:18:35 -06:00

cmd/toolstash: pass -c=1 in the second compilation

When toolstash -cmp found diff, it does a second compilation
with extra flags -v -m=2, which are imcompatible with the
concurrent backend. Pass -c=1 in the second compilation.

Change-Id: I3c77069936da1829b68375a4a6c7f9bbe364247c
Reviewed-on: https://go-review.googlesource.com/60390
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Cherry Zhang 2017-08-30 16:00:42 -04:00
parent a567bbf739
commit e4b401d06e

View File

@ -278,11 +278,14 @@ func compareTool() {
case tool == "compile" || strings.HasSuffix(tool, "g"): // compiler
useDashN := true
for _, s := range cmd {
dashcIndex := -1
for i, s := range cmd {
if s == "-+" {
// Compiling runtime. Don't use -N.
useDashN = false
break
}
if strings.HasPrefix(s, "-c=") {
dashcIndex = i
}
}
cmdN := injectflags(cmd, nil, useDashN)
@ -293,9 +296,15 @@ func compareTool() {
} else {
log.Printf("compiler output differs")
}
if dashcIndex >= 0 {
cmd[dashcIndex] = "-c=1"
}
cmd = injectflags(cmd, []string{"-v", "-m=2"}, useDashN)
break
}
if dashcIndex >= 0 {
cmd[dashcIndex] = "-c=1"
}
cmd = injectflags(cmd, []string{"-v", "-m=2"}, false)
log.Printf("compiler output differs, only with optimizers enabled")