From c833c13f0bb956bc52c461866846b7ea54a4fc6a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 7 Nov 2018 13:23:36 +0200 Subject: Improve parser diagnostics --- build2/parser.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'build2') 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. // -- cgit v1.1