diff options
author | Brad King <brad.king@kitware.com> | 2009-01-14 20:14:06 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-01-14 20:14:06 (GMT) |
commit | 9551cafd6918bba8ae9712adb7d3835b568973ff (patch) | |
tree | 9323e4315699c615eed871b68e44df4ca7d4baab /Source/cmMakefile.h | |
parent | 046449e2f71e22a2cf46b9774665250ffa9da27c (diff) | |
download | CMake-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/cmMakefile.h')
-rw-r--r-- | Source/cmMakefile.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index c0e0bf4..c77fcdb 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -780,6 +780,16 @@ public: void PopScope(); void RaiseScope(const char *var, const char *value); + /** Helper class to push and pop scopes automatically. */ + class ScopePushPop + { + public: + ScopePushPop(cmMakefile* m): Makefile(m) { this->Makefile->PushScope(); } + ~ScopePushPop() { this->Makefile->PopScope(); } + private: + cmMakefile* Makefile; + }; + void IssueMessage(cmake::MessageType t, std::string const& text) const; |