aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/file.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-08-03 17:26:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-08-03 17:26:50 +0200
commite767684a3462059852f7067a2297b1e18fdb3137 (patch)
tree2134aeafd9ade404330c7b078edf02dd5546bc5b /libbuild2/file.cxx
parentf7573d6fba84c596e02d6aae9f1e4c0bdada823a (diff)
Fix incorrect assumption in amalgamation discovery logic
Diffstat (limited to 'libbuild2/file.cxx')
-rw-r--r--libbuild2/file.cxx18
1 files changed, 10 insertions, 8 deletions
diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx
index 4c88ed9..b91de8b 100644
--- a/libbuild2/file.cxx
+++ b/libbuild2/file.cxx
@@ -1039,6 +1039,13 @@ namespace build2
scope* ars (rs.parent_scope ()->root_scope ());
+ // We must not be amalgamated by a simple project.
+ //
+ auto simple = [ars] ()
+ {
+ return ars->root_extra->project && *ars->root_extra->project == nullptr;
+ };
+
if (rp.second)
{
// If the amalgamation variable hasn't been set, then we need to check
@@ -1065,18 +1072,13 @@ namespace build2
// Else fall through.
}
else
- assert (ars == nullptr); // Shouldn't find_out_root() have found it?
+ assert (ars == nullptr || simple ()); // Shouldn't we have found it?
}
// Do additional checks if the outer root could be our amalgamation.
//
if (ars != nullptr)
{
- // We must not be amalgamated by a simple project.
- //
- bool simple (ars->root_extra->project &&
- *ars->root_extra->project == nullptr);
-
const dir_path& ad (ars->out_path ());
// If we have the amalgamation variable set by the user, verify that
@@ -1090,11 +1092,11 @@ namespace build2
dir_path d (out_root / vd);
d.normalize ();
- if (!d.sub (ad) || (simple && d == ad))
+ if (!d.sub (ad) || (simple () && d == ad))
fail << "incorrect amalgamation " << vd << " of " << out_root;
}
}
- else if (!simple)
+ else if (!simple ())
{
// Otherwise, use the outer root as our amalgamation.
//