diff options
author | Brad King <brad.king@kitware.com> | 2009-01-22 13:16:47 -0500 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-01-22 13:16:47 -0500 |
commit | 3028ca756c8621b3cc37032987eb01fbe61da248 (patch) | |
tree | 1a32991d7d25cefaa5b214759d84ab2c20a3c0b5 /Source/cmFunctionCommand.cxx | |
parent | 18eadebc4c0b43443861f40ca243e18dbabb2324 (diff) | |
download | cmake-3028ca756c8621b3cc37032987eb01fbe61da248.tar.gz |
ENH: Better policies for functions and macros
This teaches functions and macros to use policies recorded at creation
time when they are invoked. It restores the policies as a weak policy
stack entry so that any policies set by a function escape to its caller
as before.
Diffstat (limited to 'Source/cmFunctionCommand.cxx')
-rw-r--r-- | Source/cmFunctionCommand.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx index 2b5223b3af..9095961cf6 100644 --- a/Source/cmFunctionCommand.cxx +++ b/Source/cmFunctionCommand.cxx @@ -36,6 +36,7 @@ public: // we must copy when we clone newC->Args = this->Args; newC->Functions = this->Functions; + newC->Policies = this->Policies; return newC; } @@ -81,6 +82,7 @@ public: std::vector<std::string> Args; std::vector<cmListFileFunction> Functions; + cmPolicies::PolicyMap Policies; }; @@ -108,6 +110,10 @@ bool cmFunctionHelperCommand::InvokeInitialPass cmMakefile::ScopePushPop varScope(this->Makefile); static_cast<void>(varScope); + // Push a weak policy scope which restores the policies recorded at + // function creation. + cmMakefile::PolicyPushPop polScope(this->Makefile, true, this->Policies); + // set the value of argc cmOStringStream strStream; strStream << expandedArgs.size(); @@ -165,6 +171,7 @@ bool cmFunctionHelperCommand::InvokeInitialPass // The error message should have already included the call stack // so we do not need to report an error here. lexScope.Quiet(); + polScope.Quiet(); inStatus.SetNestedError(true); return false; } @@ -206,6 +213,7 @@ IsFunctionBlocked(const cmListFileFunction& lff, cmMakefile &mf, cmFunctionHelperCommand *f = new cmFunctionHelperCommand(); f->Args = this->Args; f->Functions = this->Functions; + mf.RecordPolicies(f->Policies); // Set the FilePath on the arguments to match the function since it is // not stored and the original values may be freed |