aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler_wrapper/disable_werror_flag.go14
-rw-r--r--compiler_wrapper/disable_werror_flag_test.go6
2 files changed, 10 insertions, 10 deletions
diff --git a/compiler_wrapper/disable_werror_flag.go b/compiler_wrapper/disable_werror_flag.go
index 114d8250..65ea1ab1 100644
--- a/compiler_wrapper/disable_werror_flag.go
+++ b/compiler_wrapper/disable_werror_flag.go
@@ -80,17 +80,17 @@ func doubleBuildWithWNoError(env env, cfg *config, newWarningsDir string, origin
if err != nil {
return 0, err
}
- // If -Wno-error fixed us, pretend that we never ran without -Wno-error.
- // Otherwise, pretend that we never ran the second invocation. Since -Werror
- // is an issue, log in either case.
- if retryExitCode == 0 {
- retryStdoutBuffer.WriteTo(env.stdout())
- retryStderrBuffer.WriteTo(env.stderr())
- } else {
+ // If -Wno-error fixed us, pretend that we never ran without -Wno-error. Otherwise, pretend
+ // that we never ran the second invocation.
+ if retryExitCode != 0 {
originalStdoutBuffer.WriteTo(env.stdout())
originalStderrBuffer.WriteTo(env.stderr())
+ return originalExitCode, nil
}
+ retryStdoutBuffer.WriteTo(env.stdout())
+ retryStderrBuffer.WriteTo(env.stderr())
+
// All of the below is basically logging. If we fail at any point, it's
// reasonable for that to fail the build. This is all meant for FYI-like
// builders in the first place.
diff --git a/compiler_wrapper/disable_werror_flag_test.go b/compiler_wrapper/disable_werror_flag_test.go
index eb907e6b..bd4d376e 100644
--- a/compiler_wrapper/disable_werror_flag_test.go
+++ b/compiler_wrapper/disable_werror_flag_test.go
@@ -146,7 +146,7 @@ func TestForwardStdoutAndStderrWhenDoubleBuildFails(t *testing.T) {
}
}
exitCode := callCompiler(ctx, ctx.cfg, ctx.newCommand(clangX86_64, mainCc))
- if exitCode != 5 {
+ if exitCode != 3 {
t.Errorf("unexpected exitcode. Got: %d", exitCode)
}
if err := verifyNonInternalError(ctx.stderrString(), "-Werror originalerror"); err != nil {
@@ -278,8 +278,8 @@ func TestLogWarningsWhenDoubleBuildFails(t *testing.T) {
}
ctx.mustFail(callCompiler(ctx, ctx.cfg, ctx.newCommand(clangX86_64, mainCc)))
loggedWarnings := readLoggedWarnings(ctx)
- if loggedWarnings == nil {
- t.Fatal("expected logged warnings")
+ if loggedWarnings != nil {
+ t.Fatal("expected no warnings to be logged")
}
})
}