aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/disable_werror_flag.go
diff options
context:
space:
mode:
Diffstat (limited to 'compiler_wrapper/disable_werror_flag.go')
-rw-r--r--compiler_wrapper/disable_werror_flag.go13
1 files changed, 9 insertions, 4 deletions
diff --git a/compiler_wrapper/disable_werror_flag.go b/compiler_wrapper/disable_werror_flag.go
index 17077671..91bc5845 100644
--- a/compiler_wrapper/disable_werror_flag.go
+++ b/compiler_wrapper/disable_werror_flag.go
@@ -18,6 +18,10 @@ import (
const numWErrorEstimate = 30
+func getForceDisableWerrorDir(env env, cfg *config) string {
+ return path.Join(getCompilerArtifactsDir(env), cfg.newWarningsDir)
+}
+
func shouldForceDisableWerror(env env, cfg *config, ty compilerType) bool {
if cfg.isAndroidWrapper {
return cfg.useLlvmNext
@@ -178,20 +182,21 @@ func doubleBuildWithWNoError(env env, cfg *config, originalCmd *command) (exitCo
oldMask := env.umask(0)
defer env.umask(oldMask)
+ warningsDir := getForceDisableWerrorDir(env, cfg)
// Allow root and regular users to write to this without issue.
- if err := os.MkdirAll(cfg.newWarningsDir, 0777); err != nil {
- return 0, wrapErrorwithSourceLocf(err, "error creating warnings directory %s", cfg.newWarningsDir)
+ if err := os.MkdirAll(warningsDir, 0777); err != nil {
+ return 0, wrapErrorwithSourceLocf(err, "error creating warnings directory %s", warningsDir)
}
// Have some tag to show that files aren't fully written. It would be sad if
// an interrupted build (or out of disk space, or similar) caused tools to
// have to be overly-defensive.
- incompleteSuffix := ".incomplete"
+ const incompleteSuffix = ".incomplete"
// Coming up with a consistent name for this is difficult (compiler command's
// SHA can clash in the case of identically named files in different
// directories, or similar); let's use a random one.
- tmpFile, err := ioutil.TempFile(cfg.newWarningsDir, "warnings_report*.json"+incompleteSuffix)
+ tmpFile, err := ioutil.TempFile(warningsDir, "warnings_report*.json"+incompleteSuffix)
if err != nil {
return 0, wrapErrorwithSourceLocf(err, "error creating warnings file")
}