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
1 changed files with 11 additions and 2 deletions

View File

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