From e4b401d06e5ee9f990011dc4f24cd24162131565 Mon Sep 17 00:00:00 2001 From: Cherry Zhang Date: Wed, 30 Aug 2017 16:00:42 -0400 Subject: [PATCH] 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 --- cmd/toolstash/main.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cmd/toolstash/main.go b/cmd/toolstash/main.go index 0b4cbc50..997e54ad 100644 --- a/cmd/toolstash/main.go +++ b/cmd/toolstash/main.go @@ -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")