From b9224439c1d9914e00fba128eceb3a32f571237e Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Tue, 6 Dec 2011 22:56:12 +0100 Subject: [PATCH] Add 'exit' and 'abort' to the flow control list in order to simplify code after them. --- lib/tokenize.cpp | 4 ++-- test/testsimplifytokens.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index f4632ffac..cb88a1cba 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -4609,8 +4609,8 @@ void Tokenizer::simplifyFlowControl() tok = tok->next(); eraseDeadCode(tok, beginindent->link()); - } else if (tok->str() == "return" || tok->str() == "throw") { - //catch the first ';' after the return|trow statement + } else if (Token::Match(tok,"return|throw|exit|abort")) { + //catch the first ';' for (Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) { if (tok2->str() == "(" || tok2->str() == "[") { tok2 = tok2->link(); diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index c9fc2f590..fa8e5b5bf 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -3075,6 +3075,8 @@ private: std::list beforedead; beforedead.push_back("return"); beforedead.push_back("throw ( 10 )"); + beforedead.push_back("exit ( 0 )"); + beforedead.push_back("abort ( )"); beforedead.push_back("goto labels"); beforedead.push_back("break"); beforedead.push_back("continue");