diff options
author | Brad King <brad.king@kitware.com> | 2009-01-21 14:48:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-01-21 14:48:00 (GMT) |
commit | b8f5a934ecb83f0124be8485708d4d6d763682fd (patch) | |
tree | d0fe8d5148a7f56eb62e222dd4e2bcbde633d438 /Source/cmMakefile.h | |
parent | f4d37eebb26a62d2522e7d321b09f19242826d8d (diff) | |
download | CMake-b8f5a934ecb83f0124be8485708d4d6d763682fd.zip CMake-b8f5a934ecb83f0124be8485708d4d6d763682fd.tar.gz CMake-b8f5a934ecb83f0124be8485708d4d6d763682fd.tar.bz2 |
ENH: Refactor logical block enforcement
This uses a stack of 'barriers' to efficiently divide function blockers
into groups corresponding to each input file. It simplifies detection
of missing block close commands and factors it out of ReadListFile.
Diffstat (limited to 'Source/cmMakefile.h')
-rw-r--r-- | Source/cmMakefile.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 6da3646..c6b332b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -98,6 +98,19 @@ public: cmsys::auto_ptr<cmFunctionBlocker> RemoveFunctionBlocker(const cmListFileFunction& lff); + /** Push/pop a lexical (function blocker) barrier automatically. */ + class LexicalPushPop + { + public: + LexicalPushPop(cmMakefile* mf); + ~LexicalPushPop(); + void Quiet() { this->ReportError = false; } + private: + cmMakefile* Makefile; + bool ReportError; + }; + friend class LexicalPushPop; + /** * Try running cmake and building a file. This is used for dynalically * loaded commands, not as part of the usual build process. @@ -876,7 +889,11 @@ private: const std::vector<std::string>& v) const; void AddDefaultDefinitions(); - std::list<cmFunctionBlocker *> FunctionBlockers; + typedef std::vector<cmFunctionBlocker*> FunctionBlockersType; + FunctionBlockersType FunctionBlockers; + std::vector<FunctionBlockersType::size_type> FunctionBlockerBarriers; + void PushFunctionBlockerBarrier(); + void PopFunctionBlockerBarrier(bool reportError = true); typedef std::map<cmStdString, cmData*> DataMapType; DataMapType DataMap; |