Revert "really fix #3527 (Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers)"

This reverts commit a37031944e.

I don't want this hard coding of macro names. Feel free to come with a more generic solution if you want.
This commit is contained in:
Daniel Marjamäki 2012-01-30 06:15:41 +01:00
parent a544e35ecf
commit 9df6088ddd
4 changed files with 2 additions and 55 deletions

View File

@ -2559,6 +2559,8 @@ void CheckMemoryLeakInClass::checkPublicFunctions(const Scope *scope, const Toke
return; return;
const unsigned int varid = classtok->varId(); const unsigned int varid = classtok->varId();
if (varid == 0)
return;
// Parse public functions.. // Parse public functions..
// If they allocate member variables, they should also deallocate // If they allocate member variables, they should also deallocate

View File

@ -2108,9 +2108,6 @@ bool Tokenizer::tokenize(std::istream &code,
// remove Borland stuff.. // remove Borland stuff..
simplifyBorland(); simplifyBorland();
// remove wxWidgets stuff..
simplifyWxWidgets();
// Remove "volatile", "inline", "register", and "restrict" // Remove "volatile", "inline", "register", and "restrict"
simplifyKeyword(); simplifyKeyword();
@ -8991,32 +8988,6 @@ void Tokenizer::simplifyQtSignalsSlots()
} }
} }
void Tokenizer::simplifyWxWidgets()
{
std::set<std::string> macros;
macros.insert("WXDLLIMPEXP_FWD_BASE");
macros.insert("WXDLLIMPEXP_FWD_NET");
macros.insert("WXDLLIMPEXP_FWD_CORE");
macros.insert("WXDLLIMPEXP_FWD_ADV");
macros.insert("WXDLLIMPEXP_FWD_QA");
macros.insert("WXDLLIMPEXP_FWD_HTML");
macros.insert("WXDLLIMPEXP_FWD_GL");
macros.insert("WXDLLIMPEXP_FWD_XML");
macros.insert("WXDLLIMPEXP_FWD_XRC");
macros.insert("WXDLLIMPEXP_FWD_AUI");
macros.insert("WXDLLIMPEXP_FWD_PROPGRID");
macros.insert("WXDLLIMPEXP_FWD_RICHTEXT");
macros.insert("WXDLLIMPEXP_FWD_MEDIA");
macros.insert("WXDLLIMPEXP_FWD_STC");
macros.insert("WXDLLIMPEXP_FWD_WEBVIEW");
for (Token *tok = _tokens; tok; tok = tok->next()) {
if (tok->next() && macros.find(tok->next()->str()) != macros.end())
tok->deleteNext();
}
}
const SymbolDatabase *Tokenizer::getSymbolDatabase() const const SymbolDatabase *Tokenizer::getSymbolDatabase() const
{ {
if (!_symbolDatabase) if (!_symbolDatabase)

View File

@ -671,11 +671,6 @@ public:
*/ */
void simplifyQtSignalsSlots(); void simplifyQtSignalsSlots();
/**
* Remove wxWidgets macros
*/
void simplifyWxWidgets();
/** /**
* Collapse operator name tokens into single token * Collapse operator name tokens into single token
* operator = => operator= * operator = => operator=

View File

@ -355,8 +355,6 @@ private:
TEST_CASE(Qt); TEST_CASE(Qt);
TEST_CASE(wxWidgets); // ticket #3527
TEST_CASE(sql); TEST_CASE(sql);
TEST_CASE(simplifyLogicalOperators); TEST_CASE(simplifyLogicalOperators);
@ -5905,25 +5903,6 @@ private:
ASSERT_EQUALS("", errout.str()); ASSERT_EQUALS("", errout.str());
} }
// ticket #3527
void wxWidgets() {
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_BASE wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_NET wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_CORE wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_ADV wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_QA wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_HTML wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_GL wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_XML wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_XRC wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_AUI wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_PROPGRID wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_RICHTEXT wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_MEDIA wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_STC wxCheckBox;"));
ASSERT_EQUALS("class wxCheckBox ;", tokenizeAndStringify("class WXDLLIMPEXP_FWD_WEBVIEW wxCheckBox;"));
}
void sql() { void sql() {
// Oracle PRO*C extensions for inline SQL. Just replace the SQL with "asm()" to fix wrong error messages // Oracle PRO*C extensions for inline SQL. Just replace the SQL with "asm()" to fix wrong error messages
// ticket: #1959 // ticket: #1959