aboutsummaryrefslogtreecommitdiff
path: root/build2/scope.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-11-08 12:45:33 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-11-08 12:45:33 +0200
commitdbb7a5ffefefa1e6439464cac47ebfd90a913aa7 (patch)
treebec6ea433f5ae1cd7c7eaddd3f57fa82a6cb4960 /build2/scope.cxx
parent0c2c473c9937a54562bbf767cc5450f6c03bcce6 (diff)
Fix bug in override logic for command line variable with project visibility
Diffstat (limited to 'build2/scope.cxx')
-rw-r--r--build2/scope.cxx16
1 files changed, 11 insertions, 5 deletions
diff --git a/build2/scope.cxx b/build2/scope.cxx
index b9dabe8..49263d4 100644
--- a/build2/scope.cxx
+++ b/build2/scope.cxx
@@ -225,9 +225,9 @@ namespace build2
const scope* s;
- // Return true if the override applies. Note that it expects vars and proj
- // to be not NULL; if there is nothing "more inner", then any override
- // will still be "visible".
+ // Return true if the override applies to a value from vars/proj. Note
+ // that it expects vars and proj to be not NULL; if there is nothing "more
+ // inner", then any override will still be "visible".
//
auto applies = [&s] (const variable* o,
const variable_map* vars,
@@ -246,9 +246,15 @@ namespace build2
}
case variable_visibility::project:
{
- // Does not apply if in a different project.
+ // Does not apply if in a subproject.
//
- if (proj != s->root_scope ())
+ // Note that before we used to require the same project but that
+ // missed values that are "visible" from the outer projects.
+ //
+ // If root scope is NULL, then we are looking at the global scope.
+ //
+ const scope* rs (s->root_scope ());
+ if (rs != nullptr && rs->sub_root (*proj))
return false;
break;