aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-11-07 13:23:36 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-11-07 13:23:36 +0200
commitc833c13f0bb956bc52c461866846b7ea54a4fc6a (patch)
treeb242a89863c118e1da2db9282b47a1e81451773b
parent21b440f8d1dbfe7ba38a571add298262c26eeb34 (diff)
Improve parser diagnostics
-rw-r--r--build2/parser.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx
index 2a20aba..7dd6a26 100644
--- a/build2/parser.cxx
+++ b/build2/parser.cxx
@@ -787,6 +787,17 @@ namespace build2
//
if (tt == type::colon)
{
+ // What should we do if there are no prerequisites (for example,
+ // because of an empty wildcard result)? We can fail or we can
+ // ignore. In most cases, however, this is probably an error
+ // (for example, forgetting to checkout a git submodule) so
+ // let's not confuse the user and fail (one can always handle
+ // the optional prerequisites case with a variable and an if).
+ //
+ if (pns.empty ())
+ fail (ploc) << "no prerequisites in prerequisite-specific "
+ << " variable assignment";
+
// Set the variable in the last pns.size() prerequisites of each
// target. This code is similar to target-specific case above.
//