diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-11-24 15:29:58 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-11-24 15:29:58 +0200 |
commit | 1bb9cc99e8926825a2daae0f0d1e2c3d15d778a5 (patch) | |
tree | 1e52ebd69f505280b23c3c400f9acc4a3b6488f7 /build2 | |
parent | 88b346394054416213d3d4e81e0a213403eb2ff7 (diff) | |
download | build2-1bb9cc99e8926825a2daae0f0d1e2c3d15d778a5.tar.gz build2-1bb9cc99e8926825a2daae0f0d1e2c3d15d778a5.tar.xz build2-1bb9cc99e8926825a2daae0f0d1e2c3d15d778a5.zip |
Fix few bugs in generated header path remapping logic
Diffstat (limited to 'build2')
-rw-r--r-- | build2/cc/compile.cxx | 17 | ||||
-rw-r--r-- | build2/cli/target.cxx | 2 |
2 files changed, 12 insertions, 7 deletions
diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index 1317fcbe..65c1362e 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -1549,7 +1549,7 @@ namespace build2 // // This is a nasty problem that doesn't seem to have a perfect solution // (except, perhaps, C++ modules). So what we are going to do is try to - // rectify the situation by detecting and automatically re-mapping such + // rectify the situation by detecting and automatically remapping such // mis-inclusions. It works as follows. // // First we will build a map of src/out pairs that were specified with @@ -1686,9 +1686,13 @@ namespace build2 { // Note that we don't normalize the paths since it would be // quite expensive and normally the pairs we are inerested in - // are already normalized (since usually specified as - // -I$src/out_*). + // are already normalized (since they are usually specified as + // -I$src/out_*). We just need to add a trailing directory + // separator if it's not already there. // + if (!dir_path::traits::is_separator (ds.back ())) + ds += dir_path::traits::directory_separator; + dir_path d (move (ds), dir_path::exact); // Move the buffer in. // Ignore invalid paths (buffer is not moved). @@ -1715,6 +1719,7 @@ namespace build2 // We've got a pair. // so_map.emplace (move (d), s->out_path () / p); + s = nullptr; // Taken. continue; } } @@ -2131,8 +2136,8 @@ namespace build2 // First try the whole file. Then just the directory. // - // @@ Has to be a separate map since the prefix can be - // the same as the file name. + // @@ Has to be a separate map since the prefix can be the same as + // the file name. // // auto i (pfx_map->find (f)); @@ -2216,7 +2221,7 @@ namespace build2 if (pt != nullptr) { path p (d / f.leaf ()); - l4 ([&]{trace << "re-mapping " << f << " to " << p;}); + l4 ([&]{trace << "remapping " << f << " to " << p;}); f = move (p); } } diff --git a/build2/cli/target.cxx b/build2/cli/target.cxx index c50c0b41..10aab5e8 100644 --- a/build2/cli/target.cxx +++ b/build2/cli/target.cxx @@ -55,7 +55,7 @@ namespace build2 // this is to avoid searching for existing files in src_base if the // buildfile mentions some of them explicitly as prerequisites. // - // Also required for the src-out re-mapping logic. + // Also required for the src-out remapping logic. // targets.insert<cxx::hxx> (d, o, n, trace); targets.insert<cxx::cxx> (d, o, n, trace); |