aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/lexer.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-07-25 13:06:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-07-25 13:06:47 +0200
commit185e4b00521b3aeb67df250f77d2bb88740b6582 (patch)
tree21d03ec6bad7b3f3a8e495002915505604679eb0 /build2/cc/lexer.cxx
parent7027454d7ea82f979103626d74db4b5b4067c123 (diff)
Use absolute path to translation unit
This seems to be the only sane way to obtain the same hash regardless of the working directory.
Diffstat (limited to 'build2/cc/lexer.cxx')
-rw-r--r--build2/cc/lexer.cxx10
1 files changed, 10 insertions, 0 deletions
diff --git a/build2/cc/lexer.cxx b/build2/cc/lexer.cxx
index a71bd4c..7ab1a57 100644
--- a/build2/cc/lexer.cxx
+++ b/build2/cc/lexer.cxx
@@ -882,7 +882,16 @@ namespace build2
// GCC sometimes adds what looks like working directory (has trailing
// slash). So ignore that as well.
//
+ // We now switched to using absolute translation unit paths (because
+ // of __FILE__/assert(); see compile.cxx for details). But we might
+ // still need this logic when we try to calculate location-independent
+ // hash for distributed compilation/caching. The idea is to only hash
+ // the part starting from the project root which is immutable. Plus
+ // we will need -ffile-prefix-map to deal with __FILE__.
+ //
if (!log_file_.to_directory ())
+ cs_.append (log_file_.string ());
+#if 0
{
using tr = path::traits;
const string& f (log_file_.string ());
@@ -927,6 +936,7 @@ namespace build2
cs_.append (f.c_str () + fp);
}
}
+#endif
}
else
unget (c);