aboutsummaryrefslogtreecommitdiff
path: root/build2/parser.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/parser.cxx')
-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.
//