aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libbuild2/algorithm.cxx16
-rw-r--r--libbuild2/dyndep.cxx4
-rw-r--r--libbuild2/search.cxx26
3 files changed, 28 insertions, 18 deletions
diff --git a/libbuild2/algorithm.cxx b/libbuild2/algorithm.cxx
index cb63e87..8f399dd 100644
--- a/libbuild2/algorithm.cxx
+++ b/libbuild2/algorithm.cxx
@@ -65,7 +65,13 @@ namespace build2
if (const target* pt = pk.tk.type->search (t, pk))
return *pt;
- return create_new_target (t.ctx, pk);
+ if (pk.tk.out->empty ())
+ return create_new_target (t.ctx, pk);
+
+ // If this is triggered, then you are probably not passing scope to
+ // search() (which leads to search_existing_file() being skipped).
+ //
+ fail << "no existing source file for prerequisite " << pk << endf;
}
pair<target&, ulock>
@@ -76,7 +82,13 @@ namespace build2
if (const target* pt = pk.tk.type->search (t, pk))
return {const_cast<target&> (*pt), ulock ()};
- return create_new_target_locked (t.ctx, pk);
+ if (pk.tk.out->empty ())
+ return create_new_target_locked (t.ctx, pk);
+
+ // If this is triggered, then you are probably not passing scope to
+ // search() (which leads to search_existing_file() being skipped).
+ //
+ fail << "no existing source file for prerequisite " << pk << endf;
}
const target*
diff --git a/libbuild2/dyndep.cxx b/libbuild2/dyndep.cxx
index 94d2028..9816ad6 100644
--- a/libbuild2/dyndep.cxx
+++ b/libbuild2/dyndep.cxx
@@ -445,7 +445,7 @@ namespace build2
// The directory is only moved from if insert is true. Note that it must
// be normalized.
//
- auto find = [&trace, what, &t,
+ auto find = [&trace, what, &bs, &t,
&map_extension,
&fallback] (dir_path&& d,
path&& f,
@@ -603,7 +603,7 @@ namespace build2
// @@ OPT: move d, out, n
//
if (r == nullptr && insert)
- r = &search (t, *tts[0], d, out, n, &e);
+ r = &search (t, *tts[0], d, out, n, &e, &bs);
return static_cast<const file*> (r);
};
diff --git a/libbuild2/search.cxx b/libbuild2/search.cxx
index c2f7de4..3bdb503 100644
--- a/libbuild2/search.cxx
+++ b/libbuild2/search.cxx
@@ -231,6 +231,12 @@ namespace build2
const target_key& tk (pk.tk);
+ // If out is present, then it means the target is in src and we shouldn't
+ // be creating new targets in src, should we? Feels like this should not
+ // even be called if out is not empty.
+ //
+ assert (tk.out->empty ());
+
// We default to the target in this directory scope.
//
dir_path d;
@@ -251,13 +257,6 @@ namespace build2
//
// More often insert than find, so skip find in insert().
//
- // @@ OUT: same story as in search_existing_target() re out. Maybe not:
- // if out is present, then it means the target is in src and we
- // shouldn't be creating new targets in src, should we? Feels
- // like this should not even be called in out is not empty.
- //
- //assert (tk.out->empty ()); @@ TMP
-
auto r (ctx.targets.insert (*tk.type,
move (d),
*tk.out,
@@ -280,6 +279,12 @@ namespace build2
const target_key& tk (pk.tk);
+ // If out is present, then it means the target is in src and we shouldn't
+ // be creating new targets in src, should we? Feels like this should not
+ // even be called if out is not empty.
+ //
+ assert (tk.out->empty ());
+
// We default to the target in this directory scope.
//
dir_path d;
@@ -300,13 +305,6 @@ namespace build2
//
// More often insert than find, so skip find in insert_locked().
//
- // @@ OUT: same story as in search_existing_target() re out. Maybe not:
- // if out is present, then it means the target is in src and we
- // shouldn't be creating new targets in src, should we? Feels
- // like this should not even be called in out is not empty.
- //
- //assert (tk.out->empty ()); @@ TMP
-
auto r (ctx.targets.insert_locked (*tk.type,
move (d),
*tk.out,