diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-07-20 10:29:14 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-07-20 10:29:14 +0200 |
commit | 446d4f91b38bcf2f12f645389e10b443c02c2a00 (patch) | |
tree | d06987010a9f08f05dc58718b8b5eaf740ec0445 /libbuild2/parser.hxx | |
parent | c6c8d0be6fd99b2d8ac32c23d1a4141cdbdcd107 (diff) |
Adjust conditional dependency declaration warning logic
Now instead of ignoring imported stuff (which turned out to be racy), we only
consider conditions up to the include boundary. The thinking here is that an
included (but not sourced) buildfile is a standalone entity (e.g., imported
project but also could be just a side-included buildfile).
Note that unfortunately we will still be issuing warnings in imported projects
since there is no straightforward way to know what is being distributed and
what is not while parsing.
Diffstat (limited to 'libbuild2/parser.hxx')
-rw-r--r-- | libbuild2/parser.hxx | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/libbuild2/parser.hxx b/libbuild2/parser.hxx index 61ecd5b..5f762f7 100644 --- a/libbuild2/parser.hxx +++ b/libbuild2/parser.hxx @@ -91,12 +91,6 @@ namespace build2 parse_export_stub (istream& is, const path_name& name, scope& rs, scope& bs) { - auto g = make_guard ([this, old = imported_] () mutable - { - imported_ = old; - }); - imported_ = true; - parse_buildfile (is, name, &rs, bs); return move (export_value); } @@ -912,8 +906,12 @@ namespace build2 small_vector<attributes, 2> attributes_; - bool imported_ = false; // True if loaded via export stub. - optional<location> condition_; // Innermost if/switch (but not in recipe). + // Innermost if/switch (but excluding recipes). + // + // Note also that this is cleared/restored when crossing the include + // (but not source) boundary. + // + optional<location> condition_; target* default_target_ = nullptr; |