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.go27
1 files changed, 20 insertions, 7 deletions
diff --git a/compiler_wrapper/disable_werror_flag.go b/compiler_wrapper/disable_werror_flag.go
index 864397dd..406fdef9 100644
--- a/compiler_wrapper/disable_werror_flag.go
+++ b/compiler_wrapper/disable_werror_flag.go
@@ -9,16 +9,29 @@ import (
"encoding/json"
"io/ioutil"
"os"
+ "path"
"strings"
"syscall"
)
-func shouldForceDisableWError(env env) bool {
- value, _ := env.getenv("FORCE_DISABLE_WERROR")
- return value != ""
+func getNewWarningsDir(env env, cfg *config) (dirName string, ok bool) {
+ if cfg.isAndroidWrapper {
+ if cfg.useLlvmNext {
+ value, _ := env.getenv("OUT_DIR")
+ if value != "" {
+ return path.Join(value, "warnings_reports"), true
+ }
+ }
+ } else {
+ value, _ := env.getenv("FORCE_DISABLE_WERROR")
+ if value != "" {
+ return cfg.newWarningsDir, true
+ }
+ }
+ return "", false
}
-func doubleBuildWithWNoError(env env, cfg *config, originalCmd *command) (exitCode int, err error) {
+func doubleBuildWithWNoError(env env, cfg *config, newWarningsDir string, originalCmd *command) (exitCode int, err error) {
originalStdoutBuffer := &bytes.Buffer{}
originalStderrBuffer := &bytes.Buffer{}
// TODO: This is a bug in the old wrapper that it drops the ccache path
@@ -73,8 +86,8 @@ func doubleBuildWithWNoError(env env, cfg *config, originalCmd *command) (exitCo
defer syscall.Umask(oldMask)
// 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(newWarningsDir, 0777); err != nil {
+ return 0, wrapErrorwithSourceLocf(err, "error creating warnings directory %s", newWarningsDir)
}
// Have some tag to show that files aren't fully written. It would be sad if
@@ -85,7 +98,7 @@ func doubleBuildWithWNoError(env env, cfg *config, originalCmd *command) (exitCo
// 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(newWarningsDir, "warnings_report*.json"+incompleteSuffix)
if err != nil {
return 0, wrapErrorwithSourceLocf(err, "error creating warnings file")
}