diff options
author | Daniel Franke <franke@edf-online.de> | 2018-05-18 19:59:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-06-26 18:15:21 (GMT) |
commit | 7c4c13ffef87d748b896e2c762ad0b2c00afcd31 (patch) | |
tree | 912ac1661b74cc13fbc735eb8a38f617c1598de9 /Source/cmMathCommand.cxx | |
parent | 5b0f73a15a7b49461123a969bbebceff4284df9c (diff) | |
download | CMake-7c4c13ffef87d748b896e2c762ad0b2c00afcd31.zip CMake-7c4c13ffef87d748b896e2c762ad0b2c00afcd31.tar.gz CMake-7c4c13ffef87d748b896e2c762ad0b2c00afcd31.tar.bz2 |
math: Reject unexpected expression input explicitly
Switch to C++ exceptions for lexer/parser error handling.
Teach the lexer/parser to fail on unexpected input.
Diffstat (limited to 'Source/cmMathCommand.cxx')
-rw-r--r-- | Source/cmMathCommand.cxx | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/cmMathCommand.cxx b/Source/cmMathCommand.cxx index f0945b2..ab77dc3 100644 --- a/Source/cmMathCommand.cxx +++ b/Source/cmMathCommand.cxx @@ -36,11 +36,11 @@ bool cmMathCommand::HandleExprCommand(std::vector<std::string> const& args) const std::string& outputVariable = args[1]; const std::string& expression = args[2]; + this->Makefile->AddDefinition(outputVariable, "ERROR"); + cmExprParserHelper helper; if (!helper.ParseString(expression.c_str(), 0)) { - std::string e = "cannot parse the expression: \"" + expression + "\": "; - e += helper.GetError(); - this->SetError(e); + this->SetError(helper.GetError()); return false; } |