From 0588e48ac1499388f4d2ad5bc03fe9f63782f161 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 25 Mar 2020 07:36:31 +0200 Subject: Enforce config directives only appearing in project's root.build --- libbuild2/parser.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'libbuild2/parser.cxx') diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index f20a4c4..fbf3bda 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -1655,12 +1655,13 @@ namespace build2 // config [] [?=[]] // - // @@ TODO: enforce appears in root.build + // Make sure only appears in root.build. // - if (root_ != scope_) - fail (t) << "configuration variable in non-root scope"; + if (stage_ != stage::root) + fail (t) << "configuration variable outside of project's " + << root_->root_extra->root_file; - // We enforce the config. prefix. + // Enforce the config. prefix. // // Note that this could be a subproject and it could be unnamed (e.g., the // tests subproject). The current thinking is to use hierarchical names @@ -1982,7 +1983,7 @@ namespace build2 bool optional (t.value.back () == '?'); - if (optional && boot_) + if (optional && stage_ == stage::boot) fail (t) << "optional module in bootstrap"; // The rest should be a list of module names. Parse them as names in the @@ -2035,7 +2036,7 @@ namespace build2 { assert (v.empty ()); // Module versioning not yet implemented. - if (boot_) + if (stage_ == stage::boot) boot_module (*root_, n, l); else init_module (*root_, *scope_, n, l, optional); -- cgit v1.1