aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/scope.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-04-02 08:03:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-04-02 08:03:55 +0200
commit87a7253a3bd82b59063172f3799b0a5587e7b2a5 (patch)
treee99ea1139bea536f02865fc9fcd06486676c0f73 /libbuild2/scope.cxx
parentcede94e8190ead8d2bc311e82348119d9abbfc3d (diff)
Detect and diagnose attempt to create new target in src directory
GitHub issue #277.
Diffstat (limited to 'libbuild2/scope.cxx')
-rw-r--r--libbuild2/scope.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/libbuild2/scope.cxx b/libbuild2/scope.cxx
index 6ed7bab..23781a8 100644
--- a/libbuild2/scope.cxx
+++ b/libbuild2/scope.cxx
@@ -1205,8 +1205,8 @@ namespace build2
}
auto scope_map::
- find (const dir_path& k) const -> pair<scopes::const_iterator,
- scopes::const_iterator>
+ find (const dir_path& k, bool sno) const -> pair<scopes::const_iterator,
+ scopes::const_iterator>
{
assert (k.normalized (false));
auto i (map_.find_sup (k));
@@ -1215,9 +1215,9 @@ namespace build2
auto b (i->second.begin ());
auto e (i->second.end ());
- // Skip NULL first element.
+ // Skip NULL first element if requested.
//
- if (*b == nullptr)
+ if (sno && *b == nullptr)
++b;
assert (b != e);