From bd44dc14fe2a331f4ea6ef188e6130a1d1eb4dbb Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Sat, 2 Jul 2005 22:31:30 -0400 Subject: [PATCH] ENH: Improve performance by compiling regular expressions when needed --- Source/CTest/cmCTestBuildHandler.cxx | 53 ++++++++++------------------ 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 158e55f7b..fb8241b0c 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -167,23 +167,6 @@ cmCTestBuildHandler::cmCTestBuildHandler() m_LastErrorOrWarning = m_ErrorsAndWarnings.end(); - int cc; - for ( cc = 0; cmCTestWarningErrorFileLine[cc].m_RegularExpressionString; ++ cc ) - { - cmCTestBuildHandler::cmCTestCompileErrorWarningRex r; - if ( r.m_RegularExpression.compile( - cmCTestWarningErrorFileLine[cc].m_RegularExpressionString) ) - { - r.m_FileIndex = cmCTestWarningErrorFileLine[cc].m_FileIndex; - r.m_LineIndex = cmCTestWarningErrorFileLine[cc].m_LineIndex; - m_ErrorWarningFileLineRegex.push_back(r); - } - else - { - cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem Compiling regular expression: " - << cmCTestWarningErrorFileLine[cc].m_RegularExpressionString << std::endl); - } - } } //---------------------------------------------------------------------- @@ -226,24 +209,6 @@ void cmCTestBuildHandler::Initialize() m_MaxErrors = 50; m_MaxWarnings = 50; - - int cc; - for ( cc = 0; cmCTestWarningErrorFileLine[cc].m_RegularExpressionString; ++ cc ) - { - cmCTestBuildHandler::cmCTestCompileErrorWarningRex r; - if ( r.m_RegularExpression.compile( - cmCTestWarningErrorFileLine[cc].m_RegularExpressionString) ) - { - r.m_FileIndex = cmCTestWarningErrorFileLine[cc].m_FileIndex; - r.m_LineIndex = cmCTestWarningErrorFileLine[cc].m_LineIndex; - m_ErrorWarningFileLineRegex.push_back(r); - } - else - { - cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem Compiling regular expression: " - << cmCTestWarningErrorFileLine[cc].m_RegularExpressionString << std::endl); - } - } } //---------------------------------------------------------------------- @@ -266,6 +231,24 @@ int cmCTestBuildHandler::ProcessHandler() { cmCTestLog(m_CTest, HANDLER_OUTPUT, "Build project" << std::endl); + int entry; + for ( entry = 0; cmCTestWarningErrorFileLine[entry].m_RegularExpressionString; ++ entry ) + { + cmCTestBuildHandler::cmCTestCompileErrorWarningRex r; + if ( r.m_RegularExpression.compile( + cmCTestWarningErrorFileLine[entry].m_RegularExpressionString) ) + { + r.m_FileIndex = cmCTestWarningErrorFileLine[entry].m_FileIndex; + r.m_LineIndex = cmCTestWarningErrorFileLine[entry].m_LineIndex; + m_ErrorWarningFileLineRegex.push_back(r); + } + else + { + cmCTestLog(m_CTest, ERROR_MESSAGE, "Problem Compiling regular expression: " + << cmCTestWarningErrorFileLine[entry].m_RegularExpressionString << std::endl); + } + } + // Determine build command and build directory const std::string &makeCommand = m_CTest->GetCTestConfiguration("MakeCommand"); if ( makeCommand.size() == 0 )