From 2d4787fc4ddc077e1d8fcb807768d1ecc7902a73 Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Wed, 29 May 2019 14:49:36 -0400 Subject: Genex: Add more extensive support for an unbounded number of parameters Previously genex support for unbounded number of parameters required at least 1 parameter. We now support zero or more parameters, and two or more parameters. --- Source/cmGeneratorExpressionEvaluator.cxx | 10 +++++++--- Source/cmGeneratorExpressionNode.h | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 268de6f..7442018 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -166,9 +166,13 @@ std::string GeneratorExpressionContent::EvaluateParameters( reportError(context, this->GetOriginalExpression(), "$<" + identifier + "> expression requires at least one parameter."); - } - if (numExpected == cmGeneratorExpressionNode::OneOrZeroParameters && - parameters.size() > 1) { + } else if (numExpected == cmGeneratorExpressionNode::TwoOrMoreParameters && + parameters.size() < 2) { + reportError(context, this->GetOriginalExpression(), + "$<" + identifier + + "> expression requires at least two parameters."); + } else if (numExpected == cmGeneratorExpressionNode::OneOrZeroParameters && + parameters.size() > 1) { reportError(context, this->GetOriginalExpression(), "$<" + identifier + "> expression requires one or zero parameters."); diff --git a/Source/cmGeneratorExpressionNode.h b/Source/cmGeneratorExpressionNode.h index 3dbfc6e..7a36924 100644 --- a/Source/cmGeneratorExpressionNode.h +++ b/Source/cmGeneratorExpressionNode.h @@ -20,7 +20,9 @@ struct cmGeneratorExpressionNode { DynamicParameters = 0, OneOrMoreParameters = -1, - OneOrZeroParameters = -2 + TwoOrMoreParameters = -2, + ZeroOrMoreParameters = -3, + OneOrZeroParameters = -4 }; virtual ~cmGeneratorExpressionNode() = default; -- cgit v0.12