diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-06-26 12:28:05 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-06-26 12:28:05 +0200 |
commit | d1fbcace59846d55c66e741dbc3d59e20ae3e5cf (patch) | |
tree | af1325d7d519bda64535f602c8ea1a3147b97b31 /build2/cc/utility.cxx | |
parent | dc3d7c5fa4062cac36d718766504c87696a3de41 (diff) |
Fix C/C++ link rule matching ambiguity by seeing-through utility libraries
Diffstat (limited to 'build2/cc/utility.cxx')
-rw-r--r-- | build2/cc/utility.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/build2/cc/utility.cxx b/build2/cc/utility.cxx index 39f5c35..2751032 100644 --- a/build2/cc/utility.cxx +++ b/build2/cc/utility.cxx @@ -43,8 +43,8 @@ namespace build2 : v.size () > 1 && v[1] == "shared" ? lorder::a_s : lorder::a; } - const target& - link_member (const bin::libx& x, action a, linfo li) + const target* + link_member (const bin::libx& x, action a, linfo li, bool exist) { bool ul; @@ -72,12 +72,14 @@ namespace build2 // Called by the compile rule during execute. // - return phase == run_phase::match - ? search (x, tt, x.dir, x.out, x.name) - : *search_existing (tt, x.dir, x.out, x.name); + return phase == run_phase::match && !exist + ? &search (x, tt, x.dir, x.out, x.name) + : search_existing (tt, x.dir, x.out, x.name); } else { + assert (!exist); + const lib& l (x.as<lib> ()); // Make sure group members are resolved. @@ -107,7 +109,7 @@ namespace build2 } } - return *(ls ? static_cast<const target*> (l.s) : l.a); + return ls ? static_cast<const target*> (l.s) : l.a; } } } |