summaryrefslogtreecommitdiffstats
path: root/Source/cmFunctionCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-01-14 20:14:06 (GMT)
committerBrad King <brad.king@kitware.com>2009-01-14 20:14:06 (GMT)
commit9551cafd6918bba8ae9712adb7d3835b568973ff (patch)
tree9323e4315699c615eed871b68e44df4ca7d4baab /Source/cmFunctionCommand.cxx
parent046449e2f71e22a2cf46b9774665250ffa9da27c (diff)
downloadCMake-9551cafd6918bba8ae9712adb7d3835b568973ff.zip
CMake-9551cafd6918bba8ae9712adb7d3835b568973ff.tar.gz
CMake-9551cafd6918bba8ae9712adb7d3835b568973ff.tar.bz2
BUG: Pop a function scope even on error
This uses an automatic variable to push and pop variable scope inside a function call. Previously if the function failed its scope would not be popped. This approach guarantees a balanced push/pop.
Diffstat (limited to 'Source/cmFunctionCommand.cxx')
-rw-r--r--Source/cmFunctionCommand.cxx5
1 files changed, 2 insertions, 3 deletions
diff --git a/Source/cmFunctionCommand.cxx b/Source/cmFunctionCommand.cxx
index 8bad1a4..f36eb74 100644
--- a/Source/cmFunctionCommand.cxx
+++ b/Source/cmFunctionCommand.cxx
@@ -104,7 +104,8 @@ bool cmFunctionHelperCommand::InvokeInitialPass
}
// we push a scope on the makefile
- this->Makefile->PushScope();
+ cmMakefile::ScopePushPop varScope(this->Makefile);
+ static_cast<void>(varScope);
// set the value of argc
cmOStringStream strStream;
@@ -167,13 +168,11 @@ bool cmFunctionHelperCommand::InvokeInitialPass
}
if (status.GetReturnInvoked())
{
- this->Makefile->PopScope();
return true;
}
}
// pop scope on the makefile
- this->Makefile->PopScope();
return true;
}