diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-03-25 07:36:31 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-03-25 07:36:31 +0200 |
commit | 0588e48ac1499388f4d2ad5bc03fe9f63782f161 (patch) | |
tree | 8a1785909c41dc159dce30f3682b84aa4f771661 /libbuild2/parser.cxx | |
parent | d1663e509e8cc77a8fbb8345bb1fbccacacf2429 (diff) |
Enforce config directives only appearing in project's root.build
Diffstat (limited to 'libbuild2/parser.cxx')
-rw-r--r-- | libbuild2/parser.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
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 [<var-attrs>] <var>[?=[<val-attrs>]<default-val>] // - // @@ 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.<project> prefix. + // Enforce the config.<project> 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); |