diff options
author | Stephen Kelly <steveire@gmail.com> | 2015-10-20 17:13:52 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2015-10-20 21:40:12 (GMT) |
commit | d6a03b475e023da9b7532a5b8735caec36b5de86 (patch) | |
tree | 5a7fce28bcc989ae6a841118b2031f162ae3b705 /Source/cmConditionEvaluator.h | |
parent | 22bfb39dea2476df8f7aa5ed5c773a7a6720c4bc (diff) | |
download | CMake-d6a03b475e023da9b7532a5b8735caec36b5de86.zip CMake-d6a03b475e023da9b7532a5b8735caec36b5de86.tar.gz CMake-d6a03b475e023da9b7532a5b8735caec36b5de86.tar.bz2 |
cmIfCommand: Issue CMP0054 warning with appropriate context. (#15802)
Commit v3.4.0-rc1~494^2~4 (cmMakefile: Add API for elseif to create
backtrace., 2015-05-29) removed the use of cmMakefileCall to push/pop
execution context in favor of a new way to create backtraces.
However, a call to cmMakefile::GetExecutionContext is still invoked to
issue a contextual CMP0054 warning through cmConditionEvaluator. As
the elseif is not part of the call stack, this resulted in trying to
access an empty vector.
Avoid the attempt at getting execution context when evaluating elseif by
constructing a context and backtrace on behalf of the cmConditionEvaluator
in all cases.
Diffstat (limited to 'Source/cmConditionEvaluator.h')
-rw-r--r-- | Source/cmConditionEvaluator.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/cmConditionEvaluator.h b/Source/cmConditionEvaluator.h index c4e2d11..8600825 100644 --- a/Source/cmConditionEvaluator.h +++ b/Source/cmConditionEvaluator.h @@ -22,7 +22,9 @@ class cmConditionEvaluator public: typedef std::list<cmExpandedCommandArgument> cmArgumentList; - cmConditionEvaluator(cmMakefile& makefile); + cmConditionEvaluator(cmMakefile& makefile, + cmListFileContext const& context, + cmListFileBacktrace const& bt); // this is a shared function for both If and Else to determine if the // arguments were valid, and if so, was the response true. If there is @@ -31,6 +33,9 @@ public: std::string &errorString, cmake::MessageType &status); + static cmListFileContext GetConditionContext(cmMakefile* mf, + const cmCommandContext& command, std::string const& filePath); + private: // Filter the given variable definition based on policy CMP0054. const char* GetDefinitionIfUnquoted( @@ -91,6 +96,8 @@ private: cmake::MessageType &status); cmMakefile& Makefile; + cmListFileContext ExecutionContext; + cmListFileBacktrace Backtrace; cmPolicies::PolicyStatus Policy12Status; cmPolicies::PolicyStatus Policy54Status; cmPolicies::PolicyStatus Policy57Status; |