diff options
author | George Burgess IV <gbiv@google.com> | 2020-04-01 12:21:42 -0700 |
---|---|---|
committer | George Burgess <gbiv@chromium.org> | 2020-04-01 20:41:55 +0000 |
commit | ca8e8b8dc0f702eaa3c74f9b5468547623423a41 (patch) | |
tree | 7969978a4c1f06468ddb7dc2ac9ec823eea3124d /compiler_wrapper/disable_werror_flag.go | |
parent | bfb695533f6c8f4f1b26609d233c858e2c135931 (diff) | |
download | toolchain-utils-ca8e8b8dc0f702eaa3c74f9b5468547623423a41.tar.gz |
compiler_wrapper: don't write -Werror files on still-failed builds
Not `return`ing here was troublesome for our monitoring infra, since it
meant that _any_ clang error that mentioned '-Werror', with this support
turned on, would turn into a json file. With configure steps and the
like, this probably isn't the behavior that we want.
BUG=None
TEST=unittests
Change-Id: I0669c5bd9473b687c34c23f284433a21e8a1d88c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2132233
Commit-Queue: George Burgess <gbiv@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Tested-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper/disable_werror_flag.go')
-rw-r--r-- | compiler_wrapper/disable_werror_flag.go | 14 |
1 files changed, 7 insertions, 7 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. |