From 516cdec4894096305f5002b922ba02d49cb3e816 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 2 Oct 2009 09:28:00 +0000 Subject: Optimised auto dependency generation Added control c handler in windows Now throw string exceptions instead of integer exceptions. --- tools/mhmake/src/rule.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'tools/mhmake/src/rule.cpp') diff --git a/tools/mhmake/src/rule.cpp b/tools/mhmake/src/rule.cpp index 7e71ba95f..90fee8a91 100644 --- a/tools/mhmake/src/rule.cpp +++ b/tools/mhmake/src/rule.cpp @@ -49,11 +49,12 @@ static bool FindDep(const string &DepName,vector > >&Im bool bCommandsDifferent=OldCommands.size()!=NewCommands.size(); if (g_PrintMultipleDefinedRules || bCommandsDifferent) { + string ErrorMessage; if (bCommandsDifferent) - cerr << "Implicit Rule '"<< DepName << "' defined twice with different commands\n"; + ErrorMessage += "Implicit Rule '"+ DepName + "' defined twice with different commands\n"; else - cerr << "Implicit Rule '"<< DepName << "' defined twice with same commands\n"; - cerr << "Command 1: makedir = " << SecIt->second->GetMakefile()->GetMakeDir()->GetQuotedFullFileName()<< endl; + ErrorMessage += "Implicit Rule '"+ DepName + "' defined twice with same commands\n"; + ErrorMessage += "Command 1: makedir = " + SecIt->second->GetMakefile()->GetMakeDir()->GetQuotedFullFileName()+ "\n"; vector::const_iterator It; if (bCommandsDifferent) @@ -61,19 +62,21 @@ static bool FindDep(const string &DepName,vector > >&Im It=OldCommands.begin(); while (It!=OldCommands.end()) { - cerr << " " << *It << endl; + ErrorMessage += " " + *It + "\n"; } } - cerr << "Command 2: makedir = "<< Rule->GetMakefile()->GetMakeDir()->GetQuotedFullFileName()<< endl; + cerr << "Command 2: makedir = "+ Rule->GetMakefile()->GetMakeDir()->GetQuotedFullFileName()+ "\n"; if (bCommandsDifferent) { It=NewCommands.begin(); while (It!=NewCommands.end()) { - cerr << " " << *It << endl; + ErrorMessage += " " + *It + "\n"; } - throw(1); + throw ErrorMessage; } + else + cerr << ErrorMessage << endl; } mhmakeparser *pOldMakefile=SecIt->second->GetMakefile(); mhmakeparser *pNewMakefile=Rule->GetMakefile(); @@ -83,12 +86,12 @@ static bool FindDep(const string &DepName,vector > >&Im { if (pOldMakefile->ExpandExpression(*OldIt)!=pNewMakefile->ExpandExpression(*NewIt)) { - cerr << "Implicit Rule '"<< DepName << "' defined twice with different commands\n"; - cerr << "Command 1: makedir = " << pOldMakefile->GetMakeDir()->GetQuotedFullFileName()<< endl; - cerr << " " << pOldMakefile->ExpandExpression(*OldIt) << endl; - cerr << "Command 2: makedir = "<< pNewMakefile->GetMakeDir()->GetQuotedFullFileName()<< endl; - cerr << " " << pNewMakefile->ExpandExpression(*NewIt) << endl; - throw(1); + string ErrorMessage = string("Implicit Rule '") + DepName + "' defined twice with different commands\n"; + ErrorMessage += "Command 1: makedir = " + pOldMakefile->GetMakeDir()->GetQuotedFullFileName()+ "\n"; + ErrorMessage += " " + pOldMakefile->ExpandExpression(*OldIt) + "\n"; + ErrorMessage += "Command 2: makedir = " + pNewMakefile->GetMakeDir()->GetQuotedFullFileName()+ "\n"; + ErrorMessage += " " + pNewMakefile->ExpandExpression(*NewIt); + throw ErrorMessage; } OldIt++; NewIt++; @@ -141,8 +144,7 @@ void IMPLICITRULE::SearchImplicitRule(const refptr &Target,vector< pai #ifdef _DEBUG if (!ResIt->second) { - cerr << "No rhs for implicit rule : "<< ImpRegExIt->first << endl; - throw(1); + throw string("No rhs for implicit rule : ") + ImpRegExIt->first; } #endif ResIt->second->SetStem(Res.m_Stem); -- cgit v1.2.3