aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-06-09 15:23:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-06-09 15:23:27 +0200
commitc78f03ca550bfdcec1de4e2fd96a2604476374d7 (patch)
tree156e31c8e78c4e3d8e41f0acc570537095c26f98 /libbuild2
parentc991cd8fa9f534817428a5523fc529518e8e1738 (diff)
Make importation of unqualified targets illegal
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/file.cxx15
-rw-r--r--libbuild2/target.hxx4
2 files changed, 13 insertions, 6 deletions
diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx
index f7073e6..e0467ad 100644
--- a/libbuild2/file.cxx
+++ b/libbuild2/file.cxx
@@ -1729,15 +1729,18 @@ namespace build2
{
tracer trace ("import_search");
- // If there is no project specified for this target, then our run will be
- // short and sweet: we simply return it as empty-project-qualified and
- // let someone else (e.g., a rule) take a stab at it.
+ // Note: in the future the plan is to turn this into project-local import.
//
if (tgt.unqualified ())
- {
- tgt.proj = project_name ();
+ fail (loc) << "importation of an unqualified target " << tgt <<
+ info << "use empty project qualification to import a target "
+ << "without a project";
+
+ // If the project name is empty then we simply return it as is to let
+ // someone else (e.g., a rule, import phase 2) take a stab at it.
+ //
+ if (tgt.proj->empty ())
return make_pair (move (tgt), optional<dir_path> ());
- }
context& ctx (ibase.ctx);
diff --git a/libbuild2/target.hxx b/libbuild2/target.hxx
index 2af389d..c2954f8 100644
--- a/libbuild2/target.hxx
+++ b/libbuild2/target.hxx
@@ -1260,6 +1260,10 @@ namespace build2
// map. The key's hash ignores the extension, so the hash will stay stable
// across extension updates.
//
+ // @@ TODO: we currently do not detect ambiguity if there are multiple merge
+ // candidates for a no-extension key. We could probably do it using the
+ // unordered_map::bucket() API.
+ //
// Note also that once the extension is specified, it becomes immutable.
//
class LIBBUILD2_SYMEXPORT target_set