From 9b5350e3697e226228c42a3191d787b61052b077 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Thu, 4 Jun 2009 17:46:19 +0300 Subject: [PATCH 01/41] GUI: Enable sorting in results view. --- gui/resultstree.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index 8486877f3..ca1e3e990 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -35,10 +35,10 @@ ResultsTree::ResultsTree(QSettings &settings, ApplicationList &list) : labels << tr("File") << tr("Severity") << tr("Line") << tr("Message"); mModel.setHorizontalHeaderLabels(labels); setExpandsOnDoubleClick(false); + setSortingEnabled(true); LoadSettings(); connect(this, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(QuickStartApplication(const QModelIndex &))); - } ResultsTree::~ResultsTree() @@ -46,8 +46,6 @@ ResultsTree::~ResultsTree() SaveSettings(); } - - QStandardItem *ResultsTree::CreateItem(const QString &name) { QStandardItem *item = new QStandardItem(name); @@ -55,7 +53,6 @@ QStandardItem *ResultsTree::CreateItem(const QString &name) return item; } - void ResultsTree::AddErrorItem(const QString &file, const QString &severity, const QString &message, @@ -65,7 +62,6 @@ void ResultsTree::AddErrorItem(const QString &file, { Q_UNUSED(file); - if (files.isEmpty()) { return; @@ -99,7 +95,6 @@ void ResultsTree::AddErrorItem(const QString &file, data["id"] = id; item->setData(QVariant(data)); - //Add backtrace files as children for (int i = 1;i < files.size() && i < lines.size();i++) { @@ -140,14 +135,12 @@ QStandardItem *ResultsTree::AddBacktraceFiles(QStandardItem *parent, list << CreateItem(QString("%1").arg(line)); list << CreateItem(message); - QModelIndex index = QModelIndex(); parent->appendRow(list); setRowHidden(parent->rowCount() - 1, parent->index(), hide); - if (!icon.isEmpty()) { list[0]->setIcon(QIcon(icon)); @@ -532,7 +525,6 @@ void ResultsTree::SaveErrors(QTextStream &out, QStandardItem *item, bool xml) } out << line << endl; - } } @@ -611,7 +603,6 @@ void ResultsTree::RefreshFilePaths(QStandardItem *item) //Loop through all errors within this file for (int i = 0;i < item->rowCount();i++) { - //Get error i QStandardItem *error = item->child(i, 0); @@ -620,7 +611,6 @@ void ResultsTree::RefreshFilePaths(QStandardItem *item) continue; } - //Get error's user data QVariant userdata = error->data(); //Convert it to QVariantMap @@ -638,7 +628,6 @@ void ResultsTree::RefreshFilePaths(QStandardItem *item) //Update this error's text error->setText(StripPath(files[0], false)); - //If this error has backtraces make sure the files list has enough filenames if (error->rowCount() <= files.size() - 1) { @@ -666,7 +655,6 @@ void ResultsTree::RefreshFilePaths(QStandardItem *item) } } - void ResultsTree::RefreshFilePaths() { qDebug("Refreshing file paths"); @@ -676,6 +664,4 @@ void ResultsTree::RefreshFilePaths() { RefreshFilePaths(mModel.item(i, 0)); } - } - From 6745d9b8ef2206e50e59775c13719decbcd73286 Mon Sep 17 00:00:00 2001 From: Slava Semushin Date: Fri, 5 Jun 2009 07:34:12 +0700 Subject: [PATCH 02/41] Fixed ticket #358 (Local typedef flagged as uninitialized member) http://apps.sourceforge.net/trac/cppcheck/ticket/358 --- src/checkclass.cpp | 4 ++++ test/testclass.cpp | 13 +++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/checkclass.cpp b/src/checkclass.cpp index 39a95dbbe..4a752a5bd 100644 --- a/src/checkclass.cpp +++ b/src/checkclass.cpp @@ -82,6 +82,10 @@ struct CheckClass::VAR *CheckClass::ClassChecking_GetVarList(const Token *tok1, if (next->str() == "static") continue; + // Type definitions shall be ignored.. + if (next->str() == "typedef") + continue; + // Is it a variable declaration? if (Token::Match(next, "%type% %var% ;")) { diff --git a/test/testclass.cpp b/test/testclass.cpp index e12e1595d..5cede4d7b 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -45,6 +45,7 @@ private: TEST_CASE(uninitVar1); TEST_CASE(uninitVarEnum); TEST_CASE(uninitVarStream); + TEST_CASE(uninitVarTypedef); TEST_CASE(privateCtor1); // If constructor is private.. TEST_CASE(privateCtor2); // If constructor is private.. TEST_CASE(function); // Function is not variable @@ -225,6 +226,18 @@ private: ASSERT_EQUALS(std::string(""), errout.str()); } + void uninitVarTypedef() + { + checkUninitVar("class Foo\n" + "{\n" + "public:\n" + " typedef int * pointer;\n" + " Foo() : a(0) {}\n" + " pointer a;\n" + "};\n"); + + ASSERT_EQUALS("", errout.str()); + } void privateCtor1() { From 52a8368b02d10e5207ee3f89b10401be0ac77afd Mon Sep 17 00:00:00 2001 From: Slava Semushin Date: Fri, 5 Jun 2009 07:39:36 +0700 Subject: [PATCH 03/41] Strip redundant std::string usage from tests. Second round: handle empty strings. Done by command: git grep -l ASSERT_EQUALS | xargs sed -i 's|ASSERT_EQUALS(std::string(\(".*"\)),|ASSERT_EQUALS(\1,|' Should be no functional change. --- test/testbufferoverrun.cpp | 22 ++--- test/testcharvar.cpp | 6 +- test/testclass.cpp | 22 ++--- test/testconstructors.cpp | 18 ++-- test/testdivision.cpp | 4 +- test/testfunctionusage.cpp | 10 +-- test/testincompletestatement.cpp | 14 +-- test/testmemleak.cpp | 146 +++++++++++++++---------------- test/testother.cpp | 24 ++--- test/teststl.cpp | 6 +- test/testtokenize.cpp | 4 +- test/testunusedprivfunc.cpp | 8 +- test/testunusedvar.cpp | 8 +- 13 files changed, 146 insertions(+), 146 deletions(-) diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 6112bfa6b..0698f32d9 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -123,7 +123,7 @@ private: " char str[50];\n" " }\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -145,7 +145,7 @@ private: "{\n" " strcpy(buf, str);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -156,7 +156,7 @@ private: " char data[1];\n" " return abc.data[1];\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -168,7 +168,7 @@ private: " char data[100];\n" " const char *p = &data[100];\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -181,7 +181,7 @@ private: " char data[10];\n" " data[ sizeof(*data) ] = 0;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void sizeof2() @@ -191,7 +191,7 @@ private: " char data[10];\n" " data[ sizeof(data[0]) ] = 0;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); check("static void f()\n" "{\n" @@ -500,7 +500,7 @@ private: " char str[5];\n" " snprintf(str, 5, \"%s\", \"abc\");\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void snprintf3() @@ -510,7 +510,7 @@ private: " char str[5];\n" " snprintf(str, sizeof str, \"%s\", \"abc\");\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void snprintf4() @@ -520,7 +520,7 @@ private: " char str[5];\n" " snprintf(str, 8 - x, \"abcdefghijkl\");\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -572,7 +572,7 @@ private: " str[30] = 0;\n" " }\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -587,7 +587,7 @@ private: " memset(str,0,50);\n" " }\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void assign1() diff --git a/test/testcharvar.cpp b/test/testcharvar.cpp index 550a31a0d..2f16baf83 100644 --- a/test/testcharvar.cpp +++ b/test/testcharvar.cpp @@ -65,7 +65,7 @@ private: " unsigned char ch = 0x80;\n" " buf[ch] = 0;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); check("void foo()\n" "{\n" @@ -106,7 +106,7 @@ private: " char ch;\n" " func(&ch);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void return1() @@ -116,7 +116,7 @@ private: " char c;\n" " return &c;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } }; diff --git a/test/testclass.cpp b/test/testclass.cpp index 5cede4d7b..8dae3e568 100644 --- a/test/testclass.cpp +++ b/test/testclass.cpp @@ -81,10 +81,10 @@ private: // Base class not found checkVirtualDestructor("class Derived : public Base { };"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); checkVirtualDestructor("class Derived : Base { };"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void virtualDestructor2() @@ -97,7 +97,7 @@ private: checkVirtualDestructor("class Base { };\n" "class Derived : Base { public: ~Derived() { (void)11; } };"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void virtualDestructor3() @@ -119,11 +119,11 @@ private: checkVirtualDestructor("class Base { public: ~Base(); };\n" "class Derived : public Base { };"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); checkVirtualDestructor("class Base { public: ~Base(); };\n" "class Derived : private Fred, public Base { };"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void virtualDestructor5() @@ -132,11 +132,11 @@ private: checkVirtualDestructor("class Base { public: ~Base(); };\n" "class Derived : public Base { public: ~Derived() {} };"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); checkVirtualDestructor("class Base { public: ~Base(); };\n" "class Derived : public Base { public: ~Derived(); }; Derived::~Derived() {}"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void virtualDestructorProtected() @@ -154,7 +154,7 @@ private: "public:\n" " ~B() { int a; }\n" "};\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void checkUninitVar(const char code[]) @@ -223,7 +223,7 @@ private: " }\n" "};\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void uninitVarTypedef() @@ -246,7 +246,7 @@ private: " Foo() { }\n" "};\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void privateCtor2() @@ -282,7 +282,7 @@ private: " return p;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } diff --git a/test/testconstructors.cpp b/test/testconstructors.cpp index 69fa4f76f..ef0859505 100644 --- a/test/testconstructors.cpp +++ b/test/testconstructors.cpp @@ -146,7 +146,7 @@ private: " { this->i = 0; }\n" " int i;\n" "};\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void initvar_if() @@ -163,7 +163,7 @@ private: " }\n" " int i;\n" "};\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void initvar_operator_eq1() @@ -187,7 +187,7 @@ private: "};\n"); std::string err(errout.str()); - ASSERT_EQUALS(std::string(""), err); + ASSERT_EQUALS("", err); } @@ -214,7 +214,7 @@ private: " Init() { i = 0; }\n" " int i;\n" "};\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void initvar_same_classname() @@ -240,7 +240,7 @@ private: "}\n"); std::string err(errout.str()); - ASSERT_EQUALS(std::string(""), err); + ASSERT_EQUALS("", err); } void initvar_chained_assign() @@ -261,7 +261,7 @@ private: "}\n"); std::string err(errout.str()); - ASSERT_EQUALS(std::string(""), err); + ASSERT_EQUALS("", err); } @@ -296,7 +296,7 @@ private: "}\n"); std::string err(errout.str()); - ASSERT_EQUALS(std::string(""), err); + ASSERT_EQUALS("", err); } @@ -337,7 +337,7 @@ private: "};\n" "Fred::Fred()\n" "{ }"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void initvar_destructor() @@ -350,7 +350,7 @@ private: " Fred() : var(0) {}\n" " ~Fred() {}\n" "};\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void operatorEqSTL() diff --git a/test/testdivision.cpp b/test/testdivision.cpp index eabe16dee..e9d401518 100644 --- a/test/testdivision.cpp +++ b/test/testdivision.cpp @@ -113,7 +113,7 @@ private: " unsigned int i2;\n" " result = i2 / i1;}\n" ); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void division5() @@ -124,7 +124,7 @@ private: " unsigned int val = 32;\n" " val = val / USER_HASH;}\n" ); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void division6() diff --git a/test/testfunctionusage.cpp b/test/testfunctionusage.cpp index 6e1a605b4..78cca6b11 100644 --- a/test/testfunctionusage.cpp +++ b/test/testfunctionusage.cpp @@ -66,7 +66,7 @@ private: " { }\n" "}\n"); std::string err(errout.str()); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void return1() @@ -76,7 +76,7 @@ private: " return f1();\n" "}\n"); std::string err(errout.str()); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void callback1() @@ -86,7 +86,7 @@ private: " void (*f)() = cond ? f1 : NULL;\n" "}\n"); std::string err(errout.str()); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void else1() @@ -97,7 +97,7 @@ private: " else f1();\n" "}\n"); std::string err(errout.str()); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void functionpointer() @@ -111,7 +111,7 @@ private: " f(&abc::foo);\n" " return 0\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } }; diff --git a/test/testincompletestatement.cpp b/test/testincompletestatement.cpp index f13d7e5e2..92b752fec 100644 --- a/test/testincompletestatement.cpp +++ b/test/testincompletestatement.cpp @@ -80,7 +80,7 @@ private: "#endif\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void test2() @@ -100,7 +100,7 @@ private: " const char *str[] = { \"abc\" };\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void test4() @@ -115,7 +115,7 @@ private: "};\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void test5() @@ -143,13 +143,13 @@ private: "};\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void intarray() { check("int arr[] = { 100/2, 1*100 };\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void structarraynull() @@ -158,7 +158,7 @@ private: " { 100/2, 1*100 }\n" " { 90, 70 }\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void structarray() @@ -167,7 +167,7 @@ private: " { 100/2, 1*100 }\n" " { 90, 70 }\n" "};\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } }; diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index dc83d4028..2ddb1429d 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -245,7 +245,7 @@ private: " Fred *f = new Fred;\n" " return f;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void simple3() @@ -255,7 +255,7 @@ private: " char *s = new char[100];\n" " return (char *)s;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -277,7 +277,7 @@ private: " struct *str = new strlist;\n" " return &str->s;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -289,7 +289,7 @@ private: " char *str2 = (char *)str;\n" " free(str2);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -301,7 +301,7 @@ private: "{\n" " Fred *f = new Fred;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -315,7 +315,7 @@ private: " { }\n" " return str;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -327,7 +327,7 @@ private: " c->free(c);\n" " delete c;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void simple10() @@ -337,7 +337,7 @@ private: " FILE * f = fopen(fname, str);\n" " if ( fclose(f) != NULL );\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -371,7 +371,7 @@ private: " DeleteString(str);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -384,7 +384,7 @@ private: " *somestr = str;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -402,7 +402,7 @@ private: " delete [] a;\n" " }\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -432,7 +432,7 @@ private: " return;\n" " }\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); check("void f()\n" "{\n" @@ -459,7 +459,7 @@ private: " }\n" " delete [] str;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -478,7 +478,7 @@ private: " }\n" " delete [] str;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -508,7 +508,7 @@ private: " }\n" " return s;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -523,7 +523,7 @@ private: " }\n" " return 0;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -537,7 +537,7 @@ private: " delete [] s;\n" " }\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -555,7 +555,7 @@ private: " str[0] = s;\n" " }\n" "}\n", true); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -584,7 +584,7 @@ private: " return;\n" " kfree( smp );\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void if3() @@ -595,7 +595,7 @@ private: " if (0 != s)\n" " foo(s);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void if4() @@ -609,7 +609,7 @@ private: " if (b)\n" " free(s);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void if5() @@ -621,7 +621,7 @@ private: " return;\n" " free(p);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void if6() @@ -637,7 +637,7 @@ private: "\n" " fclose( a );\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void if7() @@ -654,7 +654,7 @@ private: " delete [] a;\n" " else {}\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void if8() @@ -689,7 +689,7 @@ private: " buf = tmp;\n" " return buf;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void if10() @@ -739,7 +739,7 @@ private: " }\n" " free(str);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -801,7 +801,7 @@ private: " }\n" " return str;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -875,7 +875,7 @@ private: "\n" " return a;\n" "}\n", true); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -932,7 +932,7 @@ private: " };\n" " delete [] str;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void switch2() @@ -984,7 +984,7 @@ private: " return *str = ret;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -1030,7 +1030,7 @@ private: " char *c = new char[50];\n" " return (c ? c : NULL);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void ret6() @@ -1040,7 +1040,7 @@ private: " char *c = new char[50];\n" " return strcpy(c, \"foo\");\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void ret7() @@ -1050,7 +1050,7 @@ private: " char *c = new char[50];\n" " return memcpy(c, \"foo\",4);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -1076,7 +1076,7 @@ private: " fp = popen();\n" " pclose(fp);\n" "}\n", false); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void mismatch3() @@ -1091,7 +1091,7 @@ private: " if (abc) fclose(fp);\n" " else pclose(fp);\n" "}\n", false); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void mismatch4() @@ -1124,7 +1124,7 @@ private: " char *p = new char[100];\n" " foo(p);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -1135,7 +1135,7 @@ private: " char *p = new char[100];\n" " foo.add(p);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -1165,7 +1165,7 @@ private: " char *p = new char[100];\n" " foo(p);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -1229,7 +1229,7 @@ private: " char *str = new char[100];" " (*release)(str);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -1247,7 +1247,7 @@ private: " return;\n" " delete [] a;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void func10() @@ -1257,7 +1257,7 @@ private: " char *c = malloc(50);\n" " (fnc)(c);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void func11() @@ -1267,7 +1267,7 @@ private: " char *c = malloc(50);\n" " (s1->fnc)(c);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void func12() @@ -1287,7 +1287,7 @@ private: "\n" " add_list(base);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void func13() @@ -1297,7 +1297,7 @@ private: " char *p = malloc(100);\n" " foo(&p);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -1425,7 +1425,7 @@ private: " }\n" "}\n", true); - TODO_ASSERT_EQUALS(std::string(""), errout.str()); + TODO_ASSERT_EQUALS("", errout.str()); } void class4() @@ -1600,7 +1600,7 @@ private: " }\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -1619,7 +1619,7 @@ private: " func(&ab->a);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -1682,7 +1682,7 @@ private: " free(a);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void realloc4() @@ -1717,7 +1717,7 @@ private: " free(p);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); check("void foo()\n" "{\n" @@ -1726,7 +1726,7 @@ private: " free(p);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); check("void foo()\n" "{\n" @@ -1735,7 +1735,7 @@ private: " free(a - 10);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); check("void foo()\n" "{\n" @@ -1744,7 +1744,7 @@ private: " free(a - 10);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); check("void foo()\n" "{\n" @@ -1752,7 +1752,7 @@ private: " list += a;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -1767,7 +1767,7 @@ private: " }\n" " free(p);\n" "}\n"); - TODO_ASSERT_EQUALS(std::string(""), errout.str()); + TODO_ASSERT_EQUALS("", errout.str()); } void cast1() @@ -1788,7 +1788,7 @@ private: " free((void *)a);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void cast3() @@ -1799,7 +1799,7 @@ private: " free(reinterpret_cast(a));\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -1840,7 +1840,7 @@ private: " free(str);\n" " foo(&str);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void dealloc_use_3() @@ -1852,7 +1852,7 @@ private: " f1(&str);\n" " f2(str);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void dealloc_use_4() @@ -1863,7 +1863,7 @@ private: " ReadDir( subdir );\n" " closedir(subdir);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void dealloc_use_5() @@ -1885,7 +1885,7 @@ private: " free(str);\n" " printf(\"free %x\", str);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void dealloc_use_7() @@ -1919,7 +1919,7 @@ private: " fprintf(fd, \"test\");\n" " fclose(fd);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void strcat_result_assignment() @@ -1932,7 +1932,7 @@ private: " free( p );\n" " return 0;\n" "}"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } @@ -1943,7 +1943,7 @@ private: "{\n" " Fred *f = new Fred;\n" "}\n", false); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); check("void foo()\n" "{\n" @@ -2144,7 +2144,7 @@ private: " FILE *f = popen (\"test\", \"w\");\n" " int a = pclose(f);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void exit1() @@ -2160,7 +2160,7 @@ private: " }\n" " delete [] out;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void exit2() @@ -2170,7 +2170,7 @@ private: " char *out = new char[100];\n" " exit(0);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void stdstring() @@ -2241,14 +2241,14 @@ private: " FILE *f = fopen(fname, str);\n" " fcloseall();\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); check("void f()\n" "{\n" " FILE *f = tmpfile();\n" " fcloseall();\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void opendir_function() @@ -2276,21 +2276,21 @@ private: " DIR *f = opendir(\".\");\n" " closedir(f);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); check("void f(int fd)\n" "{\n" " DIR *f = fdopendir(fd);\n" " closedir(f);\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); check("void foo()\n" "{\n" " DIR * f = opendir(dirname);\n" " if (closedir(f));\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void dir_functions() @@ -2343,7 +2343,7 @@ private: " *c = 0;\n" " *data = c;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } void dealloc_and_alloc_in_func() @@ -2362,7 +2362,7 @@ private: " delete [] a;\n" " return 0;\n" "}\n"); - ASSERT_EQUALS(std::string(""), errout.str()); + ASSERT_EQUALS("", errout.str()); } }; diff --git a/test/testother.cpp b/test/testother.cpp index 4666365af..6eaf2093a 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -110,7 +110,7 @@ private: " }\n" " cout< Date: Fri, 5 Jun 2009 09:50:06 +0700 Subject: [PATCH 04/41] Fixed ticket #329 (snprintf size is out of bounds when two variables in one scope with similar names) FIXME: Because it's fix for simplifyTokenList() test should be moved to test/testsimplifytokens.cpp file. http://apps.sourceforge.net/trac/cppcheck/ticket/329 --- src/tokenize.cpp | 6 ++++++ test/testbufferoverrun.cpp | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/tokenize.cpp b/src/tokenize.cpp index ade46ed9b..682d5ec9e 100644 --- a/src/tokenize.cpp +++ b/src/tokenize.cpp @@ -1250,6 +1250,12 @@ void Tokenizer::simplifyTokenList() } } + else if (Token::Match(tok, "sizeof ( %var% )") && tok->tokAt(2)->varId() > 0) + { + // don't try to replace size of variable if variable has + // similar name with type (#329) + } + else if (Token::Match(tok, "sizeof ( %type% )")) { const char *type = tok->strAt(2); diff --git a/test/testbufferoverrun.cpp b/test/testbufferoverrun.cpp index 0698f32d9..03236147c 100644 --- a/test/testbufferoverrun.cpp +++ b/test/testbufferoverrun.cpp @@ -68,6 +68,7 @@ private: TEST_CASE(sizeof1); TEST_CASE(sizeof2); + TEST_CASE(sizeof3); TEST_CASE(array_index_1); TEST_CASE(array_index_2); @@ -201,8 +202,17 @@ private: ASSERT_EQUALS("[test.cpp:4]: (all) Array index out of bounds\n", errout.str()); } - - + void sizeof3() + { + check("void f()\n" + "{\n" + " char group[32];\n" + " snprintf(group, sizeof(group), \"%u\", 0);\n" + " struct group *gr;\n" + " snprintf(group, sizeof(group), \"%u\", gr->gr_gid);\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } void array_index_1() { From 21e0639443653edd9a863a692a389715247e06df Mon Sep 17 00:00:00 2001 From: Slava Semushin Date: Fri, 5 Jun 2009 11:03:48 +0700 Subject: [PATCH 05/41] Fixed ticket #360 (Teach about new(std::nothrow) form) http://apps.sourceforge.net/trac/cppcheck/ticket/360 --- src/checkmemoryleak.cpp | 8 ++++++-- test/testmemleak.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index f1359768c..95a3e447c 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -103,10 +103,14 @@ CheckMemoryLeakClass::AllocType CheckMemoryLeakClass::GetAllocationType(const To return gMalloc; } - if (Token::Match(tok2, "new %type% [;()]")) + if (Token::Match(tok2, "new %type% [;()]") || + Token::Match(tok2, "new ( std :: nothrow ) %type% [;()]") || + Token::Match(tok2, "new ( nothrow ) %type% [;()]")) return New; - if (Token::Match(tok2, "new %type% [")) + if (Token::Match(tok2, "new %type% [") || + Token::Match(tok2, "new ( std :: nothrow ) %type% [") || + Token::Match(tok2, "new ( nothrow ) %type% [")) return NewArray; if (Token::Match(tok2, "fopen|tmpfile (")) diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 2ddb1429d..82f3448d0 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -69,6 +69,7 @@ private: TEST_CASE(simple8); TEST_CASE(simple9); // Bug 2435468 - member function "free" TEST_CASE(simple10); // fclose in a if condition + TEST_CASE(new_nothrow); TEST_CASE(alloc_alloc_1); @@ -340,8 +341,48 @@ private: ASSERT_EQUALS("", errout.str()); } + void new_nothrow() + { + check("void f()\n" + "{\n" + " int *p = new(std::nothrow) int;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4]: (error) Memory leak: p\n", errout.str()); + check("void f()\n" + "{\n" + " using std::nothrow;\n" + " int *p = new(nothrow) int;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: p\n", errout.str()); + check("void f()\n" + "{\n" + " int *p = new(std::nothrow) int[10];\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4]: (error) Memory leak: p\n", errout.str()); + + check("void f()\n" + "{\n" + " using namespace std;\n" + " int *p = new(nothrow) int[10];\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:5]: (error) Memory leak: p\n", errout.str()); + + check("void f()\n" + "{\n" + " int *p = new(std::nothrow) int;\n" + " delete [] p;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4]: (error) Mismatching allocation and deallocation: p\n", errout.str()); + + check("void f()\n" + "{\n" + " int *p = new(std::nothrow) int[10];\n" + " delete p;\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:4]: (error) Mismatching allocation and deallocation: p\n", errout.str()); + } void alloc_alloc_1() { From d0f3dccc6d05da857055709200735f26d0605293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 5 Jun 2009 08:56:46 +0200 Subject: [PATCH 06/41] Fixed #354 (false positive: memory leak) --- src/checkmemoryleak.cpp | 11 +++++++++-- test/testmemleak.cpp | 11 +++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index 95a3e447c..ce62c8c59 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -657,10 +657,17 @@ Token *CheckMemoryLeakClass::getcode(const Token *tok, std::list else if (Token::simpleMatch(tok->next(), "(")) { + int parlevel = 1; for (const Token *tok2 = tok->tokAt(2); tok2; tok2 = tok2->next()) { - if (tok2->str() == "(" || tok2->str() == ")") - break; + if (tok2->str() == "(") + ++parlevel; + else if (tok2->str() == ")") + { + if (parlevel <= 1) + break; + --parlevel; + } if (tok2->str() == varname) { diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 82f3448d0..1f6f71fc5 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -123,6 +123,7 @@ private: TEST_CASE(ret5); // Bug 2458436 - return use TEST_CASE(ret6); TEST_CASE(ret7); + TEST_CASE(ret8); TEST_CASE(mismatch1); TEST_CASE(mismatch2); @@ -1094,6 +1095,16 @@ private: ASSERT_EQUALS("", errout.str()); } + void ret8() + { + check("char *foo()\n" + "{\n" + " char *c = new char[50];\n" + " return ((char *)(c+1));\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } + void mismatch1() { From 8436dbda6f812cd8bb4ed1167b5ff276309ddcac Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Fri, 5 Jun 2009 10:26:19 +0300 Subject: [PATCH 07/41] Update Windows installer readme for including QT GUI and other installer improvements. --- win_installer/readme.txt | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/win_installer/readme.txt b/win_installer/readme.txt index ff92ddfed..517cc4ea7 100644 --- a/win_installer/readme.txt +++ b/win_installer/readme.txt @@ -1,11 +1,12 @@ Windows installer for the cppcheck ---------------------------------- -Simple Windows installer installing executable, license file and readme.txt to -program files/cppcheck folder. +Windows installer for both command line cppcheck and for QT-based GUI. All +needed runtimes and libraries are installed. -Shortcuts are created to start cmd.exe in installation folder. So when the user -selects start menu/desktop icon he gets command prompt in cppcheck folder. +Command line cppccheck shortcuts are created to start cmd.exe in installation +folder. So when the user selects start menu/desktop icon he gets command prompt +in cppcheck folder. Get the InnoSetup from: http://www.innosetup.com/ @@ -13,10 +14,14 @@ Be sure to download the 'QuickStart Pack' as it installs some nice tools like ISTool and preprocessor support. Files the installer needs: -/Release/cppcheck.exe /COPYING /readme.txt /AUTHORS +/gui/release/gui.exe +/Release/cppcheck.exe +/win_installer/icon.bmp +/win_installer/LargeLogo.bmp +/win_installer/ NOTE: Remember to convert COPYING and AUTHORS to Windows EOL format! Otherwise Windows Notepad (default viewer) can't show then properly. @@ -30,6 +35,14 @@ and modify RuntimesFolder -macro in begin of cppcheck.iss to point to the folder where files are. You can find runtime files from VS installation or from net. +QT Libraries: +Visual Studio is used to build the GUI executable. And QT must be build with VS +also. When building QT make sure you build release targets! + +Copy following files to same RuntimesFolder than VS runtime files: +- QtCore4.dll +- QtGui4.dll + Creating the installer executable: #1 Open the ISTool and load cppcheck.iss #2 Update the release version number: From aaba5735ed6dd93b5fa74a79be65975106c96e45 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Fri, 5 Jun 2009 10:37:50 +0300 Subject: [PATCH 08/41] Add more generated files to gitignore. GUI project/makefiles are ignored as they are generated by qmake. --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index fb0b7adda..33e836ce5 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ tools/errmsg *.ncb *.suo *.user +*.idb +*.pdb # VS build folders Build/ BuildTmp/ @@ -17,6 +19,9 @@ gui/release/ gui/temp/ # Other (generated) GUI files gui/Makefile +gui/Makefile.debug +gui/Makefile.release +gui/gui.sln +gui/gui.vcproj gui/gui gui/qrc_gui.cpp - From 8470cdafc08d85b36725a8d6d6d12f8c2cd9fd8a Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Fri, 5 Jun 2009 12:29:02 +0300 Subject: [PATCH 09/41] GUI: Fix warning from About-dialog layout. --- gui/aboutdialog.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gui/aboutdialog.cpp b/gui/aboutdialog.cpp index 85f01e5a7..981153d1b 100644 --- a/gui/aboutdialog.cpp +++ b/gui/aboutdialog.cpp @@ -28,13 +28,13 @@ AboutDialog::AboutDialog(const QString &version, QWidget *parent) { setWindowTitle(tr("About cppcheck")); // Left icon area and right text area - QHBoxLayout *iconLayout = new QHBoxLayout(this); + QHBoxLayout *iconLayout = new QHBoxLayout(); // Keep icon at the top of the dialog - QVBoxLayout *iconVLayout = new QVBoxLayout(this); + QVBoxLayout *iconVLayout = new QVBoxLayout(); // Texts - QVBoxLayout *mainLayout = new QVBoxLayout(this); + QVBoxLayout *mainLayout = new QVBoxLayout(); // Keep close button in right - QHBoxLayout *btnLayout = new QHBoxLayout(this); + QHBoxLayout *btnLayout = new QHBoxLayout(); QIcon *icon = new QIcon(":icon.png"); QLabel *iconLabel = new QLabel(); @@ -63,6 +63,7 @@ AboutDialog::AboutDialog(const QString &version, QWidget *parent) btnLayout->addStretch(); btnLayout->addWidget(quit); + setLayout(iconLayout); connect(quit, SIGNAL(clicked()), this, SLOT(close())); } From cfb4e9198681be2335fd0607b6a87814070ca0f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 5 Jun 2009 15:02:26 +0200 Subject: [PATCH 10/41] Fix #359 (Incorrect unused function) --- src/checkfunctionusage.cpp | 9 +++++---- test/testfunctionusage.cpp | 10 ++++++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/checkfunctionusage.cpp b/src/checkfunctionusage.cpp index 1020a8505..765164ac7 100644 --- a/src/checkfunctionusage.cpp +++ b/src/checkfunctionusage.cpp @@ -99,17 +99,18 @@ void CheckFunctionUsage::parseTokens(const Tokenizer &tokenizer) if (Token::Match(tok->next(), "%var% (")) { - if (tok->str() == "*" || (tok->isName() && !Token::Match(tok, "else|return"))) - continue; funcname = tok->next(); } - if (Token::Match(tok, "[;{}.,()[=+-/&|!?:] %var% [(),;:}]")) + else if (Token::Match(tok, "[;{}.,()[=+-/&|!?:] %var% [(),;:}]")) funcname = tok->next(); - if (Token::Match(tok, "[(,] & %var% :: %var% [,)]")) + else if (Token::Match(tok, "[(,] & %var% :: %var% [,)]")) funcname = tok->tokAt(4); + else + continue; + // funcname ( => Assert that the end paranthesis isn't followed by { if (Token::Match(funcname, "%var% (")) { diff --git a/test/testfunctionusage.cpp b/test/testfunctionusage.cpp index 78cca6b11..1a9bc561a 100644 --- a/test/testfunctionusage.cpp +++ b/test/testfunctionusage.cpp @@ -37,6 +37,7 @@ private: { TEST_CASE(incondition); TEST_CASE(return1); + TEST_CASE(return2); TEST_CASE(callback1); TEST_CASE(else1); TEST_CASE(functionpointer); @@ -79,6 +80,15 @@ private: ASSERT_EQUALS("", errout.str()); } + void return2() + { + check("char * foo()\n" + "{\n" + " return *foo();\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } + void callback1() { check("void f1()\n" From 5193a36a6a2490f199de41c430482586557d9894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 5 Jun 2009 18:34:55 +0200 Subject: [PATCH 11/41] Created an undocumented command line flag "--errorlist" that prints all messages --- src/check.h | 8 ++++++++ src/cppcheck.cpp | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/check.h b/src/check.h index 8dae9419c..d00158ee8 100644 --- a/src/check.h +++ b/src/check.h @@ -24,6 +24,7 @@ #include "errorlogger.h" #include +#include class Check { @@ -78,6 +79,13 @@ protected: /** report an error */ void reportError(const std::list &callstack, const std::string &severity, const std::string &id, const std::string &msg) { + // No errorLogger => just report the message to stdout + if (_errorLogger == NULL) + { + std::cout << "(" << severity << ") " << msg << std::endl; + return; + } + std::list locationList; for (std::list::const_iterator it = callstack.begin(); it != callstack.end(); ++it) { diff --git a/src/cppcheck.cpp b/src/cppcheck.cpp index de79ccf9a..ab223d72f 100644 --- a/src/cppcheck.cpp +++ b/src/cppcheck.cpp @@ -207,6 +207,16 @@ std::string CppCheck::parseFromArgs(int argc, const char* const argv[]) _settings.autoDealloc(f); } + // print all possible error messages.. + else if (strcmp(argv[i], "--errorlist") == 0) + { + // call all "getErrorMessages" in all registered Check classes + for (std::list::iterator it = Check::instances().begin(); it != Check::instances().end(); ++it) + { + (*it)->getErrorMessages(); + } + } + else if (strncmp(argv[i], "-", 1) == 0 || strncmp(argv[i], "--", 2) == 0) { return "cppcheck: error: unrecognized command line option \"" + std::string(argv[i]) + "\"\n"; From 90b786b09c8df55cf49b95838f343c9c9c3fe409 Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Fri, 5 Jun 2009 23:45:31 +0300 Subject: [PATCH 12/41] Fix ticket #353 (No pair for character (').) http://apps.sourceforge.net/trac/cppcheck/ticket/353 --- src/preprocessor.cpp | 6 ++++++ test/testpreprocessor.cpp | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/src/preprocessor.cpp b/src/preprocessor.cpp index d70bcabb6..c6de1ef6d 100644 --- a/src/preprocessor.cpp +++ b/src/preprocessor.cpp @@ -1150,6 +1150,12 @@ std::string Preprocessor::expandMacros(std::string code, const std::string &file ++pos2; while (pos2 < code.length() && code[pos2] != ch) { + if (code[pos2] == '\\') + { + par += code[pos2]; + ++pos2; + } + par += code[pos2]; ++pos2; } diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 7d2776c32..aa55ee7f5 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -103,6 +103,7 @@ private: TEST_CASE(macro_simple6); TEST_CASE(macro_simple7); TEST_CASE(macro_simple8); + TEST_CASE(macro_simple9); TEST_CASE(macro_mismatch); TEST_CASE(macro_linenumbers); TEST_CASE(string1); @@ -665,6 +666,14 @@ private: ASSERT_EQUALS("\n\n123 1234", OurPreprocessor::expandMacros(filedata)); } + void macro_simple9() + { + const char filedata[] = "#define ABC(a) f(a)\n" + "ABC( \"\\\"\" );\n" + "ABC( \"g\" );"; + ASSERT_EQUALS("\nf(\"\\\"\");\nf(\"g\");", OurPreprocessor::expandMacros(filedata)); + } + void macro_mismatch() { const char filedata[] = "#define AAA(aa,bb) f(aa)\n" From 51349d126b70f49389d9b8f67d2156a8d87f12c6 Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Fri, 5 Jun 2009 23:52:05 +0300 Subject: [PATCH 13/41] UTF-8 fixes to GUI files aboutdialog.* added to codeblocks projectfile --- cppcheck.cbp | 2 ++ gui/aboutdialog.cpp | 4 ++-- gui/aboutdialog.h | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cppcheck.cbp b/cppcheck.cbp index 61fadfc9f..1152d2f1e 100644 --- a/cppcheck.cbp +++ b/cppcheck.cbp @@ -30,6 +30,8 @@ + + diff --git a/gui/aboutdialog.cpp b/gui/aboutdialog.cpp index 981153d1b..842ca623e 100644 --- a/gui/aboutdialog.cpp +++ b/gui/aboutdialog.cpp @@ -1,6 +1,6 @@ /* * Cppcheck - A tool for static C/C++ code analysis - * Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team. + * Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ AboutDialog::AboutDialog(const QString &version, QWidget *parent) iconLabel->setPixmap(icon->pixmap(QSize(48, 48))); QLabel *name = new QLabel(tr("Cppcheck - A tool for static C/C++ code analysis.")); QLabel *ver = new QLabel(QString(tr("Version %1")).arg(mVersion)); - QLabel *copy = new QLabel(("Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.")); + QLabel *copy = new QLabel(("Copyright (C) 2007-2009 Daniel Marjamäki and cppcheck team.")); copy->setWordWrap(true); QLabel *gpl = new QLabel(tr("This program is licensed under the terms " \ "of the GNU General Public License version 3")); diff --git a/gui/aboutdialog.h b/gui/aboutdialog.h index 4c714ffe7..78a47ace4 100644 --- a/gui/aboutdialog.h +++ b/gui/aboutdialog.h @@ -1,6 +1,6 @@ /* * Cppcheck - A tool for static C/C++ code analysis - * Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team. + * Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From 9cd5558f5e467ea41944a3d3e3d2878886a9a1e6 Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Sat, 6 Jun 2009 00:33:13 +0300 Subject: [PATCH 14/41] Fix ticket #364 (false positive:: division by zero) http://apps.sourceforge.net/trac/cppcheck/ticket/364 --- src/tokenize.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ src/tokenize.h | 5 +++++ test/testother.cpp | 8 ++++++-- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/src/tokenize.cpp b/src/tokenize.cpp index 682d5ec9e..d905a7c2b 100644 --- a/src/tokenize.cpp +++ b/src/tokenize.cpp @@ -1465,6 +1465,7 @@ void Tokenizer::simplifyTokenList() modified |= removeReduntantConditions(); modified |= simplifyRedundantParanthesis(); modified |= simplifyCalculations(); + modified |= simplifyQuestionMark(); } createLinks(); @@ -1840,6 +1841,51 @@ bool Tokenizer::simplifyConditions() return ret; } +bool Tokenizer::simplifyQuestionMark() +{ + bool ret = false; + for (Token *tok = _tokens; tok; tok = tok->next()) + { + if (tok->str() != "?") + continue; + + if (!tok->previous() || !tok->previous()->previous()) + continue; + + if (!Token::Match(tok->previous()->previous(), "[=,(]")) + continue; + + if (!Token::Match(tok->previous(), "%bool%") && + !Token::Match(tok->previous(), "%num%")) + continue; + + if (tok->previous()->str() == "false" || + tok->previous()->str() == "0") + { + // Use code after semicolon, remove code before it. + const Token *end = Token::findmatch(tok, ":"); + if (!end || !end->next()) + continue; + + end = end->next(); + tok = tok->previous(); + while (tok->next() != end) + { + tok->deleteNext(); + } + + Token *temp = tok; + tok = tok->next(); + temp->deleteThis(); + } + else + { + // Use code before semicolon + } + } + + return ret; +} bool Tokenizer::simplifyCasts() { diff --git a/src/tokenize.h b/src/tokenize.h index a4fac3a38..e51d84961 100644 --- a/src/tokenize.h +++ b/src/tokenize.h @@ -100,6 +100,11 @@ public: */ bool simplifyVarDecl(); + /** + * Simplify question mark - colon operator + * Example: 0 ? (2/0) : 0 => 0 + */ + bool simplifyQuestionMark(); /** * simplify if-assignments.. diff --git a/test/testother.cpp b/test/testother.cpp index 6eaf2093a..b09ee78ff 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -111,10 +111,14 @@ private: " cout< Date: Sat, 6 Jun 2009 10:51:50 +0300 Subject: [PATCH 15/41] GUI: Fix handling UTF-8 strings in sources. Our source files are UTF-8 and as such contain some chars outside 7-bit ASCII. To handle UTF-8 correctly we must set text codec for QT to UTF-8. --- gui/main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gui/main.cpp b/gui/main.cpp index 4b6d524b6..c77f2652d 100644 --- a/gui/main.cpp +++ b/gui/main.cpp @@ -18,6 +18,7 @@ #include +#include #include "mainwindow.h" int main(int argc, char *argv[]) @@ -25,6 +26,10 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); app.setWindowIcon(QIcon(":icon.png")); + // Set codecs so that UTF-8 strings in sources are handled correctly. + QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); + QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8")); + MainWindow window; window.show(); return app.exec(); From 3b080e5b0bcb56103a43a67ad89ec35f7b97e7a4 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sat, 6 Jun 2009 11:38:48 +0300 Subject: [PATCH 16/41] GUI: Convert native path to internal presentation. If application path is edited by hand there can be native Windows path separators. Unify path separators to internal presentation before storing the path. --- gui/applicationdialog.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gui/applicationdialog.cpp b/gui/applicationdialog.cpp index ced506fdc..a0c8b81d1 100644 --- a/gui/applicationdialog.cpp +++ b/gui/applicationdialog.cpp @@ -116,7 +116,9 @@ void ApplicationDialog::Ok() } else { - accept(); + // Convert possible native (Windows) path to internal presentation format + mPath->setText(QDir::fromNativeSeparators(mPath->text())); + accept(); } } From dd473b074a92f92e16d73caae63a064bb61133b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 6 Jun 2009 10:40:48 +0200 Subject: [PATCH 17/41] Fix #153 (Unsigned divide) The "unsigned i" variable declaration wasn't handled well. So I added an "int" token. --- src/tokenize.cpp | 27 +++++++++++++++++++++++++++ src/tokenize.h | 6 ++++++ test/testtokenize.cpp | 25 +++++++++++++++++++++++++ 3 files changed, 58 insertions(+) diff --git a/src/tokenize.cpp b/src/tokenize.cpp index d905a7c2b..2dfda58d5 100644 --- a/src/tokenize.cpp +++ b/src/tokenize.cpp @@ -473,6 +473,9 @@ bool Tokenizer::tokenize(std::istream &code, const char FileName[]) } } + // replace "unsigned i" with "unsigned int i" + unsignedint(); + simplifyVarDecl(); // Handle templates.. @@ -2214,6 +2217,30 @@ bool Tokenizer::simplifyVarDecl() } +void Tokenizer::unsignedint() +{ + for (Token *tok = _tokens; tok; tok = tok->next()) + { + // A variable declaration where the "int" is left out? + if (!Token::Match(tok, "unsigned %var% [;,=]")) + continue; + + // Previous token should either be a symbol or one of "{};" + if (tok->previous() && + !tok->previous()->isName() && + !Token::Match(tok->previous(), "[{};]")) + continue; + + // next token should not be a standard type? + if (tok->next()->isStandardType()) + continue; + + // The "int" is missing.. add it + tok->insertToken("int"); + } +} + + bool Tokenizer::simplifyIfAssign() { bool ret = false; diff --git a/src/tokenize.h b/src/tokenize.h index e51d84961..9ebe2ea7f 100644 --- a/src/tokenize.h +++ b/src/tokenize.h @@ -100,6 +100,12 @@ public: */ bool simplifyVarDecl(); + /** + * insert an "int" after "unsigned" if needed: + * "unsigned i" => "unsigned int i" + */ + void unsignedint(); + /** * Simplify question mark - colon operator * Example: 0 ? (2/0) : 0 => 0 diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 71dbb79ca..7171470b8 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -145,6 +145,9 @@ private: TEST_CASE(syntax_error); TEST_CASE(removeKeywords); + + // unsigned i; => unsigned int i; + TEST_CASE(unsigned1); } @@ -2028,6 +2031,28 @@ private: ASSERT_EQUALS("if ( ! ! x ) { ; }", actual); } + + /** + * tokenize "unsigned i" => "unsigned int i" + * tokenize "unsigned int" => "unsigned int" + */ + void unsigned1() + { + // No changes.. + { + const char code[] = "void foo ( unsigned int , unsigned float ) ;"; + ASSERT_EQUALS(code, tokenizeAndStringify(code)); + } + + // insert "int" after "unsigned".. + { + const char code1[] = "unsigned i ;"; + const char code2[] = "unsigned int i ;"; + ASSERT_EQUALS(code2, tokenizeAndStringify(code1)); + } + + } + }; REGISTER_TEST(TestTokenizer) From 3e0f1a5e56dfb5140b0e5c6401ff2bb2d7e0d46f Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sat, 6 Jun 2009 12:49:59 +0300 Subject: [PATCH 18/41] GUI: Astyle fix. --- gui/applicationdialog.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/applicationdialog.cpp b/gui/applicationdialog.cpp index a0c8b81d1..7c8425611 100644 --- a/gui/applicationdialog.cpp +++ b/gui/applicationdialog.cpp @@ -116,9 +116,9 @@ void ApplicationDialog::Ok() } else { - // Convert possible native (Windows) path to internal presentation format - mPath->setText(QDir::fromNativeSeparators(mPath->text())); - accept(); + // Convert possible native (Windows) path to internal presentation format + mPath->setText(QDir::fromNativeSeparators(mPath->text())); + accept(); } } From 13eb74173cdeb25d9f5fdacf2de0d99a25294e26 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sat, 6 Jun 2009 12:51:14 +0300 Subject: [PATCH 19/41] GUI: Make mainwindow parent of Settings-dialog. --- gui/mainwindow.cpp | 2 +- gui/settingsdialog.cpp | 6 +++++- gui/settingsdialog.h | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index b6282a69b..5a25b1568 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -291,7 +291,7 @@ void MainWindow::CheckDone() void MainWindow::ProgramSettings() { - SettingsDialog dialog(mSettings, mApplications); + SettingsDialog dialog(mSettings, mApplications, this); if (dialog.exec() == QDialog::Accepted) { dialog.SaveCheckboxValues(); diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index bfc25102b..d707e0b17 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -18,12 +18,16 @@ #include "settingsdialog.h" +#include +#include #include #include #include #include "applicationdialog.h" -SettingsDialog::SettingsDialog(QSettings &programSettings, ApplicationList &list) : +SettingsDialog::SettingsDialog(QSettings &programSettings, ApplicationList &list, + QWidget *parent) : + QDialog(parent), mSettings(programSettings), mApplications(list) { diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h index 57eea9d52..0fb0e3443 100644 --- a/gui/settingsdialog.h +++ b/gui/settingsdialog.h @@ -41,7 +41,7 @@ class SettingsDialog : public QDialog { Q_OBJECT public: - SettingsDialog(QSettings &programSettings, ApplicationList &list); + SettingsDialog(QSettings &programSettings, ApplicationList &list, QWidget *parent = 0); virtual ~SettingsDialog(); /** From db17236000131b0145a8a1d41bf07c7adbf8113b Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sat, 6 Jun 2009 12:57:16 +0300 Subject: [PATCH 20/41] GUI: Make Settings-dialog a parent of Add Application-dialog. --- gui/applicationdialog.cpp | 4 +++- gui/applicationdialog.h | 4 +++- gui/settingsdialog.cpp | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gui/applicationdialog.cpp b/gui/applicationdialog.cpp index 7c8425611..1a3ea16e6 100644 --- a/gui/applicationdialog.cpp +++ b/gui/applicationdialog.cpp @@ -28,7 +28,9 @@ ApplicationDialog::ApplicationDialog(const QString &name, const QString &path, - const QString &title) + const QString &title, + QWidget *parent) : + QDialog(parent) { QVBoxLayout *layout = new QVBoxLayout(); mName = new QLineEdit(name); diff --git a/gui/applicationdialog.h b/gui/applicationdialog.h index bb4ef4d38..878e4b40a 100644 --- a/gui/applicationdialog.h +++ b/gui/applicationdialog.h @@ -38,10 +38,12 @@ public: * @param name Default name for the application to start * @param path Path for the application * @param title Title for the dialog + * @param parent Parent widget */ ApplicationDialog(const QString &name, const QString &path, - const QString &title); + const QString &title, + QWidget *parent = 0); virtual ~ApplicationDialog(); /** diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index d707e0b17..c7abd7b1d 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -214,7 +214,7 @@ void SettingsDialog::SaveCheckboxValue(QCheckBox *box, const QString &name) void SettingsDialog::AddApplication() { - ApplicationDialog dialog("", "", tr("Add a new application")); + ApplicationDialog dialog("", "", tr("Add a new application"), this); if (dialog.exec() == QDialog::Accepted) { From 3142a73fd99462a3c88d99fe31fdb6757fa65e80 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sat, 6 Jun 2009 13:07:20 +0300 Subject: [PATCH 21/41] GUI: Limit application name's max length. Limit the application name in Applications-dialog to 100 chars. Nobody should need longer names especially when the application name is shown as a menuitem. --- gui/applicationdialog.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/gui/applicationdialog.cpp b/gui/applicationdialog.cpp index 1a3ea16e6..865a31d3e 100644 --- a/gui/applicationdialog.cpp +++ b/gui/applicationdialog.cpp @@ -34,6 +34,7 @@ ApplicationDialog::ApplicationDialog(const QString &name, { QVBoxLayout *layout = new QVBoxLayout(); mName = new QLineEdit(name); + mName->setMaxLength(100); // Should be plenty for app name mPath = new QLineEdit(path); QString guide = tr("Here you can add applications that can open error files.\n" \ From acaa22ff6c37c27265ccd10f89a32e85f882e666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 6 Jun 2009 14:48:48 +0200 Subject: [PATCH 22/41] Refactoring: Simple code cleanup --- test/testfunctionusage.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/testfunctionusage.cpp b/test/testfunctionusage.cpp index 1a9bc561a..e439a22f7 100644 --- a/test/testfunctionusage.cpp +++ b/test/testfunctionusage.cpp @@ -66,7 +66,6 @@ private: " if (f1())\n" " { }\n" "}\n"); - std::string err(errout.str()); ASSERT_EQUALS("", errout.str()); } @@ -76,7 +75,6 @@ private: "{\n" " return f1();\n" "}\n"); - std::string err(errout.str()); ASSERT_EQUALS("", errout.str()); } @@ -95,7 +93,6 @@ private: "{\n" " void (*f)() = cond ? f1 : NULL;\n" "}\n"); - std::string err(errout.str()); ASSERT_EQUALS("", errout.str()); } @@ -106,7 +103,6 @@ private: " if (cond) ;\n" " else f1();\n" "}\n"); - std::string err(errout.str()); ASSERT_EQUALS("", errout.str()); } From a8c5526c849cf68b8480fbe1a27261e8e0202011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 6 Jun 2009 20:55:16 +0200 Subject: [PATCH 23/41] Fix #368 (Leak detected when allocated memory assigned to member of structure which returned from function) The return value of strcpy wasn't handled very well --- src/checkmemoryleak.cpp | 15 ++++++++------- test/testmemleak.cpp | 11 +++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index ce62c8c59..40e70ce51 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -595,25 +595,25 @@ Token *CheckMemoryLeakClass::getcode(const Token *tok, std::list addtoken(tok->str().c_str()); } - if ((tok->str() == "case")) + else if ((tok->str() == "case")) { addtoken("case"); addtoken(";"); } - if ((tok->str() == "default")) + else if ((tok->str() == "default")) { addtoken("default"); addtoken(";"); } // Loops.. - if ((tok->str() == "for") || (tok->str() == "while")) + else if ((tok->str() == "for") || (tok->str() == "while")) { addtoken("loop"); isloop = true; } - if ((tok->str() == "do")) + else if ((tok->str() == "do")) { addtoken("do"); } @@ -633,7 +633,7 @@ Token *CheckMemoryLeakClass::getcode(const Token *tok, std::list } // Return.. - if (tok->str() == "return") + else if (tok->str() == "return") { addtoken("return"); @@ -684,7 +684,7 @@ Token *CheckMemoryLeakClass::getcode(const Token *tok, std::list } // throw.. - if (Token::Match(tok, "try|throw|catch")) + else if (Token::Match(tok, "try|throw|catch")) addtoken(tok->strAt(0)); // exit.. @@ -694,7 +694,8 @@ Token *CheckMemoryLeakClass::getcode(const Token *tok, std::list // Assignment.. if (Token::Match(tok, std::string("[)=] " + varnameStr + " [+;)]").c_str()) || Token::Match(tok, std::string(varnameStr + " +=|-=").c_str()) || - Token::Match(tok, std::string("+=|<< " + varnameStr + " ;").c_str())) + Token::Match(tok, std::string("+=|<< " + varnameStr + " ;").c_str()) || + Token::Match(tok, std::string("= strcpy|strcat|memmove|memcpy ( " + varnameStr + " ,").c_str())) { addtoken("use"); } diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 1f6f71fc5..cb14b8ad3 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -190,6 +190,7 @@ private: // free a free'd pointer TEST_CASE(freefree1); TEST_CASE(freefree2); + TEST_CASE(strcpy_result_assignment); TEST_CASE(strcat_result_assignment); TEST_CASE(all1); // Extra checking when --all is given @@ -1974,6 +1975,16 @@ private: ASSERT_EQUALS("", errout.str()); } + void strcpy_result_assignment() + { + check("void foo()\n" + "{\n" + " char *p1 = malloc(10);\n" + " char *p2 = strcpy(p1, \"a\");\n" + "}"); + ASSERT_EQUALS("", errout.str()); + } + void strcat_result_assignment() { check("void foo()\n" From 5747133fa87675690c70570168536fcc8f144d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 6 Jun 2009 21:25:41 +0200 Subject: [PATCH 24/41] Fix #370 (Assign auto variable to parameter false positive) --- src/checkautovariables.cpp | 8 ++++---- test/testautovariables.cpp | 7 +++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/checkautovariables.cpp b/src/checkautovariables.cpp index 83eb2869d..059aac4e5 100644 --- a/src/checkautovariables.cpp +++ b/src/checkautovariables.cpp @@ -191,17 +191,17 @@ void CheckAutoVariables::autoVariables() continue; addVD(tok->tokAt(2)); } - else if (bindent > 0 && Token::Match(tok, "%var% = & %var%")) //Critical assignement + else if (bindent > 0 && Token::Match(tok, "[;{}] %var% = & %var%")) //Critical assignement { - if (errorAv(tok->tokAt(0), tok->tokAt(3))) + if (errorAv(tok->tokAt(1), tok->tokAt(4))) reportError(tok, "error", "autoVariables", "Wrong assignement of an auto-variable to an effective parameter of a function"); } - else if (bindent > 0 && Token::Match(tok, "%var% [ %any% ] = & %var%")) //Critical assignement + else if (bindent > 0 && Token::Match(tok, "[;{}] %var% [ %any% ] = & %var%")) //Critical assignement { - if (errorAv(tok->tokAt(0), tok->tokAt(6))) + if (errorAv(tok->tokAt(1), tok->tokAt(7))) reportError(tok, "error", "autoVariables", diff --git a/test/testautovariables.cpp b/test/testautovariables.cpp index b0eb55b23..d00c5040a 100644 --- a/test/testautovariables.cpp +++ b/test/testautovariables.cpp @@ -75,6 +75,13 @@ private: " int num=2;" "res=#}"); ASSERT_EQUALS("[test.cpp:3]: (error) Wrong assignement of an auto-variable to an effective parameter of a function\n", errout.str()); + + check("void func1(int **res)\n" + "{\n" + " int num = 2;\n" + " foo.res = #\n" + "}"); + ASSERT_EQUALS("", errout.str()); } void testautovararray() { From 9bac4aca755c53af8933749dac9a5412fcb48b04 Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Sun, 7 Jun 2009 09:55:20 +0300 Subject: [PATCH 25/41] Fix ticket #371 (Resource leak when exit() and if() uses together) http://apps.sourceforge.net/trac/cppcheck/ticket/371 --- src/checkmemoryleak.cpp | 21 +++++++++++++++++---- test/testmemleak.cpp | 8 ++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index 40e70ce51..3822e0020 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -809,13 +809,26 @@ void CheckMemoryLeakClass::simplifycode(Token *tok, bool &all) continue; // Found an "exit".. try to remove everything before it - const Token *tokEnd = tok2->next(); - while (tok2->previous() && !Token::Match(tok2->previous(), "[{}]")) - tok2 = tok2->previous(); - if (tok2->previous()) + Token *tokEnd = tok2->next(); + int indentlevel = 0; + while (tok2->previous()) + { tok2 = tok2->previous(); + if (tok2->str() == "}") + { + indentlevel--; + } + else if (tok2->str() == "{") + { + if (indentlevel == 0) + break; + + indentlevel++; + } + } Token::eraseTokens(tok2, tokEnd); + tok2 = tokEnd; } // reduce the code.. diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index cb14b8ad3..2b3ac0f3f 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -2234,6 +2234,14 @@ private: " exit(0);\n" "}\n"); ASSERT_EQUALS("", errout.str()); + + check("void f()\n" + "{\n" + " char *out = new char[100];\n" + " if( out ) {}\n" + " exit(0);\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); } void stdstring() From 548f45899f81f2563af6489b3b96df4803ffd74d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 7 Jun 2009 12:57:39 +0200 Subject: [PATCH 26/41] Updated version to 1.33 --- createrelease | 2 +- src/cppcheck.cpp | 2 +- win_installer/cppcheck.iss | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/createrelease b/createrelease index ac1115d16..2a4025559 100755 --- a/createrelease +++ b/createrelease @@ -4,7 +4,7 @@ # Archive files are created in user's home directory. # Tag to use -tag=1.32 +tag=1.33 # Name of release releasename=cppcheck-$tag diff --git a/src/cppcheck.cpp b/src/cppcheck.cpp index ab223d72f..88f0c8a94 100644 --- a/src/cppcheck.cpp +++ b/src/cppcheck.cpp @@ -74,7 +74,7 @@ std::string CppCheck::parseFromArgs(int argc, const char* const argv[]) for (int i = 1; i < argc; i++) { if (strcmp(argv[i], "--version") == 0) - return "Cppcheck 1.32\n"; + return "Cppcheck 1.33\n"; // Flag used for various purposes during debugging if (strcmp(argv[i], "--debug") == 0) diff --git a/win_installer/cppcheck.iss b/win_installer/cppcheck.iss index cc9b66573..f738893ea 100644 --- a/win_installer/cppcheck.iss +++ b/win_installer/cppcheck.iss @@ -19,7 +19,7 @@ #define MyAppName "cppcheck" -#define AppVersion "1.32" +#define AppVersion "1.33" #define MyAppURL "http://cppcheck.wiki.sourceforge.net/" #define MyAppExeName "cppcheck.exe" #define QTGuiExe "gui.exe" From 97c407cfb6f8717ad9062dce6e53d6d45a10a1ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 7 Jun 2009 13:14:28 +0200 Subject: [PATCH 27/41] Added a Changelog file that is generated automaticly by git2cl --- Changelog | 9257 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 9257 insertions(+) create mode 100644 Changelog diff --git a/Changelog b/Changelog new file mode 100644 index 000000000..0401baaf5 --- /dev/null +++ b/Changelog @@ -0,0 +1,9257 @@ +2009-06-07 Daniel Marjamäki + + * createrelease, src/cppcheck.cpp, win_installer/cppcheck.iss: + Updated version to 1.33 + +2009-06-07 Reijo Tomperi + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Fix ticket #371 + (Resource leak when exit() and if() uses together) + http://apps.sourceforge.net/trac/cppcheck/ticket/371 + +2009-06-06 Daniel Marjamäki + + * src/checkautovariables.cpp, test/testautovariables.cpp: Fix #370 + (Assign auto variable to parameter false positive) + +2009-06-06 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Fix #368 (Leak + detected when allocated memory assigned to member of structure which + returned from function) The return value of strcpy wasn't handled very well + +2009-06-06 Daniel Marjamäki + + * test/testfunctionusage.cpp: Refactoring: Simple code cleanup + +2009-06-06 Kimmo Varis + + * : commit 3142a73fd99462a3c88d99fe31fdb6757fa65e80 Author: Kimmo + Varis Date: Sat Jun 6 13:07:20 2009 +0300 + +2009-06-06 Kimmo Varis + + * gui/applicationdialog.cpp, gui/applicationdialog.h, + gui/settingsdialog.cpp: GUI: Make Settings-dialog a parent of Add + Application-dialog. + +2009-06-06 Kimmo Varis + + * gui/mainwindow.cpp, gui/settingsdialog.cpp, gui/settingsdialog.h: + GUI: Make mainwindow parent of Settings-dialog. + +2009-06-06 Kimmo Varis + + * gui/applicationdialog.cpp: GUI: Astyle fix. + +2009-06-06 Daniel Marjamäki + + * src/tokenize.cpp, src/tokenize.h, test/testtokenize.cpp: Fix #153 + (Unsigned divide) The "unsigned i" variable declaration wasn't handled well. So I + added an "int" token. + +2009-06-06 Kimmo Varis + + * gui/applicationdialog.cpp: GUI: Convert native path to internal + presentation. If application path is edited by hand there can be + native Windows path separators. Unify path separators to internal + presentation before storing the path. + +2009-06-06 Kimmo Varis + + * gui/main.cpp: GUI: Fix handling UTF-8 strings in sources. Our + source files are UTF-8 and as such contain some chars outside 7-bit + ASCII. To handle UTF-8 correctly we must set text codec for QT to + UTF-8. + +2009-06-06 Reijo Tomperi + + * src/tokenize.cpp, src/tokenize.h, test/testother.cpp: Fix ticket + #364 (false positive:: division by zero) + http://apps.sourceforge.net/trac/cppcheck/ticket/364 + +2009-06-05 Reijo Tomperi + + * cppcheck.cbp, gui/aboutdialog.cpp, gui/aboutdialog.h: UTF-8 fixes + to GUI files aboutdialog.* added to codeblocks projectfile + +2009-06-05 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fix ticket #353 + (No pair for character (').) + http://apps.sourceforge.net/trac/cppcheck/ticket/353 + +2009-06-05 Daniel Marjamäki + + * src/check.h, src/cppcheck.cpp: Created an undocumented command + line flag "--errorlist" that prints all messages + +2009-06-05 Daniel Marjamäki + + * src/checkfunctionusage.cpp, test/testfunctionusage.cpp: Fix #359 + (Incorrect unused function) + +2009-06-05 Kimmo Varis + + * gui/aboutdialog.cpp: GUI: Fix warning from About-dialog layout. + +2009-06-05 Kimmo Varis + + * : commit aaba5735ed6dd93b5fa74a79be65975106c96e45 Author: Kimmo + Varis Date: Fri Jun 5 10:37:50 2009 +0300 + +2009-06-05 Kimmo Varis + + * win_installer/readme.txt: Update Windows installer readme for + including QT GUI and other installer improvements. + +2009-06-05 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Fixed #354 (false + positive: memory leak) + +2009-06-05 Slava Semushin + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Fixed ticket #360 + (Teach about new(std::nothrow) form) http://apps.sourceforge.net/trac/cppcheck/ticket/360 + +2009-06-05 Slava Semushin + + * src/tokenize.cpp, test/testbufferoverrun.cpp: Fixed ticket #329 + (snprintf size is out of bounds when two variables in one scope with + similar names) FIXME: Because it's fix for simplifyTokenList() test should be moved + to test/testsimplifytokens.cpp file. http://apps.sourceforge.net/trac/cppcheck/ticket/329 + +2009-06-05 Slava Semushin + + * test/testbufferoverrun.cpp, test/testcharvar.cpp, + test/testclass.cpp, test/testconstructors.cpp, + test/testdivision.cpp, test/testfunctionusage.cpp, + test/testincompletestatement.cpp, test/testmemleak.cpp, + test/testother.cpp, test/teststl.cpp, test/testtokenize.cpp, + test/testunusedprivfunc.cpp, test/testunusedvar.cpp: Strip redundant + std::string usage from tests. Second round: handle empty strings. Done by command: git grep -l ASSERT_EQUALS | xargs sed -i + 's|ASSERT_EQUALS(std::string(\(".*"\)),|ASSERT_EQUALS(\1,|' Should be no functional change. + +2009-06-05 Slava Semushin + + * src/checkclass.cpp, test/testclass.cpp: Fixed ticket #358 (Local + typedef flagged as uninitialized member) http://apps.sourceforge.net/trac/cppcheck/ticket/358 + +2009-06-04 Kimmo Varis + + * gui/resultstree.cpp: GUI: Enable sorting in results view. + +2009-06-04 Kimmo Varis + + * gui/settingsdialog.cpp: GUI: Improve Settings-dialog layout. + +2009-06-04 Kimmo Varis + + * gui/mainwindow.cpp, gui/mainwindow.h, gui/threadhandler.cpp, + gui/threadhandler.h: GUI: Prevent exiting the application while + checking. + +2009-06-04 Kimmo Varis + + * gui/aboutdialog.cpp: GUI: Add program icon to the About-dialog. + +2009-06-04 Kimmo Varis + + * gui/aboutdialog.cpp, gui/aboutdialog.h, gui/gui.pro, + gui/mainwindow.cpp: GUI: Add About-dialog. Replace messagebox + containing about-text with dialog. About-dialog must contain + copyright information. + +2009-06-04 Kimmo Varis + + * gui/mainwindow.cpp: Remove some empty lines. + +2009-06-04 Kimmo Varis + + * : commit a74faf334e2737c90f7f90e82b1be8d53a9ef7ee Author: Kimmo + Varis Date: Thu Jun 4 12:38:08 2009 +0300 + +2009-06-03 Reijo Tomperi + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Fix ticket #352 + (Memory leaks: Missed memory leak when "--all" is not given) + http://apps.sourceforge.net/trac/cppcheck/ticket/352 Detect memory + leaks without --all when there is "alloc ; assign callfunc ; + +2009-06-03 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fix ticket #351 (false + positive::resource leak) + http://apps.sourceforge.net/trac/cppcheck/ticket/351 + +2009-06-03 Vesa Pikki + + * gui/resultstree.h: Added a missing include. + +2009-06-03 Vesa Pikki + + * gui/mainwindow.cpp, gui/mainwindow.h, gui/resultstree.cpp, + gui/resultstree.h, gui/resultsview.cpp, gui/resultsview.h, + gui/settingsdialog.cpp, gui/settingsdialog.h, + gui/threadhandler.cpp, gui/threadresult.cpp, gui/threadresult.h: + Added the initial version of saving results to a file. + +2009-06-02 Reijo Tomperi + + * gui/applicationdialog.h, gui/applicationlist.h, gui/common.h, + gui/settingsdialog.h, src/mathlib.cpp, src/mathlib.h: Changed EOL + character to LF in a few files. + +2009-06-02 Reijo Tomperi + + * gui/checkthread.cpp: astyle fix + +2009-06-02 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, test/testbufferoverrun.cpp: Fixed #350 + (False positive: Array index out of bounds) + +2009-06-02 Kimmo Varis + + * doxyfile: Add GUI code to doxygen output. + +2009-06-02 Kimmo Varis + + * gui/checkthread.cpp, gui/checkthread.h, gui/mainwindow.cpp, + gui/threadhandler.cpp: GUI: Implement stopping the compare. Threads + must be exited from check cleanly even though it takes small amount + of time. Just terminating thread can have unpredictable side-effects + (even weird crashes). + +2009-06-02 Kimmo Varis + + * gui/threadresult.h: Fix mixed EOL style. + +2009-06-02 Kimmo Varis + + * gui/mainwindow.cpp, gui/mainwindow.h, gui/resultsview.cpp, + gui/resultsview.h: GUI: Add Collapse/Expand all -items to View-menu. + +2009-06-02 Kimmo Varis + + * gui/mainwindow.h: Fix mixed EOL style. + +2009-06-02 Kimmo Varis + + * gui/resultstree.h: Fix mixed EOL style. + +2009-06-02 Kimmo Varis + + * gui/resultsview.h: Fix mixed EOL style. + +2009-06-02 Kimmo Varis + + * gui/resultstree.cpp: GUI: Include result tree icons to resource + (and executable). + +2009-06-01 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, test/testbufferoverrun.cpp: Fixed #339 + (Buffer overrun not detected with pointer arrays) + http://apps.sourceforge.net/trac/cppcheck/ticket/339 + +2009-06-01 Slava Semushin + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Fixed ticket #349 + (Add detection for resource leaks after tmpfile() usage) https://apps.sourceforge.net/trac/cppcheck/ticket/349 + +2009-06-01 Slava Semushin + + * src/tokenize.cpp, test/testsimplifytokens.cpp: Fixed ticket #348 + (Simplify sizeof for pointers) https://apps.sourceforge.net/trac/cppcheck/ticket/348 + +2009-06-01 Slava Semushin + + * src/tokenize.cpp: Tokenizer::simplifyTokenList: use SizeOfType(). No functional change. + +2009-06-01 Slava Semushin + + * src/tokenize.cpp: Tokenizer::simplifyTokenList: reduce indent. No functional change. + +2009-06-01 Slava Semushin + + * src/tokenize.cpp: Tokenizer::simplifyTokenList: some improvements. Corrections for 2de4c516e9e5e3dd9590379b0e980c9fc484db89 commit: - declare variable near their usage - set right position of next token + +2009-06-01 Slava Semushin + + * test/testautovariables.cpp, test/testbufferoverrun.cpp, + test/testcharvar.cpp, test/testclass.cpp, + test/testconstructors.cpp, test/testdangerousfunctions.cpp, + test/testdivision.cpp, test/testfilelister.cpp, + test/testincompletestatement.cpp, test/testmathlib.cpp, + test/testmemleak.cpp, test/testother.cpp, test/testredundantif.cpp, + test/testsimplifytokens.cpp, test/teststl.cpp, + test/testtokenize.cpp, test/testunusedprivfunc.cpp: Strip redundant + std::string usage from tests. Done by command: git grep -l ASSERT_EQUALS | xargs sed -i + 's|ASSERT_EQUALS(std::string(\(".\+"\)),|ASSERT_EQUALS(\1,|' Should be no functional change. + +2009-05-31 Reijo Tomperi + + * src/tokenize.cpp, test/testsimplifytokens.cpp: Fixed ticket #338 + (Simplify sizeof for pointer arrays) by patch submitted by + php-coderrr http://apps.sourceforge.net/trac/cppcheck/ticket/338 + +2009-06-01 Slava Semushin + + * src/tokenize.cpp: src/tokenize.cpp(unwantedWords): propagate const + modifier. No functional change. + +2009-05-31 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: Variable Id: structs must + not have variable id + +2009-05-31 Slava Semushin + + * : commit fb0c217c3e4103219737a1e20e68e95b05ee82f3 Author: Slava + Semushin Date: Sun May 31 20:48:40 2009 + +0700 + +2009-05-31 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fix ticket #344 + (Tokenizer crash in Windows) + http://apps.sourceforge.net/trac/cppcheck/ticket/344 + +2009-05-31 Daniel Marjamäki + + * src/tokenize.cpp, src/tokenize.h, test/testsimplifytokens.cpp: + Fixed ticket #345 ('!' and 'not' tokens interpreted differently even + though they mean the same) + +2009-05-31 Daniel Marjamäki + + * src/errorlogger.cpp, src/errorlogger.h, test/testcppcheck.cpp: Fix + ticket #318 ('..' in include will cause conflicting slashes in + messages) + +2009-05-31 Daniel Marjamäki + + * src/checkfunctionusage.cpp, test/testfunctionusage.cpp: Fix for + #341 (Functions passed as pointer not detected as used) + +2009-05-31 Daniel Marjamäki + + * src/cppcheck.cpp: cppcheck: removed the 'this may take several + minutes' when checking unused functions. The check is much faster + nowadays + +2009-05-30 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Memory leaks: + calling function that deallocates the memory and allocates new + memory https://apps.sourceforge.net/trac/cppcheck/ticket/336 + +2009-05-30 Kimmo Varis + + * gui/gui.pro: GUI: Add manifest for Windows build. + +2009-05-30 Kimmo Varis + + * gui/gui.pro, src/filelister.cpp: GUI: Fix building with MinGW. + Add shlwapi library to qmake project file. Use WCHAR instead of + wchar_t. + +2009-05-30 Kimmo Varis + + * src/filelister.cpp: Make GUI work in Windows compiled with VS. + Since GUI is QT project it is also Unicode project. And other + cppcheck code is ANSI code. So we must convert data between Unicode + and ANSI when calling WinAPI functions. WinAPI functions want + Unicode strings but e.g. std::string contains ANSI strings. + +2009-05-30 Kimmo Varis + + * .gitignore: Add more generated GUI files to gitignore. + +2009-05-30 Daniel Marjamäki + + * : commit d33139b2c781d1c4eda1b8ab56212aef5fb1cf42 Author: Daniel + Marjamäki Date: Sat May 30 + 14:24:55 2009 +0200 + +2009-05-30 Kimmo Varis + + * src/filelister.cpp: Windows: Fix FileLister to send full paths + instead of only filenames. + +2009-05-30 Kimmo Varis + + * : commit b2d50ca512ca136732e69bb4e7d9641fd0d168e1 Author: Kimmo + Varis Date: Sat May 30 10:32:33 2009 +0300 + +2009-05-30 Reijo Tomperi + + * AUTHORS, cppcheck.cbp, gui/applicationdialog.cpp, + gui/applicationdialog.h, gui/applicationlist.cpp, + gui/applicationlist.h, gui/checkthread.cpp, gui/checkthread.h, + gui/common.h, gui/main.cpp, gui/mainwindow.cpp, gui/mainwindow.h, + gui/resultstree.cpp, gui/resultstree.h, gui/resultsview.cpp, + gui/resultsview.h, gui/settingsdialog.cpp, gui/settingsdialog.h, + gui/threadhandler.cpp, gui/threadhandler.h, gui/threadresult.cpp, + gui/threadresult.h, src/check.h, src/checkautovariables.cpp, + src/checkautovariables.h, src/checkbufferoverrun.cpp, + src/checkbufferoverrun.h, src/checkclass.cpp, src/checkclass.h, + src/checkdangerousfunctions.cpp, src/checkdangerousfunctions.h, + src/checkfunctionusage.cpp, src/checkfunctionusage.h, + src/checkheaders.cpp, src/checkheaders.h, src/checkmemoryleak.cpp, + src/checkmemoryleak.h, src/checkother.cpp, src/checkother.h, + src/checksecurity.cpp, src/checksecurity.h, src/checkstl.cpp, + src/checkstl.h, src/cppcheck.cpp, src/cppcheck.h, + src/cppcheckexecutor.cpp, src/cppcheckexecutor.h, + src/errorlogger.cpp, src/errorlogger.h, src/filelister.cpp, + src/filelister.h, src/main.cpp, src/mathlib.cpp, src/mathlib.h, + src/preprocessor.cpp, src/preprocessor.h, src/settings.cpp, + src/settings.h, src/threadexecutor.cpp, src/threadexecutor.h, + src/token.cpp, src/token.h, src/tokenize.cpp, src/tokenize.h, + test/testautovariables.cpp, test/testbufferoverrun.cpp, + test/testcharvar.cpp, test/testclass.cpp, + test/testconstructors.cpp, test/testcppcheck.cpp, + test/testdangerousfunctions.cpp, test/testdivision.cpp, + test/testfilelister.cpp, test/testfunctionusage.cpp, + test/testincompletestatement.cpp, test/testmathlib.cpp, + test/testmemleak.cpp, test/testmemleakmp.cpp, test/testother.cpp, + test/testpreprocessor.cpp, test/testredundantif.cpp, + test/testrunner.cpp, test/testsecurity.cpp, + test/testsimplifytokens.cpp, test/teststl.cpp, test/testsuite.cpp, + test/testsuite.h, test/testtoken.cpp, test/testtokenize.cpp, + test/testunusedprivfunc.cpp, test/testunusedvar.cpp, + tools/dmake.cpp, tools/errmsg.cpp: Fix ticket #325 (Replace + developer names in source files with AUTHORS file) + http://apps.sourceforge.net/trac/cppcheck/ticket/325 + +2009-05-30 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fix ticket #342 (Simplify + "if( (true) == true )") + http://apps.sourceforge.net/trac/cppcheck/ticket/342 + +2009-05-28 Reijo Tomperi + + * test/testtokenize.cpp: Changed expected result for test case + TestTokenizer::removeParantheses3 to simplify it more + +2009-05-28 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fix bug related to ticket + #330, cppcheck hanged with some files containing "((" + http://apps.sourceforge.net/trac/cppcheck/ticket/330 + +2009-05-28 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: Tokenizer: Simplifying + redundant parantheses http://apps.sourceforge.net/trac/cppcheck/ticket/330 + +2009-05-28 Kimmo Varis + + * gui/threadhandler.h: Fix EOL style (had Unix/DOS) mixed style. + +2009-05-28 Kimmo Varis + + * gui/applicationdialog.cpp: GUI: Fix typo in Add New Application + -dialog. + +2009-05-28 Kimmo Varis + + * gui/mainwindow.cpp: GUI: Add separator in View-menu before + check/uncheck all. + +2009-05-28 Kimmo Varis + + * .gitignore: Add GUI build folders to gitignore. + +2009-05-28 Kimmo Varis + + * gui/cppcheck-gui.rc, gui/gui.pro: GUI: Add application icon for + Windows. + +2009-05-28 Kimmo Varis + + * gui/mainwindow.cpp: GUI: Use PNG icon instead of SVG icon for + Check directory -action. + +2009-05-28 Kimmo Varis + + * gui/gui.pro, gui/gui.qrc, gui/main.cpp, gui/mainwindow.cpp, + gui/resultstree.cpp: Add icon files to resource file. Having + resource files compiled in the executable makes installing the + application easier (especially on Windows). + +2009-05-28 Kimmo Varis + + * src/filelister.cpp: Fix building GUI with Visual Studio. + +2009-05-27 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fix ticket #319 (Function + names are tagged as variables) + http://apps.sourceforge.net/trac/cppcheck/ticket/319 + +2009-05-27 Reijo Tomperi + + * test/testmemleak.cpp, test/testtokenize.cpp: Added test case + TestMemleak::dealloc_and_alloc_in_func + +2009-05-27 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: Fix ticket 330 (found + memory leak when __builtin_expect uses) + +2009-05-27 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: Fix ticket 308 (cppcheck + msg:: invalid number of ((). Cant process file) + +2009-05-27 Daniel Marjamäki + + * : commit 650d58e3de2a9487edc36e97fb55cf0ebefb9f77 Author: Daniel + Marjamäki Date: Wed May 27 + 19:38:26 2009 +0200 + +2009-05-27 Kimmo Varis + + * win_installer/cppcheck.iss, win_installer/readme.txt: Installer: + Add docoments to Start-menu. Add AUTHORS.txt, COPYING.txt and + readme.txt to the Start-menu. Files are opened by default .txt file + viewer which is usually Notepad. + +2009-05-27 Kimmo Varis + + * win_installer/cppcheck.iss: Installer: Add .txt extension to text + files. Windows does not know how to open files without extension in + name so add .txt extension when installing for AUTHORS and COPYING. + +2009-05-27 Kimmo Varis + + * win_installer/cppcheck.iss: Installer: Install AUTHORS-file. + AUTHORS is good to install as it tells who are working with + cppcheck. + +2009-05-27 Kimmo Varis + + * win_installer/cppcheck.iss: Installer: Add large installer bitmap. + Adding large installer image which is shown as "sidebar" of + installer's welcome window. The bitmap is combination of Inno Setup + standard image and cppcheck icon. + +2009-05-27 Kimmo Varis + + * win_installer/readme.txt: Installer: Fix output folder name in + installer readme. + +2009-05-27 Kimmo Varis + + * win_installer/cppcheck.iss: Installer: Add small image shown in + top of the installer. + +2009-05-26 Reijo Tomperi + + * src/token.cpp, test/testtokenize.cpp: Fix ticket #334 + (segmentation fault on boost 1.39.0) + http://apps.sourceforge.net/trac/cppcheck/ticket/334 + +2009-05-26 Vesa Pikki + + * gui/mainwindow.cpp, gui/resultstree.cpp: Astyle formatting. + +2009-05-26 Vesa Pikki + + * AUTHORS, gui/mainwindow.cpp, gui/mainwindow.h, + gui/resultstree.cpp, gui/resultstree.h: Added 22x22 icons from + http://tango.freedesktop.org. Also added icon source to AUTHORS + file. Also added toolbar with the default actions. Added icons to + result files and errors. + +2009-05-25 Daniel Marjamäki + + * gui/icon.svg, gui/main.cpp, logo.svg: renamed the logo files to + icon instead + +2009-05-25 Daniel Marjamäki + + * gui/main.cpp, logo.svg: logo: modified the logo so it looks better + when used as mainicon for the gui program + +2009-05-25 Vesa Pikki + + * gui/main.cpp: GUI now uses Cppcheck's logo. + +2009-05-25 Daniel Marjamäki + + * logo.svg: Added a temporary logotype for cppcheck + +2009-05-25 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp, + test/testtokenize.cpp: Fixed ticket #333 (tokenizer: incorrect + removal of decrement/increment) + +2009-05-25 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: Fix ticket #317 + (pre-increment causes style false positive) + +2009-05-25 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: Fix ticket #317 + (pre-increment causes style false positive) + +2009-05-24 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fix ticket #332 + (White space between macro name and '(' causes macro simplification + to fail) http://apps.sourceforge.net/trac/cppcheck/ticket/332 + +2009-05-24 Vesa Pikki + + * : commit d9c36eada2cdc5f6c2e9b8f92bd319789fc588eb Author: Vesa + Pikki Date: Sun May 24 12:09:37 2009 +0300 + +2009-05-24 Vesa Pikki + + * gui/applicationlist.cpp, gui/applicationlist.h, + gui/settingsdialog.cpp, gui/settingsdialog.h: User can now undo + changes to application list by clicking cancel. + +2009-05-24 Vesa Pikki + + * gui/applicationdialog.cpp, gui/applicationlist.cpp, + gui/mainwindow.cpp, gui/settingsdialog.cpp: Astyle formatting. + +2009-05-24 Vesa Pikki + + * gui/applicationdialog.cpp, gui/applicationdialog.h, + gui/applicationlist.cpp, gui/checkthread.cpp, gui/checkthread.h, + gui/mainwindow.cpp, gui/mainwindow.h, gui/resultstree.cpp, + gui/settingsdialog.cpp: Fixed issues pointed out by Reijo. The + number of threads is now atleast 1. Added a very simple about + dialog with version number and license. Replaced all CppCheck's + with Cppcheck. Renamed "show more errors" to "show possible false + positives" in the menu. User created application now has to have a + name and a path. + +2009-05-24 Slava Semushin + + * src/checkmemoryleak.cpp: + src/checkmemoryleak.cpp(GetAllocationType): simplify condition a + bit. Replace two Token::simpleMatch() calls to one Token::Match(). Correction for my previous + (2654a4aa54457f71b5dbcdc43ee714a054e65069) commit. No functional change. + +2009-05-22 Slava Semushin + + * src/checkmemoryleak.cpp, src/checkmemoryleak.h, + test/testmemleak.cpp: Added support to search resource leaks after + opendir()/fdopendir() usage. + +2009-05-20 Slava Semushin + + * src/checkother.cpp, test/testother.cpp: Part of fix for ticket + #284 (style check: redundant condition improvement) Fixed case "if (p) delete [] p;" and also added test case for it. http://apps.sourceforge.net/trac/cppcheck/ticket/284 + +2009-05-20 Slava Semushin + + * src/checkother.cpp, test/testother.cpp: Part of fix for ticket + #284 (style check: redundant condition improvement) Fixed case "if (p != NULL) delete p;" and also added test case for + it. http://apps.sourceforge.net/trac/cppcheck/ticket/284 + +2009-05-24 Slava Semushin + + * src/checkmemoryleak.cpp: + src/checkmemoryleak.cpp(GetDeallocationType): removed brackets. No functional change. + +2009-05-23 Vesa Pikki + + * gui/applicationdialog.cpp, gui/applicationdialog.h, + gui/applicationlist.h, gui/common.h, gui/mainwindow.h, + gui/resultstree.cpp, gui/resultstree.h, gui/resultsview.h, + gui/settingsdialog.h, gui/threadhandler.h, gui/threadresult.h: Added + more comments to class members and methods. + +2009-05-23 Vesa Pikki + + * gui/applicationlist.cpp, gui/applicationlist.h, + gui/mainwindow.cpp, gui/mainwindow.h, gui/resultstree.cpp, + gui/resultstree.h, gui/settingsdialog.cpp, gui/settingsdialog.h: Now + starts the default application by double clicking the error. + +2009-05-23 Vesa Pikki + + * : commit 70c32c10e4e3b69562d00ffc2922f46f7c280ee8 Author: Vesa + Pikki Date: Sat May 23 14:26:04 2009 +0300 + +2009-05-23 Slava Semushin + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Added 17 functions + which work with FILE structure to white list. Inspired by previous commit. + +2009-05-23 Vesa Pikki + + * gui/applicationdialog.cpp, gui/applicationdialog.h, + gui/applicationlist.cpp, gui/applicationlist.h, gui/gui.pro, + gui/mainwindow.cpp, gui/mainwindow.h, gui/settingsdialog.cpp, + gui/settingsdialog.h: Added the ability to add/remove/modify + applications to open errors with. Only the list of applications + added, errors cant be opened yet. + +2009-05-23 Slava Semushin + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Fixed ticket #327 + (File descriptor leak not detected when feof() used) Thanks to aggro80@ for help. http://apps.sourceforge.net/trac/cppcheck/ticket/327 + +2009-05-23 Vesa Pikki + + * gui/resultstree.cpp, gui/resultstree.h: When adding a new error, + only hides it and doesn't check all errors. + +2009-05-23 Vesa Pikki + + * gui/common.h, gui/mainwindow.cpp, gui/mainwindow.h, + gui/resultstree.cpp, gui/resultstree.h, gui/resultsview.cpp, + gui/resultsview.h, gui/test.cpp, gui/threadhandler.cpp, + gui/threadresult.cpp, gui/threadresult.h: Results tree now uses only + QStandardItemModel for data storage. Items are now hidden from the + tree and the tree is not recreated everytime it is refreshed. Also + added test.cpp as a sample data for GUI testing. Added Check all + and uncheck all buttons to menu to show/hide all errors more easily. + +2009-05-23 Vesa Pikki + + * gui/gui.pro: Updated new cppcheck files to project file. + +2009-05-23 Reijo Tomperi + + * src/preprocessor.cpp, src/preprocessor.h, + test/testpreprocessor.cpp: Fix ticket #304 (#include should + be searched from paths given with -I parameter.) + http://apps.sourceforge.net/trac/cppcheck/ticket/304 Note that the + ticket is same as with previous commit, but task description was + changed a little. + +2009-05-22 Reijo Tomperi + + * src/preprocessor.cpp, src/preprocessor.h, + test/testpreprocessor.cpp: Fix ticket #304 (#include should + be parsed like #include "file.h" is being parsed) + http://apps.sourceforge.net/trac/cppcheck/ticket/304 + +2009-05-22 Reijo Tomperi + + * src/tokenize.cpp, test/testmemleak.cpp: Fix ticket #326 (Reported + memory leak when pointer returned by assign to function's parameter) + http://apps.sourceforge.net/trac/cppcheck/ticket/326 + +2009-05-22 Slava Semushin + + * src/checkfunctionusage.cpp, src/checkmemoryleak.cpp, + src/tokenize.cpp: Replaced two Token::simpleMatch() calls to one + Token::Match(). Suggested by hyd_danmar in ticket + http://apps.sourceforge.net/trac/cppcheck/ticket/323 No functional change. + +2009-05-22 Slava Semushin + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Fixed ticket #324 + (Teach about fcloseall() function) http://apps.sourceforge.net/trac/cppcheck/ticket/324 + +2009-05-22 Slava Semushin + + * src/checkdangerousfunctions.h: Fixed ticket #300 (wrong level + given) Enable checks of dangerous functions only when --style option used. http://apps.sourceforge.net/trac/cppcheck/ticket/300 + +2009-05-22 Slava Semushin + + * src/checkautovariables.cpp, src/checkother.cpp, tools/errmsg.cpp: + Propagate static and const modifiers. No functional change. + +2009-05-22 Slava Semushin + + * src/checkautovariables.cpp, src/checkdangerousfunctions.cpp: + Removed unused or superfluous headers. No functional change. + +2009-05-22 Slava Semushin + + * src/checkautovariables.cpp, src/checkautovariables.h, + src/checkdangerousfunctions.cpp, src/checkdangerousfunctions.h, + test/testautovariables.cpp, test/testdangerousfunctions.cpp: Updated + wrong comments (looks like after copy&paste). No code change. + +2009-05-21 Reijo Tomperi + + * man/cppcheck.1.xml: Updated man page to reflect AUTHORS file. + +2009-05-21 Reijo Tomperi + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Fix #299 (Memory + leak not detected when parameters contain ::) + http://apps.sourceforge.net/trac/cppcheck/ticket/299 + +2009-05-21 Daniel Marjamäki + + * AUTHORS: AUTHORS: Added an authors file Ticket: http://apps.sourceforge.net/trac/cppcheck/ticket/325 + +2009-05-21 Daniel Marjamäki + + * src/checkautovariables.cpp, src/checkclass.cpp, + src/checkfunctionusage.cpp, src/checkheaders.cpp, + src/checkmemoryleak.cpp, src/checkother.cpp, src/checkstl.cpp, + src/preprocessor.cpp, src/tokenize.cpp: Applied patch + 0001-Use-Token-simpleMatch-instead-of-Token-Match-w Author: php-coder Ticket: http://apps.sourceforge.net/trac/cppcheck/ticket/323 + +2009-05-21 Daniel Marjamäki + + * src/checkmemoryleak.cpp: Applied patch + 0003-GetAllocationType-mark-some-members-as-static-and-a.patch Author: php-coder Ticket: http://apps.sourceforge.net/trac/cppcheck/ticket/321 + +2009-05-21 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/checkmemoryleak.h: Applied patch + 0002-CheckMemoryLeak-renamed-enum-members.patch Author: php-coder + +2009-05-21 Daniel Marjamäki + + * src/checkmemoryleak.h: Applied patch + 0001-src-checkmemoryleak.h-replaced-assignment-in-contru.patch Author: php-coder + +2009-05-20 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fix ticket #316 + (\n is tokenized into \\ in a string when macro is used) + http://apps.sourceforge.net/trac/cppcheck/ticket/316 + +2009-05-19 Reijo Tomperi + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Apply patch #320 + from php-coderrr ([PATCH] Determine memory leaks after strndup() + usage) http://apps.sourceforge.net/trac/cppcheck/ticket/320 + +2009-05-19 Reijo Tomperi + + * src/preprocessor.cpp, src/preprocessor.h, + test/testpreprocessor.cpp: Fix ticket #315 (Segmentation fault when + checking Linux kernel) (previous fix was only partial fix) + http://apps.sourceforge.net/trac/cppcheck/ticket/315 + +2009-05-18 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fix ticket #315 + (Segmentation fault when checking Linux kernel) + http://apps.sourceforge.net/trac/cppcheck/ticket/315 + +2009-05-18 Reijo Tomperi + + * src/checkclass.cpp, test/testconstructors.cpp: astyle fix + +2009-05-17 Daniel Marjamäki + + * src/checkclass.cpp, test/testconstructors.cpp: Classes: Static + variables don't need to be initialized or assigned in constructors + etc http://apps.sourceforge.net/trac/cppcheck/ticket/307 + +2009-05-17 Daniel Marjamäki + + * src/checkstl.cpp, test/teststl.cpp: STL: It is ok to compare + vector iterators with < + https://apps.sourceforge.net/trac/cppcheck/ticket/313 + +2009-05-17 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fix for ticket + 291 - preprocessor: better handling of defines + http://apps.sourceforge.net/trac/cppcheck/ticket/291 + +2009-05-14 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fix ticket #312 + (division by pointer value causes wrong tokenizing) + http://apps.sourceforge.net/trac/cppcheck/ticket/312 + +2009-05-13 Daniel Marjamäki + + * test/testpreprocessor.cpp: Preprocessor: Added test case for #291. + One of the assertions is a TODO and it should be fixed. http://apps.sourceforge.net/trac/cppcheck/ticket/291 + +2009-05-13 Reijo Tomperi + + * src/preprocessor.cpp, src/preprocessor.h, + test/testpreprocessor.cpp: Fix ticket #306 (Invalid multi-line + comment produces cryptic internal error) + http://apps.sourceforge.net/trac/cppcheck/ticket/306 + +2009-05-13 Reijo Tomperi + + * src/tokenize.cpp, test/testpreprocessor.cpp: Added TODO test case + TestPreprocessor::multiline_comment Made tokenizer to printout token + list in case of syntax error, if debug is used + +2009-05-12 Reijo Tomperi + + * test/testmemleak.cpp: Added TODO test case TestMemleak::stdstring + +2009-05-12 Reijo Tomperi + + * test/testtoken.cpp, test/testtokenize.cpp: Fix ticket #305 + (Negative value passed to ASSERT_EQUALS) + http://apps.sourceforge.net/trac/cppcheck/ticket/305 Moved also test + case from testtokenizer to testtoken. + +2009-05-11 Reijo Tomperi + + * src/cppcheck.cpp, src/tokenize.cpp, src/tokenize.h, + test/teststl.cpp, test/testtokenize.cpp: Fix ticket #288 + (Tokenizer::syntaxError should use error logger instead of + std::cout) http://apps.sourceforge.net/trac/cppcheck/ticket/288 + +2009-05-11 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fix ticket #302 + (White space between "\" and newline not handled correctly) + http://apps.sourceforge.net/trac/cppcheck/ticket/302 + +2009-05-10 Daniel Marjamäki + + * createrelease, src/cppcheck.cpp, win_installer/cppcheck.iss: + Updated version to 1.32 + +2009-05-10 Daniel Marjamäki + + * src/checkother.cpp, test/testother.cpp: null pointer + dereferencing: check that its a pointer that is dereferenced to + avoid false positives when using classes that behave almost like + pointers (#295) + +2009-05-10 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: memory leaks: + Handling exit (#297) + +2009-05-09 Reijo Tomperi + + * src/tokenize.cpp, test/testsimplifytokens.cpp, + test/testtokenize.cpp: Fix #289 (if() is not properly tokenized) + http://apps.sourceforge.net/trac/cppcheck/ticket/289 + +2009-05-09 Reijo Tomperi + + * src/threadexecutor.cpp: Apply #296 ([PATCH] cppcheck leak memory + when -j option uses) + http://apps.sourceforge.net/trac/cppcheck/ticket/296 + +2009-05-09 Reijo Tomperi + + * src/preprocessor.cpp, src/tokenize.cpp, src/tokenize.h, + test/testpreprocessor.cpp: Fix ticket #294 (### Error: Invalid + number of character () + http://apps.sourceforge.net/trac/cppcheck/ticket/294 + +2009-05-09 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: templates: fixed + problem when for example calling static member function in a + template class (#293) + +2009-05-08 Kimmo Varis + + * win_installer/cppcheck.iss, win_installer/readme.txt: Add VS + runtimes to the Windows installer. cppcheck requires VS 9 + runtimefiles to run. Those runtimes are installed by many programs + and it is probable lots of people already have them. But still there + are users without those files. And for them it is non-trivial task + to get cppcheck to run. So better just include runtimes for + everybody. + +2009-05-08 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: template: no usage + -> no expansion (#292) + +2009-05-07 Reijo Tomperi + + * cppcheck.cbp: testautovariables added to the codeblocks project + file + +2009-05-07 Reijo Tomperi + + * src/cppcheck.cpp, src/tokenize.cpp, src/tokenize.h, + test/testautovariables.cpp, test/testdivision.cpp, + test/testincompletestatement.cpp, test/teststl.cpp, + test/testtokenize.cpp: Initial fix for ticket #283 (segmentation + fault when checking xterm sources) + http://apps.sourceforge.net/trac/cppcheck/ticket/283 It should print + out error message now instead of crashing. Cleanup is needed. + +2009-05-07 Daniel Marjamäki + + * src/tokenize.cpp: templates: don't expand forward declarations for + templates + +2009-05-06 Reijo Tomperi + + * src/checkclass.cpp, test/testclass.cpp: Fix ticket #282 (protected + destructor - false positive) + http://apps.sourceforge.net/trac/cppcheck/ticket/282 + +2009-05-06 Daniel Marjamäki + + * src/checkstl.cpp, test/teststl.cpp: stl: removed false positives + for STL buffer overruns. Bailing out when it can't be checked if the + index is ok or not. (#285) + +2009-05-06 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: memleak: removed + false positives for pclose (#286) + +2009-05-06 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: templates: + instantiations in a template class (#280) + +2009-05-06 Reijo Tomperi + + * test/testmemleak.cpp: Added TODO test case + TestMemleak::assign_pclose + +2009-05-05 Reijo Tomperi + + * test/testsimplifytokens.cpp: Added test case + TestSimplifyTokens::template7 + +2009-05-05 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: templates: speedup + by breaking out inner loops (#257) + +2009-05-05 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Preprocessor: + Handling newlines when using # to stringify parameters (#281) + +2009-05-03 Daniel Marjamäki + + * src/tokenize.cpp: speedup: made the token simplifications a little + faster + +2009-05-03 Daniel Marjamäki + + * src/tokenize.cpp, src/tokenize.h: templates: extracted the + template simplification into a separate function + +2009-05-03 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fix #276 (simplification: + Variable value) http://apps.sourceforge.net/trac/cppcheck/ticket/276 + +2009-05-03 Reijo Tomperi + + * src/checkbufferoverrun.cpp, src/checkclass.cpp, + src/checkheaders.cpp, src/checkmemoryleak.cpp, src/token.cpp, + src/token.h, src/tokenize.cpp, test/testtokenize.cpp: Fix #279 + (Refactoring: replace and remove Token::aaaa , Token::aaaa0 and + Token::aaaa1) http://apps.sourceforge.net/trac/cppcheck/ticket/279 + +2009-05-03 Daniel Marjamäki + + * src/tokenize.cpp: varid: speedup of the algorithm for setting + variable ids + +2009-05-03 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: varid: updated handling + of variable id for class variables (#26) + +2009-05-03 Reijo Tomperi + + * src/tokenize.cpp: Fix possible bug caused by previous commit. + +2009-05-03 Reijo Tomperi + + * src/tokenize.cpp: Fix slowlyness, caused by one of the previous + commits. + +2009-05-03 Daniel Marjamäki + + * src/checkstl.cpp, src/checkstl.h, test/teststl.cpp: stl: Fixed + ticket #277 - dereferencing an iterator that has been erased + +2009-05-02 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: tokenizer: give class + member variables varId (#26) + +2009-05-02 Daniel Marjamäki + + * test/teststl.cpp: stl: added a ticket for the todo test case + TestStl::eraseDereference + +2009-05-02 Daniel Marjamäki + + * test/teststl.cpp: stl: added todo test case, invalid iterator + after insert + +2009-05-02 Daniel Marjamäki + + * test/teststl.cpp: stl: added todo test case, erasing invalid + iterator + +2009-05-02 Daniel Marjamäki + + * test/teststl.cpp: stl: added test case, dereferencing an iterator + that has been erased + +2009-05-02 Daniel Marjamäki + + * test/testmathlib.cpp: testing mathlib: Test that conversion to + numbers work + +2009-05-02 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/checkother.cpp, src/mathlib.h, + src/tokenize.cpp: Refactoring: Using MathLib for converting string + to number commit beacd5793f9e9987432a20ac39a76ae6c2c8babd Author: Daniel + Marjamäki Date: Sat May 2 + 10:44:18 2009 +0200 memleak: using mathlib commit 4d28172a5d88cc2cbe5ed94a4e4fdbd0dd4bb5e1 Author: Daniel + Marjamäki Date: Sat May 2 + 10:35:06 2009 +0200 tokenizer: using the MathLib for converting string to number commit 4e4b95b3554c9c6d121efeb39741204b1621b1a3 Author: Daniel + Marjamäki Date: Sat May 2 + 10:28:39 2009 +0200 CheckOther: Using mathlib + +2009-05-01 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, test/testtokenize.cpp: refactoring: + Replaced 'aaaa' + +2009-05-01 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fix ticket #204 (false + positive::memory leak with --all when free is guarded by simple if) + http://apps.sourceforge.net/trac/cppcheck/ticket/204 + +2009-05-01 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: tokenizer: simplify + assembler (#270), fix _asm also. + http://apps.sourceforge.net/trac/cppcheck/ticket/270 + +2009-05-01 Reijo Tomperi + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Fix ticket #196 + (False positive: Resource leak) + http://apps.sourceforge.net/trac/cppcheck/ticket/196 + +2009-05-01 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: tokenizer: simplify + assembler (#270) + +2009-05-01 Reijo Tomperi + + * src/tokenize.cpp: Astyle fix + +2009-05-01 Reijo Tomperi + + * src/tokenize.cpp, test/testsimplifytokens.cpp: Fix ticket #275 + Simplify if( a == 0 ), if( 0 == a ) into if( !a ) + http://apps.sourceforge.net/trac/cppcheck/ticket/275 + +2009-05-01 Daniel Marjamäki + + * test/testconstructors.cpp: astyle formatting + +2009-05-01 Daniel Marjamäki + + * test/testconstructors.cpp: class checking: enabled test case. The + --all setting must be provided + +2009-05-01 Reijo Tomperi + + * test/testmemleak.cpp: astyle fix + +2009-05-01 Reijo Tomperi + + * src/checkmemoryleak.cpp, test/testconstructors.cpp, + test/testmemleak.cpp: Fix partially ticket #196 False positive: + Resource leak And add few test cases related to it. Move one failing + test behind TODO + http://apps.sourceforge.net/trac/cppcheck/ticket/196 + +2009-05-01 Daniel Marjamäki + + * src/checkclass.cpp: class checking: only check class assignments + if the --all has been given + +2009-05-01 Daniel Marjamäki + + * src/checkclass.cpp, src/checkclass.h, test/testconstructors.cpp: + class checking: Checking that vectors/lists/strings etc are modified + in the assignment function + +2009-04-29 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fix ticket #269 + (Incorrect variable id, when delete is used.) + http://apps.sourceforge.net/trac/cppcheck/ticket/269 + +2009-04-29 Reijo Tomperi + + * test/testtokenize.cpp: Added test case TestTokenizer::varid_delete + for ticket #269 http://apps.sourceforge.net/trac/cppcheck/ticket/269 + +2009-04-29 Reijo Tomperi + + * test/testmemleak.cpp: Added test case + TestMemleak::free_member_in_sub_func for ticket #253 + http://apps.sourceforge.net/trac/cppcheck/ticket/253 + +2009-04-29 Daniel Marjamäki + + * src/checkstl.cpp, test/teststl.cpp: stl: checking that iterator is + used against a single container + +2009-04-29 Daniel Marjamäki + + * test/teststl.cpp: stl: added todo test case about using same + iterator with different containers + +2009-04-28 Daniel Marjamäki + + * test/teststl.cpp: changed todo comment to TODO_ASSERT_EQUALS + +2009-04-28 Daniel Marjamäki + + * src/checkstl.cpp, src/checkstl.h, test/teststl.cpp: checkstl: + Check for invalid pointer to vector element + +2009-04-28 Daniel Marjamäki + + * test/testconstructors.cpp: added todo test case for detecting + unmodified containers in the operator= function + +2009-04-28 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: memory leaks: + handling std::auto_ptr (#266) + +2009-04-27 Daniel Marjamäki + + * : commit b49997e69d7d058ea722d2d7ef8d4a231a514181 Author: Daniel + Marjamäki Date: Mon Apr 27 + 21:29:03 2009 +0200 + +2009-04-26 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Improve fix to + ticket #261: Allow macro definition to have uncoupled double quote. + http://apps.sourceforge.net/trac/cppcheck/ticket/261 + +2009-04-26 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Preprocessor: + Report correct file and line in message 'No pair for character..' + (#261) + +2009-04-25 Daniel Marjamäki + + * src/checkstl.cpp, test/teststl.cpp: push_back: updated the + checking of push_back (#263) + +2009-04-25 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: varid: Set variable id + for stl containers and iterators + +2009-04-25 Daniel Marjamäki + + * test/teststl.cpp: push_back: added a few todo test cases for the + checking of push_back + +2009-04-23 Reijo Tomperi + + * src/errorlogger.cpp: astyle fix + +2009-04-23 Daniel Marjamäki + + * src/errorlogger.cpp, test/testcppcheck.cpp: xml generator: handle + '<' and '>' (#263) + +2009-04-20 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fix ticket #258 + (segmentation fault) + http://apps.sourceforge.net/trac/cppcheck/ticket/258 + +2009-04-19 Daniel Marjamäki + + * src/checkother.cpp, test/testother.cpp: return pointer to local + array: fixed false positive when return value is converted to for + instance a std::string (#255) + +2009-04-16 Daniel Marjamäki + + * src/mathlib.cpp, src/mathlib.h, test/testmathlib.cpp: mathlib: + Fixed todo 3/2=1 + +2009-04-14 Reijo Tomperi + + * src/tokenize.cpp: Fix ticket #257 (Improve speed of template + tokenizing) http://apps.sourceforge.net/trac/cppcheck/ticket/257 + +2009-04-14 Daniel Marjamäki + + * src/checkclass.cpp, test/testunusedprivfunc.cpp: private + functions: don't report false positives when using initialization + lists (#254) + +2009-04-13 Daniel Marjamäki + + * src/checkstl.cpp, src/checkstl.h, test/teststl.cpp: STL boundries: + added new check written by Bill Eggert (#247) + +2009-04-13 Kimmo Varis + + * .gitignore: Improve gitignore file for VS. Improve gitignore to + ignore Visual Studio build directories and other VS generated files + not wanted in version control. + +2009-04-13 Reijo Tomperi + + * cppcheck.cbp, gui/threadhandler.cpp, src/check.h: Fix ticket #252 + (Fix --style warnings in cppcheck) + http://apps.sourceforge.net/trac/cppcheck/ticket/252 + +2009-04-12 Daniel Marjamäki + + * createrelease, src/cppcheck.cpp, win_installer/cppcheck.iss: + updated version to 1.31 + +2009-04-12 Daniel Marjamäki + + * test/testmathlib.cpp: math lib: 3/2 should result in 1 + +2009-04-10 Reijo Tomperi + + * src/checkstl.cpp, test/teststl.cpp: Fix ticket #248 (STL erase + check broken?) http://apps.sourceforge.net/trac/cppcheck/ticket/248 + +2009-04-10 Daniel Marjamäki + + * cppcheck.sln, cppcheck.vcproj, testrunner.sln, testrunner.vcproj: + changed mode of visual studio files + +2009-04-10 Daniel Marjamäki + + * cppcheck.sln, cppcheck.vcproj, testrunner.sln, testrunner.vcproj: + updated Visual Studio files + +2009-04-09 Reijo Tomperi + + * cppcheck.cbp: Add mathlib to codeblocks projectfile + +2009-04-09 Daniel Marjamäki + + * src/mathlib.cpp, src/mathlib.h: mathlib: Added licence text + +2009-04-06 Daniel Marjamäki + + * src/tokenize.cpp: simplify calculations: Don't simplify division + with 0 + +2009-04-06 Daniel Marjamäki + + * Makefile, src/tokenize.cpp: tokenize: use mathlib when simplifying + calculations (ticket: 236) + +2009-04-06 Daniel Marjamäki + + * Makefile, cppcheck.geany, src/mathlib.cpp, src/mathlib.h, + test/testmathlib.cpp: added testing for mathlib + +2009-04-06 Daniel Marjamäki + + * Makefile, src/mathlib.cpp, src/mathlib.h: Added math library that + was created by hoangtuansu + +2009-04-05 Reijo Tomperi + + * src/tokenize.cpp, test/testsimplifytokens.cpp: Fix ticket #212 + (Tokenizer: Handle L "text") + http://apps.sourceforge.net/trac/cppcheck/ticket/212 + +2009-04-05 Reijo Tomperi + + * src/preprocessor.cpp: Fix ticket #244 (Headers from included file + are searched from wrong path) + http://apps.sourceforge.net/trac/cppcheck/ticket/244 + +2009-04-04 Leandro Lisboa Penz + + * .gitignore: .gitignore: do not show status of built files. + +2009-04-04 Leandro Lisboa Penz + + * test/testmemleak.cpp: checkmemoryleak: fixed and reactivated + forwhile9 and forwhile10 tests. + +2009-04-04 Reijo Tomperi + + * src/checkbufferoverrun.cpp, test/testbufferoverrun.cpp: Fix ticket + #243 (boundary checking) + http://apps.sourceforge.net/trac/cppcheck/ticket/243 + +2009-04-03 Reijo Tomperi + + * test/testpreprocessor.cpp: astyle fix + +2009-04-03 Reijo Tomperi + + * src/cppcheck.cpp, src/preprocessor.cpp, src/preprocessor.h, + test/testpreprocessor.cpp: Fix ticket #242 (Preprocessor: Bail out + on failure instead of terminating the program) + http://apps.sourceforge.net/trac/cppcheck/ticket/242 + +2009-04-03 Reijo Tomperi + + * src/checksecurity.cpp: Fix some potential null pointer crashes + +2009-03-31 Daniel Marjamäki + + * src/checkclass.cpp, src/checkclass.h, test/testconstructors.cpp: + operator=: changed error message when variable is not assigned + +2009-03-31 Reijo Tomperi + + * src/tokenize.cpp, test/testsimplifytokens.cpp: Fix ticket #239 + (missing function implementation in namespace causes crash) + http://apps.sourceforge.net/trac/cppcheck/ticket/239 + +2009-03-29 Daniel Marjamäki + + * src/checkother.cpp, test/testother.cpp: division with zero => + division by zero + +2009-03-29 Daniel Marjamäki + + * src/checkother.cpp, src/checkother.h, test/testother.cpp: zero + division: it's an error + +2009-03-29 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: tokenizer: don't + replace sizeof when size can't be determined (#233) + +2009-03-28 Reijo Tomperi + + * src/checkautovariables.cpp: astyle fix + +2009-03-28 Gianluca Scacco + + * test/testautovariables.cpp: Added new test to autovariable + +2009-03-28 Gianluca Scacco + + * src/checkautovariables.cpp, test/testautovariables.cpp: Fixed + ticket #228: false positive with usage of an auto-variable + +2009-03-28 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: Tokenizer: Don't treat + typedefs as variable declarations (#234) + +2009-03-28 Daniel Marjamäki + + * test/testmemleak.cpp: Memory leaks: refactoring the TODO test + cases + +2009-03-28 Daniel Marjamäki + + * src/token.cpp, src/token.h, src/tokenize.cpp: performance + enhancement (patch submitted by davidmiller in ticket 231) + +2009-03-28 Nicolas Le Cam + + * test/testmemleak.cpp: Add TestMemleak::realloc4 that currently + fail. Change TestMemleak::if10, TestMemleak::forwhile8 and + TestMemleak::realloc2 as they are currently leaking memory, mark + them as TODO. Comment out TestMemleak::forwhile9 and + TestMemleak::forwhile10 as they are wrong (infinite loops). + +2009-03-28 Daniel Marjamäki + + * test/testother.cpp: removed TestOther::zeroDiv3 - it is not valid + +2009-03-28 Daniel Marjamäki + + * src/checkother.cpp, src/checkother.h, test/testother.cpp: added + check for zero division. The code was written by Nguyen Duong Tuan + +2009-03-27 Daniel Marjamäki + + * src/checkother.cpp, src/checkother.h, test/testother.cpp: possible + null pointer dereference after a while-loop + +2009-03-27 Daniel Marjamäki + + * src/checkother.h: moved checks back to style (where they used to + be) + +2009-03-27 Daniel Marjamäki + + * src/tokenize.cpp: tokenizer: fix segmentation fault if end of + token list is reached + +2009-03-25 Daniel Marjamäki + + * test/testclass.cpp, test/testmemleak.cpp, test/testsuite.h: + testing: new handling of todo test cases. If they use + TODO_ASSERT_EQUALS instead we can detect when they are fixed + +2009-03-25 Daniel Marjamäki + + * test/testtokenize.cpp: variable id: enabled test case for function + parameters + +2009-03-25 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: variable id: give + std::string variables an id + +2009-03-25 Daniel Marjamäki + + * src/checkautovariables.cpp: astyle formatting + +2009-03-25 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + test/testbufferoverrun.cpp: Buffer overrun: Added check to detect + when size argument to memset is a char constant (#213) + +2009-03-25 Daniel Marjamäki + + * src/tokenize.cpp, test/testmemleak.cpp, test/testtokenize.cpp: + simplify tokens (known variable values in conditions) + +2009-03-24 Gianluca Scacco + + * src/checkautovariables.cpp: Fixed Ticket #202: Return of the + address of an auto-variable + +2009-03-24 Daniel Marjamäki + + * src/checkother.cpp, test/testother.cpp: Fixed ticket 216 (False + positive: variable scope) + +2009-03-24 Daniel Marjamäki + + * src/checkclass.cpp: register CheckClass + +2009-03-24 Daniel Marjamäki + + * src/checkother.cpp: fixed testcase + +2009-03-24 Daniel Marjamäki + + * test/testother.cpp: added testcase + +2009-03-24 Daniel Marjamäki + + * src/checkother.cpp: Fixed ticket 197 (false positive: condition is + always true/false) + +2009-03-24 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, test/testbufferoverrun.cpp: fixed + snprintf false positive (#210) + +2009-03-24 Daniel Marjamäki + + * src/tokenize.cpp, src/tokenize.h, test/testsimplifytokens.cpp: + Simplify if conditions more.. simplifyIfAssign + simplifyIfNot + +2009-03-23 Daniel Marjamäki + + * src/checkother.cpp, test/testcharvar.cpp: Fixed ticket 205 (False + positive: char variable used in bit operation) + +2009-03-23 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Fixed the testcase + TestMemleak::realloc3 + +2009-03-23 Daniel Marjamäki + + * src/tokenize.cpp, src/tokenize.h, test/testsimplifytokens.cpp: + simplify tokens: move assignment out from condition (Ticket #201) + +2009-03-22 Daniel Marjamäki + + * test/testmemleak.cpp: added todo test case for ticket 200 + +2009-03-22 Vesa Pikki + + * gui/settingsdialog.cpp, gui/settingsdialog.h: Removed unnecessary + options from settings dialog. + +2009-03-22 Daniel Marjamäki + + * : commit a87419f59b099adc374d74a103835b66b7ee2f22 Author: Daniel + Marjamäki Date: Sun Mar 22 + 18:57:53 2009 +0100 + +2009-03-22 Vesa Pikki + + * gui/mainwindow.cpp: Added a window title. + +2009-03-22 Vesa Pikki + + * gui/common.h: Added license text. + +2009-03-22 Vesa Pikki + + * : commit 1e66d7f0e44949fc56e57b93cf1c106b736a363e Author: Vesa + Pikki Date: Sun Mar 22 19:41:32 2009 +0200 + +2009-03-22 Vesa Pikki + + * gui/mainwindow.cpp, gui/resultstree.cpp: Conflicts: gui/mainwindow.cpp gui/resultstree.cpp + +2009-03-22 Vesa Pikki + + * gui/common.h, gui/mainwindow.cpp, gui/mainwindow.h, + gui/resultstree.cpp, gui/resultstree.h, gui/resultsview.cpp, + gui/resultsview.h: Merged gui branch to master. + +2009-03-22 Vesa Pikki + + * gui/mainwindow.cpp, gui/resultstree.cpp, gui/resultstree.h, + gui/resultsview.cpp: Astyle formatting. + +2009-03-22 Vesa Pikki + + * gui/common.h, gui/mainwindow.cpp, gui/mainwindow.h, + gui/resultstree.cpp, gui/resultstree.h, gui/resultsview.cpp, + gui/resultsview.h: Can now hide and show results based on cpp flags. + +2009-03-22 Vesa Pikki + + * gui/mainwindow.cpp, gui/mainwindow.h: Added view menu and buttons + for it. + +2009-03-22 Vesa Pikki + + * gui/mainwindow.cpp, gui/mainwindow.h, gui/resultstree.cpp, + gui/threadhandler.cpp, gui/threadhandler.h: Added recheck and clear + results buttons. + +2009-03-22 Vesa Pikki + + * gui/mainwindow.cpp, gui/threadhandler.cpp: astyle formatting. + +2009-03-22 Vesa Pikki + + * gui/mainwindow.cpp, gui/mainwindow.h, gui/resultstree.cpp, + gui/threadhandler.cpp, gui/threadhandler.h: Added recheck and clear + results buttons. + +2009-03-22 Vesa Pikki + + * gui/mainwindow.cpp, gui/resultstree.cpp, gui/settingsdialog.h, + gui/threadhandler.cpp, test/testautovariables.cpp: Astyle + formatting. + +2009-03-22 Vesa Pikki + + * : commit 5e1994068ad4d81d38cc9cbf4ff7beff58cdac25 Author: Vesa + Pikki Date: Sun Mar 22 14:32:07 2009 +0200 + +2009-03-22 Vesa Pikki + + * gui/checkdialog.cpp, gui/checkdialog.h: Removed check dialog. + Files to be checked are selected by default file open dialog with + all checking options enabled. + +2009-03-22 Daniel Marjamäki + + * Makefile: updated the Makefile + +2009-03-22 Gianluca Scacco + + * Makefile, test/testautovariables.cpp: Fixed error compiling + testautovariables + +2009-03-22 Daniel Marjamäki + + * src/checkautovariables.cpp: astyle code formatting + +2009-03-22 Daniel Marjamäki + + * : commit e017d5a07928fba2836dbcfa96d7ca42b3a4634c Author: Daniel + Marjamäki Date: Sun Mar 22 + 08:20:15 2009 +0100 + +2009-03-22 Gianluca Scacco + + * src/checkautovariables.cpp, src/checkautovariables.h: Refactoring + of CheckAutoVariables + +2009-03-21 Daniel Marjamäki + + * src/tokenize.cpp: improved the Tokenizer::setVarId to handle + function parameters better + +2009-03-21 Daniel Marjamäki + + * src/check.h, src/checkautovariables.cpp, + src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + src/checkmemoryleak.cpp, src/checkmemoryleak.h, src/errorlogger.h: + refactoring error messages + +2009-03-21 Daniel Marjamäki + + * Makefile: updated the MakeFile + +2009-03-21 Daniel Marjamäki + + * Makefile, src/checkautovariables.cpp: Fixed 188 (Return of auto + variable address), applied patched submitted by gscacco + +2009-03-21 Daniel Marjamäki + + * src/checkdangerousfunctions.cpp, src/checkdangerousfunctions.h, + src/checksecurity.cpp, src/checksecurity.h, src/errorlogger.h, + test/testsecurity.cpp: refactoring error messages + +2009-03-21 Daniel Marjamäki + + * src/checkclass.cpp, src/checkclass.h, src/checkmemoryleak.cpp, + src/checkmemoryleak.h, src/checkother.cpp, src/checkother.h, + src/checkstl.cpp, src/checkstl.h, src/errorlogger.h: refactoring + error messages + +2009-03-21 Daniel Marjamäki + + * cppcheck.geany: added geany project file + +2009-03-21 Daniel Marjamäki + + * src/checkstl.cpp, src/checkstl.h, test/teststl.cpp: refactoring - + handling the stlOutOfBounds error message the new way + +2009-03-21 Daniel Marjamäki + + * src/check.h, src/checkstl.h: refactoring - added a function + getErrorMessages that will be used to get a list of error messages + +2009-03-21 Daniel Marjamäki + + * src/checkautovariables.h, test/teststl.cpp: refactoring - fixed + the unit tests + +2009-03-21 Daniel Marjamäki + + * Makefile, tools/dmake.cpp, tools/errmsg.cpp: refactoring: The + errmsg is no longer supposed to generate the errorLogger code + +2009-03-21 Daniel Marjamäki + + * src/check.h, src/checkautovariables.h, src/checkbufferoverrun.h, + src/checkclass.h, src/checkdangerousfunctions.h, + src/checkmemoryleak.h, src/checkother.h, src/checkstl.h, + src/cppcheck.cpp: refactoring: there are now 2 functions for running + checks. 'runChecks' and 'runSimplifiedChecks' + +2009-03-20 Daniel Marjamäki + + * Makefile, cppcheck.cbp, src/check.h, src/checkstl.cpp: refactoring + +2009-03-20 Daniel Marjamäki + + * src/check.h, src/checkstl.cpp, src/checkstl.h: refactoring: + generate error message in the class + +2009-03-20 Daniel Marjamäki + + * src/check.h: refactoring: Added a function to the Check base class + that allows easier error reporting + +2009-03-20 Daniel Marjamäki + + * src/token.cpp: improved Token::tokAt to handle negative argument + too + +2009-03-20 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, src/checkdangerousfunctions.cpp, + src/checkdangerousfunctions.h, src/checkmemoryleak.cpp, + src/checkmemoryleak.h, src/checkother.cpp, src/checkother.h, + src/cppcheck.cpp, test/testcharvar.cpp, + test/testdangerousfunctions.cpp, test/testdivision.cpp, + test/testincompletestatement.cpp, test/testmemleak.cpp, + test/testmemleakmp.cpp, test/testother.cpp, + test/testredundantif.cpp, test/testunusedvar.cpp: refactoring the + rest of the classes + +2009-03-20 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + src/cppcheck.cpp, test/testbufferoverrun.cpp: refactoring + checkbufferoverrun + +2009-03-20 Daniel Marjamäki + + * src/checkclass.cpp, src/checkclass.h, src/cppcheck.cpp, + test/testclass.cpp, test/testconstructors.cpp, + test/testunusedprivfunc.cpp: refactoring CheckClass + +2009-03-20 Daniel Marjamäki + + * src/check.h, src/checkstl.cpp, src/checkstl.h: refactoring + +2009-03-19 Daniel Marjamäki + + * : commit 5565be0c74cbda4de3582dab1d057710de76d7ce Author: Daniel + Marjamäki Date: Thu Mar 19 + 21:20:08 2009 +0100 + +2009-03-19 Daniel Marjamäki + + * Makefile, src/checkautovariables.cpp, src/checkautovariables.h, + src/errorlogger.h, tools/errmsg.cpp: added and integrated + checkautovariables that gscacco created + +2009-03-19 Daniel Marjamäki + + * src/checkautovariables.cpp, src/checkautovariables.h, + test/teststl.cpp: astyle formatting + +2009-03-19 Daniel Marjamäki + + * Makefile, src/checkautovariables.cpp, src/checkautovariables.h, + src/errorlogger.h, tools/errmsg.cpp: added checkautovariables and + integrated it into cppcheck + +2009-03-19 Daniel Marjamäki + + * test/teststl.cpp: astyle formatting + +2009-03-19 Daniel Marjamäki + + * test/teststl.cpp: refactoring: fixed the teststl so it is runnable + again + +2009-03-19 Daniel Marjamäki + + * cppcheck.cbp, src/check.h, src/checkstl.cpp, src/checkstl.h, + src/cppcheck.cpp: refactoring: loop through all Check instances and + execute the runChecks function + +2009-03-19 Daniel Marjamäki + + * src/checkstl.cpp, src/checkstl.h: refactoring: removed the changes + to the error handling + +2009-03-18 Daniel Marjamäki + + * : commit a573c62cd532d3bdae381f8cf4696ec2e2eccd0a Author: Daniel + Marjamäki Date: Wed Mar 18 + 22:40:38 2009 +0100 + +2009-03-18 Nicolas Le Cam + + * test/testtokenize.cpp: Fix compilation on 64bit systems + +2009-03-18 Daniel Marjamäki + + * src/tokenize.cpp, src/tokenize.h, test/testtokenize.cpp: Fixed + ticket 184 (Tokenizer - Simplification: Split up variable + declarations) + +2009-03-18 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fixed tokenizer: "return + - 2 ;" --> "return -2 ;" + +2009-03-18 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fix ticket #191 + (semicolon after #endif stop tokenizing of function) + http://apps.sourceforge.net/trac/cppcheck/ticket/191 + +2009-03-17 Reijo Tomperi + + * src/token.cpp: Astyle fix + +2009-03-17 Reijo Tomperi + + * Makefile, test/testmemleakmp.cpp, test/testtoken.cpp: Fixed some + memory leaks in test cases + +2009-03-17 Daniel Marjamäki + + * src/checkother.cpp, src/token.cpp, src/tokenize.cpp, + test/testtokenize.cpp: tokenize negative numbers into a single token + +2009-03-17 Reijo Tomperi + + * src/tokenize.cpp: Fix ticket #186 (runtime error when checking + code that has a namespace) + http://apps.sourceforge.net/trac/cppcheck/ticket/186 + +2009-03-17 Daniel Marjamäki + + * src/tokenize.cpp: Refactoring the code for the templates handling + +2009-03-17 Daniel Marjamäki + + * test/teststl.cpp: Added test case for detecting false positive in + the STL size handling + +2009-03-16 Reijo Tomperi + + * src/cppcheck.cpp, src/tokenize.cpp, src/tokenize.h: --debug flag + can be used to printout token list (for development purposes) + +2009-03-16 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fix ticket #179 + (preprocessor issues) + http://apps.sourceforge.net/trac/cppcheck/ticket/179 + +2009-03-16 Daniel Marjamäki + + * test/testtokenize.cpp: Ticket #184 (Tokenizer - Simplification: + Split up variable declarations), added testcases + +2009-03-16 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, test/testbufferoverrun.cpp: Fixed + Ticket #82 (detect buffer overrun; dynamic memory) + +2009-03-15 Reijo Tomperi + + * test/testpreprocessor.cpp: test case stringify3 added + +2009-03-15 Reijo Tomperi + + * src/tokenize.cpp, test/testmemleak.cpp, + test/testpreprocessor.cpp, test/testtokenize.cpp: Improved tokenizer + to handle '#' better. Previously everything after # was combined + into a single token, now # is considered more like an alphabet, with + few exceptions, e.g. "##" tokens. + +2009-03-15 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: Fix Ticket 180 + (Templates: Expanding member functions that are not implemented + inline) + +2009-03-15 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: templates: replace + constructor/destructor names when expanding template classes + +2009-03-15 Reijo Tomperi + + * test/testpreprocessor.cpp: Test case stringify2() added. + +2009-03-15 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fix ticket #177 + (Tokenizer doesn't add braces around if-scope) + http://apps.sourceforge.net/trac/cppcheck/ticket/177 + +2009-03-15 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fix ticket #181 + (#pragma causes wrong line numbers) + http://apps.sourceforge.net/trac/cppcheck/ticket/181 + +2009-03-15 Reijo Tomperi + + * src/checkmemoryleak.cpp, src/tokenize.cpp, src/tokenize.h: Improve + creation of link() for Token class. Tokenizer::simplifyTokenList() + should now return code where Token::link() actually works. + +2009-03-14 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: templates: better + handling of templates with multiple type arguments + +2009-03-14 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Memory leak: handle + allocation in deallocation list + +2009-03-14 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/checkmemoryleak.h, + test/testmemleak.cpp: Memory leaks: Refactoring to use + Tokenizer::FindClassFunction. Enabled test case, the memory leak is + now detected + +2009-03-13 Daniel Marjamäki + + * : commit 3b29125d659c1cb4d1547cba3597b06a4b9454c9 Author: Daniel + Marjamäki Date: Fri Mar 13 + 22:38:42 2009 +0100 + +2009-03-13 Daniel Marjamäki + + * src/checkclass.cpp, src/checkclass.h, src/tokenize.cpp, + src/tokenize.h: refactoring: moved 'FindClassFunction' from + CheckClass to Tokenizer + +2009-03-13 Reijo Tomperi + + * src/token.cpp, src/token.h, src/tokenize.cpp: Fixed ticket #169 + (Add Token::link()) + http://apps.sourceforge.net/trac/cppcheck/ticket/169 + +2009-03-13 Daniel Marjamäki + + * test/testmemleak.cpp: TestMemleak: added two testcases for + checking for leaks in classes + +2009-03-13 Reijo Tomperi + + * src/token.cpp, src/token.h, src/tokenize.cpp, src/tokenize.h, + test/testsimplifytokens.cpp: Fix ticket #151 (Handling of + namespaces) http://apps.sourceforge.net/trac/cppcheck/ticket/151 + +2009-03-12 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: expanding template + classes + +2009-03-12 Daniel Marjamäki + + * src/checkclass.cpp, test/testconstructors.cpp: uninitialized const + pointer member variables + +2009-03-11 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: astyle style fixes + +2009-03-11 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: templates: simplify + template functions with 1 type argument + +2009-03-11 Reijo Tomperi + + * test/testpreprocessor.cpp: astyle fix + +2009-03-10 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: made the + Tokenizer::simplifyCasts more generic + +2009-03-10 Daniel Marjamäki + + * src/checkmemoryleak.cpp: Fixed ticket 134 (memory leak not + detected) caused by wrong checking if code is inside class function + or not + +2009-03-09 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fixed ticket 147 + (Invalid line number for error message) + +2009-03-09 Daniel Marjamäki + + * src/checksecurity.h: removed unused private function + CheckSecurity::eraseCheckLoop + +2009-03-09 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: simplify casts + +2009-03-09 Kimmo Varis + + * : commit 9698c6d96b86f608ff0473776584edb416a59d57 Author: Kimmo + Varis Date: Mon Mar 9 20:03:22 2009 +0200 + +2009-03-09 Vesa Pikki + + * : commit b3923b72ad48cc09ff4ec8355b0d406af02a580a Author: Kimmo + Varis Date: Mon Mar 9 19:58:38 2009 +0200 + +2009-03-09 Vesa Pikki + + * : commit 3d6e3d38bbc67a4742a1a775142867e0c254b07d Author: Vesa + Pikki Date: Mon Mar 9 19:35:43 2009 +0200 + +2009-03-09 Kimmo Varis + + * win_installer/cppcheck.iss: Build installer to Build directory in + project root. Currently installer is build to subdirectory of the + iss file which is not obvious place to find it. Also it is not good + practice to build executables to source directories. + +2009-03-09 Kimmo Varis + + * win_installer/cppcheck.iss: Set description for the installer + file. This description is shown in the explorer. + +2009-03-09 Kimmo Varis + + * win_installer/cppcheck.iss: Set user wiki URL as + application/support URL. The installer was setting Sf.net project + page as an URL which might be confusing for the users. Better use + the wiki page. + +2009-03-09 Kimmo Varis + + * win_installer/cppcheck.iss: Set version number for the installer + file. The installer file was missing a version number (was shown as + 0.0.0.0) in the Windows Explorer. Set the installer file version + number identical to product version number. + +2009-03-08 Reijo Tomperi + + * test/testpreprocessor.cpp: Added test case for #147 (Invalid line + number for error message) + http://apps.sourceforge.net/trac/cppcheck/ticket/147 + macro_linenumbers() in test/testpreprocessor.cpp + +2009-03-08 Reijo Tomperi + + * src/errorlogger.cpp: Fix ticket #148 (unable to compile with + g++-3.3) http://apps.sourceforge.net/trac/cppcheck/ticket/148 + +2009-03-08 Reijo Tomperi + + * man/cppcheck.1.xml: Man page copyright year changed to 2009 + +2009-03-08 Daniel Marjamäki + + * win_installer/cppcheck.iss: updated version to 1.30 in + installation script + +2009-03-08 Daniel Marjamäki + + * src/cppcheck.cpp: updated version to 1.30 + +2009-03-08 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Astyle fix + +2009-03-08 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fix ticket #145 + (Line numbers are invalid if file is included inside #ifdef) + http://apps.sourceforge.net/trac/cppcheck/ticket/145 + +2009-03-07 unknown + + * gui/checkdialog.cpp, src/filelister.cpp: Windows Qt compilation + fixes. FileLister::RecursiveAddFiles failed to compile in Windows + when GUI was compiled. Since that method wasn't used in Qt build I + ifdeffed it out. Also removed vcl related code from checkdialog since that was + removed from release. + +2009-03-07 Reijo Tomperi + + * man/cppcheck.1.xml: Improve man page + +2009-03-07 Daniel Marjamäki + + * createrelease: createrelease updated to use git instead of svn + +2009-03-07 Daniel Marjamäki + + * man/cppcheck.1.xml, src/cppcheck.cpp: Fix ticket #140 (New command + line option --auto-dealloc), added documentation + +2009-03-07 Reijo Tomperi + + * Makefile, tools/dmake.cpp: Fix ticket #141 (changed the makefile), + changing compiler is now easier in the makefile. + http://apps.sourceforge.net/trac/cppcheck/ticket/141 + +2009-03-06 Reijo Tomperi + + * man/cppcheck.1.xml, src/cppcheck.cpp: Fix ticket #137 (--version + would be nice) and also do some cleanup for help texts + http://apps.sourceforge.net/trac/cppcheck/ticket/137 + +2009-03-06 Reijo Tomperi + + * src/threadexecutor.cpp: Fix ticket #139 (Compilation error on + building cppcheck version 1.29 with gcc-4.3.2 on Ubuntu 8.10) + http://apps.sourceforge.net/trac/cppcheck/ticket/139 + +2009-03-06 Daniel Marjamäki + + * src/cppcheck.cpp, src/settings.cpp, src/settings.h, + test/testmemleak.cpp: astyle formatting + +2009-03-06 Daniel Marjamäki + + * src/cppcheck.cpp: auto-deallocated classes: added command line + option for specifying .lst file + (http://apps.sourceforge.net/trac/cppcheck/ticket/120) + +2009-03-06 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/settings.cpp, src/settings.h, + test/testmemleak.cpp: added internal support for handling list of + classes that are automaticly deallocated + +2009-03-06 Reijo Tomperi + + * man/cppcheck.1.xml, src/checkstl.cpp, src/cppcheck.cpp, + src/cppcheckexecutor.cpp, src/cppcheckexecutor.h, src/main.cpp, + src/settings.cpp, src/settings.h: Fix ticket #135 (Add option to + control main() exit value) + +2009-03-05 Reijo Tomperi + + * src/checkstl.cpp, test/teststl.cpp: Fix segmentation fault that + happens with invalid code. + +2009-03-05 Reijo Tomperi + + * src/tokenize.cpp, test/testsimplifytokens.cpp: Fix ticket #133 + (Segmentation fault when static_cast is in for loop) + +2009-03-05 Daniel Marjamäki + + * src/checkbufferoverrun.cpp: checkbufferoverrun: fixed bug - skip + some checks when variable id is unknown (Ticket: 138) + +2009-03-04 Daniel Marjamäki + + * src/cppcheck.cpp: reverted accidental changes committed in [1330] + +2009-03-04 Daniel Marjamäki + + * src/cppcheck.cpp, src/tokenize.cpp: fixed tokenizer problem when + reading char constants + +2009-03-04 Daniel Marjamäki + + * src/tokenize.cpp, src/tokenize.h: simplify calculations better + +2009-03-04 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: known variables: better + handling of ++ and -- + +2009-03-03 Reijo Tomperi + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Fix #132 (False + positive returning memcpy()) + +2009-03-03 Reijo Tomperi + + * src/token.cpp, test/testsimplifytokens.cpp, test/testtokenize.cpp: + Fix ticket Add/Change #125 (the printout of the token list is wrong) + +2009-03-03 Reijo Tomperi + + * src/token.cpp, src/token.h: Refactoring: Combined printOut() and + stringifyList() in Token class + +2009-03-03 Kimmo Varis + + * createrelease: Use svn export to export sources without SVN + folders. + +2009-03-03 Kimmo Varis + + * createrelease: Use variable for relase folder and version in + release script. + +2009-03-02 Daniel Marjamäki + + * src/checkclass.cpp, test/testunusedprivfunc.cpp: unused private + function: better handling of initialization lists in constructors + +2009-03-02 Vesa Pikki + + * gui/resultsview.cpp, gui/threadhandler.cpp, gui/threadresult.cpp: + Removed some unnecessary debug prints. + +2009-03-02 Vesa Pikki + + * gui/checkdialog.cpp, gui/checkdialog.h, gui/checkthread.cpp, + gui/checkthread.h, gui/resultstree.cpp, gui/resultsview.cpp, + gui/resultsview.h, gui/threadhandler.cpp, gui/threadhandler.h, + gui/threadresult.cpp, gui/threadresult.h, src/filelister.h: Now adds + directory contents to list of files to check. Only adds proper + (.cpp,.c,.cpp,...) files to the list of files to check. Modified + checkthread to clear results after each file. + +2009-03-02 Daniel Marjamäki + + * createrelease: createrelease: The script for creating the 1.29 + source packages + +2009-03-02 Daniel Marjamäki + + * src/checkclass.cpp, test/testunusedprivfunc.cpp: unused private + function: fixed false positive (ticket: 129) + +2009-03-01 Vesa Pikki + + * gui/checkdialog.cpp, gui/checkdialog.h, gui/checkthread.cpp, + gui/checkthread.h, gui/gui.pro, gui/mainwindow.cpp, + gui/mainwindow.h, gui/resultstree.cpp, gui/resultstree.h, + gui/resultsview.cpp, gui/resultsview.h, gui/threadhandler.cpp, + gui/threadhandler.h, gui/threadresult.cpp, gui/threadresult.h: Began + implementing ThreadExecutor with Qt threads. Still a work in + progress. Added tr to all strings. + +2009-03-01 Reijo Tomperi + + * man/cppcheck.1.xml: Copyright fix for the man page + +2009-03-01 Reijo Tomperi + + * man/cppcheck.1.xml: Copyright for the man page + +2009-03-01 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/checkmemoryleak.h, + test/testmemleak.cpp: memory leak: fixed issue with reporting wrong + location + +2009-03-01 Reijo Tomperi + + * src/threadexecutor.cpp: Fixed some compiling warnings by adding + more error checking. + +2009-03-01 Daniel Marjamäki + + * src/tokenize.cpp: removed deprecated flag 'firstMatch' + +2009-03-01 Reijo Tomperi + + * src/errorlogger.h, tools/errmsg.cpp: Copyright fixes + +2009-03-01 Reijo Tomperi + + * src/errorlogger.h, src/threadexecutor.cpp: Fixing compile problem + with new gcc + +2009-03-01 Reijo Tomperi + + * src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + src/checkclass.cpp, src/checkclass.h, + src/checkdangerousfunctions.cpp, src/checkdangerousfunctions.h, + src/checkfunctionusage.cpp, src/checkfunctionusage.h, + src/checkheaders.cpp, src/checkheaders.h, src/checkmemoryleak.cpp, + src/checkmemoryleak.h, src/checkother.cpp, src/checkother.h, + src/checksecurity.cpp, src/checksecurity.h, src/checkstl.cpp, + src/checkstl.h, src/cppcheck.cpp, src/cppcheck.h, + src/cppcheckexecutor.cpp, src/cppcheckexecutor.h, + src/errorlogger.cpp, src/errorlogger.h, src/filelister.cpp, + src/filelister.h, src/main.cpp, src/preprocessor.cpp, + src/preprocessor.h, src/settings.cpp, src/settings.h, + src/threadexecutor.cpp, src/threadexecutor.h, src/token.cpp, + src/token.h, src/tokenize.cpp, src/tokenize.h, + test/testbufferoverrun.cpp, test/testcharvar.cpp, + test/testclass.cpp, test/testconstructors.cpp, + test/testcppcheck.cpp, test/testdangerousfunctions.cpp, + test/testdivision.cpp, test/testfilelister.cpp, + test/testfunctionusage.cpp, test/testincompletestatement.cpp, + test/testmemleak.cpp, test/testmemleakmp.cpp, test/testother.cpp, + test/testpreprocessor.cpp, test/testredundantif.cpp, + test/testrunner.cpp, test/testsecurity.cpp, + test/testsimplifytokens.cpp, test/teststl.cpp, test/testsuite.cpp, + test/testsuite.h, test/testtoken.cpp, test/testtokenize.cpp, + test/testunusedprivfunc.cpp, test/testunusedvar.cpp, + tools/dmake.cpp, tools/errmsg.cpp: Copyrights updated + +2009-03-01 Reijo Tomperi + + * cppcheck.cbp: Added GUI to codeblocks project file + +2009-03-01 Reijo Tomperi + + * src/errorlogger.h, tools/errmsg.cpp: Fixed another --style problem + with our code + +2009-03-01 Reijo Tomperi + + * src/threadexecutor.cpp, src/threadexecutor.h: Fixed bug, -j option + produced duplicate error messages. + +2009-03-01 Reijo Tomperi + + * src/errorlogger.cpp, src/errorlogger.h, tools/errmsg.cpp: Use + reference instead of string copy (fixes some --style warnings from + our code) + +2009-03-01 Daniel Marjamäki + + * src/cppcheck.cpp: removed the '--vcl' flag from the console app + +2009-03-01 Reijo Tomperi + + * man/cppcheck.1.xml: Removed --vcl fromt he man page + +2009-03-01 Reijo Tomperi + + * man/cppcheck.1.xml: Updated man page for --vcl + +2009-03-01 Daniel Marjamäki + + * src/tokenize.cpp, test/testother.cpp, test/testtokenize.cpp: + variable id: fixed so that the variable ids are assigned correctly + (ticket:126) + +2009-03-01 Vesa Pikki + + * gui/checkdialog.cpp, gui/checkdialog.h, gui/checkthread.cpp, + gui/checkthread.h, gui/gui.pro, gui/main.cpp, gui/mainwindow.cpp, + gui/mainwindow.h, gui/resultstree.cpp, gui/resultstree.h, + gui/resultsview.cpp, gui/resultsview.h, gui/settingsdialog.cpp, + gui/settingsdialog.h, runastyle, runastyle.bat: Began implementing a + simple Qt based GUI. Also modified astyle scripts to format gui + code aswell. + +2009-02-28 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: variable + declarations: don't simplify when declaring and assigning array in + the same statement + +2009-02-28 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: variable id: handling + 'return' and 'else' better + +2009-02-28 Daniel Marjamäki + + * test/testsimplifytokens.cpp, test/testtokenize.cpp: moved sizeof + tests to the TestSimplifyTokens class + +2009-02-28 Daniel Marjamäki + + * test/testtokenize.cpp: refactoring unit tests + +2009-02-28 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: sizeof: fixed a problem + with 'sizeof(varname)' but there are more to fix with it + +2009-02-27 Reijo Tomperi + + * src/cppcheck.cpp, src/cppcheck.h: Added Cppcheck::clearFiles() + function. + +2009-02-27 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: simplify known variable: + don't simplify this ';i++;' + +2009-02-27 Daniel Marjamäki + + * src/checkfunctionusage.cpp: unused functions: fixed false + positives + +2009-02-27 Daniel Marjamäki + + * test/testbufferoverrun.cpp: Reverted changes made in [1289] + +2009-02-27 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: simplify tokens: + fixed bug when removing redundant parantheses around variable + +2009-02-26 Daniel Marjamäki + + * test/testbufferoverrun.cpp: array index out of bounds: Added todo + test case TestBufferOverrun::array_index_13 for ticket #118 + +2009-02-26 Kimmo Varis + + * win_installer/cppcheck.iss: Use 'folder' instead of 'directory' in + Windows installer. + +2009-02-25 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: simplify tokens: + remove redundant parantheses around variable.. 'p = (q);' + +2009-02-25 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: memory leak: Fixed + a false positive when all is given + +2009-02-25 Daniel Marjamäki + + * src/checkclass.cpp, test/testunusedprivfunc.cpp: unused private + function: Handle 'embedded' function implementations better + +2009-02-24 Daniel Marjamäki + + * src/checkclass.cpp: checkclass: refactoring + +2009-02-24 Daniel Marjamäki + + * src/checkclass.cpp, test/testunusedprivfunc.cpp: reverted [1282] + because some changes were committed by mistake + +2009-02-24 Daniel Marjamäki + + * src/checkclass.cpp, test/testunusedprivfunc.cpp: checkclass: + refactoring + +2009-02-24 Daniel Marjamäki + + * src/tokenize.cpp: sizeof fix. classes and structs are always given + the size 100. This removes false positives about mismatching size + +2009-02-24 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: simplify tokens: simplify + known variable value handles ++ and -- better + +2009-02-24 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: memory leak: fixed + false positive when using 'return strcpy' + +2009-02-23 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: memory leaks: + improved handling of --vcl + +2009-02-22 Reijo Tomperi + + * man/cppcheck.1.xml, src/cppcheck.cpp, src/cppcheckexecutor.cpp, + src/settings.cpp, src/settings.h, src/threadexecutor.cpp: Change -w + to -j to make it similar with make and scons. + +2009-02-22 Kimmo Varis + + * src/cppcheck.rc: Windows RC file is ANSI file, storing as UTF-8 + messes it up. + +2009-02-22 Reijo Tomperi + + * src/errorlogger.h, tools/errmsg.cpp: Members of + ErrorLogger::ErrorMessage made public for better access to them. + +2009-02-22 Reijo Tomperi + + * src/cppcheck.cpp, src/cppcheck.h: CppCheck::addFile() accepts + paths also now. + +2009-02-21 Daniel Marjamäki + + * cppcheck.cbp: codeblocks: Updated the project file with the new + security check + +2009-02-21 Daniel Marjamäki + + * src/checkclass.cpp, src/tokenize.cpp, test/testclass.cpp: + constructors: don't warn about missing constructor if class only has + static variable members + +2009-02-21 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, test/testbufferoverrun.cpp: buffer + overrun: catch cases when using cin to read to a char array + +2009-02-21 Daniel Marjamäki + + * Makefile, src/checksecurity.cpp, src/checksecurity.h, + test/testsecurity.cpp: security: renamed classes + +2009-02-21 Daniel Marjamäki + + * Makefile, src/checksecurity.cpp, src/checksecurity.h, + src/checkvalidate.cpp, src/checkvalidate.h, test/testsecurity.cpp, + test/testvalidate.cpp: security: Renamed files + +2009-02-21 Daniel Marjamäki + + * src/checkclass.cpp, test/testclass.cpp: TestClass: Added test for + uninitialized "mutable int i" + +2009-02-21 Daniel Marjamäki + + * cppcheck.vcproj: Visual C++: Updated the project file to include + the thread execution + +2009-02-20 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, test/testbufferoverrun.cpp: buffer + overrun: dangerous usage of strncpy+strncat + +2009-02-20 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, src/errorlogger.h, + test/testbufferoverrun.cpp, tools/errmsg.cpp: buffer overrun: Added + checking of strncat + +2009-02-20 Daniel Marjamäki + + * test/testbufferoverrun.cpp: added todo testcases for strncat + checking + +2009-02-20 Daniel Marjamäki + + * src/threadexecutor.cpp: g++: fixed compiler errors + +2009-02-20 Reijo Tomperi + + * man/cppcheck.1.xml, src/cppcheck.cpp, src/cppcheckexecutor.cpp, + src/settings.cpp, src/settings.h, src/threadexecutor.cpp, + src/threadexecutor.h, tools/errmsg.cpp: Fix ticket #113 (Add support + for multi core CPUs and -w parameter to specifify amount of worker + threads) + +2009-02-20 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: simplify known variables: + variable used as array index + +2009-02-20 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/cppcheck.cpp, src/errorlogger.h, + src/settings.cpp, src/settings.h, test/testmemleak.cpp: memory leak: + Added command line flag '--vcl' that is used to suppress error + messages for VCL code + +2009-02-19 Reijo Tomperi + + * Makefile, cppcheck.cbp, src/cppcheck.cpp, src/cppcheck.h, + src/cppcheckexecutor.cpp, src/cppcheckexecutor.h, + src/errorlogger.cpp, src/errorlogger.h, src/threadexecutor.cpp, + src/threadexecutor.h, test/testsuite.h, tools/errmsg.cpp: Multicore + cpu support for Linux (currently disabled and compiling produces + warnings) "no errors" output removed. + +2009-02-19 Daniel Marjamäki + + * src/checkvalidate.cpp, src/checkvalidate.h, src/errorlogger.h, + src/settings.cpp, src/settings.h, test/testvalidate.cpp, + tools/errmsg.cpp: security: added simple gui checking + +2009-02-19 Daniel Marjamäki + + * Makefile, src/checkvalidate.cpp, src/checkvalidate.h, + src/errorlogger.h, test/testvalidate.cpp, testrunner.vcproj, + tools/errmsg.cpp: input validation: added checking + +2009-02-18 Daniel Marjamäki + + * test/testsimplifytokens.cpp: fixed failed tests + +2009-02-18 Daniel Marjamäki + + * test/testsimplifytokens.cpp: reverted [1254] it was made by + mistake + +2009-02-18 Daniel Marjamäki + + * test/testsimplifytokens.cpp: stl push_back: Added check (invalid + iterator) + +2009-02-18 Daniel Marjamäki + + * src/checkstl.cpp, src/checkstl.h, src/cppcheck.cpp, + src/errorlogger.h, test/teststl.cpp, tools/errmsg.cpp: stl + push_back: Added check (invalid iterator) + +2009-02-17 Daniel Marjamäki + + * src/tokenize.cpp: activated the Tokenizer::elseif functionality + +2009-02-17 Daniel Marjamäki + + * src/tokenize.cpp, src/tokenize.h, test/testsimplifytokens.cpp: + Added Tokenizer::elseif for breaking up 'else if' into 'else { if + ..' + +2009-02-16 Daniel Marjamäki + + * test/testtokenize.cpp: varid: Added a todo test case for giving + function parameters varid + +2009-02-16 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: tokenizer: fixed issues + related to variable ids * use setVarId in simplifyTokenList * make sure function parameters and variables declared in for + example for loops get variable ids + +2009-02-15 Reijo Tomperi + + * src/tokenize.cpp: astyle fix + +2009-02-15 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: tokenizer: improved the + simplification of '*(var+num)' => 'var[num]' + +2009-02-15 Daniel Marjamäki + + * src/tokenize.cpp, test/testsimplifytokens.cpp: tokenizer: Remove + redundant parantheses around number. Ticket: #105 + +2009-02-15 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: Tokenizer: Fixed bug in + tokenizer that removed '\' from preprocessor lines Ticket: #106 + +2009-02-15 Daniel Marjamäki + + * src/filelister.cpp: FileLister: handle '\\' path separator the + same way '/' is handled + +2009-02-15 Daniel Marjamäki + + * src/filelister.cpp: filelister: use '\\' instead of '/' in windows + paths + +2009-02-14 Reijo Tomperi + + * src/preprocessor.cpp: Code comments updated + +2009-02-14 Reijo Tomperi + + * src/errorlogger.h, tools/errmsg.cpp: Code comments updated + +2009-02-14 Reijo Tomperi + + * test/testtokenize.cpp: Added test case TestTokenizer::sizeof5 + +2009-02-14 Reijo Tomperi + + * src/token.cpp, src/tokenize.cpp, test/testtokenize.cpp: Constant + variable converting converted struct members (foo.a => foo.45) also, + fixed that. + +2009-02-14 Reijo Tomperi + + * src/tokenize.cpp, test/testsimplifytokens.cpp: Fix ticket #107 + (Convert + + into + and + - into -) and add test case for it + +2009-02-14 Reijo Tomperi + + * test/testsimplifytokens.cpp: Fixed typos in test case and enabled + it. + +2009-02-14 Reijo Tomperi + + * src/tokenize.cpp: astyle fix + +2009-02-14 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: tokenizer: tokenize '++', + '--' and '>>' correctly + +2009-02-14 Reijo Tomperi + + * src/cppcheck.cpp, src/errorlogger.h, test/testclass.cpp, + test/testconstructors.cpp, tools/errmsg.cpp: Fix ticket #104 (Change + (error) Uninitialized member variable -> (style) Member variable not + initialized in the constructor) + +2009-02-14 Daniel Marjamäki + + * src/cppcheck.cpp: debug output: commented out the code for writing + token listing + +2009-02-14 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: memory leak: handle + 'delete (p)' and 'delete [] (p)'. Fixes ticket 102 + +2009-02-14 Daniel Marjamäki + + * src/cppcheck.cpp, src/tokenize.cpp: simplify known value: insert + known variable value into calculations + +2009-02-13 Daniel Marjamäki + + * test/testtokenize.cpp: simplify tokens: added todo test case, the + varid is lost when simplifying variable declarations + +2009-02-13 Daniel Marjamäki + + * test/testtokenize.cpp: simplify token list: Added a TODO test + case. variable id is lost + +2009-02-13 Leandro Penz + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Preprocessor: + support for ##-comma-eating in variadic macros; passing now fmt2 + test. + +2009-02-13 Leandro Penz + + * src/tokenize.cpp, test/testtokenize.cpp: Tokenizer: fixed ## + tokenization. + +2009-02-13 Leandro Penz + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Preprocessor: + initial variadic macro support; passing now on fmt1 case. + +2009-02-13 Daniel Marjamäki + + * src/token.cpp, src/token.h, test/testtokenize.cpp: + Token::stringifyList: Added function that stringifies a token list + +2009-02-12 Reijo Tomperi + + * test/testsimplifytokens.cpp: Improved test case "double_plus" + +2009-02-12 Reijo Tomperi + + * src/token.cpp, test/testsimplifytokens.cpp: Added test case + double_plus and improved Token::printOut + +2009-02-12 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fix ticket #100 (Simplify + constants simplifies leaks out from variable scope and simplifies + whole file) + +2009-02-12 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, test/testbufferoverrun.cpp: buffer + overruns: added simple support for initialized array + +2009-02-12 Leandro Penz + + * src/checkother.cpp, test/testincompletestatement.cpp: Incomplete + statements: removed false positive when setting array of structures + or multi-dimensional arrays. + +2009-02-11 Reijo Tomperi + + * test/testtokenize.cpp: Test case TestTokenizer::simplify_constants + added (commented out) + +2009-02-11 Daniel Marjamäki + + * src/checkstl.cpp, test/teststl.cpp: stl dangerous usage of erase: + Added test cases about using return and goto + +2009-02-11 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + test/testbufferoverrun.cpp: buffer overrun: improved checking of + global variables + +2009-02-11 Leandro Penz + + * src/checkother.cpp, test/testincompletestatement.cpp: Incomplete + statement: fixed and enabled intarray test case. + +2009-02-11 Leandro Penz + + * test/testincompletestatement.cpp: Incomplete statement: test case + for statement that begins with numeric constant. + +2009-02-11 Daniel Marjamäki + + * Makefile, src/checkbufferoverrun.cpp, src/checkbufferoverrun.h: + checkbufferoverrun: cleaned up the header includes + +2009-02-11 Daniel Marjamäki + + * Makefile: updated the Makefile + +2009-02-11 Daniel Marjamäki + + * src/checkstl.cpp, src/checkstl.h, src/cppcheck.cpp, + src/errorlogger.h, test/teststl.cpp, tools/errmsg.cpp: dangerous + usage of erase: added check + +2009-02-10 Kimmo Varis + + * cppcheck.vcproj, testrunner.vcproj: Update Visual Studio project + files. + +2009-02-10 Reijo Tomperi + + * src/checkheaders.cpp, src/cppcheck.cpp, src/cppcheck.h, + src/cppcheckexecutor.cpp, src/cppcheckexecutor.h, + src/errorlogger.cpp, src/errorlogger.h, test/testsuite.cpp, + test/testsuite.h, tools/errmsg.cpp: Refactoring: reportErr takes now + only one parameter, ErrorLogger::ErrorMessage, which contains all + required information and also some help functions for formatting it + for output. + +2009-02-10 Daniel Marjamäki + + * src/checkstl.cpp, test/teststl.cpp: stl: added testcase for bad + iterator usage + +2009-02-10 Reijo Tomperi + + * src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + src/checkstl.cpp, src/checkstl.h, src/cppcheck.cpp, + test/testbufferoverrun.cpp, test/teststl.cpp: Moved stloutofbounds + check to CheckStl class. + +2009-02-10 Daniel Marjamäki + + * cppcheck.cbp: codeblocks: updated the project file + +2009-02-10 Daniel Marjamäki + + * src/checkstl.cpp: astyle coding style update + +2009-02-10 Daniel Marjamäki + + * Makefile, src/checkstl.cpp, src/checkstl.h, src/cppcheck.cpp, + src/errorlogger.h, test/teststl.cpp, tools/errmsg.cpp: STL: added + check for iterator usage + +2009-02-10 Reijo Tomperi + + * src/checkbufferoverrun.cpp, src/errorlogger.h, tools/errmsg.cpp: + stlOutOfBounds error message created + +2009-02-09 Reijo Tomperi + + * src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + test/testbufferoverrun.cpp: Fix ticket #94 (STL container overrun). + Check is currently behind --all + +2009-02-09 Reijo Tomperi + + * man/cppcheck.1.xml, src/checkdangerousfunctions.cpp, + src/checkheaders.cpp, src/cppcheck.cpp, src/cppcheck.h, + src/cppcheckexecutor.cpp, src/cppcheckexecutor.h, + src/errorlogger.cpp, src/errorlogger.h, src/tokenize.cpp, + src/tokenize.h, test/testdangerousfunctions.cpp, + test/testsuite.cpp, test/testsuite.h, tools/errmsg.cpp: Fix ticket + #93 (Write xml results into error stream instead of results.xml + file.) and also refactor the code to use ErrorLogger::reportErr() + for all errors, for both xml and plain text. And move xml formatting + from Cppcheck to CppcheckExecutor. + +2009-02-09 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/checkmemoryleak.h, + test/testmemleak.cpp: memory leak: keep track of --all better + +2009-02-09 Daniel Marjamäki + + * test/testincompletestatement.cpp: incomplete statement: added a + testcase for a false positive + +2009-02-09 Kimmo Varis + + * cppcheck.vcproj: Update Visual Studio project file. + +2009-02-09 Daniel Marjamäki + + * src/checkclass.cpp, test/testclass.cpp: uninitialized variables: + added testcases and made a fix + +2009-02-08 Reijo Tomperi + + * cppcheck.cbp: Update to codeblocks project file + +2009-02-08 Reijo Tomperi + + * Makefile, cppcheck.cbp, src/checkbufferoverrun.cpp, + src/checkclass.cpp, src/checkdangerousfunctions.cpp, + src/checkfunctionusage.cpp, src/checkmemoryleak.cpp, + src/checkother.cpp, src/cppcheck.cpp, src/errorlogger.cpp, + src/errorlogger.h, src/errormessage.cpp, src/errormessage.h, + tools/dmake.cpp, tools/errmsg.cpp: Fix ticket #80 (refactoring: + classes ErrorMessage and ErrorLogger), note that errormessage and + errorlogger were merged, errormessage.* is no more. + +2009-02-08 Daniel Marjamäki + + * test/testmemleak.cpp: Memory leak: Test code was supposed to call + unknown function + +2009-02-08 Daniel Marjamäki + + * src/errormessage.h, test/testmemleak.cpp, tools/errmsg.cpp: + mismatching allocation size: moved to error suite + +2009-02-08 Daniel Marjamäki + + * test/testmemleak.cpp: Memory leaks: Make sure leak is found even + when using unknown functions + +2009-02-08 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Memory leak: find + memory leak in TestMemleak::unknownFunction2 + +2009-02-08 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Memory leak: + Handling function that can't be traced into + +2009-02-08 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fixed issue about 4+5 + being made a single token, problem appeared in recent commits. + +2009-02-08 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fix ticket #89 (False + positive, (style) Redundant code - begins with numeric constant + (e-value)) + +2009-02-08 Reijo Tomperi + + * src/tokenize.cpp, test/testincompletestatement.cpp, + test/testtokenize.cpp: Improve fix made for Ticket #85 to handle + strings that are in 3 parts also. + +2009-02-08 Reijo Tomperi + + * src/tokenize.cpp, test/testincompletestatement.cpp, + test/testtokenize.cpp: Fixed ticket #88 (False positive, (style) + Redundant code - begins with numeric constant) + +2009-02-08 Reijo Tomperi + + * src/tokenize.cpp, test/testincompletestatement.cpp, + test/testsimplifytokens.cpp: Fix ticket #85 (False positive (style) + Redundant code, begins with string) + +2009-02-08 Daniel Marjamäki + + * test/testmemleak.cpp: Memory leaks: Added todo testcase - handle + function calls that can't be followed + +2009-02-07 Reijo Tomperi + + * src/token.cpp, src/token.h: Fixed compiler warning ( #81 ) and + optimized the speed a little. Removed _cstr from Token class, use + _str.c_str() instead. + +2009-02-07 Reijo Tomperi + + * src/cppcheck.cpp, src/tokenize.cpp, test/testpreprocessor.cpp: + Fixed more of ticket #81 (getting rid of compiler warnings) + +2009-02-07 Reijo Tomperi + + * src/checkmemoryleak.h, src/checkother.h, src/preprocessor.h, + src/tokenize.h, test/testbufferoverrun.cpp, test/testcharvar.cpp, + test/testclass.cpp, test/testconstructors.cpp, + test/testdangerousfunctions.cpp, test/testdivision.cpp, + test/testfunctionusage.cpp, test/testincompletestatement.cpp, + test/testmemleak.cpp, test/testmemleakmp.cpp, + test/testpreprocessor.cpp, test/testredundantif.cpp, + test/testtokenize.cpp, test/testunusedprivfunc.cpp, + test/testunusedvar.cpp: Fix ticket #84 (unit testing: use + "protected" instead of preprocessor) + +2009-02-07 Reijo Tomperi + + * src/checkmemoryleak.cpp, src/tokenize.cpp, test/testtokenize.cpp: + Fix ticket #83 (cppcheck hangs) and add a test case for it + +2009-02-07 Daniel Marjamäki + + * src/checkmemoryleak.cpp: Borland C++: Fix to make it compile + +2009-02-07 Reijo Tomperi + + * src/cppcheck.cpp: Fixed partially ticket #81 (getting rid of + compiler warnings) + +2009-02-07 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/checkmemoryleak.h, + src/errormessage.h, src/tokenize.cpp, test/testmemleak.cpp, + tools/errmsg.cpp: memory allocation: check for mismatching size + +2009-02-07 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: TestMemleak: fixed + problems with wrong linenumbers. This fixes ticket 79 + +2009-02-07 Daniel Marjamäki + + * cppcheck.cbproj: Borland C++: Added CheckDangerousFunctions.* to + the project + +2009-02-07 Daniel Marjamäki + + * src/filelister.cpp: FileLister: Added code that I received from + Jeffrey Walton to handle directories and files better + +2009-02-06 Daniel Marjamäki + + * test/testmemleak.cpp: TestMemleak: Fixed tests + +2009-02-06 Daniel Marjamäki + + * src/cppcheck.cpp, src/errormessage.h, tools/errmsg.cpp: mismathing + allocation and deallocation: moved to error checks + +2009-02-06 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testcppcheck.cpp, + test/testmemleak.cpp: errmsg: use the error message dealloc-use + +2009-02-06 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/checkmemoryleak.h, + test/testmemleak.cpp: memleak: removed false positives for + mismatching allocation and deallocation + +2009-02-05 Reijo Tomperi + + * src/errormessage.h, test/testbufferoverrun.cpp, + test/testclass.cpp, test/testconstructors.cpp, + test/testcppcheck.cpp, test/testdivision.cpp, test/testmemleak.cpp, + test/testother.cpp, tools/errmsg.cpp: Fixed: Ticket #78 Change + (always) into (error) in error messages + +2009-02-05 Reijo Tomperi + + * test/testcppcheck.cpp: Added test case linenumbers2 + +2009-02-05 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/cppcheck.cpp, test/testmemleak.cpp: + memleak: corrected the wrong line number (#77) + +2009-02-05 Reijo Tomperi + + * Makefile, cppcheck.cbp, test/testcppcheck.cpp: testcppcheck.cpp + file added, test case "linenumbers" added, codeblocks project file + updated + +2009-02-05 Daniel Marjamäki + + * src/checkother.cpp, test/testincompletestatement.cpp: incomplete + statement: minor update + +2009-02-04 Daniel Marjamäki + + * test/testclass.cpp: activated TestClass:function + +2009-02-04 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: remove casts: Added test + case to ensure that function declarations are not reduced + +2009-02-04 Daniel Marjamäki + + * test/testclass.cpp, test/testtokenize.cpp: testclass: added todo + testcase for #74 + +2009-02-04 Daniel Marjamäki + + * src/checkother.cpp, src/checkother.h, src/errormessage.h, + test/testother.cpp, tools/errmsg.cpp: returning pointer to local + array + +2009-02-04 Daniel Marjamäki + + * src/checkother.cpp, test/testcharvar.cpp: charvar: fixed todo + testcase + +2009-02-04 Daniel Marjamäki + + * test/testbufferoverrun.cpp: testbufferoverrun: activated test + +2009-02-04 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/checkmemoryleak.h, + test/testmemleak.cpp: memory leak: fixed ticket #9 + +2009-02-03 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fixed varid is 0 bug + which happened with sizeof(var[0]) and added testcase for it + +2009-02-02 Reijo Tomperi + + * testrunner.vcproj: Updated testrunner.vcproj files + +2009-02-02 Daniel Marjamäki + + * testrunner.vcproj: visual c++: added checkdangerousfunctions + +2009-02-02 Daniel Marjamäki + + * createrelease: added createrelease script + +2009-02-02 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: tokenizer: setvarid + handle variable declaration at start of token list + +2009-02-02 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: Tokenizer: sizeof + handling of 'sizeof(var[0])' + +2009-02-02 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: Tokenizer: setVarId + improved to handle declaration at the first token + +2009-02-02 Daniel Marjamäki + + * src/tokenize.cpp, test/testbufferoverrun.cpp, + test/testtokenize.cpp: tokenizer: improved sizeof handling + +2009-02-02 Daniel Marjamäki + + * test/testtokenize.cpp: TestTokenize: Added testcase sizeof2 (TODO) + +2009-02-02 Daniel Marjamäki + + * test/testtokenize.cpp: testtokenize: sizeof handling + +2009-02-02 Daniel Marjamäki + + * test/testmemleak.cpp: testmemleak: fixed a test case + +2009-02-02 Daniel Marjamäki + + * src/checkmemoryleak.cpp: memory leaks: Minor fix to output correct + severity + +2009-02-02 Daniel Marjamäki + + * test/testmemleak.cpp: TestMemleak: Added test cases + +2009-02-01 Daniel Marjamäki + + * src/cppcheck.cpp, src/cppcheck.h, src/cppcheckexecutor.cpp, + src/cppcheckexecutor.h, src/errorlogger.h, src/errormessage.cpp, + src/errormessage.h, src/settings.cpp, src/settings.h, + test/testsuite.cpp, test/testsuite.h, tools/errmsg.cpp: xml: + generating better xml output + +2009-02-01 Daniel Marjamäki + + * tools/errmsg.cpp: astyle formatting + +2009-02-01 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + src/checkclass.cpp, src/checkfunctionusage.cpp, + src/checkmemoryleak.cpp, src/checkother.cpp, src/errormessage.cpp, + src/errormessage.h, tools/errmsg.cpp: errmsg: refactoring the error + messages + +2009-02-01 Daniel Marjamäki + + * src/cppcheck.cpp, src/cppcheck.rc, win_installer/cppcheck.iss: + changed version to 1.28 + +2009-01-31 Reijo Tomperi + + * src/checkdangerousfunctions.cpp, src/checkdangerousfunctions.h, + src/checkmemoryleak.cpp, src/checkmemoryleak.h: Removed some dead + code and improved one function to use reference instead of a copy. + +2009-01-31 Reijo Tomperi + + * man/cppcheck.1.xml: Fixed man page, previous version had + while < and > should be used. + +2009-01-31 Reijo Tomperi + + * src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + src/checkdangerousfunctions.cpp, src/checkdangerousfunctions.h, + src/checkother.h, src/preprocessor.h: Fixing files using dos-style + line change to use unix-style line change. + +2009-01-31 Reijo Tomperi + + * cppcheck.cbp: Updated codeblocks projectfile + +2009-01-31 Daniel Marjamäki + + * tools/errmsg.cpp: removed unused function definition for + stringifySeverity + +2009-01-31 Kimmo Varis + + * cppcheck.vcproj: Add new files (Src/checkdangerousfunctions.cpp + and .h) to Visual Studio project. + +2009-01-31 Reijo Tomperi + + * src/checkdangerousfunctions.cpp, test/testdangerousfunctions.cpp: + Running astyle for the previous commits + +2009-01-31 Leandro Penz + + * Makefile, src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + src/checkdangerousfunctions.cpp, src/checkdangerousfunctions.h, + src/cppcheck.cpp, test/testdangerousfunctions.cpp: + dangerousfunctions: added check for mktemp (ticket #69), and + refatored gets and scanf check from bufferoverrun into + dangerousfunctions. + +2009-01-31 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/cppcheck.cpp, src/errormessage.h, + test/testmemleak.cpp, tools/errmsg.cpp: mismatching allocation / + deallocation: moved to --all + +2009-01-31 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/checkmemoryleak.h, + src/errormessage.h, test/testmemleak.cpp, tools/errmsg.cpp: errmsg: + output severity in messages. a fix to track severity in the memory + leaks check + +2009-01-31 Daniel Marjamäki + + * test/testmemleak.cpp: mismatching allocation and deallocation: + added test case that currently generates false positives + +2009-01-31 Daniel Marjamäki + + * src/errormessage.h, test/testbufferoverrun.cpp, + test/testcharvar.cpp, test/testclass.cpp, + test/testconstructors.cpp, test/testdivision.cpp, + test/testincompletestatement.cpp, test/testmemleak.cpp, + test/testother.cpp, test/testredundantif.cpp, + test/testunusedprivfunc.cpp, test/testunusedvar.cpp, + tools/errmsg.cpp: errmsg: write severity in the message + +2009-01-30 Daniel Marjamäki + + * test/testbufferoverrun.cpp: added test case + TestBufferOverrun::sizeof2 + +2009-01-30 Daniel Marjamäki + + * test/testcharvar.cpp: added todo testcase + +2009-01-28 Reijo Tomperi + + * man/cppcheck.1.xml: Updated man page for --unused-functions and + --xml-results + +2009-01-28 Daniel Marjamäki + + * test/testpreprocessor.cpp: preprocessor: Added testcase fmt2 that + is commented out because it doesn't work yet + +2009-01-28 Kimmo Varis + + * cppcheck.vcproj: Visual Studio: Remove incremental linking from + release target due to other option disabling it and causing warning: + Linking... LINK : warning LNK4075: ignoring '/INCREMENTAL' due to + '/OPT:ICF' specification + +2009-01-28 Daniel Marjamäki + + * src/tokenize.cpp, test/testbufferoverrun.cpp: tokenizer: fixed + TestTokenizer::sizeof1 + +2009-01-28 Daniel Marjamäki + + * src/cppcheck.cpp, src/settings.cpp, src/settings.h: unused + functions: Created command line parameter --unused-functions + +2009-01-28 Daniel Marjamäki + + * src/cppcheck.cpp, src/settings.cpp, src/settings.h: xml results: + added a command line switch for generating simple results.xml file + +2009-01-28 Daniel Marjamäki + + * test/testbufferoverrun.cpp: bad sizeof handling + +2009-01-28 Leandro Penz + + * src/checkmemoryleak.cpp: MatchFunctionsThatReturnArg: calling + Match only once. + +2009-01-27 Reijo Tomperi + + * src/tokenize.cpp, test/testsimplifytokens.cpp: Partial support for + sizeof x, by converting it into sizeof(x). Does not handle complex + structures. Closing ticket #65 + +2009-01-27 Reijo Tomperi + + * src/token.cpp, src/token.h, test/testtokenize.cpp: Fixed bug in + multiCompare, which fixes ticket #66 ([False positive] "Buffer + overrun" with "--all") + +2009-01-27 Daniel Marjamäki + + * test/testclass.cpp: uninitialized member: don't check private + constructors + +2009-01-27 Daniel Marjamäki + + * src/tokenize.cpp: function parameters: fixed segmentation fault + (derefence null) + +2009-01-27 Daniel Marjamäki + + * src/checkother.cpp: sprintf overlapping data + +2009-01-26 Reijo Tomperi + + * src/token.cpp, src/token.h, src/tokenize.cpp, src/tokenize.h, + test/testtokenize.cpp: Fix ticket #25 (simplify "void f(x) int x; {" + into "void f(int x) {") + +2009-01-26 Daniel Marjamäki + + * src/checkother.cpp, src/errormessage.h, tools/errmsg.cpp: sprintf + overlapping data: added extra text that is shown if --verbose is + given + +2009-01-26 Daniel Marjamäki + + * src/cppcheck.cpp, src/errormessage.h, tools/errmsg.cpp: errmsg: + Moved 'function parameter parname is passed by value' to the style + checks + +2009-01-26 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: memleak: class + function usage (fixing #63) + +2009-01-26 Daniel Marjamäki + + * src/tokenize.cpp, src/tokenize.h, test/testtokenize.cpp: + tokenizer: simplify redundant paranthesis + +2009-01-25 Leandro Penz + + * src/checkmemoryleak.cpp, src/checkmemoryleak.h, + test/testmemleak.cpp: memleak: strcat_result_assignment fixed by + checking some functions for "x = func(x[),]". + +2009-01-25 Daniel Marjamäki + + * test/testmemleak.cpp: testmemleak: removed the test case that was + added in [1105]. It has been moved to the TestTokenizer instead + +2009-01-25 Daniel Marjamäki + + * test/testtokenize.cpp: testtokenize: Added test case for + simplifying '((x))' to '(x)' + +2009-01-25 Daniel Marjamäki + + * test/testpreprocessor.cpp: testpreprocessor: removed unused test + case + +2009-01-25 Reijo Tomperi + + * test/testmemleak.cpp: Added test case complex_free + +2009-01-25 Reijo Tomperi + + * test/testmemleak.cpp: Test case added: strcat_result_assignment + +2009-01-25 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + stringify macros + +2009-01-25 Reijo Tomperi + + * src/cppcheck.h: Updated comments in code + +2009-01-25 Reijo Tomperi + + * src/cppcheck.cpp: Fix ticket #58 (If given path is empty it is + assumed that it wasn't given) + +2009-01-24 Reijo Tomperi + + * src/tokenize.cpp: Fix ticket #57 (wrong path in error message) + +2009-01-24 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + insert space. '#if(' => '#if (' + +2009-01-24 Leandro Penz + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: memleak: + *x=malloc(); func(&x) is no longer reported as a leak (eliminated + &use2). + +2009-01-24 Leandro Penz + + * test/testbufferoverrun.cpp: snprintf: more tests. + +2009-01-24 Reijo Tomperi + + * src/tokenize.cpp, test/testpreprocessor.cpp: Added test case + preprocessor_and_operation for ticket #55 (also fixed style from + previous commit) + +2009-01-24 Kimmo Varis + + * src/cppcheck.cpp: Fix two overly long lines in command line help. + +2009-01-24 Daniel Marjamäki + + * test/testtokenize.cpp: testtokenize: updated + 'TestTokenize::simplify_function_parameters' + +2009-01-24 Kimmo Varis + + * cppcheck.vcproj: Visual Studio: add resource.h into VS project. + +2009-01-24 Kimmo Varis + + * win_installer/cppcheck.iss, win_installer/modpath.iss: Ticket #34: + Windows installer: Add cppcheck folder to system path. + +2009-01-24 Daniel Marjamäki + + * src/tokenize.cpp: tokenizer: Added guard in case the preprocessor + is mismatching + +2009-01-24 Daniel Marjamäki + + * src/cppcheck.cpp: cppcheck: printing preprocessed file to + 'temp.txt' + +2009-01-24 Reijo Tomperi + + * src/cppcheck.cpp: Fixed ticket #54 (Make cppcheck print status + e.g. 4/20 files checked) + +2009-01-24 Reijo Tomperi + + * test/testtokenize.cpp: Added test case + simplify_function_parameters + +2009-01-23 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + src/checkother.cpp, src/checkother.h, src/preprocessor.cpp, + src/preprocessor.h, src/tokenize.cpp, src/tokenize.h: removed + windows encodings + +2009-01-23 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + src/checkother.cpp, src/checkother.h, src/preprocessor.cpp, + src/preprocessor.h, src/tokenize.cpp, src/tokenize.h: borland and + visual c++ fixes + +2009-01-23 Daniel Marjamäki + + * src/checkbufferoverrun.cpp: reverted [1084] it can be fixed better + +2009-01-23 Daniel Marjamäki + + * src/checkbufferoverrun.cpp: borland: the strtol is found in + + +2009-01-23 Daniel Marjamäki + + * src/checkclass.cpp, src/checkmemoryleak.cpp, src/filelister.cpp: + include: Had to include in a few places to be able to + compile cppcheck + +2009-01-23 Reijo Tomperi + + * src/preprocessor.cpp: Add additional checking to avoid ethernal + loops when someone is using incorrect different case for the same + file. It should be unlikely that anyone would actually use + different files in the same project and separate them only by casing + of some letters. + +2009-01-23 Reijo Tomperi + + * src/checkbufferoverrun.cpp, src/checkclass.cpp, src/checkclass.h, + src/checkheaders.cpp, src/checkmemoryleak.cpp, src/checkother.cpp, + src/filelister.cpp, src/filelister.h, src/preprocessor.cpp, + src/token.cpp, src/tokenize.cpp: Fixing ticket #35 (Get rid of + #ifdefs in our code where possible) + +2009-01-23 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: memory leak: don't + give false positive when deallocating member variable this->i (#53) + +2009-01-23 Daniel Marjamäki + + * test/testsuite.cpp: removed compiler warning + +2009-01-23 Daniel Marjamäki + + * src/cppcheck.cpp: better fix to get rid of compiler warning is to + comment the function parameter + +2009-01-23 Reijo Tomperi + + * src/cppcheck.cpp, src/preprocessor.cpp: Fixed Ticket #52, Cppcheck + hangs when checking VLC's source code + +2009-01-23 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + fixed bug with mixed macros ABC and ABCD + +2009-01-23 Daniel Marjamäki + + * src/preprocessor.cpp: removed bam coding + +2009-01-23 Daniel Marjamäki + + * src/preprocessor.cpp: preprocessor: The stdlib.h is needed for the + exit function + +2009-01-22 Daniel Marjamäki + + * src/cppcheck.cpp: cppcheck: The '&&' should be '||' when checking + if a check should be called + +2009-01-22 Daniel Marjamäki + + * Makefile, tools/dmake.cpp: Build: Enabled the Wextra flag when + building cppcheck + +2009-01-22 Reijo Tomperi + + * man/cppcheck.1.xml, src/cppcheck.cpp: Fix Ticket #46, invalid + commandline. (Also added -h and --help parameters) + +2009-01-22 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + handle redefinition of macro + +2009-01-22 Reijo Tomperi + + * man/cppcheck.1.xml, src/cppcheck.cpp, src/cppcheck.h, + src/preprocessor.cpp, src/preprocessor.h: Fix Ticket #30, Need a way + to specify include file folders (-I parameter was added) + +2009-01-22 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + handle include guards by not checking for configurations in header + files + +2009-01-21 Nicolas Le Cam + + * src/preprocessor.cpp: Code cleanup. + +2009-01-21 Reijo Tomperi + + * src/errormessage.h, src/preprocessor.cpp: Fixed style + +2009-01-21 Nicolas Le Cam + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Fix + Preprocessor::read to handle char constant of more than one char, + fixing issue #45; Fix the test that handle the case. + +2009-01-21 Nicolas Le Cam + + * src/checkother.cpp, src/checkother.h, src/cppcheck.cpp, + src/errormessage.h, test/testunusedvar.cpp, tools/errmsg.cpp: Remove + checks that are already covered well by most compilers (Unreachable + Code; Assignment in Condition; Unused Variable). + +2009-01-21 Reijo Tomperi + + * src/cppcheck.cpp, src/preprocessor.cpp, src/preprocessor.h, + test/testpreprocessor.cpp: Fix Ticket #43, preprocessor: include + file doesn't work so good in subfolders (note, because of other + issues, checking will be very slow now that this is fixed) + +2009-01-21 Reijo Tomperi + + * man/cppcheck.1.xml, src/checkbufferoverrun.cpp, + src/checkbufferoverrun.h, src/checkclass.cpp, src/checkclass.h, + src/checkfunctionusage.cpp, src/checkfunctionusage.h, + src/checkheaders.cpp, src/checkheaders.h, src/checkmemoryleak.cpp, + src/checkmemoryleak.h, src/checkother.cpp, src/checkother.h, + src/cppcheck.cpp, src/cppcheck.h, src/cppcheckexecutor.cpp, + src/cppcheckexecutor.h, src/errorlogger.h, src/errormessage.cpp, + src/errormessage.h, src/filelister.cpp, src/filelister.h, + src/main.cpp, src/preprocessor.cpp, src/preprocessor.h, + src/settings.cpp, src/settings.h, src/token.cpp, src/token.h, + src/tokenize.cpp, src/tokenize.h, test/testbufferoverrun.cpp, + test/testcharvar.cpp, test/testclass.cpp, + test/testconstructors.cpp, test/testdivision.cpp, + test/testfilelister.cpp, test/testfunctionusage.cpp, + test/testincompletestatement.cpp, test/testmemleak.cpp, + test/testmemleakmp.cpp, test/testother.cpp, + test/testpreprocessor.cpp, test/testredundantif.cpp, + test/testrunner.cpp, test/testsimplifytokens.cpp, + test/testsuite.cpp, test/testsuite.h, test/testtoken.cpp, + test/testtokenize.cpp, test/testunusedprivfunc.cpp, + test/testunusedvar.cpp, tools/dmake.cpp, tools/errmsg.cpp: Fixed + Ticket #40, Check copyright texts in files, now that we have new + developers. + +2009-01-21 Reijo Tomperi + + * test/testpreprocessor.cpp: Added test case + multi_character_character + +2009-01-21 Daniel Marjamäki + + * src/checkclass.cpp, src/cppcheck.cpp: uninitialized variables: run + always + +2009-01-21 Nicolas Le Cam + + * src/checkother.cpp: Fix CheckOther::functionVariableUsage, passing + a variable to a function also means reading it. + +2009-01-21 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + handled problem with parsing strings when expanding macros + +2009-01-21 Daniel Marjamäki + + * src/tokenize.cpp: code style + +2009-01-21 Daniel Marjamäki + + * test/testpreprocessor.cpp: preprocessor: Added todo test. It + crashes when it's used + +2009-01-20 Nicolas Le Cam + + * src/tokenize.cpp: Fix Tokenizer::setVarId for pointers and two + types variable declaration + +2009-01-20 Nicolas Le Cam + + * src/checkother.cpp: CheckOther::functionVariableUsage: minor + optimization. + +2009-01-20 Nicolas Le Cam + + * src/token.cpp: Token::Match: Allow pattern like '*|' + +2009-01-20 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fixes test case "file2", + fixes bug with include file handling + +2009-01-20 Nicolas Le Cam + + * src/checkmemoryleak.cpp, src/tokenize.cpp: Tokenizer: Remove + 'unlikely' keyword in simplifyTokenList; Don't check for it in + CheckMemoryLeak. + +2009-01-20 Daniel Marjamäki + + * using_gcov.txt: doc: how to use gcov + +2009-01-20 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + Handle ## + +2009-01-20 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: tokenizer: tokenize ## + better + +2009-01-20 Daniel Marjamäki + + * test/testtokenize.cpp: tokenizer: added testcase with include + files. It should be fixed. + +2009-01-20 Daniel Marjamäki + + * src/token.cpp, src/token.h, src/tokenize.cpp, src/tokenize.h: code + cleanup + +2009-01-19 Reijo Tomperi + + * src/errormessage.h, test/testpreprocessor.cpp: Added test case + preprocessor_doublesharp, executed ./runastyle for errormessage.h + +2009-01-19 Nicolas Le Cam + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h: Update + errormessage.h and code using it. + +2009-01-19 Nicolas Le Cam + + * tools/errmsg.cpp: errmsg: Don't create unused parameters + +2009-01-19 Reijo Tomperi + + * cppcheck.cbp: codeblocks project file changed to use make target + testrunner, instead of test + +2009-01-19 Reijo Tomperi + + * src/preprocessor.cpp, test/testpreprocessor.cpp: Added a test case + and fixed bug. If #include was inside a string, cppcheck hanged in + preprocessor. + +2009-01-19 Reijo Tomperi + + * src/cppcheck.cpp: Changed output of the program to print out the + file name before preprocessor. + +2009-01-19 Reijo Tomperi + + * src/tokenize.cpp, test/testtokenize.cpp: Fixed bug in line numbers + and enabled test case that spots it. + +2009-01-19 Daniel Marjamäki + + * test/testtokenize.cpp: testtokenize: Added test "file1". It + currently fails. + +2009-01-19 Daniel Marjamäki + + * src/tokenize.cpp: tokenizer: activated the handling of #file and + #endfile + +2009-01-19 Daniel Marjamäki + + * src/preprocessor.cpp: preprocessor: Activated the include handling + +2009-01-19 Daniel Marjamäki + + * test/testtokenize.cpp: testtokenize: Removed unneeded test case + "define1" + +2009-01-19 Daniel Marjamäki + + * test/testpreprocessor.cpp: testpreprocessor: Removed test that + doesn't work now that the preprocessor handles includes + +2009-01-19 Kimmo Varis + + * src/cppcheck.rc: Visual Studio: Fix building resource file with + Visual Studio Express. + +2009-01-18 Nicolas Le Cam + + * : Add bugtraq:url and bugtraq:logregex properties + +2009-01-18 Reijo Tomperi + + * src/preprocessor.cpp: Fixing crash, not sure about side effects. + Ticket #37 + +2009-01-18 Reijo Tomperi + + * src/checkother.cpp, src/preprocessor.cpp: Added temporary bailout + code, cppcheck crashes when string checking leaks out. This needs a + better fix, this is just to see the problem more easily. + +2009-01-18 Nicolas Le Cam + + * src/checkother.cpp, test/testother.cpp: unreachableCode: Moved + warning of a break statement following a return in --style; Added a + test case; Minor optimization. + +2009-01-18 Leandro Penz + + * src/checkother.cpp, test/testunusedvar.cpp: functionVariableUsage: + no longer SIGSEGVs on unfinished struct. Fixes Ticket #31. + +2009-01-18 Reijo Tomperi + + * src/preprocessor.cpp, src/tokenize.cpp, src/tokenize.h: More work + for includes, still commented out. Uncomment from tokenize.cpp and + preprocessor.cpp to take into use. + +2009-01-18 Reijo Tomperi + + * src/preprocessor.cpp, src/preprocessor.h: More work for includes, + still commented out. Tokenizer needs #file handling + +2009-01-18 Daniel Marjamäki + + * src/preprocessor.cpp: code style fix + +2009-01-18 Daniel Marjamäki + + * src/checkother.cpp, test/testother.cpp: strPlusChar: Fixed false + positives + +2009-01-18 Reijo Tomperi + + * src/preprocessor.cpp, src/preprocessor.h: Some work for the + include support (commented out for now) + +2009-01-18 Daniel Marjamäki + + * test/testpreprocessor.cpp: preprocessor: make sure macros are not + expanded when they are found in strings + +2009-01-18 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + Make sure that "#define ABC (a+b+c)" is expanded correctly + +2009-01-18 Daniel Marjamäki + + * src/preprocessor.cpp: preprocessor: Reactivated the expandMacros. + This time it's done after the #if #else #endif has been processed + +2009-01-18 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + fixed so the TestPreprocessor::preprocessor_undef succeeds + +2009-01-18 Kimmo Varis + + * win_installer/readme.txt: Improve the Windows installer readme + text. + +2009-01-18 Daniel Marjamäki + + * src/preprocessor.cpp: style updated + +2009-01-18 Daniel Marjamäki + + * src/preprocessor.cpp: preprocessor: Refactoring. Broke out some + functionality of expandMacros into a class Macro + +2009-01-18 Reijo Tomperi + + * test/testtokenize.cpp: Fix compile warning signed-unsigned + +2009-01-18 Reijo Tomperi + + * test/testtokenize.cpp: Refactoring: Style applied + +2009-01-18 Daniel Marjamäki + + * src/preprocessor.cpp, src/preprocessor.h, + test/testpreprocessor.cpp: Preprocessor: Reverted [1008] - The old + expandMacros was readded + +2009-01-18 Kimmo Varis + + * src/cppcheck.rc, src/resource.h: Fix VS build broken due to + tripled version resource info. + +2009-01-18 Daniel Marjamäki + + * test/testtokenize.cpp: Tokenizer: Added unit test to check that + define is tokenized correctly + +2009-01-18 Daniel Marjamäki + + * src/tokenize.cpp, test/testtokenize.cpp: tokenizer: The tokenizer + shouldn't handle comments nor preprocessor directives. The + preprocessor will take care of that + +2009-01-18 Daniel Marjamäki + + * src/preprocessor.cpp, src/preprocessor.h, + test/testpreprocessor.cpp: Preprocessor: Removed + "Preprocessor::expandMacros" and commented all its tests + +2009-01-18 Daniel Marjamäki + + * src/preprocessor.cpp: preprocessor: Don't use the "expandMacros" + from cppcheck + +2009-01-17 Reijo Tomperi + + * src/checkclass.cpp, test/testclass.cpp: Fix Ticket #32 False + positive with --style: Uninitialized member variable (when stream is + used) + +2009-01-17 Kimmo Varis + + * src/filelister.cpp: Does not understand . as current folder (Trac + #4) + +2009-01-17 Reijo Tomperi + + * test/testclass.cpp: Test case for Ticket #32 + +2009-01-17 Daniel Marjamäki + + * src/checkother.cpp, test/testunusedvar.cpp: unused var: fixed + false positives when using shift operator + +2009-01-17 Reijo Tomperi + + * tasks.txt: Removed tasks.txt, most of it is moved to Track, some + general issues were not + +2009-01-17 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, src/errormessage.h, src/resource.h, + test/testbufferoverrun.cpp, tools/errmsg.cpp: bounds checking: Added + error message "snprintf size is out of bounds" + +2009-01-17 Reijo Tomperi + + * cppcheck.vcproj, src/cppcheck.rc, src/resource.h: Patch [ 2508549 + ] Add Windows version resource + +2009-01-17 Reijo Tomperi + + * win_installer/cppcheck.iss, win_installer/readme.txt: patch [ + 2508523 ] Windows installer (with readme.txt based on patch + comments) + +2009-01-17 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/errormessage.h, + test/testmemleak.cpp, tools/errmsg.cpp: errmsg: added varname to the + message "deallocating a deallocated pointer" + +2009-01-17 Daniel Marjamäki + + * src/checkother.cpp, test/testunusedvar.cpp: unused variable: + reading the value of variable in a for loop.. "for(;a;)" see ticket + #18 + +2009-01-17 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: memory leak: detect + memory leak (#6) + +2009-01-16 Reijo Tomperi + + * src/cppcheck.cpp: Added .c++ to help texts also. + +2009-01-16 Daniel Marjamäki + + * src/preprocessor.cpp: preprocessor: bail out code in expandMacros + +2009-01-16 Reijo Tomperi + + * src/filelister.cpp: Add support for .c++ files ( Debian + Bug#512060: cppcheck: refuses to check .c++ files ) + +2009-01-16 Daniel Marjamäki + + * src/preprocessor.cpp: preprocessor: Fixed a null pointer + dereference + +2009-01-16 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Memory leak: Fixed + false positives about deallocating pointer that has already been + deallocated + +2009-01-16 Daniel Marjamäki + + * src/checkfunctionusage.cpp: function usage: don't report "main" + and "if" as unused + +2009-01-16 Daniel Marjamäki + + * src/checkmemoryleak.cpp: memory leak: don't show debug info + +2009-01-16 Kimmo Varis + + * testrunner.vcproj: Visual Studio: fix testrunner project file by + adding subfolders to paths. Disable 'warnings as errors' as there + are lots of warnings. + +2009-01-15 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/errormessage.h, + test/testmemleak.cpp, tools/errmsg.cpp: memory leaks: Added checking + of deallocate to see that the pointer isn't deallocated already + +2009-01-15 Daniel Marjamäki + + * src/checkother.cpp: code style + +2009-01-15 Daniel Marjamäki + + * src/checkother.cpp, test/testother.cpp: str plus char: added + simple variable handling + +2009-01-15 Daniel Marjamäki + + * src/checkother.cpp: code style fixing + +2009-01-15 Daniel Marjamäki + + * src/checkother.cpp, src/checkother.h, src/cppcheck.cpp, + src/errormessage.h, test/testother.cpp, tools/errmsg.cpp: str plus + char: Added check and error message for str + ch + +2009-01-14 Daniel Marjamäki + + * src/preprocessor.cpp: preprocessor: Bail out the expandMacros if + it finds "#undef". The previous handling can cause cppcheck to hang + +2009-01-14 Daniel Marjamäki + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h, + test/testclass.cpp, tools/errmsg.cpp: errmsg: Added 'condition is + always true/false' + +2009-01-14 Daniel Marjamäki + + * src/checkclass.cpp, test/testclass.cpp: Uninitialized member + variables: Checking enum variables + +2009-01-14 Daniel Marjamäki + + * src/preprocessor.cpp: preprocessor: a segmentation fault fix. + Check if tokens is null. + +2009-01-14 Daniel Marjamäki + + * src/checkmemoryleak.cpp: dos2unix fixing + +2009-01-14 Daniel Marjamäki + + * test/testmemleak.cpp: memory leak: Added test case + +2009-01-14 Daniel Marjamäki + + * src/checkmemoryleak.cpp: memory leak: fixed false positive about + using variable after it is released + +2009-01-14 Daniel Marjamäki + + * src/cppcheck.cpp: cppcheck: added function call to the variable + scope check. + +2009-01-14 Daniel Marjamäki + + * cppcheck.vcproj: Visual C++: Added "src/errormessage.*" to the + project file + +2009-01-14 Daniel Marjamäki + + * src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + test/testbufferoverrun.cpp: buffer overruns: added sprintf checking + +2009-01-14 Daniel Marjamäki + + * src/checkbufferoverrun.h: doxygen: Added comments in + checkbufferoverrun.h + +2009-01-14 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/checkmemoryleak.h, + test/testmemleak.cpp: Memory leak: Readded some checking to classes + +2009-01-14 Leandro Penz + + * src/checkother.cpp: unreachableCode: avoid SIGSEGV when there is + no "}" after return. + +2009-01-14 Leandro Penz + + * src/checkother.cpp, test/testunusedvar.cpp: functionVariableUsage: + support for nested struct/union declaration. + +2009-01-13 Daniel Marjamäki + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: Memory leak: Fixed + a false positive + +2009-01-13 Daniel Marjamäki + + * src/checkfunctionusage.cpp, src/checkother.cpp, src/cppcheck.cpp, + src/errormessage.h, tools/errmsg.cpp: errmsg: Added 'assignment in + if-condition' + +2009-01-13 Daniel Marjamäki + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: refactoring + +2009-01-12 Daniel Marjamäki + + * test/testpreprocessor.cpp: testpreprocessor: commented the "undef" + test that doesn't work + +2009-01-12 Daniel Marjamäki + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: added message about bad usage of char + variable + +2009-01-12 Reijo Tomperi + + * test/testpreprocessor.cpp: Added test case which currently fails, + #undef is not handled + +2009-01-12 Daniel Marjamäki + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: Added message for 'incomplete statement' + +2009-01-12 Daniel Marjamäki + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: Added messages for 'variable is not used / + not read / not assigned' + +2009-01-12 Daniel Marjamäki + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: Added message 'function parameter is + passed by value' + +2009-01-12 Daniel Marjamäki + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: added message 'unreachable code below + return' + +2009-01-12 Daniel Marjamäki + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: Added 'unused struct member' + +2009-01-12 Daniel Marjamäki + + * test/testdivision.cpp: testdivision: The 'unsigned division' is a + style check + +2009-01-12 Daniel Marjamäki + + * src/errormessage.h, tools/errmsg.cpp: errmsg: Made the 'unsigned + division' a style error + +2009-01-12 Daniel Marjamäki + + * src/checkother.cpp, src/checkother.h, src/cppcheck.cpp, + src/errormessage.h, test/testcharvar.cpp, test/testdivision.cpp, + test/testincompletestatement.cpp, test/testother.cpp, + test/testredundantif.cpp, test/testunusedvar.cpp, tools/errmsg.cpp: + errmsg: Added 'unsigned division' + +2009-01-12 Daniel Marjamäki + + * src/checkclass.cpp: refactoring: cleanup old code + +2009-01-12 Daniel Marjamäki + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: Added message 'Overlapping data buffer' + +2009-01-12 Daniel Marjamäki + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: Added "found redundant if - 'if + (condition);' + +2009-01-12 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + Style updates + +2009-01-12 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + Handle newlines better + +2009-01-11 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + fixed a small bug when expanding macro without parameter + +2009-01-11 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + Fixed bug when expanding macros without parameters + +2009-01-11 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + expand macro without parameters + +2009-01-11 Daniel Marjamäki + + * src/checkother.cpp, test/testunusedvar.cpp: struct member usage: + bail out the check if the struct contain any functions + +2009-01-11 Daniel Marjamäki + + * src/tokenize.cpp, test/testother.cpp: setVarId: Fixed bug + (variable id for struct member not correctly set) + +2009-01-11 Daniel Marjamäki + + * test/testpreprocessor.cpp: preprocessor: Added a test to see that + "" is handled correctly inside strings + +2009-01-11 Daniel Marjamäki + + * src/checkfunctionusage.cpp, src/errormessage.h, + src/preprocessor.cpp, tools/errmsg.cpp: errmsg: the "unused + function" message shall not take any Tokenizer nor Token parameters + +2009-01-11 Daniel Marjamäki + + * src/preprocessor.cpp, test/testpreprocessor.cpp: preprocessor: + Handle "" better + +2009-01-11 Daniel Marjamäki + + * Makefile, src/checkfunctionusage.cpp, src/cppcheck.cpp, + src/errormessage.h, src/settings.cpp, src/settings.h, + tools/errmsg.cpp: errmsg: added "unused function" + +2009-01-11 Daniel Marjamäki + + * Makefile, tools/dmake.cpp: dmake: Minor updates. Moved target + "all" a little. Handle the change 937 where "make test" also + executes testrunner + +2009-01-10 Leandro Penz + + * Makefile: make test now builds everything and runs all tests. + +2009-01-10 Leandro Penz + + * src/token.cpp, test/testtokenize.cpp: match: skip initial !! + patterns if on first token. + +2009-01-10 Leandro Penz + + * src/token.cpp: match: optimisation + +2009-01-10 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: added "mismatching allocation and + deallocation" + +2009-01-10 Daniel Marjamäki + + * src/cppcheck.cpp: cppcheck: Minor bug fix + +2009-01-10 Daniel Marjamäki + + * Makefile, src/checkbufferoverrun.cpp, src/checkbufferoverrun.h, + src/cppcheck.cpp, src/errormessage.h, tools/errmsg.cpp: errmsg: + Added error messages for "Array index out of bounds" and "Buffer + overrun" + +2009-01-10 Daniel Marjamäki + + * src/checkclass.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: added error message about virtual + destructors + +2009-01-10 Daniel Marjamäki + + * src/checkclass.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: Added "operator= should return something + +2009-01-10 Daniel Marjamäki + + * src/checkclass.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errmsg: Added "Using 'memset' on class" + +2009-01-10 Daniel Marjamäki + + * src/checkclass.cpp, src/cppcheck.cpp, src/errormessage.h, + test/testunusedprivfunc.cpp, tools/errmsg.cpp: errmsg: Added "Unused + private function ..." + +2009-01-10 Daniel Marjamäki + + * src/checkclass.cpp, src/cppcheck.cpp, src/errormessage.h, + test/testconstructors.cpp, tools/errmsg.cpp: errmsg: Added + "uninitialized member variable" + +2009-01-10 Leandro Penz + + * src/checkmemoryleak.cpp, test/testmemleak.cpp: checkmemoryleak: no + longer flag "dealloc ; alloc ; if continue ;" as a leak, even with + --all + +2009-01-10 Daniel Marjamäki + + * src/checkother.cpp, test/testunusedvar.cpp: unused struct member: + fixed false positive for member "const int a;" + +2009-01-10 Daniel Marjamäki + + * src/checkclass.cpp, test/testother.cpp, tools/errmsg.cpp: astyle: + updated the code style + +2009-01-10 Daniel Marjamäki + + * src/checkother.cpp, test/testother.cpp: sprintf: fixed bug "false + positive when variable is used again after snprintf" + +2009-01-10 Daniel Marjamäki + + * Makefile, src/checkclass.cpp, src/cppcheck.cpp, + src/errormessage.h, test/testconstructors.cpp, tools/errmsg.cpp: + errmsg: Added errormessage for 'the class 'classname' doesn't have a + constructor' + +2009-01-10 Daniel Marjamäki + + * src/errormessage.h, tools/errmsg.cpp: errmsg: bug fix + +2009-01-10 Daniel Marjamäki + + * src/checkother.cpp, test/testother.cpp: sprintf: fixed false + positives with "sprintf(buf, "%i", sizeof(buf)); + +2009-01-10 Daniel Marjamäki + + * tools/errmsg.cpp: errmsg: reformatted with astyle + +2009-01-10 Daniel Marjamäki + + * tools/errmsg.cpp: errmsg: The generated code is compliant with the + astyle formatting + +2009-01-10 Daniel Marjamäki + + * Makefile, tools/dmake.cpp: dmake: minor fixes. The tools binaries + will be put in the tools folder + +2009-01-10 Daniel Marjamäki + + * src/token.cpp: match: optimisation + +2009-01-10 Daniel Marjamäki + + * src/preprocessor.cpp: preprocessor: code style fixing + +2009-01-10 Daniel Marjamäki + + * src/preprocessor.cpp: preprocessor: handle the \newline in strings + +2009-01-10 Leandro Penz + + * src/token.cpp, test/testtokenize.cpp: token: when Token::Match + reached the end of input, it returned true if the next pattern was + !!. It now returns true only if all remaining patterns are !!. + +2009-01-09 Reijo Tomperi + + * tasks.txt: tasks updated, parseArgs refactoring idea was rejected + +2009-01-09 Daniel Marjamäki + + * tasks.txt: tasks: removed the "new checks" sections because these + are better reported in the tracker + +2009-01-09 Daniel Marjamäki + + * Makefile, tools/dmake.cpp: make: updated the make so that the + tools are built with "make all". And added the errormessage.h + generator to the makefile also + +2009-01-09 Daniel Marjamäki + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h, + tools/errmsg.cpp: errormessage: added error message + ErrorMessage::dangerousUsageStrtol + +2009-01-09 Daniel Marjamäki + + * src/errormessage.cpp: errormessage: added header + +2009-01-09 Daniel Marjamäki + + * tools/dmake.cpp: dmake: don't generate Makefile if there are no + src files + +2009-01-09 Daniel Marjamäki + + * src/tokenize.cpp: tokenize: avoid "terminate called after throwing + an instance of 'std::out_of_range'" + +2009-01-08 Reijo Tomperi + + * cppcheck.cbp, test/testpreprocessor.cpp: Added test case for + preprocessor which currently fails. codeblocks project file updated, + tools-files added. + +2009-01-08 Reijo Tomperi + + * src/cppcheck.cpp, src/cppcheck.h, src/cppcheckexecutor.cpp, + src/cppcheckexecutor.h, src/main.cpp: Main returns now EXIT_SUCCESS + or EXIT_FAILURE instead of 0. Feature request fixed: [ 2489787 ] + Return value of cppcheck is always 0 + +2009-01-08 Reijo Tomperi + + * src/checkother.cpp, src/cppcheck.cpp, src/errormessage.h, + test/testother.cpp: astyle changes, missed from previous commits + +2009-01-08 Reijo Tomperi + + * Makefile, tools/dmake.cpp: Fixed make install from the generated + makefile + +2009-01-08 Daniel Marjamäki + + * Makefile, src/checkother.cpp, src/cppcheck.cpp, + src/errormessage.h, test/testredundantif.cpp, tools/errmsg.cpp: + errormessage: Added a few more messages for checkother.cpp + +2009-01-08 Reijo Tomperi + + * src/errormessage.h, tools/errmsg.cpp: Added license text to + errormessage.h (via code tha generates it) and also mention that it + is generated by machine + +2009-01-08 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/cppcheck.cpp, tasks.txt: + errormessage: Added the new errormessage handling to cppcheck + +2009-01-08 Daniel Marjamäki + + * src/errormessage.cpp, src/errormessage.h: errormessage: updated + the files. the errormessage.h is automaticly generated by the + tools/errmsg program + +2009-01-08 Daniel Marjamäki + + * tools/errmsg.cpp: tools/errmsg: some refactoring + +2009-01-08 Daniel Marjamäki + + * src/checkother.cpp, test/testother.cpp: sprintf: check for + dangerous usage with sprintf|snprintf with overlapping data + +2009-01-08 Daniel Marjamäki + + * runastyle: runastyle : also set the code style in the tools + +2009-01-08 Daniel Marjamäki + + * tools/dmake.cpp, tools/errmsg.cpp: tools: Added headers to source + files + +2009-01-07 Daniel Marjamäki + + * src/checkmemoryleak.cpp, src/checkmemoryleak.h, src/tokenize.cpp, + test/testmemleak.cpp: Simplify tokens: add a ";" after case and + default + +2009-01-07 Daniel Marjamäki + + * src/preprocessor.cpp: preprocessor: applied patch submitted by + kimmov + +2009-01-07 Daniel Marjamäki + + * src/checkclass.cpp, src/checkmemoryleak.cpp, + src/preprocessor.cpp, src/token.cpp, src/tokenize.cpp: Reverted + [890] it cause more problems with Visual C++ + +2009-01-07 Daniel Marjamäki + + * cppcheck.vcproj: Visual C++: Applied patch "fix_vs_project.patch" + that kimmov submitted + +2009-01-07 Daniel Marjamäki + + * tools/dmake.cpp, tools/errmsg.cpp: tools: updated the code style + +2009-01-07 Daniel Marjamäki + + * src/checkclass.cpp, src/checkmemoryleak.cpp, + src/preprocessor.cpp, src/token.cpp, src/tokenize.cpp: Borland C++: + Removed unneeded ifdefs + +2009-01-07 Daniel Marjamäki + + * runastyle.bat: windows: Added runastyle.bat + +2009-01-07 Daniel Marjamäki + + * cppcheck.cbproj, testrunner.cbproj: Borland C++: Updated the + project files + +2009-01-06 Reijo Tomperi + + * src/checkmemoryleak.cpp: Optimization: 6,2 s -> 5,6 s + +2009-01-06 Reijo Tomperi + + * cppcheck.cbp: Changed codeblocks project file to reflect new build + targets + +2009-01-06 Daniel Marjamäki + + * Makefile, tools/dmake.cpp: tools/dmake: A few simple fixes. + Commited the new Makefile + +2009-01-06 Daniel Marjamäki + + * tools/Makefile, tools/dmake.cpp: tools: dmake added a tool for + maintaining the Makefile + +2009-01-06 Reijo Tomperi + + * doxyfile, tasks.txt: Doxyfile added + +2009-01-06 Daniel Marjamäki + + * tools/errmsg.cpp: tools/errmsg: minor fixes + +2009-01-06 Daniel Marjamäki + + * tools/errmsg.cpp: tools/errmsg: code correction + +2009-01-06 Daniel Marjamäki + + * tools/errmsg.cpp: tools/errmsg: generate documentation + +2009-01-06 Daniel Marjamäki + + * tools/errmsg.cpp: tools/errmsg: generate the function to use when + determining if a check should be done or not + +2009-01-06 Daniel Marjamäki + + * tools/errmsg.cpp: tools: Added a folder where we can keep small + usable utilities + +2009-01-06 Reijo Tomperi + + * Makefile, checkbufferoverrun.cpp, checkbufferoverrun.h, + checkclass.cpp, checkclass.h, checkfunctionusage.cpp, + checkfunctionusage.h, checkheaders.cpp, checkheaders.h, + checkmemoryleak.cpp, checkmemoryleak.h, checkother.cpp, + checkother.h, cppcheck.cbp, cppcheck.cpp, cppcheck.h, + cppcheckexecutor.cpp, cppcheckexecutor.h, errorlogger.h, + errormessage.cpp, errormessage.h, filelister.cpp, filelister.h, + main.cpp, preprocessor.cpp, preprocessor.h, runastyle, + settings.cpp, settings.h, src/checkbufferoverrun.cpp, + src/checkbufferoverrun.h, src/checkclass.cpp, src/checkclass.h, + src/checkfunctionusage.cpp, src/checkfunctionusage.h, + src/checkheaders.cpp, src/checkheaders.h, src/checkmemoryleak.cpp, + src/checkmemoryleak.h, src/checkother.cpp, src/checkother.h, + src/cppcheck.cpp, src/cppcheck.h, src/cppcheckexecutor.cpp, + src/cppcheckexecutor.h, src/errorlogger.h, src/errormessage.cpp, + src/errormessage.h, src/filelister.cpp, src/filelister.h, + src/main.cpp, src/preprocessor.cpp, src/preprocessor.h, + src/settings.cpp, src/settings.h, src/token.cpp, src/token.h, + src/tokenize.cpp, src/tokenize.h, test/testbufferoverrun.cpp, + test/testcharvar.cpp, test/testclass.cpp, + test/testconstructors.cpp, test/testdivision.cpp, + test/testfilelister.cpp, test/testfunctionusage.cpp, + test/testincompletestatement.cpp, test/testmemleak.cpp, + test/testmemleakmp.cpp, test/testother.cpp, + test/testpreprocessor.cpp, test/testredundantif.cpp, + test/testrunner.cpp, test/testsimplifytokens.cpp, + test/testsuite.cpp, test/testsuite.h, test/testtoken.cpp, + test/testtokenize.cpp, test/testunusedprivfunc.cpp, + test/testunusedvar.cpp, testbufferoverrun.cpp, testcharvar.cpp, + testclass.cpp, testconstructors.cpp, testdivision.cpp, + testfilelister.cpp, testfunctionusage.cpp, + testincompletestatement.cpp, testmemleak.cpp, testmemleakmp.cpp, + testother.cpp, testpreprocessor.cpp, testredundantif.cpp, + testrunner.cpp, testsimplifytokens.cpp, testsuite.cpp, testsuite.h, + testtoken.cpp, testtokenize.cpp, testunusedprivfunc.cpp, + testunusedvar.cpp, token.cpp, token.h, tokenize.cpp, tokenize.h: + Refactoring: Added src/ and test/ folders. Moved source files to + those folders, updated makefile and codeblocks project file. + +2009-01-06 Daniel Marjamäki + + * tasks.txt: tasks : Added tasks to create a doxygen project file + +2009-01-06 Daniel Marjamäki + + * tasks.txt: tasks: rewrote the tasks file + +2009-01-06 Daniel Marjamäki + + * preprocessor.cpp, testpreprocessor.cpp: Preprocessor: Refactoring + the unit testing. And enabled the macro expansion + +2009-01-06 Daniel Marjamäki + + * preprocessor.cpp, testpreprocessor.cpp: Preprocessor: Improved + handling of multiline macros + +2009-01-06 Daniel Marjamäki + + * Makefile: Makefile: Fixed the preprocessor dependencies + +2009-01-05 Reijo Tomperi + + * tasks.txt: tasks.txt updated, %var1% task is done + +2009-01-05 Reijo Tomperi + + * checkmemoryleak.cpp, token.cpp, token.h: Refactoring: %var1% + complitely removed. Execution time increased from 4,7 to 6,2 + seconds. + +2009-01-05 Reijo Tomperi + + * checkmemoryleak.cpp: Refactoring: Getting rid of %var1% + +2009-01-05 Reijo Tomperi + + * checkmemoryleak.cpp: Refactoring: Getting rid of %var1% + +2009-01-05 Daniel Marjamäki + + * testpreprocessor.cpp: Preprocessor : Added a few more testcases + for the macro expansion + +2009-01-05 Daniel Marjamäki + + * preprocessor.cpp, testpreprocessor.cpp: Preprocessor: Added simple + handling for expanding preprocessor macros + +2009-01-05 Daniel Marjamäki + + * runastyle: runastyle: Added script for running "astyle" with the + options I have chosen against all cpp and h files + +2009-01-05 Daniel Marjamäki + + * checkbufferoverrun.cpp, checkbufferoverrun.h, checkclass.cpp, + checkclass.h, checkfunctionusage.cpp, checkfunctionusage.h, + checkheaders.cpp, checkheaders.h, checkmemoryleak.cpp, + checkmemoryleak.h, checkother.cpp, checkother.h, cppcheck.cpp, + cppcheck.h, cppcheckexecutor.cpp, cppcheckexecutor.h, + errorlogger.h, errormessage.h, filelister.cpp, filelister.h, + main.cpp, preprocessor.cpp, preprocessor.h, testbufferoverrun.cpp, + testcharvar.cpp, testclass.cpp, testconstructors.cpp, + testdivision.cpp, testfilelister.cpp, testfunctionusage.cpp, + testincompletestatement.cpp, testmemleak.cpp, testmemleakmp.cpp, + testother.cpp, testpreprocessor.cpp, testredundantif.cpp, + testrunner.cpp, testsimplifytokens.cpp, testsuite.cpp, testsuite.h, + testtoken.cpp, testtokenize.cpp, testunusedprivfunc.cpp, + testunusedvar.cpp, token.cpp, token.h, tokenize.cpp, tokenize.h: + Style: Updated the coding style with "astyle" + +2009-01-05 Daniel Marjamäki + + * preprocessor.cpp, preprocessor.h, testpreprocessor.cpp: + Preprocessor: Began work on the macro handling + +2009-01-05 Daniel Marjamäki + + * checkclass.cpp: Refactoring: Simplified a condition + +2009-01-04 Reijo Tomperi + + * checkclass.cpp: Refactoring: Getting rid of %var1% + +2009-01-04 Reijo Tomperi + + * checkbufferoverrun.cpp: Refactoring: Getting rid of %var1% + +2009-01-04 Reijo Tomperi + + * checkclass.cpp, checkother.cpp, token.cpp: Fixed several bugs from + previous commits and added check code that will print errors if + varid is 0 when %varid% is given in Match(). + +2009-01-04 Reijo Tomperi + + * checkclass.cpp, token.cpp, token.h: Refactoring: findMatch() that + supports varId added. %var1% -> %varid% changed + +2009-01-04 Daniel Marjamäki + + * filelister.cpp: MinGW: Applied the patch submitted by kidkat that + makes cppcheck compilable with MinGW + +2009-01-04 Daniel Marjamäki + + * checkother.cpp, testunusedvar.cpp: variable usage: fixed false + positive when using operator '^' + +2009-01-04 Reijo Tomperi + + * filelister.cpp: Made previous feature request fix more portable + +2009-01-04 Daniel Marjamäki + + * cppcheck.cpp: variable usage: The check must be made before + simplifyTokenList to avoid false positives + +2009-01-04 Reijo Tomperi + + * filelister.cpp: Fix for feature request: [ 2485706 ] Add support + to *.C file extension + +2009-01-04 Daniel Marjamäki + + * checkother.cpp: Variable usage: Addon to previous commit. Also + handle "&=" and "^=" + +2009-01-04 Daniel Marjamäki + + * checkother.cpp, testunusedvar.cpp: unused variable: Fixed false + positive when using '|=' assignment + +2009-01-04 Daniel Marjamäki + + * checkother.cpp, testunusedvar.cpp: Variable usage : Fixed false + positives for struct/union member variables + +2009-01-04 Daniel Marjamäki + + * checkother.cpp, testunusedvar.cpp: Variable usage: Fixed false + positive with operators ~ and ! + +2009-01-04 Daniel Marjamäki + + * checkother.cpp, testunusedvar.cpp: Variable usage: Fixed false + positives (tmp1 ? tmp2 : tmp3) + +2009-01-04 Daniel Marjamäki + + * testunusedvar.cpp: variable usage: added a test case to make sure + usage in a if is seen + +2009-01-04 Daniel Marjamäki + + * checkother.cpp, testunusedvar.cpp: Variable usage : Fixed false + positive with modulo + +2009-01-04 Daniel Marjamäki + + * checkother.cpp: Variable usage: Fixed a segmentation fault + +2009-01-04 Daniel Marjamäki + + * checkother.cpp, testunusedvar.cpp: Struct member usage : Check + union member variables at the same time + +2009-01-04 Daniel Marjamäki + + * checkother.cpp: Variable usage: fixed false positives for union + member variables + +2009-01-04 Daniel Marjamäki + + * checkother.cpp, testunusedvar.cpp: struct member usage: fixed + false positives + +2009-01-04 Reijo Tomperi + + * checkother.cpp: Refactoring var1 -> varid + +2009-01-04 Daniel Marjamäki + + * checkother.cpp, testunusedvar.cpp: Function usage : Fixed false + positives for inline structs + +2009-01-04 Daniel Marjamäki + + * checkother.cpp, testunusedvar.cpp: Variable usage : Fixed a false + positive for ("b = (int)a;" => a is read) + +2009-01-04 Daniel Marjamäki + + * tokenize.cpp: tokenize : Removed unneeded variable + +2009-01-04 Daniel Marjamäki + + * checkother.cpp: Refactoring : Changed a 'strcmp' to a + 'simpleMatch' + +2009-01-03 Reijo Tomperi + + * checkother.cpp: Possibly bug fix, changed %var% into %var1% as + name was also given as a parameter to Match(). Not sure which was + intended here. + +2009-01-03 Reijo Tomperi + + * checkbufferoverrun.cpp, checkclass.cpp, checkmemoryleak.cpp, + checkother.cpp, token.cpp, token.h, tokenize.cpp: Refactoring: + Changed order of parameters in Match() and findMatch() (deprecated + parameter moved to last) + +2009-01-03 Reijo Tomperi + + * checkother.cpp, testcharvar.cpp: Refactoring: %var1% -> %varid% + +2009-01-03 Reijo Tomperi + + * checkbufferoverrun.cpp, checkbufferoverrun.h, checkclass.cpp, + checkclass.h, checkfunctionusage.cpp, checkheaders.cpp, + checkmemoryleak.cpp, checkmemoryleak.h, checkother.cpp, + checkother.h, tasks.txt, testmemleak.cpp, testmemleakmp.cpp, + testsimplifytokens.cpp, testsuite.h, testtoken.cpp, + testtokenize.cpp, token.cpp, token.h, tokenize.cpp, tokenize.h: + Refactoring: Rename class "TOKEN" to "Token" + +2009-01-03 Daniel Marjamäki + + * cppcheck.cpp: Buffer overrun: Moved the "buffer overrun" and + "array index out of bounds" to "--all" because there were false + positives + +2009-01-03 Reijo Tomperi + + * Makefile, cppcheck.cbp, errormessage.cpp, errormessage.h: + ErrorMessage class added (not used yet and it is still unfinished) + +2009-01-03 Daniel Marjamäki + + * checkmemoryleak.cpp: Refactoring : Removed a short commented code + that I never use anyway + +2009-01-03 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Using freed memory : Fixed + false positive when usage is something like: printf("free %x",p); + +2009-01-03 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak : Fixed a + regression and added a test case + +2009-01-02 Reijo Tomperi + + * checkbufferoverrun.cpp, checkbufferoverrun.h, checkclass.cpp, + checkclass.h, checkfunctionusage.cpp, checkfunctionusage.h, + checkheaders.cpp, checkheaders.h, checkmemoryleak.cpp, + checkmemoryleak.h, checkother.cpp, checkother.h, cppcheck.cpp, + cppcheck.h, cppcheckexecutor.cpp, cppcheckexecutor.h, + errorlogger.h, filelister.cpp, filelister.h, main.cpp, + preprocessor.cpp, preprocessor.h, settings.cpp, settings.h, + testbufferoverrun.cpp, testcharvar.cpp, testclass.cpp, + testconstructors.cpp, testdivision.cpp, testfilelister.cpp, + testfunctionusage.cpp, testincompletestatement.cpp, + testmemleak.cpp, testmemleakmp.cpp, testother.cpp, + testpreprocessor.cpp, testredundantif.cpp, testrunner.cpp, + testsimplifytokens.cpp, testsuite.cpp, testsuite.h, testtoken.cpp, + testtokenize.cpp, testunusedprivfunc.cpp, testunusedvar.cpp, + token.cpp, token.h, tokenize.cpp, tokenize.h: Copyright 2007-2008 -> + 2007-2009 + +2009-01-02 Reijo Tomperi + + * token.cpp: Refactoring: Constructor of TOKEN changed to use + initialization list instead of assignment. + +2009-01-02 Daniel Marjamäki + + * preprocessor.cpp, preprocessor.h, testpreprocessor.cpp: + Preprocessor : Replace "#if defined(.." with "ifdef .." where + possible + +2009-01-02 Daniel Marjamäki + + * testmemleak.cpp: Memory leak : Added test case "if10" which is + similar to "if9" + +2009-01-02 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak: Improved the + checking of usage after free (if str is freed then "char c = + str[0];" is illegal) + +2009-01-02 Daniel Marjamäki + + * testmemleak.cpp: Memory leak: Renamed the test case "func12" to + "if9" + +2009-01-02 Nicolas Le Cam + + * testmemleak.cpp: Memory leak : Add a new test that currently fail + to highlight a regression + +2009-01-02 Nicolas Le Cam + + * cppcheck.cpp: Preprocessor: Get rid of an unused parameter + +2009-01-02 Nicolas Le Cam + + * preprocessor.cpp, preprocessor.h, testpreprocessor.cpp: + Preprocessor: Get rid of an unused parameter + +2009-01-02 Nicolas Le Cam + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak : Completly fix + false positive when using callbacks (Bug 2458510) + +2009-01-01 Reijo Tomperi + + * checkother.cpp: Refactoring: i++; changed to ++i; + +2009-01-01 Reijo Tomperi + + * checkbufferoverrun.cpp, checkclass.cpp, checkheaders.cpp, + checkmemoryleak.cpp, checkother.cpp, cppcheck.cpp, + preprocessor.cpp, testmemleak.cpp, testsuite.cpp, token.cpp, + tokenize.cpp: Refactoring: Prefer ++i; over i++; + +2009-01-01 Daniel Marjamäki + + * checkmemoryleak.cpp: Memory leak : Changed the handling of + "realloc" a little. The "getcode" will return "realloc" instead. And + this will be converted to "dealloc;alloc;" before simplifycode + +2009-01-01 Daniel Marjamäki + + * checkmemoryleak.cpp: Memory leak : a little different handling + when the callstack gets too big + +2009-01-01 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak : fixed false + positive when there are recursive calls. (using memory after it has + been freed) + +2009-01-01 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak : Fixed false + positives for "memory is used after it has been freed" + +2009-01-01 Daniel Marjamäki + + * checkmemoryleak.cpp: Memory leak : Fixed a bug in getcode + (assignment) + +2009-01-01 Daniel Marjamäki + + * checkmemoryleak.cpp, testtoken.cpp, token.cpp, token.h, + tokenize.cpp: TOKEN: Renamed TOKEN::setstr to TOKEN::str + +2009-01-01 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak : Fix to avoid + false positives + +2008-12-31 Daniel Marjamäki + + * checkmemoryleak.cpp: memory leak: removed 'if(true)' and + 'if(false)' as these are handled in the tokenizer instead + +2008-12-31 Daniel Marjamäki + + * releasenotes.txt: releasenotes : removed this file + +2008-12-31 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak : Added check + "Using resource after it has been released" + +2008-12-31 Daniel Marjamäki + + * checkother.cpp: if checking : fixed bug in previous commit + +2008-12-31 Daniel Marjamäki + + * checkother.cpp: if statements : bug fix and refactorings in the + checking for "if (condition);" + +2008-12-30 Daniel Marjamäki + + * cppcheck.cpp: help : minor updates to help text that cppcheck + shows when no parameters are given + +2008-12-30 Daniel Marjamäki + + * readme.txt: readme : minor updates + +2008-12-30 Reijo Tomperi + + * cppcheck.cpp: c++check -> cppcheck + +2008-12-30 Daniel Marjamäki + + * releasenotes.txt: releasenotes : edit + +2008-12-30 Daniel Marjamäki + + * cppcheck.cpp: cppcheck : updated version to 1.27 in help text + +2008-12-29 Daniel Marjamäki + + * checkmemoryleak.cpp: Memory leak : Reverted 796 and 797. I didn't + see definite improvements + +2008-12-29 Daniel Marjamäki + + * checkmemoryleak.cpp: Memory leak : Removed checking of 'if(true)' + and 'if(false)' as these are handled in the Tokenizer + +2008-12-29 Daniel Marjamäki + + * checkmemoryleak.cpp: Memory leak : Optimising the + 'CheckMemoryLeakClass::simplifycode' + +2008-12-28 Daniel Marjamäki + + * checkmemoryleak.cpp: Memory leak : Remove false positive for "if + (cond1) str=strdup(); if (cond2) str=strdup();" + +2008-12-28 Daniel Marjamäki + + * checkmemoryleak.cpp: memory leak : fixed false positive for "list + << data" + +2008-12-28 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak : Fixed false + positive for "list += data" + +2008-12-28 Reijo Tomperi + + * cppcheck.cpp: Bail out text is now not printed with --quiet option + +2008-12-28 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak : Fixed a + problem with a fclose inside an if condition + +2008-12-28 Reijo Tomperi + + * releasenotes.txt: releasenotes updated command line options made + more accurate + +2008-12-28 Daniel Marjamäki + + * releasenotes.txt: releasenotes : Added release notes for the + coming 1.27 release + +2008-12-28 Daniel Marjamäki + + * tokenize.cpp: Tokenizer::setVarId : Minor bug fix + +2008-12-27 Reijo Tomperi + + * tokenize.cpp: Optimizing setVarId() + +2008-12-27 Reijo Tomperi + + * preprocessor.cpp, preprocessor.h: preprocessor optimized to handle + faster removal of spaces near newline + +2008-12-27 Daniel Marjamäki + + * testrunner.vcproj: Visual C++ : Updated the project file + +2008-12-27 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak: Added check + "TestMemoryLeak::throw2" (no false positive upon throw) + +2008-12-27 Reijo Tomperi + + * cppcheck.cpp, man/cppcheck.1.xml, readme.txt, settings.cpp, + settings.h: Bailing out if too many (over 12) configurations found + froma file. --force parameter added to prevent this from happening. + +2008-12-27 Reijo Tomperi + + * preprocessor.cpp: Change one while loop to use stl algorithms and + added TODO about slow part of code + +2008-12-26 Reijo Tomperi + + * cppcheck.cpp, preprocessor.cpp, preprocessor.h: Added preprocessor + a way to retrieve configurations and file content one configuration + at time, because large files could consume 500 MB or even more + memory. + +2008-12-26 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leaks : Fixed false + positive for "p" when there is a line such as "p2 = p + 1;" + +2008-12-26 Daniel Marjamäki + + * testsimplifytokens.cpp: removeRedundantConditions : Added a simple + test case for "else if (false)" + +2008-12-26 Daniel Marjamäki + + * testsimplifytokens.cpp: removeRedundantConditions : Fixed the test + case added in [777] + +2008-12-26 Daniel Marjamäki + + * testsimplifytokens.cpp: removeReduntantConditions : Added test + case + +2008-12-26 Reijo Tomperi + + * testsimplifytokens.cpp, tokenize.cpp, tokenize.h: + removeReduntantConditions() can now handle if( true ) else if () + conditions also. + +2008-12-26 Daniel Marjamäki + + * testmemleak.cpp: Memory leak : Added TODO test case "class3". It + currently fails + +2008-12-25 Daniel Marjamäki + + * tokenize.cpp: refactoring : Removed unread variable 'staticfunc' + +2008-12-25 Daniel Marjamäki + + * checkbufferoverrun.cpp, token.cpp, token.h, tokenize.cpp: + TOKEN::Match : Removed the parameter varnames2 because it's unused + and deprecated + +2008-12-25 Daniel Marjamäki + + * token.cpp: uniformize files + +2008-12-25 Daniel Marjamäki + + * Makefile, Makefile.gprof: Makefile : Removed the .gprof makefile + and added a CGLAGS variable so the normal Makefile can easily be + changed + +2008-12-25 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leaks : Fixed false + positive with return (Bug 2458436) + +2008-12-25 Daniel Marjamäki + + * Makefile: Makefile : Reverted the Makefile changes in [763] + because they were committed by mistake + +2008-12-25 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak : Fixed false + positive when using callbacks (Bug 2458510) + +2008-12-24 Reijo Tomperi + + * tokenize.cpp: Cleanup to removeReduntantConditions() + +2008-12-24 Daniel Marjamäki + + * Makefile.gprof: added Makefile that can be used when profiling + cppcheck with gprof + +2008-12-24 Reijo Tomperi + + * tokenize.cpp: Minor improvement to removeReduntantConditions() + +2008-12-24 Daniel Marjamäki + + * tokenize.cpp: tokenize : optimising "simplifyConditions" + +2008-12-24 Daniel Marjamäki + + * Makefile, tokenize.cpp: Tokenizer::setVarId : small optimisations + +2008-12-24 Daniel Marjamäki + + * checkmemoryleak.cpp: memory leaks : optimising 'simplifycode' + +2008-12-24 Daniel Marjamäki + + * checkclass.cpp: checkclass : simple refactorings. Use Match + pattern better. Use str() and simpleMatch instead of Match when + possible + +2008-12-23 Reijo Tomperi + + * token.h: Some comments added + +2008-12-23 Nicolas Le Cam + + * token.cpp: Formatting: demux simpleMatch for readability + +2008-12-23 Reijo Tomperi + + * token.cpp, token.h: Optimization: isNotPattern() removed + +2008-12-23 Daniel Marjamäki + + * tokenize.cpp: tokenize : small optimisations. Use simpleMatch and + direct std::string comparisons instead of Match + +2008-12-23 Reijo Tomperi + + * token.cpp: Optimization, improved Match(). The str[0] == '%' + improvement + +2008-12-23 Nicolas Le Cam + + * token.cpp: Fix comparison between signed and unsigned integer + expressions warning + +2008-12-23 Daniel Marjamäki + + * tokenize.cpp: simplifyKnownVariables : optimisation + +2008-12-23 Daniel Marjamäki + + * checkmemoryleak.cpp: memory leaks : bug fix + +2008-12-23 Daniel Marjamäki + + * testsimplifytokens.cpp, testtokenize.cpp, tokenize.cpp: + simplifyIfAddBraces : Further fixes so that braces will be added to + an "else" statement too + +2008-12-23 Daniel Marjamäki + + * checkbufferoverrun.cpp: checkbufferoverrun : a bug fix and a + better use of Match + +2008-12-22 Nicolas Le Cam + + * checkbufferoverrun.cpp: Minor optimizations: introduce use of + simpleMatch, don't use [simple]Match on one word patterns; Minor + style formattings + +2008-12-22 Nicolas Le Cam + + * filelister.cpp: Fix FileLister::RecursiveAddFiles on files without + a base path. + +2008-12-22 Daniel Marjamäki + + * testsimplifytokens.cpp, testtokenize.cpp, tokenize.cpp: + simplifyIfAddBraces : Added check to cppcheck as it seems to work + pretty good now + +2008-12-22 Daniel Marjamäki + + * tokenize.cpp: simplifyIfAddBraces : Fixed a segmentation fault + +2008-12-22 Daniel Marjamäki + + * testtokenize.cpp, tokenize.cpp: simplifyIfAddBraces : Fixed minor + bug that caused the closing brace to be put on the wrong place + +2008-12-22 Daniel Marjamäki + + * testtokenize.cpp: TestTokenizer : Split the test + TestTokenizer::simplifyKnownVariables into 5 separate tests + +2008-12-22 Daniel Marjamäki + + * testtokenize.cpp: TestTokenizer : Broke up + TestTokenizer::ifAddBraces into a few separate tests + +2008-12-22 Daniel Marjamäki + + * tokenize.cpp: simplifyIfAddBraces : Fixed segmentation fault + +2008-12-22 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leaks : Reduce "if { + dealloc ; return ; } if return ;" to "if return ;". Related with bug + 2458532 + +2008-12-22 Daniel Marjamäki + + * testtokenize.cpp, tokenize.cpp, tokenize.h: Tokenizer : Added + function 'simplifyIfAddBraces' + +2008-12-22 Nicolas Le Cam + + * token.cpp: Fix simpleMatch when pattern only contain one word + +2008-12-21 Nicolas Le Cam + + * token.cpp, token.h: Implement simpleMatch that should be use when + pattern contains no flags + +2008-12-21 Reijo Tomperi + + * testsimplifytokens.cpp, tokenize.cpp, tokenize.h: More improvement + to removeReduntantConditions() and few tests for it also + +2008-12-21 Reijo Tomperi + + * testtokenize.cpp, tokenize.cpp, tokenize.h: Remove reduntant if + sentences that are never executed. + +2008-12-21 Nicolas Le Cam + + * tokenize.cpp: Optimization: Speed up typedef simplification. + +2008-12-21 Nicolas Le Cam + + * tokenize.cpp: Fix signed/unsigned warning (thanks Aggro) + +2008-12-21 Nicolas Le Cam + + * checkmemoryleak.cpp, token.cpp, tokenize.cpp: Refactoring: strdup + also exists in MSVS + +2008-12-21 Nicolas Le Cam + + * token.cpp, token.h, tokenize.cpp: Opimization: Remove + combineWithNext Member, use an array instead + +2008-12-21 Reijo Tomperi + + * testsimplifytokens.cpp: Few tests added for checking simplify of + if sentences + +2008-12-21 Reijo Tomperi + + * tokenize.cpp: Fixed bug, varid was not assigned properly when bool + use = false; was splitted into two statements in simplify code. + +2008-12-21 Reijo Tomperi + + * token.cpp, token.h, tokenize.cpp: Improving + simplifyKnownVariables() to simplify bool variables used inside if() + like int values are simplified. + +2008-12-21 Reijo Tomperi + + * checkbufferoverrun.cpp: Fixed one compiler (gcc) warning. + +2008-12-21 Nicolas Le Cam + + * checkbufferoverrun.cpp: Fix bug I introduced in rv727 + +2008-12-21 Nicolas Le Cam + + * checkbufferoverrun.cpp, checkmemoryleak.cpp, tokenize.cpp: Minor + optimizations and fixes + +2008-12-21 Daniel Marjamäki + + * tokenize.cpp: simplifyKnownVariables: fixed a segmentation fault + +2008-12-20 Reijo Tomperi + + * checkother.cpp, testother.cpp: Fixed bug with redundant condition: + + http://sourceforge.net/forum/forum.php?thread_id=2711792&forum_id=693501 + +2008-12-20 Daniel Marjamäki + + * checkmemoryleak.cpp, checkmemoryleak.h, testmemleakmp.cpp: Memory + leak : Updated the multipass checking a little + +2008-12-20 Reijo Tomperi + + * testclass.cpp: Updated the test to reflect change in previous + commit + +2008-12-20 Reijo Tomperi + + * checkclass.cpp: Improved the error message related to virtual + destructors + +2008-12-20 Daniel Marjamäki + + * checkclass.cpp: refactoring : Replaced "aaaa" with "str" + +2008-12-20 Daniel Marjamäki + + * cppcheck.cbp, testmemleakmp.cpp: codeblocks : added testmemleakmp + +2008-12-20 Daniel Marjamäki + + * Makefile, checkclass.cpp, checkmemoryleak.cpp, checkmemoryleak.h: + memory leak : Added experimental functionality for multipass + checking of memory leaks. Only added in the unit tests yet. + +2008-12-20 Daniel Marjamäki + + * token.cpp, token.h: Refactoring : Removed the function 'findtoken' + +2008-12-20 Daniel Marjamäki + + * checkclass.cpp: Refactoring : Replaced findtoken with findmatch + +2008-12-20 Daniel Marjamäki + + * checkother.cpp: refactoring : Replaced 'findtoken' with + 'findmatch' + +2008-12-20 Daniel Marjamäki + + * checkbufferoverrun.cpp: buffer overrun : Refactoring + +2008-12-20 Daniel Marjamäki + + * checkbufferoverrun.cpp, checkbufferoverrun.h, cppcheck.cpp, + testbufferoverrun.cpp: buffer overruns : renamed functions + minor + simplification + +2008-12-20 Daniel Marjamäki + + * checkclass.cpp, checkclass.h, cppcheck.cpp, testconstructors.cpp, + testunusedprivfunc.cpp: Class checking : Renamed the check functions + +2008-12-19 Reijo Tomperi + + * man/cppcheck.1.xml: Man page updated + +2008-12-19 Reijo Tomperi + + * cppcheck.cbp: Project file updated + +2008-12-19 Reijo Tomperi + + * testother.cpp: Updated app name and copyright to this new file + also + +2008-12-19 Reijo Tomperi + + * man/cppcheck.1.xml: Updated author names to man page + +2008-12-19 Daniel Marjamäki + + * Makefile, testother.cpp: Redundant condition: Added a test case + when a condition is not redundant + +2008-12-19 Reijo Tomperi + + * checkbufferoverrun.cpp, checkbufferoverrun.h, checkclass.cpp, + checkclass.h, checkfunctionusage.cpp, checkfunctionusage.h, + checkheaders.cpp, checkheaders.h, checkmemoryleak.cpp, + checkmemoryleak.h, checkother.cpp, checkother.h, cppcheck.cpp, + cppcheck.h, cppcheckexecutor.cpp, cppcheckexecutor.h, + errorlogger.h, filelister.cpp, filelister.h, main.cpp, + preprocessor.cpp, preprocessor.h, settings.cpp, settings.h, + testbufferoverrun.cpp, testcharvar.cpp, testclass.cpp, + testconstructors.cpp, testdivision.cpp, testfilelister.cpp, + testfunctionusage.cpp, testincompletestatement.cpp, + testmemleak.cpp, testpreprocessor.cpp, testredundantif.cpp, + testrunner.cpp, testsimplifytokens.cpp, testsuite.cpp, testsuite.h, + testtoken.cpp, testtokenize.cpp, testunusedprivfunc.cpp, + testunusedvar.cpp, token.cpp, token.h, tokenize.cpp, tokenize.h: + Copyright and app name changed in each file + +2008-12-19 Reijo Tomperi + + * filelister.cpp, testclass.cpp: Fixed bug, checking single file was + not possible. Few new tests added also + +2008-12-19 Reijo Tomperi + + * checkfunctionusage.cpp, checkfunctionusage.h, cppcheck.cpp: Don't + use keyword "this" in constructor + +2008-12-19 Reijo Tomperi + + * man/cppcheck.1.xml, readme.txt: Update man page and readme to + reflect the new syntax + +2008-12-19 Reijo Tomperi + + * cppcheck.cpp: Interface: Tags -a, -q, -s and -v added. + +2008-12-19 Reijo Tomperi + + * cppcheck.cpp: Interface: New version of interface and help texts, + --errorsonly changed to --quiet + +2008-12-19 Reijo Tomperi + + * cppcheck.cpp: Interface: Removed --recursive option, made it + default. Changed help texts. + +2008-12-19 Daniel Marjamäki + + * cppcheck.vcproj: visual c++: updated the project file + +2008-12-18 Nicolas Le Cam + + * checkbufferoverrun.cpp, checkbufferoverrun.h, checkclass.cpp, + checkclass.h, checkfunctionusage.cpp, checkfunctionusage.h, + checkheaders.cpp, checkheaders.h, checkmemoryleak.cpp, + checkmemoryleak.h, checkother.cpp, checkother.h, cppcheck.cpp, + cppcheck.h, cppcheckexecutor.cpp, cppcheckexecutor.h, + errorlogger.h, filelister.cpp, filelister.h, main.cpp, + preprocessor.cpp, preprocessor.h, settings.cpp, settings.h, + testbufferoverrun.cpp, testcharvar.cpp, testclass.cpp, + testconstructors.cpp, testdivision.cpp, testfilelister.cpp, + testfunctionusage.cpp, testincompletestatement.cpp, + testmemleak.cpp, testpreprocessor.cpp, testredundantif.cpp, + testrunner.cpp, testsimplifytokens.cpp, testsuite.cpp, testsuite.h, + testtoken.cpp, testtokenize.cpp, testunusedprivfunc.cpp, + testunusedvar.cpp, token.cpp, token.h, tokenize.cpp, tokenize.h: + Formatting: uniformize end of lines. + +2008-12-18 Daniel Marjamäki + + * testtokenize.cpp, tokenize.cpp: variable id : set variable ids for + struct members + +2008-12-18 Daniel Marjamäki + + * token.cpp: token : if setstr is used clear the variable id + +2008-12-18 Daniel Marjamäki + + * checkmemoryleak.cpp: Memory leaks : Remove "if break|continue ;" + that may otherwise cause false positives + +2008-12-18 Daniel Marjamäki + + * tokenize.cpp: tokenizer : using the simplifyKnownVariables + +2008-12-17 Daniel Marjamäki + + * checkclass.cpp, testclass.cpp: virtual destructors : no + errormessage if the derived class has no destructor or empty + destructor + +2008-12-17 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: memory leak : fixed 2 bugs + related to the testcases TestMemleak::if7 and TestMemleak::simple9 + +2008-12-17 Daniel Marjamäki + + * token.cpp, token.h, tokenize.cpp: token : fixed so that + TOKEN::_previous is updated when deleting tokens + +2008-12-17 Daniel Marjamäki + + * testsuite.cpp, testsuite.h: testsuite : make it possible to run a + specific testcase + +2008-12-16 Daniel Marjamäki + + * testmemleak.cpp: Memory leak : Added a test case for future + checking of struct members + +2008-12-16 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak : Fixed issue + 2429936 - false positive reported on the break in the code "loop { + dealloc ; alloc ; if break ; }" + +2008-12-16 Daniel Marjamäki + + * testmemleak.cpp: Memory leaks : Added test case for bug 2429936 + +2008-12-16 Daniel Marjamäki + + * checkmemoryleak.cpp, testmemleak.cpp: Memory leak : Fixed bug + described in issue 2432631. False positive on something like this.. + "alloc ; if(!var) alloc;" + +2008-12-16 Daniel Marjamäki + + * token.cpp, token.h: token : minor refactoring to + TOKEN::insertToken. Give the linenr and fileIndex the same values as + this token. It's better than nothing + +2008-12-15 Nicolas Le Cam + + * checkother.cpp, checkother.h, cppcheck.cpp: Removes + WarningIs(Alpha|Digit) checks as this can introduce more problems + than fixes. + +2008-12-15 Daniel Marjamäki + + * tasks.txt: tasks : Added task for optimising TOKEN::Match + +2008-12-15 Daniel Marjamäki + + * checkother.cpp, testredundantif.cpp: Redundant condition : fixed + the checking + +2008-12-15 Daniel Marjamäki + + * Makefile, checkother.cpp, checkother.h, testredundantif.cpp: + Redundant condition : Added a check + +2008-12-14 Nicolas Le Cam + + * tokenize.cpp: Fix compilation + +2008-12-14 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h, CheckClass.cpp, + CheckClass.h, CheckFunctionUsage.cpp, CheckFunctionUsage.h, + CheckHeaders.cpp, CheckHeaders.h, CheckMemoryLeak.cpp, + CheckMemoryLeak.h, CheckOther.cpp, CheckOther.h, FileLister.cpp, + FileLister.h, checkbufferoverrun.cpp, checkbufferoverrun.h, + checkclass.cpp, checkclass.h, checkfunctionusage.cpp, + checkfunctionusage.h, checkheaders.cpp, checkheaders.h, + checkmemoryleak.cpp, checkmemoryleak.h, checkother.cpp, + checkother.h, filelister.cpp, filelister.h, testfilelister.cpp: + Refactoring and fix to previous commits by me, forgot to actually + rename the files before ... + +2008-12-14 Nicolas Le Cam + + * FileLister.cpp, tokenize.cpp: Formatting: uniformize end of lines. + +2008-12-14 Reijo Tomperi + + * Makefile, cppcheck.cbp, cppcheck.cpp, cppcheck.h, + testbufferoverrun.cpp, testcharvar.cpp, testclass.cpp, + testconstructors.cpp, testdivision.cpp, testfilelister.cpp, + testfunctionusage.cpp, testincompletestatement.cpp, + testmemleak.cpp, testunusedprivfunc.cpp, testunusedvar.cpp, + tokenize.cpp: Refactoring: Renamed all files to lower case. Also + added testfilelister.cpp which was forgotted from previous commit. + +2008-12-14 Reijo Tomperi + + * FileLister.cpp, FileLister.h, Makefile, tokenize.cpp: Fixed bug, + paths like "/path/../index.h" created duplicate warnings with files + like "/index.h". Relative paths are now simplified to look a like. + Test cases added. + +2008-12-14 Nicolas Le Cam + + * CheckMemoryLeak.cpp, testtoken.cpp, testtokenize.cpp, + tokenize.cpp, tokenize.h: Formatting: uniformize end of lines. + +2008-12-14 Nicolas Le Cam + + * tasks.txt: Add something I want to work on + +2008-12-14 Nicolas Le Cam + + * tokenize.cpp: Add the last c++ cast operator + +2008-12-14 Daniel Marjamäki + + * tasks.txt: tasks : things that can be done + +2008-12-13 Reijo Tomperi + + * testtokenize.cpp: Old TODO comment removed + +2008-12-13 Reijo Tomperi + + * testtokenize.cpp: More tests added for simplifyKnownVariables() + +2008-12-13 Daniel Marjamäki + + * testtokenize.cpp, tokenize.cpp: tokenizer : updated + simplifyKnownVariables + +2008-12-13 Reijo Tomperi + + * testtokenize.cpp, tokenize.cpp, tokenize.h: Started making + simplifyKnownVariables(), but it is very much unfinished. Two test + cases added for it. + +2008-12-13 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leak : added standard functions that + are safe and doesn't need to be checked + +2008-12-13 Reijo Tomperi + + * tokenize.cpp, tokenize.h: Refactoring, simplifyConditions(), + simplifyCasts() and simplifyFunctionReturn() now return the opposite + of their boolean return value. + +2008-12-13 Daniel Marjamäki + + * testmemleak.cpp, tokenize.cpp, tokenize.h: Tokenizer : Simplify + function calls for functions that only returns a constant value + +2008-12-13 Daniel Marjamäki + + * testmemleak.cpp, tokenize.cpp, tokenize.h: Tokenizer : Added + function for simplifying casts + +2008-12-13 Nicolas Le Cam + + * CheckFunctionUsage.cpp, testsimplifytokens.cpp: Refactoring: + changed "aaaa" to "str" + +2008-12-13 Nicolas Le Cam + + * CheckBufferOverrun.cpp, CheckMemoryLeak.cpp, cppcheck.cpp, + preprocessor.cpp, preprocessor.h, testbufferoverrun.cpp, + testmemleak.cpp, testtokenize.cpp, token.cpp, token.h, tokenize.cpp: + Formatting: uniformize end of lines. + +2008-12-13 Nicolas Le Cam + + * testmemleak.cpp: Add three memoryleak tests involving pointer + casting that currently 'fail' + +2008-12-13 Daniel Marjamäki + + * testmemleak.cpp: Memory leak : Added a test case for false + positive when using function call + +2008-12-13 Daniel Marjamäki + + * CheckBufferOverrun.cpp, testbufferoverrun.cpp: Buffer overrun : + Use variable id if available in check of memset etc + +2008-12-13 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leak : Fixed a test where pointer is + reassigned + +2008-12-12 Reijo Tomperi + + * testmemleak.cpp: Slightly improved test case + +2008-12-12 Reijo Tomperi + + * testmemleak.cpp: Added test case for false positive, fails + currently + +2008-12-12 Reijo Tomperi + + * CheckMemoryLeak.cpp: Refactoring, some !Match() calls chanded into + using !!else syntax + +2008-12-12 Reijo Tomperi + + * testtokenize.cpp, token.cpp, token.h: TOKEN: Patterns like "if ; + !!else" are now possible + +2008-12-12 Daniel Marjamäki + + * tokenize.cpp: Tokenizer::SetVarId : Fixed segmentation fault + +2008-12-12 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h, + testbufferoverrun.cpp: CheckBufferOverrun : Using variable id to + check local array variables + +2008-12-12 Reijo Tomperi + + * testmemleak.cpp: testmemleak: Added 2 tests, fopen() and popen() + should return resource leak, instead of memory leak + +2008-12-12 Daniel Marjamäki + + * testbufferoverrun.cpp: testbufferoverrun : Added a testcase where + variable id is needed to avoid false positive + +2008-12-12 Reijo Tomperi + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h: Memoryleak: fopen and + popen report now "Resource leak" instead of "Memory leak" + +2008-12-12 Nicolas Le Cam + + * token.cpp: Fix a crash in eraseToken + +2008-12-11 Nicolas Le Cam + + * CheckOther.cpp: Fix compilation under VS2003 + +2008-12-11 Reijo Tomperi + + * cppcheck.cpp: Minor bug fix, CppCheck::Check didn't reset error + list after all checking was done. + +2008-12-11 Daniel Marjamäki + + * cppcheck.cpp, preprocessor.cpp, preprocessor.h, + testpreprocessor.cpp: preprocessing : Skip special characters. + Refactoring. + +2008-12-11 Daniel Marjamäki + + * todo.txt: todo : deleted this deprecated file + +2008-12-11 Daniel Marjamäki + + * readme.txt: readme : fixed the readme file + +2008-12-11 Daniel Marjamäki + + * CheckMemoryLeak.cpp: memory leak : Minor fixes to make the unit + tests work + +2008-12-10 Daniel Marjamäki + + * CheckClass.cpp, CheckMemoryLeak.cpp, CheckOther.cpp, + FileLister.cpp, FileLister.h, testmemleak.cpp: code cleanups + +2008-12-10 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leaks : Minor updates + and refactoring + +2008-12-10 Daniel Marjamäki + + * CheckOther.cpp: Borland C++ : minor update to make the code + compilable with borland c++ + +2008-12-10 Daniel Marjamäki + + * CheckClass.cpp: Virtual destructor : minor fix to avoid false + positives when more modifiers are used + +2008-12-10 Daniel Marjamäki + + * FileLister.cpp, FileLister.h: FileLister: Borland can use windows + api for file searching + +2008-12-09 Reijo Tomperi + + * cppcheck.cbp, token.cpp, token.h: Project file updated + (testtoken.cpp was missing), added TOKEN::printOut() function to + help with debugging. + +2008-12-09 Reijo Tomperi + + * Makefile, testtoken.cpp: Added test file for TOKEN class + +2008-12-09 Reijo Tomperi + + * CheckMemoryLeak.cpp, token.cpp, token.h, tokenize.cpp: + Refactoring: Moved token creation and token deletion into TOKEN + class. Added previous() (not tested yet) + +2008-12-09 Daniel Marjamäki + + * cppcheck.cpp: cppcheck : Set variable ids + +2008-12-09 Daniel Marjamäki + + * testmemleak.cpp: testmemleak : added a unit test that ensures that + the variable id handling works correctly. But it's currently not + working, and therefore it's commented out + +2008-12-09 Daniel Marjamäki + + * token.cpp, token.h: token : Updated the "Match" function so it can + check the variable id + +2008-12-09 Daniel Marjamäki + + * CheckOther.cpp: Variable usage : 2 more fixes + +2008-12-09 Nicolas Le Cam + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h, CheckClass.cpp, + CheckClass.h, CheckFunctionUsage.cpp, CheckMemoryLeak.cpp, + CheckMemoryLeak.h, CheckOther.cpp, CheckOther.h, FileLister.cpp, + FileLister.h, cppcheck.cpp, cppcheck.h, cppcheckexecutor.cpp, + cppcheckexecutor.h, errorlogger.h, main.cpp, preprocessor.cpp, + preprocessor.h, settings.cpp, settings.h, testbufferoverrun.cpp, + testconstructors.cpp, testfunctionusage.cpp, testmemleak.cpp, + testpreprocessor.cpp, testrunner.cpp, testsimplifytokens.cpp, + testsuite.cpp, testsuite.h, testtokenize.cpp, testunusedvar.cpp, + token.cpp, token.h, tokenize.cpp, tokenize.h: Formatting: uniformize + end of lines. + +2008-12-08 Nicolas Le Cam + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h, CheckClass.cpp, + CheckClass.h, CheckFunctionUsage.cpp, CheckMemoryLeak.cpp, + CheckMemoryLeak.h, CheckOther.cpp, CheckOther.h, FileLister.cpp, + FileLister.h, cppcheck.cpp, cppcheck.h, cppcheckexecutor.cpp, + cppcheckexecutor.h, errorlogger.h, main.cpp, preprocessor.cpp, + preprocessor.h, settings.cpp, settings.h, testbufferoverrun.cpp, + testconstructors.cpp, testfunctionusage.cpp, testmemleak.cpp, + testpreprocessor.cpp, testrunner.cpp, testsimplifytokens.cpp, + testsuite.cpp, testsuite.h, testtokenize.cpp, testunusedvar.cpp, + token.cpp, token.h, tokenize.cpp, tokenize.h: Revert revisions 627 + and 628 + +2008-12-08 Nicolas Le Cam + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckClass.h, + CheckMemoryLeak.cpp, CheckMemoryLeak.h, CheckOther.cpp, + CheckOther.h, FileLister.h, cppcheck.cpp, cppcheck.h, + cppcheckexecutor.cpp, cppcheckexecutor.h, errorlogger.h, + preprocessor.cpp, preprocessor.h, settings.cpp, settings.h, + testconstructors.cpp, testfunctionusage.cpp, testmemleak.cpp, + testpreprocessor.cpp, testsimplifytokens.cpp, testsuite.h, + testtokenize.cpp, testunusedvar.cpp, token.cpp, token.h, + tokenize.cpp, tokenize.h: Formatting: uniformize end of lines (part + 2) + +2008-12-08 Nicolas Le Cam + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h, CheckClass.cpp, + CheckClass.h, CheckFunctionUsage.cpp, CheckMemoryLeak.cpp, + CheckMemoryLeak.h, CheckOther.cpp, CheckOther.h, FileLister.cpp, + FileLister.h, cppcheck.cpp, cppcheck.h, cppcheckexecutor.cpp, + cppcheckexecutor.h, errorlogger.h, main.cpp, preprocessor.cpp, + preprocessor.h, settings.cpp, settings.h, testbufferoverrun.cpp, + testconstructors.cpp, testfunctionusage.cpp, testmemleak.cpp, + testpreprocessor.cpp, testrunner.cpp, testsimplifytokens.cpp, + testsuite.cpp, testsuite.h, testtokenize.cpp, testunusedvar.cpp, + token.cpp, token.h, tokenize.cpp, tokenize.h: Formatting: uniformize + end of lines. + +2008-12-08 Nicolas Le Cam + + * token.cpp: TOKEN::Match minor optimization + +2008-12-08 Reijo Tomperi + + * CheckFunctionUsage.cpp, CheckHeaders.cpp, CheckMemoryLeak.cpp, + CheckOther.cpp, token.cpp, token.h, tokenize.cpp: Refactoring: Rest + of the public variables in TOKEN moved to private area. + +2008-12-08 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckFunctionUsage.cpp, + CheckHeaders.cpp, CheckMemoryLeak.cpp, CheckOther.cpp, + errorlogger.h, testbufferoverrun.cpp, testsimplifytokens.cpp, + testtokenize.cpp, token.cpp, token.h, tokenize.cpp: Refactoring: + TOKEN::next renamed to _next, getter and setter functions for it + added next() and next(TOKEN*). + +2008-12-08 Daniel Marjamäki + + * CheckOther.cpp: Variable usage : A few small fixes to reduce false + positives + +2008-12-08 Reijo Tomperi + + * testtokenize.cpp, token.cpp, token.h, tokenize.cpp: Refactoring: + TOKEN::varId was moved from public to private + +2008-12-08 Daniel Marjamäki + + * testtokenize.cpp, token.h, tokenize.cpp, tokenize.h: Variable Id : + First simple implementation + +2008-12-08 Daniel Marjamäki + + * testsuite.h: testing : Minor fix for ASSERT_EQUALS macro + +2008-12-08 Nicolas Le Cam + + * testtokenize.cpp: Fix two warnings + +2008-12-08 Nicolas Le Cam + + * CheckClass.cpp: Virtual Destructor : Minor optimization + +2008-12-08 Daniel Marjamäki + + * cppcheck.cbproj, testrunner.cbproj: Borland C++ : Updated project + files cppcheck and testrunner + +2008-12-07 Nicolas Le Cam + + * testunusedvar.cpp: Fix compilation + +2008-12-07 Daniel Marjamäki + + * CheckOther.cpp, cppcheck.cpp, testunusedvar.cpp: function variable + usage : various fixes. but probably more fixes are needed. + +2008-12-07 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, testunusedvar.cpp: function variable + usage : Added a simple check + +2008-12-07 Reijo Tomperi + + * testtokenize.cpp, token.cpp: Fixed bug in TOKEN::multiCompare. + "abc" and "a" were matched. + +2008-12-07 Nicolas Le Cam + + * CheckMemoryLeak.cpp: Minor optimization. Reuse findmatch result + instead of recalling it + +2008-12-07 Daniel Marjamäki + + * testtokenize.cpp: tokenizer : The token "a" shouldn't match the + pattern "abc|def", added assertion to a test but it's currently + commented because it fails + +2008-12-07 Nicolas Le Cam + + * CheckClass.cpp, testconstructors.cpp: Constructors: Fix checking + of 'operator=' with test + +2008-12-07 Daniel Marjamäki + + * cppcheck.cbp: cppcheck.cbp : Added testclass.cpp + +2008-12-07 Daniel Marjamäki + + * CheckClass.cpp, testclass.cpp: Virtual destructors : Don't check + base classes when inheritance is non-public + +2008-12-07 Daniel Marjamäki + + * CheckClass.cpp, CheckClass.h, testconstructors.cpp: Constructors : + Refactoring + Added checking of 'operator=' + +2008-12-07 Daniel Marjamäki + + * tokenize.cpp: Fixed a bug in Tokenizer::simplifyTokenList. The + keyword operator is never used in a variable declaration + +2008-12-07 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leaks : Handle + assignments better - bug 2395524 + +2008-12-07 Daniel Marjamäki + + * CheckClass.cpp: Check constructors: Minor optimisation + +2008-12-07 Daniel Marjamäki + + * CheckClass.cpp, testconstructors.cpp: Constructors : Fixed so the + test that kush_eplus added works + +2008-12-07 Daniel Marjamäki + + * CheckClass.cpp: Refactoring. Use "str" instead of "aaaa0" + +2008-12-07 Daniel Marjamäki + + * CheckClass.cpp: Refactoring: use "findmatch" instead of + "findtoken" + +2008-12-07 Daniel Marjamäki + + * CheckClass.cpp, testclass.cpp: Virtual destructors : Handle + inheritance where "private|protected|public" is not defined + +2008-12-07 Nicolas Le Cam + + * testconstructors.cpp: Add a test case that currently fail + +2008-12-07 Nicolas Le Cam + + * FileLister.cpp: Fix bug when calling cppcheck without --recursive + flag + +2008-12-06 Daniel Marjamäki + + * testclass.cpp: Virtual destructors : Minor fix to a test to handle + a private inheritance + +2008-12-06 Daniel Marjamäki + + * CheckClass.cpp: Virtual Destructors : pattern for declaring a + derived class... "class %var% : public|protected|private %var% .." + +2008-12-06 Daniel Marjamäki + + * CheckClass.cpp, testclass.cpp: virtual destructor : iterate + through base classes for a derived class to check that the + destructor in each base class i virtual + +2008-12-06 Daniel Marjamäki + + * CheckClass.cpp, testconstructors.cpp: Uninitialized member + variables : Don't give false positives for private constructors + +2008-12-06 Daniel Marjamäki + + * Makefile, testclass.cpp: testclass : Added a new unit testing file + +2008-12-06 Daniel Marjamäki + + * CheckClass.cpp: Minor optimisation. Don't do redundant checking + +2008-12-06 Daniel Marjamäki + + * tokenize.cpp: tokenize: "~Base" should generate two tokens. "~" + and "Base" + +2008-12-06 Daniel Marjamäki + + * CheckClass.cpp, CheckClass.h, cppcheck.cpp: Class checking : Check + that base class destructors are virtual. Experimental + +2008-12-06 Daniel Marjamäki + + * CheckClass.cpp, CheckClass.h: CheckClass : Refactoring - Removed + include and moved struct VAR into the class + +2008-12-06 Daniel Marjamäki + + * CheckOther.cpp: Unreachable code : minor bug fixes + +2008-12-06 Daniel Marjamäki + + * CheckOther.cpp: Unreachable code : Fixed false positives for label + +2008-12-06 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, cppcheck.cpp: Added check that + detects unreachable code below a 'return' statement + +2008-12-06 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h, testmemleak.cpp: Memory + leaks: Better handling of "realloc". Fixing bug [ 2395262 ] + +2008-12-06 Daniel Marjamäki + + * token.cpp: TODO: Added a todo for refactoring TOKEN::Match + +2008-12-06 Daniel Marjamäki + + * tokenize.cpp: Tokenizer: Remove "volatile" keyword to simplify + checking + +2008-12-06 Daniel Marjamäki + + * testtokenize.cpp: Fixed so that the expected and actual values in + asserts are not mixed + +2008-12-06 Daniel Marjamäki + + * testtokenize.cpp: testtokenize: Added TestTokenize::match1 that + makes sure the old matching of "|" and "||" still works + +2008-12-06 Reijo Tomperi + + * CheckMemoryLeak.cpp: CheckMemoryLeak.cpp, g_renew and g_try_renew + also removed + +2008-12-06 Reijo Tomperi + + * CheckMemoryLeak.cpp: Memory leak: False positive with g_realloc(). + Removed g_realloc() and g_try_realloc() for now. See feature request + [ 2395262 ] Check leaks with realloc, g_realloc and g_try_realloc() + +2008-12-06 Reijo Tomperi + + * cppcheck.cpp, cppcheck.h, cppcheckexecutor.cpp, + cppcheckexecutor.h: cppcheck and executor, fixed compiling error + +2008-12-06 Daniel Marjamäki + + * cppcheck.cpp, cppcheck.h, cppcheckexecutor.cpp, + cppcheckexecutor.h: refactoring: Increased constness of function + parameters + +2008-12-05 Reijo Tomperi + + * preprocessor.cpp: Preprocessor: Fixed bug, read() didn't handle + correctly string constants like this: "\"" + +2008-12-05 Reijo Tomperi + + * CheckBufferOverrun.cpp, token.cpp: Token: Fixed bug in match + function, simplified CheckBufferOverrun code + +2008-12-05 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leak: refactoring - changed "aaaa" to + "str" + +2008-12-05 Daniel Marjamäki + + * tokenize.cpp: tokenize: Replace a complicated condition with a + "Match" + +2008-12-05 Daniel Marjamäki + + * tokenize.cpp: tokenize: Replace "aaaa" and "strcmp" with "str" and + "Match" + +2008-12-05 Daniel Marjamäki + + * CheckHeaders.cpp: CheckHeaders: Refactoring so str and Match is + used instead of aaaa and strcmp etc + +2008-12-05 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leak: Replaced a few "strcmp" with + "==" + +2008-12-05 Daniel Marjamäki + + * CheckBufferOverrun.cpp: Buffer overrun: Minor refactoring. Use the + Match function better. + +2008-12-05 Daniel Marjamäki + + * tokenize.cpp: tokenize: Minor refactorings + +2008-12-05 Daniel Marjamäki + + * CheckOther.cpp: CheckOther: Fixed a compiler warning + +2008-12-04 Reijo Tomperi + + * testtokenize.cpp, token.cpp: Bug fix: Minor bug in previous + commit, test added to catch that bug also. + +2008-12-04 Reijo Tomperi + + * testtokenize.cpp, token.cpp, token.h, tokenize.cpp: TOKEN: Match() + function improved, %any% and const|volatile kind of patterns are now + accepted. Simplified comparing on tokenize.cpp. + +2008-12-04 Daniel Marjamäki + + * testtokenize.cpp, tokenize.cpp: Tokenizer: Simplify numeric + comparisons + +2008-12-04 Daniel Marjamäki + + * testsuite.cpp: testsuite: show diffing strings better when they + are not equal + +2008-12-04 Daniel Marjamäki + + * testtokenize.cpp: TestTokenize: Use TOKEN::str() instead of + TOKEN::aaaa() where possible + +2008-12-04 Daniel Marjamäki + + * preprocessor.cpp, preprocessor.h, testpreprocessor.cpp: + Preprocessor: Minor refactoring and improved testing + +2008-12-03 Reijo Tomperi + + * testtokenize.cpp, tokenize.cpp: Tokenizer: Fixed bug, const and + volatile functions were not recogniced by fillFunctionList() + +2008-12-03 Daniel Marjamäki + + * preprocessor.cpp, testpreprocessor.cpp: preprocessor: fixed + handling of tabs and spaces + +2008-12-02 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leaks: Various improvements in + "simplifycode" + +2008-12-02 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leak: Further improvements of + "simplifycode" + +2008-12-02 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leak: Changed a comment + +2008-12-02 Daniel Marjamäki + + * cppcheck.cbproj: updated the borland project file + +2008-12-01 Reijo Tomperi + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h: Minor improvement to code + comments. + +2008-12-01 Nicolas Le Cam + + * CheckOther.cpp: Warning If minor optimizations + +2008-12-01 Reijo Tomperi + + * CheckOther.h: Patch: [ 2371330 ] Removed + CheckOther::WarningDangerousFunctions() declaration + +2008-12-01 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Refactoring and + improvements of simplifycode etc + +2008-12-01 Daniel Marjamäki + + * testsuite.cpp, testsuite.h: testing: minor refactoring so better + error messages are shown + +2008-12-01 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h, testmemleak.cpp: Memory + leaks: When "--debug" is given the checking will be different to + highlight problems in "getcode" and "simplifycode" + +2008-11-30 Daniel Marjamäki + + * cppcheck.cpp: added comment about "--debug" flag. This is used for + various debugging purposes so the behaviour of c++check is undefined + if it's given + +2008-11-30 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: The "do" must + be handled differently. Made a first fix for it + +2008-11-30 Reijo Tomperi + + * cppcheck.cpp, man/cppcheck.1.xml: Verbose: Added line change to + help text printing and updated man page + +2008-11-30 Daniel Marjamäki + + * cppcheck.cpp, cppcheck.h, settings.cpp, settings.h: Verbose error + message output through '--verbose' + +2008-11-29 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Fixed the test + 'CheckMemoryLeak::func8' + +2008-11-29 Daniel Marjamäki + + * testmemleak.cpp: Test Memory leak: Added a test case, currently a + false positive is generated + +2008-11-29 Daniel Marjamäki + + * cppcheck.cpp: cppcheck: Write version number etc + +2008-11-28 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Moved the class + member checking to the "--all" + +2008-11-27 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h, cppcheck.cpp, + testbufferoverrun.cpp: Array index : No recursive checking unless + the "--all" has been given + +2008-11-27 Reijo Tomperi + + * FileLister.cpp, cppcheck.cpp, man/cppcheck.1.xml: Recursive file + listing, .cxx added to file list + +2008-11-27 Reijo Tomperi + + * CheckMemoryLeak.cpp: Removed debug output + +2008-11-27 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leaks: Reverted the + sensitive checking in r536. And improved the simplifycode function. + +2008-11-26 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leaks: Made the + checking a lot more sensitive + +2008-11-26 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h: CheckMemoryLeak: + Refactoring. Use TOKEN::isStandardType instead of rewriting its + functionality + +2008-11-26 Daniel Marjamäki + + * token.cpp, token.h: token: refactoring the 'isStandardType' a + little + +2008-11-26 Daniel Marjamäki + + * testmemleak.cpp: testmemleak: Added 'func7' test case. Not working + yet + +2008-11-25 Reijo Tomperi + + * cppcheck.cpp, cppcheck.h: Feature added: CppCheck class has now + function addFile(string,string) which allows checking of unreal + files, by giving just filename and file content as a parameter. + +2008-11-25 Daniel Marjamäki + + * cppcheck.cpp, testbufferoverrun.cpp, testcharvar.cpp, + testmemleak.cpp, tokenize.cpp, tokenize.h: Refactoring: Removed + _settings member from the Tokenizer + +2008-11-25 Daniel Marjamäki + + * cppcheck.cpp, testbufferoverrun.cpp, testcharvar.cpp, + testconstructors.cpp, testdivision.cpp, testfunctionusage.cpp, + testincompletestatement.cpp, testmemleak.cpp, + testsimplifytokens.cpp, testtokenize.cpp, testunusedprivfunc.cpp, + testunusedvar.cpp, tokenize.cpp, tokenize.h: Refactoring: Tokenizer + - renaming functions, moved the 'tokenizeCode' to the private + section + +2008-11-25 Daniel Marjamäki + + * CheckFunctionUsage.cpp, tokenize.cpp: TODO: added a todo to add an + error message. and removed an "invalid" todo + +2008-11-25 Daniel Marjamäki + + * CheckFunctionUsage.cpp: Function usage: Report which file the + missing function is implemented in + +2008-11-24 Reijo Tomperi + + * cppcheck.h, cppcheckexecutor.cpp, cppcheckexecutor.h, + errorlogger.h: Refactoring: Added missing license texts and some + comments + +2008-11-24 Reijo Tomperi + + * cppcheck.cbp: Refactoring: Updated project file for Code::Blocks + +2008-11-24 Reijo Tomperi + + * Makefile, cppcheck.cpp, cppcheck.h, cppcheckexecutor.cpp, + cppcheckexecutor.h, errorlogger.h, main.cpp, testsuite.cpp, + testsuite.h: Refactoring: CppCheckExecutor class added + +2008-11-24 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckFunctionUsage.cpp, + CheckHeaders.cpp, CheckMemoryLeak.cpp, CheckOther.cpp, + testsimplifytokens.cpp, testtokenize.cpp, token.cpp, token.h, + tokenize.cpp: TOKEN: Refactoring the 'str' member variable + +2008-11-24 Daniel Marjamäki + + * FileLister.cpp: Visual C++: Updated the FileLister (applied patch + FileLister_ReworkRecursiveAddFiles submitted by kush_eplus) + +2008-11-24 Reijo Tomperi + + * token.cpp: bug fix, didn't compile on Linux (3 utf characters on + top of file again) + +2008-11-24 Daniel Marjamäki + + * cppcheck.vcproj: Visual C++: Updated the project file * removed 'commoncheck' * added 'checkfunctionusage' * added 'token' + +2008-11-24 Daniel Marjamäki + + * cppcheck.cbproj, token.cpp: Borland C++: Minor updates so cppcheck + compiles with Borland C++ + +2008-11-23 Reijo Tomperi + + * cppcheck.cpp, cppcheck.h, main.cpp, settings.cpp, settings.h: + Refactoring: Started making CppCheck class more generally usable + (e.g. as a part of IDE). + +2008-11-23 Reijo Tomperi + + * Makefile: Refactoring: Updated makefile to be more up-to-date + after big refactoring changes. + +2008-11-23 Daniel Marjamäki + + * CheckFunctionUsage.cpp: Function usage: Better handling of + '!foo()' + +2008-11-23 Reijo Tomperi + + * cppcheck.cbp, testrunner.cbp: Project files: Changed both targets + to same file, using custom makefile + +2008-11-23 Daniel Marjamäki + + * CheckFunctionUsage.cpp: Function usage: Minor update in the + pattern for using function + +2008-11-23 Daniel Marjamäki + + * CheckFunctionUsage.cpp, testfunctionusage.cpp: Function Usage: + Handling '.. else foo()' + +2008-11-23 Daniel Marjamäki + + * CheckFunctionUsage.cpp, testfunctionusage.cpp: Function usage: + Handling callbacks better: 'void (*f)() = cond ? foo : NULL' + +2008-11-23 Daniel Marjamäki + + * CheckFunctionUsage.cpp, testfunctionusage.cpp: Function usage: + handling 'return foo();' better + +2008-11-23 Daniel Marjamäki + + * cppcheck.cbp: codeblocks: Added project file for cppcheck + +2008-11-23 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckHeaders.cpp, + CheckMemoryLeak.cpp, token.cpp, token.h, tokenize.cpp: Refactoring: + IsName() and IsNumber() are no longer static and they don't take a + parameter. + +2008-11-23 Daniel Marjamäki + + * testfunctionusage.cpp: Added test file for function usage + +2008-11-23 Daniel Marjamäki + + * CheckFunctionUsage.cpp, Makefile, testrunner.cbp: Function Usage: + Make sure it's detected that func is used in code such as 'if ( + func() ) { ..' + +2008-11-23 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h, + CheckFunctionUsage.cpp, CheckFunctionUsage.h, CheckMemoryLeak.cpp, + CheckMemoryLeak.h, FileLister.h, cppcheck.cpp, cppcheck.h, + testbufferoverrun.cpp, testcharvar.cpp, testconstructors.cpp, + testdivision.cpp, testincompletestatement.cpp, testmemleak.cpp, + testtokenize.cpp, testunusedprivfunc.cpp, testunusedvar.cpp, + tokenize.cpp, tokenize.h: Refactoring: Renamed some member + variables: variable -> _variable + +2008-11-23 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckFunctionUsage.cpp, + CheckHeaders.cpp, CheckMemoryLeak.cpp, CheckOther.cpp, token.cpp, + token.h, tokenize.cpp: Refactoring: at() changed to tokAt() and + getstr() changed to strAt() + +2008-11-23 Daniel Marjamäki + + * CheckFunctionUsage.cpp: Function usage: Fixes in the check + +2008-11-23 Daniel Marjamäki + + * CheckFunctionUsage.cpp, CheckFunctionUsage.h, cppcheck.cpp, + cppcheck.h, testbufferoverrun.cpp, testcharvar.cpp, + testmemleak.cpp, testrunner.cbp, testsuite.cpp, testtokenize.cpp, + tokenize.cpp, tokenize.h: Refactoring: The + Tokenizer::FillFunctionList has no use of its parameter. Enabled the + CheckFunctionUsage + +2008-11-22 Reijo Tomperi + + * testtokenize.cpp: Bug fix: Didn't compile on Debian, missing + #include + +2008-11-22 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckFunctionUsage.cpp, + CheckHeaders.cpp, CheckMemoryLeak.cpp, CheckOther.cpp, Makefile, + token.cpp, token.h, tokenize.cpp, tokenize.h: Refactoring: token.* + files added, Some functions from Tokenizer moved under TOKEN. + Renamed few functions, like gettok() -> at(), combineWithNext() and + deleteNext() are also new names for old functions. Usage was gettok( + tok, 2 ), but now it is tok->at( 2 ). + +2008-11-22 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leak: Added checking for 'kcalloc' + +2008-11-22 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leak: The 'realloc' shouldn't be + treated exactly like 'malloc' + +2008-11-22 Daniel Marjamäki + + * CheckClass.cpp, CheckClass.h, CheckHeaders.cpp, CheckHeaders.h, + CheckMemoryLeak.cpp, CheckMemoryLeak.h, CheckOther.cpp, + CheckOther.h, testbufferoverrun.cpp, testcharvar.cpp, + testconstructors.cpp, testdivision.cpp, + testincompletestatement.cpp, testmemleak.cpp, testtokenize.cpp, + testunusedprivfunc.cpp, testunusedvar.cpp, tokenize.cpp, tokenize.h: + increased constness of member variable _tokenizer in the Check* + classes + +2008-11-22 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h, tokenize.cpp, + tokenize.h: CheckBufferOverrun: increased constness of _tokenizer + member + +2008-11-22 Daniel Marjamäki + + * cppcheck.cpp, cppcheck.h, testbufferoverrun.cpp, testcharvar.cpp, + testconstructors.cpp, testdivision.cpp, + testincompletestatement.cpp, testmemleak.cpp, testrunner.cbp, + testsimplifytokens.cpp, testtokenize.cpp, testunusedprivfunc.cpp, + testunusedvar.cpp, tokenize.cpp, tokenize.h: Check Function Usage: + Removed much of the old checking and made some refactoring + +2008-11-22 Daniel Marjamäki + + * CheckFunctionUsage.cpp, CheckFunctionUsage.h, Makefile: Function + Usage: Added a new class for checking function usage + +2008-11-22 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testtokenize.cpp, tokenize.cpp, tokenize.h: + tokenizer: simplifyConditions tries to simplify conditions.. those + that are always true to '( true )' and those that are always false + to '( false )' + +2008-11-22 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Handle + conditions that are always true / false + +2008-11-22 Daniel Marjamäki + + * testbufferoverrun.cpp, testcharvar.cpp, testconstructors.cpp, + testdivision.cpp, testincompletestatement.cpp, testmemleak.cpp, + testtokenize.cpp, testunusedprivfunc.cpp, testunusedvar.cpp, + tokenize.cpp: tokenizer: Added DeallocateTokens to the destructor so + it's not necessary to cleanup manually + +2008-11-22 Daniel Marjamäki + + * testtokenize.cpp, tokenize.cpp, tokenize.h: tokenizer: Added + functions "alwaysTrue" and "alwaysFalse" to check if a condition is + always true / false + +2008-11-21 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckHeaders.cpp, + CheckMemoryLeak.cpp, CheckOther.cpp, CommonCheck.cpp, + CommonCheck.h, Makefile, cppcheck.cpp, preprocessor.cpp, + testbufferoverrun.cpp, testcharvar.cpp, testmemleak.cpp, + tokenize.cpp, tokenize.h: Refactoring: CommonCheck.* files are + removed. Rest of the global functions from there were moved to + Tokenizer class + +2008-11-21 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h: Memory leak: Added + checking for 'fopen' and 'popen' + +2008-11-21 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Better handling + when calling functions + +2008-11-21 Daniel Marjamäki + + * cppcheck.cpp: unsigned division and char variable usage - moved + checks to "--style" + +2008-11-20 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h, CheckClass.cpp, + CheckClass.h, CheckHeaders.cpp, CheckHeaders.h, + CheckMemoryLeak.cpp, CheckMemoryLeak.h, CheckOther.cpp, + CheckOther.h, CommonCheck.cpp, CommonCheck.h, cppcheck.cpp, + cppcheck.h, errorlogger.h, preprocessor.cpp, preprocessor.h, + testbufferoverrun.cpp, testcharvar.cpp, testconstructors.cpp, + testdivision.cpp, testincompletestatement.cpp, testmemleak.cpp, + testpreprocessor.cpp, testrunner.cpp, testsimplifytokens.cpp, + testsuite.cpp, testsuite.h, testtokenize.cpp, + testunusedprivfunc.cpp, testunusedvar.cpp, tokenize.cpp, tokenize.h: + Refactoring: Errors are no longer logged via global functions to a + global stream. Instead callback function is used via interface. + ErrorLogger interface was added and taken into use. + +2008-11-20 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckHeaders.cpp, + CheckMemoryLeak.cpp, CheckOther.cpp, CommonCheck.cpp, + CommonCheck.h, tokenize.cpp, tokenize.h: Refactoring: Some global + functions moved to Tokenizer class + +2008-11-20 Daniel Marjamäki + + * testtokenize.cpp, tokenize.cpp, tokenize.h: cleanup + +2008-11-20 Daniel Marjamäki + + * testtokenize.cpp, tokenize.cpp, tokenize.h: Function list: Remove + functions with duplicate names to prevent false positives + +2008-11-19 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leak: Minor update to make the + checking stronger + +2008-11-19 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Readded some + checks that were removed in r481 + +2008-11-19 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Moved false + positive to "--all" upon some special case conditions (bug 2313129) + +2008-11-18 Daniel Marjamäki + + * CheckBufferOverrun.cpp: Buffer overrun: Fixed a segmentation fault + +2008-11-18 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leak: limit the max call depth to 2 + +2008-11-17 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leak: Minor fix to prevent hang + +2008-11-17 Daniel Marjamäki + + * cppcheck.cpp: minor update to startup message + +2008-11-17 Daniel Marjamäki + + * preprocessor.cpp: preprocessor: Better warning when illegal + character found + +2008-11-17 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: moved + simplifyTokens rule to '--all' + +2008-11-17 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Better handling + of 'if (0 != p)' + +2008-11-16 Daniel Marjamäki + + * CheckBufferOverrun.cpp, testbufferoverrun.cpp: Array index + overrun: Improved the checking of class variables + +2008-11-16 Daniel Marjamäki + + * testmemleak.cpp: testmemleak: Removed old TODO + +2008-11-16 Reijo Tomperi + + * CheckHeaders.cpp, CheckOther.cpp, tokenize.cpp, tokenize.h: + Refactoring: tokens() changed to const and to return const pointer. + +2008-11-16 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckHeaders.cpp, + CheckMemoryLeak.cpp, CheckOther.cpp, testsimplifytokens.cpp, + testtokenize.cpp, tokenize.cpp, tokenize.h: Refactoring: Global + variable tokenes is no more. + +2008-11-16 Reijo Tomperi + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h: Refactoring: static + variable in CheckMemoryLeak is now a private member of the class. + +2008-11-16 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h, CheckClass.cpp, + CheckClass.h, CheckMemoryLeak.cpp, CheckMemoryLeak.h, cppcheck.cpp, + testbufferoverrun.cpp, testcharvar.cpp, testconstructors.cpp, + testdivision.cpp, testmemleak.cpp, testrunner.cpp, + testunusedprivfunc.cpp, tokenize.cpp, tokenize.h: Few static + variables are now private members. ShowAll etc. global variables are + now members of Settings class and given as a parameter to the + classes that need them. + +2008-11-16 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h, testmemleak.cpp: Memory + leak: Mismatching allocation and deallocation in subfunction + +2008-11-16 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Added a simple + test case + +2008-11-16 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h, testmemleak.cpp: Memory + leak: reverted most of change 461. + +2008-11-16 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Added test case + that failed. And fixed it. + +2008-11-15 Reijo Tomperi + + * tokenize.cpp: Bug fix: Missing include from previous commit, + didn't compile on Debian. + +2008-11-15 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckMemoryLeak.cpp, CommonCheck.cpp, + CommonCheck.h, cppcheck.cpp, cppcheck.h, testbufferoverrun.cpp, + testcharvar.cpp, testmemleak.cpp, tokenize.cpp, tokenize.h: + Refactoring: Global/Static variables, FunctionList, GlobalFunctions + and UsedGlobalFunctions are now private members of Tokenizer class. + Class GlobalFunction is now private subclass of Tokenizer. Global + functions CheckGlobalFunctionUsage, FillFunctionList and + GetFunctionTokenByName are now member functions of Tokenizer. + +2008-11-15 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h, testmemleak.cpp: Memory + Leak: Handling Linux lists better => Detect more leaks + +2008-11-15 Daniel Marjamäki + + * testrunner.cbp: codeblocks: Added project file 'testrunner.cbp' + +2008-11-15 Daniel Marjamäki + + * testmemleak.cpp, testsimplifytokens.cpp, tokenize.cpp: + SimplifyTokens: Replace 'sizeof(*abc)' with '100'. This prevents + false positives in checks + +2008-11-15 Daniel Marjamäki + + * Makefile, testsimplifytokens.cpp, tokenize.cpp: Simplify Tokens: + Replace NULL with 0 and '(char *)0' with '0' + +2008-11-15 Daniel Marjamäki + + * CheckClass.cpp, testconstructors.cpp: Uninitialized Member + Variables: Fixed bug 'false positive on multi constructors' + +2008-11-15 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, testconstructors.cpp: cleanup files + +2008-11-15 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, testconstructors.cpp: Uninitialized + member variable: Added unit test that currently fails for bug + 2270353 - Uninitialized variable false positive on multi + constructors + +2008-11-15 Daniel Marjamäki + + * cppcheck.vcproj, testrunner.sln, testrunner.vcproj: Visual C++ + Express 2008: Added project 'testrunner' and updated the project + 'cppcheck' + +2008-11-15 Daniel Marjamäki + + * cppcheck.cbproj, testrunner.cbproj: Borland C++: Added files + "cppcheck" and "settings" to the projects + +2008-11-15 Daniel Marjamäki + + * man/cppcheck.1.xml: Applied patch "errors_only_man" that adds + description for "--errorsonly" to the man page. This was submitted + by kimmov in bug 2277848 + +2008-11-14 Reijo Tomperi + + * Makefile, cppcheck.cpp, cppcheck.h, main.cpp, settings.cpp, + settings.h, testrunner.cpp: Refactoring: New classes CppCheck and + Settings. Code from main.cpp was moved to cppcheck.cpp + +2008-11-13 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckHeaders.cpp, + CheckMemoryLeak.cpp, CheckOther.cpp, CommonCheck.cpp, + CommonCheck.h, main.cpp, testbufferoverrun.cpp, testcharvar.cpp, + testconstructors.cpp, testdivision.cpp, + testincompletestatement.cpp, testmemleak.cpp, testrunner.cpp, + testtokenize.cpp, testunusedprivfunc.cpp, testunusedvar.cpp, + tokenize.cpp, tokenize.h: Refactoring: Global variable Files is no + more. Use tokenizer->getFiles() to get a pointer to it. + +2008-11-13 Reijo Tomperi + + * Makefile: Make: New improved makefile + +2008-11-13 Daniel Marjamäki + + * CheckClass.cpp, testconstructors.cpp: Uninitialized variable: + chained assignments + +2008-11-13 Daniel Marjamäki + + * main.cpp: Added command line option "--errorsonly" + +2008-11-12 Reijo Tomperi + + * CheckBufferOverrun.cpp, main.cpp, testbufferoverrun.cpp, + testcharvar.cpp, testconstructors.cpp, testdivision.cpp, + testincompletestatement.cpp, testmemleak.cpp, testtokenize.cpp, + testunusedprivfunc.cpp, testunusedvar.cpp, tokenize.cpp, tokenize.h: + Refactoring: tokens_back and TypeSize are no longer global variables + +2008-11-12 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h, CheckClass.cpp, + CheckClass.h, CheckHeaders.cpp, CheckHeaders.h, + CheckMemoryLeak.cpp, CheckMemoryLeak.h, CheckOther.cpp, + CheckOther.h, main.cpp, testbufferoverrun.cpp, testcharvar.cpp, + testconstructors.cpp, testdivision.cpp, + testincompletestatement.cpp, testmemleak.cpp, + testunusedprivfunc.cpp, testunusedvar.cpp, tokenize.h: Refactoring: + Tokenizer object given as a parameter to most of the classes + +2008-11-11 Daniel Marjamäki + + * CheckClass.cpp, testunusedprivfunc.cpp: Unused private function: + return pointer to private function + +2008-11-11 Daniel Marjamäki + + * testmemleak.cpp: Memory leak: Added TODO test. Mismatching + allocation and deallocation in subfunction + +2008-11-11 Daniel Marjamäki + + * testunusedprivfunc.cpp: unused private function: Added test1 + (assert that error message is given for simple case) + +2008-11-11 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Fixed one more + unit test + +2008-11-11 Daniel Marjamäki + + * CheckOther.cpp: Refactoring: Don't use the TOKEN::str directly + +2008-11-11 Daniel Marjamäki + + * CheckBufferOverrun.cpp: Refactoring: Use 'Match' instead of direct + comparisons + +2008-11-11 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h, CheckClass.cpp, + CheckClass.h, CheckHeaders.cpp, CheckHeaders.h, + CheckMemoryLeak.cpp, CheckMemoryLeak.h, CheckOther.cpp, + CheckOther.h, Makefile, main.cpp, preprocessor.cpp, preprocessor.h, + testbufferoverrun.cpp, testcharvar.cpp, testconstructors.cpp, + testdivision.cpp, testincompletestatement.cpp, testmemleak.cpp, + testpreprocessor.cpp, testunusedprivfunc.cpp, testunusedvar.cpp: + Refactoring: Following new classes were created: + CheckBufferOverrunClass CheckClass CheckHeaders CheckMemoryLeakClass + CheckOther Preprocessor + +2008-11-10 Daniel Marjamäki + + * testunusedvar.cpp: unused struct member: Added checks + +2008-11-10 Daniel Marjamäki + + * testmemleak.cpp: testmemleak: Added todo 'forwhile7' + +2008-11-10 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Handle "goto" a + little differently + +2008-11-10 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: cleanup + +2008-11-10 Daniel Marjamäki + + * todo.txt: todo: added memory leak examples + +2008-11-10 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leaks: Added tests + and handling for 'throw' and linux lists + +2008-11-10 Daniel Marjamäki + + * todo.txt: todo: added 'check operator=' + +2008-11-09 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory leak: Minor updates in the notvar + function + +2008-11-09 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory Leak: Improved + checking of subfunctions. Simplify their code. + +2008-11-09 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Ensure that + simple memory leak is detected + +2008-11-09 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CommonCheck.cpp, CommonCheck.h, + testmemleak.cpp: Memory leak: Began work for parsing into + subfunctions. + +2008-11-09 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: Removed false + positives. 'use ; use ;' is not always the same as 'use ;' + +2008-11-09 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CommonCheck.cpp, testmemleak.cpp: Memory + Leak: Stronger checking. Ignore 'if use ;' and 'if dealloc;'. A leak + could occur if it's not executed. + +2008-11-09 Reijo Tomperi + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckHeaders.cpp, + CheckMemoryLeak.cpp, CheckOther.cpp, CommonCheck.cpp, main.cpp, + testbufferoverrun.cpp, testcharvar.cpp, testconstructors.cpp, + testdivision.cpp, testincompletestatement.cpp, testmemleak.cpp, + testtokenize.cpp, testunusedprivfunc.cpp, testunusedvar.cpp, + tokenize.cpp, tokenize.h: Refactoring: Tokenizer class added, + functions still mostly static and using globals + +2008-11-08 Daniel Marjamäki + + * testsuite.h: GPL: Added comment in testsuite.h + +2008-11-08 Daniel Marjamäki + + * Makefile, testunusedprivfunc.cpp: Unused private function: Added + test + +2008-11-08 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory leak: remove the + dealloc in "if dealloc ;" if it's not followed by an "else". This + makes the checking stronger. + +2008-11-07 Reijo Tomperi + + * tokenize.h: - Fixed compiling on Debian with gcc ( missing includes and std:: ) - Removed c-style include for Borland compiler. + +2008-11-07 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory Leak: Added checking + +2008-11-07 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h, testmemleak.cpp, + tokenize.h: cleanup the files + +2008-11-07 Daniel Marjamäki + + * tokenize.h: Visual C++: Fixed compiler error for "strdup" + +2008-11-07 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp, testrunner.cbproj: Memory + Leaks: Convert "do-while" blocks to "while" blocks to make the + handling for that the same. + +2008-11-07 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h, testmemleak.cpp: Memory + Leaks: Improved the checking of loops. + +2008-11-07 Daniel Marjamäki + + * tokenize.h: Borland C++: Fixed compiler error (couldn't find the + function 'free') + +2008-11-06 Reijo Tomperi + + * FileLister.cpp, FileLister.h, testtokenize.cpp: FileLister.* and + testtokenize.cpp, changed encoding to utf-8 + +2008-11-06 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory Leak: Fixed bug with + strdup in loop. Bug 2225370 + +2008-11-06 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckMemoryLeak.cpp, CommonCheck.cpp, + CommonCheck.h, tokenize.cpp, tokenize.h: Refactoring TOKEN: Changed + from struct to class + +2008-11-06 Daniel Marjamäki + + * CheckBufferOverrun.cpp, Makefile, testbufferoverrun.cpp, + testincompletestatement.cpp, tokenize.cpp: cleanup of UTF-8. Updated + the Makefile + +2008-11-06 Daniel Marjamäki + + * CheckOther.cpp: CheckAlpha: Expanded checking to include 'isupper' + and 'islower' + +2008-11-06 Daniel Marjamäki + + * CheckClass.cpp: CheckClass: Applied patch 2220196 + +2008-11-05 Daniel Marjamäki + + * todo.txt: todo: A few short updated notes + +2008-11-05 Daniel Marjamäki + + * tests.cpp: tests: Removed this deprecated file + +2008-11-05 Daniel Marjamäki + + * testrunner.cbproj: C++ Builder: Updated the testrunner project + +2008-11-05 Daniel Marjamäki + + * CheckBufferOverrun.cpp, testbufferoverrun.cpp: Buffer overrun: + Fixed a false positive + +2008-11-05 Daniel Marjamäki + + * testother.cpp: testother: Removed this test. Individual tests will + be created instead + +2008-11-05 Daniel Marjamäki + + * testincompletestatement.cpp: testincompletestatement: created new + test + +2008-11-05 Daniel Marjamäki + + * testbufferoverrun.cpp: TestBufferOverrun: Added a test case that + shouldn't generate error. Get address beyond array. + +2008-11-05 Daniel Marjamäki + + * testtokenize.cpp, tokenize.cpp: Tokenizer: Skip inline assembly + (Bug 2220727) + +2008-11-05 Daniel Marjamäki + + * CheckClass.cpp: CheckClass: Removed false positive "unused private + function" for typedef (Bug 2220326) + +2008-11-04 Daniel Marjamäki + + * testtokenize.cpp, tokenize.cpp: Tokenize: Changed the array + CurrentToken to a std::string + +2008-11-04 Daniel Marjamäki + + * testrunner.cbproj: Borland C++: Added 'TestTokenize' to the + testrunner project + +2008-11-03 Daniel Marjamäki + + * testpreprocessor.cpp: testpreprocessor: updated the testing for + multiline preprocessor statements + +2008-11-03 Daniel Marjamäki + + * preprocessor.cpp: preprocessor: fixed invalid character + +2008-11-03 Daniel Marjamäki + + * cppcheck.cbproj, testrunner.cbproj: Updated the Borland C++ + project files + +2008-11-03 Daniel Marjamäki + + * cppcheck.sln, cppcheck.vcproj: Added Visual C++ 2008 Express + solution and project files + +2008-11-03 Daniel Marjamäki + + * preprocessor.cpp: preprocessor: simple optimizations + +2008-11-03 Daniel Marjamäki + + * FileLister.cpp, FileLister.h, Makefile, main.cpp: File Listing: + New handling of listing files. (Bug 2194949) + +2008-11-03 Daniel Marjamäki + + * testpreprocessor.cpp: TestPreprocessor: Minor update to ensure + that extra spaces are filtered out + +2008-11-03 Daniel Marjamäki + + * testbufferoverrun.cpp, testcharvar.cpp, testconstructors.cpp, + testdivision.cpp, testmemleak.cpp, testother.cpp, testunusedvar.cpp: + Testing: DeallocateTokens after each test + +2008-11-03 Daniel Marjamäki + + * testtokenize.cpp, tokenize.cpp: Tokenizer: Handle '\' in + preprocessor lines + +2008-11-02 Daniel Marjamäki + + * preprocessor.cpp, testpreprocessor.cpp: preprocessor: handling the + '\' in preprocessor code + +2008-11-02 Daniel Marjamäki + + * CheckOther.cpp, testcharvar.cpp: TestCharVar: Fixed some false + positives + +2008-11-02 Daniel Marjamäki + + * CheckClass.cpp: Class Checking: Fixed AV in FindClassFunction + +2008-11-02 Daniel Marjamäki + + * testmemleak.cpp, tokenize.cpp: memleak: fixed false positives for + assignment in return statement (bug 2205568) + +2008-11-01 Daniel Marjamäki + + * CheckClass.cpp, testconstructors.cpp: Uninitialized Member + Variables: Fixed problems with different classes with same name (Bug + 2208157) + +2008-11-01 Daniel Marjamäki + + * man/cppcheck.1.xml: man: Added xml for generating man page + +2008-11-01 Daniel Marjamäki + + * Makefile: Makefile: Applied changes suggested by Reijo + +2008-11-01 Daniel Marjamäki + + * CheckClass.cpp, testconstructors.cpp: Uninitialized member + variables: Removed false positives when using operator= (Bug + 2190376) + +2008-11-01 Daniel Marjamäki + + * CheckClass.cpp, testconstructors.cpp: Uninitialized Member + Variables: Check statements that begin after for example "if (..)" + or "else" (Bug 2190290) + +2008-11-01 Daniel Marjamäki + + * CheckClass.cpp, testconstructors.cpp: Unitialized Members + Variables: Fixed false positives when using "this" (Bug 2190300) + +2008-10-31 Daniel Marjamäki + + * testpreprocessor.cpp: testpreprocessor: changed the syntax + +2008-10-31 Daniel Marjamäki + + * preprocessor.cpp: preprocessor: Minor typo fix + +2008-10-31 Daniel Marjamäki + + * main.cpp, preprocessor.cpp, preprocessor.h, testpreprocessor.cpp: + Preprocessor: Added elif handling. Check for invalid characters + +2008-10-31 Daniel Marjamäki + + * preprocessor.cpp, tokenize.cpp: fixed compilation warnings + generated by visual c++. Nothing serious + +2008-10-30 Daniel Marjamäki + + * main.cpp, preprocessor.cpp, testpreprocessor.cpp, tokenize.cpp, + tokenize.h: preprocessor: Use the new preprocessor in cppcheck + +2008-10-30 Daniel Marjamäki + + * preprocessor.cpp, testpreprocessor.cpp: preprocessor: Handling + "#if .." better + +2008-10-30 Daniel Marjamäki + + * main.cpp, preprocessor.cpp, testpreprocessor.cpp: preprocessor: + Minor cleanups and fixes + +2008-10-30 Daniel Marjamäki + + * main.cpp: Check that a supported compiler is used to when + compiling c++check + +2008-10-30 Daniel Marjamäki + + * testpreprocessor.cpp: preprocessor: Added test if_cond1. It fails + currently + +2008-10-29 Daniel Marjamäki + + * preprocessor.cpp, testpreprocessor.cpp: preprocessor: Added tests + test3, test4, test5 and if1 + +2008-10-29 Daniel Marjamäki + + * preprocessor.cpp: preprocessor: Fixed tests + +2008-10-28 Daniel Marjamäki + + * testpreprocessor.cpp: preprocessor: updated the tests. They are + now failing. + +2008-10-28 Daniel Marjamäki + + * preprocessor.cpp, preprocessor.h, testpreprocessor.cpp: cleanup + +2008-10-27 Daniel Marjamäki + + * preprocessor.cpp, testpreprocessor.cpp: preprocessor: refactoring + the preprocessor and added TestPreprocessor::if0 + +2008-10-27 Daniel Marjamäki + + * preprocessor.cpp, preprocessor.h, testpreprocessor.cpp: + preprocessor: Refactoring + +2008-10-27 Daniel Marjamäki + + * testrunner.cbproj: C++ Builder: Added the preprocessor files to + testrunner.cbproj + +2008-10-26 Daniel Marjamäki + + * preprocessor.cpp, testpreprocessor.cpp: preprocessor: Remove + comments + +2008-10-26 Daniel Marjamäki + + * preprocessor.cpp, testpreprocessor.cpp: preprocessor: refactoring + +2008-10-26 Daniel Marjamäki + + * preprocessor.cpp: preprocessor: quick fix to make the + TestPreprocessor::test1 work + +2008-10-26 Daniel Marjamäki + + * preprocessor.cpp, preprocessor.h, testpreprocessor.cpp: + preprocessor: Created a simple test. But it fails currently. + +2008-10-26 Daniel Marjamäki + + * testrunner.cpp, testsuite.cpp, testsuite.h: Testing: Only run + tests in a specified class + +2008-10-26 Daniel Marjamäki + + * Makefile, preprocessor.cpp, preprocessor.h, testpreprocessor.cpp: + preprocessor: Added new preprocessor. Only used in the tests yet. + +2008-10-26 Daniel Marjamäki + + * COPYING, CheckBufferOverrun.cpp, CheckBufferOverrun.h, + CheckClass.cpp, CheckClass.h, CheckHeaders.cpp, CheckHeaders.h, + CheckMemoryLeak.cpp, CheckMemoryLeak.h, CheckOther.cpp, + CheckOther.h, CommonCheck.cpp, CommonCheck.h, main.cpp, + testbufferoverrun.cpp, testcharvar.cpp, testconstructors.cpp, + testdivision.cpp, testmemleak.cpp, testother.cpp, testrunner.cpp, + testsuite.cpp, testunusedvar.cpp, tokenize.cpp, tokenize.h: + Licensing: Using the GPL 3 license + +2008-10-25 Daniel Marjamäki + + * CommonCheck.cpp, main.cpp: Usage of Global functions: Only checked + if "--all" is given. Show progress. + +2008-10-25 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Reverted [352] it's not a + good fix + +2008-10-25 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: CheckMemoryLeak: Fixed bug + 2190219 - False positive, Mismatching allocation and deallocation + +2008-10-23 Daniel Marjamäki + + * CheckOther.cpp, Makefile, testother.cpp: CheckIncompleteStatement: + Fixed false positive generated by CheckIncompleteStatement (bug + 2187837) + +2008-10-21 Daniel Marjamäki + + * CheckClass.cpp: CheckClass: Minor fix to make it compile in Visual + c++ + +2008-10-19 Daniel Marjamäki + + * CheckClass.cpp: CheckConstructors: Handle recursion better. Don't + hang. + +2008-10-19 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory Leak: Better checking of mismatching + alloc and dealloc for gtk + +2008-10-19 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: Memory Leak: Fixed false + positive + +2008-10-19 Daniel Marjamäki + + * tokenize.cpp: tokenize: Fixed possible endless loop problem when + handling typedefs + +2008-10-18 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Memory Leak: Better checking of memory leaks + in gtk applications + +2008-10-16 Daniel Marjamäki + + * Makefile, testbufferoverrun.cpp, testcharvar.cpp, + testconstructors.cpp, testdivision.cpp, testmemleak.cpp, + testsuite.cpp, testsuite.h, testunusedvar.cpp: testing: Various + fixes to make the tests compile without warnings/errors + +2008-10-16 Daniel Marjamäki + + * CheckMemoryLeak.cpp: MemoryLeak: Minor fix to reduce false + positives + +2008-10-15 Daniel Marjamäki + + * CheckMemoryLeak.cpp: MemoryLeak: minor updates + +2008-10-15 Daniel Marjamäki + + * testbufferoverrun.cpp, testcharvar.cpp, testconstructors.cpp, + testdivision.cpp, testmemleak.cpp, testsuite.h: Testing: Added macro + 'REGISTER_TEST' + +2008-10-13 Daniel Marjamäki + + * testbufferoverrun.cpp, testcharvar.cpp, testconstructors.cpp, + testdivision.cpp, testmemleak.cpp, testrunner.cbproj, + testrunner.cpp, testsuite.cpp, testsuite.h: Testing: Updated the + testing to the new test framework + +2008-10-12 Daniel Marjamäki + + * MiniCppUnit.cpp, MiniCppUnit.h, TestsRunner.cpp: testing: Removed + MiniCppUnit + +2008-10-12 Daniel Marjamäki + + * testrunner.cpp, testsuite.cpp, testsuite.h: testing: Added a new + unit testing framework + +2008-10-08 Daniel Marjamäki + + * testmemleak.cpp: testmemleak: preparing to add checks of function + calls + +2008-10-06 Daniel Marjamäki + + * CheckOther.cpp, testdivision.cpp: Unsigned division: Checking if + negative constant is used + +2008-10-06 Daniel Marjamäki + + * testdivision.cpp: TestDivision: Added two tests of unsigned + division when negative constant is used. + +2008-10-04 Daniel Marjamäki + + * CheckOther.cpp, main.cpp, testdivision.cpp: CheckUnsignedDivision: + Made it more accurate and moved it to the standard checks + +2008-09-29 Daniel Marjamäki + + * CheckMemoryLeak.cpp: CheckMemoryLeak: Removed false positives + about not deleting class instances + +2008-09-24 Daniel Marjamäki + + * main.cpp: cppcheck: removed checking of implementation in header. + temporarily commented out the check for variable scope. These + changes were made so that fewer warning messages will be produced + when running c++check + +2008-09-24 Daniel Marjamäki + + * Makefile, testunusedvar.cpp: testunusedvar: Added simple testing + for unused variables + +2008-09-23 Daniel Marjamäki + + * CheckOther.cpp: CheckOther: Minor updates. Removed false positives + for CheckScope + +2008-09-20 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, main.cpp, tokenize.cpp: Incomplete + statement: Check for statements that begin with a constant + +2008-09-16 Daniel Marjamäki + + * CheckOther.cpp, testcharvar.cpp: CheckOther: Minor updates in + checking of signed char variables and unsigned division + +2008-09-15 Daniel Marjamäki + + * CheckOther.cpp, testdivision.cpp: CheckUnsignedDivision: + Refactoring + +2008-09-11 Daniel Marjamäki + + * tokenize.cpp: tokenize: Fixed a bug in the tokenizer + +2008-09-11 Daniel Marjamäki + + * main.cpp: visual c++: added "--recursive" support + +2008-09-11 Daniel Marjamäki + + * CheckClass.cpp, CheckMemoryLeak.cpp, CommonCheck.cpp, main.cpp, + tokenize.cpp: compilation: Various cross compilation fixes. The + "--recursive" option doesn't work on VC now. + +2008-09-10 Daniel Marjamäki + + * CommonCheck.cpp, MiniCppUnit.cpp, main.cpp: compilation: hopefully + the program should be compilable on VC now + +2008-09-02 Daniel Marjamäki + + * CheckMemoryLeak.cpp: memleak: better handling of switch blocks + +2008-09-01 Daniel Marjamäki + + * testmemleak.cpp: testmemleak: added checks for class members + +2008-08-31 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: memleak: uncommented and + fixed the handling of switch + +2008-08-30 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: memleak: commented out the + switch handling temporarily. it causes segmentation faults when + checking the linux kernel. + +2008-08-30 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckHeaders.cpp, + CheckOther.cpp, CommonCheck.cpp, main.cpp, tokenize.cpp: made + cppcheck compile with g++ 4.3 + +2008-08-30 Daniel Marjamäki + + * main.cpp, tokenize.cpp: djgpp: Fixed compiler warnings/errors when + compiling with DJGPP + +2008-08-28 Daniel Marjamäki + + * testdivision.cpp, tokenize.cpp: tokenize: handle simple typedefs + +2008-08-28 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, Makefile, main.cpp, + testcharvar.cpp, testrunner.cbproj: char variable usage: Added + checking + +2008-08-27 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: testmemleak: improved the + checking of loops + +2008-08-27 Daniel Marjamäki + + * CheckOther.cpp, testdivision.cpp: testdivision: changed the error + message. hopefully it is clearer + +2008-08-27 Daniel Marjamäki + + * testrunner.cbproj: testrunner.cbproj: added 'testbufferoverrun', + 'testconstructors' and 'testdivision' + +2008-08-25 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: CheckMemoryLeak: Improved + the reducing of "if.." + +2008-08-24 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak.cpp: testmemleak: replace switch + blocks with if blocks + +2008-08-24 Daniel Marjamäki + + * Makefile, testconstructors.cpp: testing: added 'testconstructors' + +2008-08-23 Daniel Marjamäki + + * testdivision.cpp: test: Added 'testdivision.cpp' + +2008-08-23 Daniel Marjamäki + + * Makefile, testmemleak.cpp, tests.cpp: test: Added 'testdivision' + +2008-08-23 Daniel Marjamäki + + * testbufferoverrun.cpp, tests.cpp: test: Minor polishing + +2008-08-23 Daniel Marjamäki + + * testbufferoverrun.cpp: test: Added the last buffer overrun tests + +2008-08-23 Daniel Marjamäki + + * Makefile, testbufferoverrun.cpp, tests.cpp: testing: Added + 'testbufferoverrun' + +2008-08-23 Daniel Marjamäki + + * MiniCppUnit.cpp, MiniCppUnit.h: minicppunit: removed compiler + warnings about characters + +2008-08-23 Daniel Marjamäki + + * CheckMemoryLeak.cpp: CheckMemoryLeak: Updated the handling of + 'case' and 'default' a little + +2008-08-22 Daniel Marjamäki + + * test_cppcheck.cbproj, testrunner.cbproj: testing: created new + testproject for codegear that uses the minicppunit framework + +2008-08-22 Daniel Marjamäki + + * CheckMemoryLeak.cpp, MiniCppUnit.cpp, MiniCppUnit.h, + testmemleak.cpp, tests.cpp: testing: Moved tests from tests.cpp to + testmemleak.cpp (forwhile, switch) + +2008-08-21 Daniel Marjamäki + + * CheckMemoryLeak.cpp, MiniCppUnit.cpp, testmemleak.cpp, tests.cpp: + testing: Added tests TestMemoryleak::ifelse + +2008-08-21 Daniel Marjamäki + + * Makefile, MiniCppUnit.cpp, MiniCppUnit.h, TestsRunner.cpp, + testmemleak.cpp: testing: Started using the MiniCppUnit framework + +2008-08-20 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CommonCheck.cpp: refactoring: made + compilation work in codegear + +2008-08-20 Daniel Marjamäki + + * CheckMemoryLeak.cpp: CheckMemoryLeak: Fixed a bug: Don't erase "{ + }", replace with ";" + +2008-08-19 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Added testcase + (false positive from linux kernel) + +2008-08-19 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CommonCheck.cpp, tests.cpp: CheckMemoryLeak: + Small improvements + +2008-08-18 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: By default skip + class memory leaks because there may be various types of garbage + collectors + +2008-08-17 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Minor updates + +2008-08-17 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Made a test case + work + +2008-08-16 Daniel Marjamäki + + * CheckMemoryLeak.cpp: CheckMemoryLeak: Simplified and updated the + code reducers + +2008-08-16 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Refactoring + further + +2008-08-16 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Added simple + checking + +2008-08-16 Daniel Marjamäki + + * CheckMemoryLeak.cpp: CheckMemoryLeak: Got rid of false positives + +2008-08-16 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CommonCheck.cpp, CommonCheck.h: + CheckMemoryLeak: Refactoring the check + +2008-08-15 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Made the checking + a lot simpler when "--all" is not given. This should give few false + positives + +2008-08-15 Daniel Marjamäki + + * tests.cpp: tests: Added memory leak test that gives a false + positive + +2008-08-15 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Added testcase + and made it work (assume that foo.add(p) deallocates p. Todo to + trace into foo.add) + +2008-08-14 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: better handling + of switch blocks + +2008-08-13 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Handle one more + test case (return pointer) + +2008-08-13 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Calling unknown + function => assume that it's deallocating variable + +2008-08-12 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: memory leak: improved the + checking. subfunctions are parsed. redundant conditions are skipped + +2008-08-12 Daniel Marjamäki + + * CheckOther.cpp, tokenize.cpp: cleanup: removed spaces + +2008-08-12 Daniel Marjamäki + + * CheckBufferOverrun.cpp, tests.cpp: buffer overruns: added tests + and improved the checking + +2008-08-11 Daniel Marjamäki + + * tests.cpp: tests: cleanup and reordering + +2008-08-11 Daniel Marjamäki + + * tests.cpp: tests: Refactoring + +2008-08-09 Daniel Marjamäki + + * todo.txt: todo: added todo to simplify the token list further + +2008-08-09 Daniel Marjamäki + + * tests.cpp: tests: minor updates of the tests + +2008-08-09 Daniel Marjamäki + + * CheckMemoryLeak.cpp: CheckMemoryLeak: Improved the checking + (handling loops) + +2008-08-07 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: updated the + checking so that all execution paths are tried + +2008-08-07 Daniel Marjamäki + + * cppcheck.cbproj, test_cppcheck.cbproj: cg2007: Added CodeGear 2007 + project files + +2008-08-07 Daniel Marjamäki + + * CheckMemoryLeak.cpp: Refactoring: Renamed class allocfunc to + AllocFunc + +2008-08-07 Daniel Marjamäki + + * CommonCheck.cpp: CommonCheck: Refactoring. Renamed + clGlobalFunction to GlobalFunction + +2008-05-14 Daniel Marjamäki + + * tests.cpp: tests: updated the tests + +2008-05-14 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h: CheckOther: Removed unused functions + +2008-05-10 Daniel Marjamäki + + * tests.cpp: testing: Added test for mismatching allocation and + deallocation + +2008-05-10 Daniel Marjamäki + + * CheckBufferOverrun.cpp: CheckBufferOverrun: Refactoring and made + the checking smarter + +2008-05-10 Daniel Marjamäki + + * CheckBufferOverrun.cpp: CheckBufferOverrun: Fixed minor bug that + resultet in false positives + +2008-05-10 Daniel Marjamäki + + * CheckMemoryLeak.cpp: CheckMemoryLeak: Made the checking weaker to + reduce false positives + +2008-05-10 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Handling + functions that allocate memory + +2008-05-10 Daniel Marjamäki + + * CheckOther.cpp, tests.cpp: CheckStructMemberUsage: Added more + cases + +2008-05-09 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, main.cpp, tests.cpp: + CheckStructMemberUsage: Check for unused struct members + +2008-05-05 Daniel Marjamäki + + * CommonCheck.cpp: CheckGlobalFunctionUsage: Optimised + +2008-05-04 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Removed false + positives + +2008-05-03 Daniel Marjamäki + + * CheckOther.cpp, tests.cpp: CheckConstantFunctionParameters: + Updated the check to handle all std::.. struct and class + +2008-05-03 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, main.cpp: Added check: passing + constant function parameter by value instead of by reference/pointer + +2008-05-03 Daniel Marjamäki + + * CheckMemoryLeak.cpp: CheckMemoryLeak.cpp: Minor improvements to + avoid false positives + +2008-04-18 Daniel Marjamäki + + * CheckClass.cpp: Checking memset/memcpy/memmove. Removed false + positives + +2008-04-16 Daniel Marjamäki + + * CheckMemoryLeak.cpp: CheckMemoryLeak: A few tweaks to make it + report less false positives against the linux kernel + +2008-04-14 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Small fixes and + updates + +2008-04-14 Daniel Marjamäki + + * CheckMemoryLeak.cpp: CheckMemoryLeak: Bug fix so that checking + stops when the variable goes out of scope + +2008-04-14 Daniel Marjamäki + + * bugs_that_cppcheck_finds.txt: Removed 'bugs_that_cppcheck_finds'. + It will be listed in the wiki instead + +2008-04-12 Daniel Marjamäki + + * CheckClass.cpp, CheckMemoryLeak.cpp, tests.cpp: Minor updates. + Added todo. Refactoring + +2008-04-12 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: Improved the + checking (tests.cpp:memleak_in_function:test16) + +2008-04-12 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: CheckMemoryLeak: fixed bug that + caused false positives + +2008-04-12 Daniel Marjamäki + + * tests.cpp: Added testcase to look at later + +2008-04-12 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tokenize.cpp, tokenize.h: Checking for memory + leaks. Changed the handling of comments about deleting + +2008-04-11 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp, tokenize.cpp, tokenize.h: Make it + possible to disable memory leak checking for a variable. Usable to + avoid false positives + +2008-04-11 Daniel Marjamäki + + * main.cpp: Added comments + +2008-04-08 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: Refactoring CheckMemoryLeak to + detect more leaks + +2008-04-06 Daniel Marjamäki + + * CheckBufferOverrun.cpp, tests.cpp: CheckBufferOverrun: Removed a + false positive + +2008-04-06 Daniel Marjamäki + + * bugs_that_cppcheck_finds.txt, todo.txt: Minor updates in text + files. + +2008-04-06 Daniel Marjamäki + + * TestTok.cpp: TestTok: Deleted deprecated file + +2008-04-06 Daniel Marjamäki + + * CheckMemoryLeak.cpp: CheckMemoryLeak: Added more allocation and + deallocation functions + +2008-04-06 Daniel Marjamäki + + * Makefile: Makefile: Removed Statements + +2008-04-06 Daniel Marjamäki + + * Statements.cpp, Statements.h: Statements: Removed this bastard + from cppcheck + +2008-04-06 Daniel Marjamäki + + * main.cpp: Minor updates to [232] and [233]. Use __GNUC__ define + instead of CYGWIN + +2008-04-06 Daniel Marjamäki + + * main.cpp: Addon to [232] + +2008-04-06 Daniel Marjamäki + + * CheckHeaders.cpp, CheckMemoryLeak.cpp, CommonCheck.cpp, + CommonCheck.h, main.cpp, tokenize.cpp: Fixing bug 1935006 - Compile + problems on cygwin + +2008-04-05 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: Re-adding CheckMemoryLeak + functionality. More work is still needed. + +2008-04-04 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: Further improvements of + CheckMemoryLeak. Still not working as good as a few revisions ago. + +2008-04-04 Daniel Marjamäki + + * bufferoverrun.txt: Removed old file 'bufferoverrun.txt' + +2008-04-03 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: Refactoring CheckMemoryLeak + +2008-04-02 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckMemoryLeak.cpp, + CommonCheck.cpp: Match: Added matching for [] + +2008-04-02 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: Rewriting CheckMemoryLeak (Just + Started) + +2008-04-01 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckOther.cpp, tests.cpp: Minor updates. + Removed some false positives when checking variable scope + +2008-03-29 Daniel Marjamäki + + * CheckOther.cpp, CommonCheck.cpp, Statements.cpp, tests.cpp: Fixed + minor bugs + +2008-03-29 Daniel Marjamäki + + * CommonCheck.cpp, CommonCheck.h, Statements.cpp, main.cpp, + tests.cpp, tokenize.cpp: Added style checks to check for unused + global functions + +2008-03-28 Daniel Marjamäki + + * CheckClass.cpp, CommonCheck.cpp, CommonCheck.h, main.cpp, + tests.cpp: Refactoring: Removed 'HasErrors'. Better usage of + 'Match'. Hid the 'FunctionList' + +2008-03-28 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckHeaders.cpp, + CheckMemoryLeak.cpp, CheckOther.cpp, CommonCheck.cpp, + CommonCheck.h, Statements.cpp, main.cpp, tests.cpp, tokenize.cpp, + tokenize.h: Refactoring: Replaced deprecated "match" with the new + "Match" + +2008-03-27 Daniel Marjamäki + + * CheckBufferOverrun.cpp, tests.cpp: CheckBufferOverrun: Improved + checking of arrays declared like this: "type * var [ num ]" + +2008-03-26 Daniel Marjamäki + + * CheckBufferOverrun.cpp: test cppcheck: All tests work + +2008-03-25 Daniel Marjamäki + + * CheckBufferOverrun.cpp: Fixed bugs in 'CheckBufferOverrun.cpp' + +2008-03-25 Daniel Marjamäki + + * CheckBufferOverrun.cpp: To compile with borland, 'algorithm' was + needed + +2008-03-24 Daniel Marjamäki + + * CheckBufferOverrun.cpp, tests.cpp: Refactoring of + 'CheckBufferOverrun.cpp' + +2008-03-24 Daniel Marjamäki + + * CheckBufferOverrun.cpp: Refactoring 'CheckBufferOverrun'. Added + 'Match1'. + +2008-03-24 Daniel Marjamäki + + * CheckBufferOverrun.cpp: Refactoring the 'CheckBufferOverrun' + +2008-03-24 Daniel Marjamäki + + * CheckBufferOverrun.cpp, tests.cpp: Removed checking of 'dynamic + data' it's impossible to determine if it's false or true positives + without deeper analysis. + +2008-03-24 Daniel Marjamäki + + * CheckBufferOverrun.cpp: Made the checking for buffer overruns more + generic + +2008-03-24 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CommonCheck.cpp, CommonCheck.h: Combined + 'findfunction' and 'FindFunction'. Updated "CheckBufferOverrun" + (checking for-loops). + +2008-03-23 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CommonCheck.cpp, CommonCheck.h, tests.cpp: + Buffer overrun in function parameter + +2008-03-23 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckClass.cpp, tokenize.cpp: Refactoring + (Replace '->' with '.', use matching function when possible) + +2008-03-23 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckHeaders.cpp, CheckOther.cpp, + CommonCheck.cpp, CommonCheck.h, tests.cpp: Reverted 205:207 + +2008-03-23 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckOther.cpp, CommonCheck.cpp, + CommonCheck.h: Refactoring + +2008-03-23 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckHeaders.cpp, CheckOther.cpp, + CommonCheck.cpp, CommonCheck.h, tests.cpp: Refactoring: Use + 'setindentlevel' + +2008-03-22 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CommonCheck.cpp, CommonCheck.h: + Refactoring: Added helper function 'setindentlevel' + +2008-03-22 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CommonCheck.cpp, CommonCheck.h: Minor + refactoring + +2008-03-22 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckOther.cpp, + tokenize.cpp, tokenize.h: In the checks, use const pointers + +2008-03-21 Daniel Marjamäki + + * CheckBufferOverrun.cpp, tests.cpp: Handling pointers in + 'CheckBufferOverrun_StructVariable' + +2008-03-21 Daniel Marjamäki + + * CheckBufferOverrun.cpp, tests.cpp: Check for buffer overruns for + struct members (only numeric) + +2008-03-21 Daniel Marjamäki + + * checknpp.bat: Deleted obsolete file 'checknpp.bat' + +2008-03-21 Daniel Marjamäki + + * CheckOther.cpp, tests.cpp: 'CheckUnsignedDivision' -> more errors. + 'CheckVariableScope' -> removed false errors. + +2008-03-20 Daniel Marjamäki + + * CheckOther.cpp: Rewrote the checking for "unsigned division" => + less false positives + +2008-03-19 Daniel Marjamäki + + * tokenize.cpp: tokenize: Fixed two bugs * don't hang if we can't find the ending of a string. * don't divide by zero + +2008-03-19 Daniel Marjamäki + + * CheckOther.cpp, Statements.cpp, main.cpp: Updates here and there + to make it more accurate + +2008-03-18 Daniel Marjamäki + + * CheckClass.cpp: Better checking of class declarations. + +2008-03-18 Daniel Marjamäki + + * tests.cpp, tokenize.cpp: Updated tokenizer. To handle "#define + f1(a,b) (a+b)" better + +2008-03-17 Daniel Marjamäki + + * CheckOther.cpp, tests.cpp: Checking variable scope + +2008-03-17 Daniel Marjamäki + + * todo.txt: Updated 'todo.txt' + +2008-03-16 Daniel Marjamäki + + * CheckOther.cpp, main.cpp, tests.cpp: bug fixes for + 'CheckVariableScope' + +2008-03-16 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, CommonCheck.cpp, CommonCheck.h, + tests.cpp, tokenize.cpp, tokenize.h: Added test + 'CheckVariableScope'. Increased constness. + +2008-03-16 Daniel Marjamäki + + * tests.cpp, todo.txt: added 'todo.txt' + +2008-03-15 Daniel Marjamäki + + * checkproj.bat: Removed 'checkproj.bat' (Deprecated) + +2008-02-22 Daniel Marjamäki + + * readme.txt: updated command syntax example + +2008-02-22 Daniel Marjamäki + + * tests.cpp: allow duplicate error messages in tests + +2008-02-22 Daniel Marjamäki + + * CheckOther.cpp, CommonCheck.cpp, CommonCheck.h, main.cpp: Removed + false positives and also duplicate error messages. + +2008-02-22 Daniel Marjamäki + + * CheckOther.cpp: comments + +2008-02-22 Daniel Marjamäki + + * CheckClass.cpp: Removed false positives + +2008-02-22 Daniel Marjamäki + + * main.cpp: sort the files before checking to make the results + comparable + +2008-02-21 Daniel Marjamäki + + * CheckBufferOverrun.cpp: Fixed bug (Dereferencing NULL) + +2008-02-21 Daniel Marjamäki + + * CheckOther.cpp: removed false positives for CheckUnsignedDivision + +2008-02-21 Daniel Marjamäki + + * main.cpp: recursive checking when compiling with gcc + +2008-02-21 Daniel Marjamäki + + * main.cpp: recursive checking when compiled by borland c++ + +2008-02-20 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, main.cpp, tests.cpp, tokenize.cpp: + CheckUnsignedDivision: Added check. Not very accurate yet. + +2008-02-19 Daniel Marjamäki + + * CheckClass.cpp, tests.cpp: CheckClass: Improved constructor + checking + +2008-02-18 Daniel Marjamäki + + * Statements.cpp: Refactoring: Removed unneeded parameter + PointerType + +2008-02-18 Daniel Marjamäki + + * CheckClass.cpp, CheckHeaders.cpp, main.cpp, tokenize.cpp: Made it + compilable by borland c++ + +2008-02-18 Daniel Marjamäki + + * CheckClass.cpp, tests.cpp: ClassChecking: Only enable the 'no + constructor' warning if '--style' is given + +2008-02-18 Daniel Marjamäki + + * CheckClass.cpp, tests.cpp: Class Checking: No constructor + +2008-02-17 Daniel Marjamäki + + * main.cpp, tests.cpp: checking multiple files + +2008-02-17 Daniel Marjamäki + + * bugs_that_cppcheck_finds.txt: Added list of bugs that cppcheck + find (incomplete) + +2008-02-17 Daniel Marjamäki + + * CheckMemoryLeak.cpp, tests.cpp: Unit Testing: Checking for + mismatching allocation / deallocation + +2008-02-17 Daniel Marjamäki + + * Statements.cpp, tests.cpp: Unit Testing: Testing the statement + list + +2008-02-17 Daniel Marjamäki + + * Statements.cpp, Statements.h, internaltesting/testassign.cpp, + internaltesting/testassign.out, internaltesting/testdecl.cpp, + internaltesting/testdecl.out, internaltesting/testif.cpp, + internaltesting/testif.out, internaltesting/testloop.cpp, + internaltesting/testloop.out, internaltesting/testnew.cpp, + internaltesting/testnew.out, internaltesting/testuse.cpp, + internaltesting/testuse.out, tests.cpp: Unit Testing: Moved the + 'internaltesting' + +2008-02-17 Daniel Marjamäki + + * internaltesting.bat: Cleanup old testing + +2008-02-17 Daniel Marjamäki + + * testdangerousfunc1/err.msg, + testdangerousfunc1/testdangerousfunc1.cpp, testdelete1/err.msg, + testdelete1/testdelete1.cpp, testh1/err.msg, testh1/testh1.cpp, + testh1/testh1.h, testh2/emptyh.h, testh2/err.msg, + testh2/testh2.cpp, testh2/testh2.h, testh3/err.msg, testh3/h1.h, + testh3/h2.h, testh3/testh3.cpp, testh5/err.msg, testh5/testh5.cpp, + testh5/testh5.h, testh6/err.msg, testh6/testh6.cpp, + testh6/testh6.h, testmemset1/err.msg, testmemset1/testmemset1.cpp, + teststdfunc1/err.msg, teststdfunc1/teststdfunc1.cpp: Cleanup old + tests + +2008-02-17 Daniel Marjamäki + + * testcond1/err.msg, testcond1/testcond1.cpp, testfunc2/err.msg, + testfunc2/testfunc2.cpp, testfunc3/err.msg, + testfunc3/testfunc3.cpp, testfunc4/err.msg, + testfunc4/testfunc4.cpp, testfunc6/err.msg, + testfunc6/testfunc6.cpp, testif1/err.msg, testif1/testif1.cpp, + testif2/err.msg, testif2/testif2.cpp, testif3/err.msg, + testif3/testif3.cpp, testif4/err.msg, testif4/testif4.cpp, + testif5/err.msg, testif5/testif5.cpp, updateall.bat: Cleanup of old + testcases + +2008-02-17 Daniel Marjamäki + + * testmemleak1/err.msg, testmemleak1/testmemleak1.cpp, + testmemleak2/err.msg, testmemleak2/testmemleak2.cpp, + testmemleak3/err.msg, testmemleak3/testmemleak3.cpp, + testmemleak4/err.msg, testmemleak4/testmemleak4.cpp, tests.cpp: Unit + Testing: Moving memleak checks + +2008-02-16 Daniel Marjamäki + + * CheckMemoryLeak.cpp, main.cpp, testmemcheck1/err.msg, + testmemcheck1/testmemcheck1.cpp, testmemcheck2/err.msg, + testmemcheck2/testmemcheck2.cpp, testmemcheck3/err.msg, + testmemcheck3/testmemcheck3.cpp, testmemcheck4/err.msg, + testmemcheck4/testmemcheck4.cpp, testmemcheck5/err.msg, + testmemcheck5/testmemcheck5.cpp, tests.cpp: Unit Testing: Moved + 'testmemcheck' + +2008-02-16 Daniel Marjamäki + + * testUninitVar1/err.msg, testUninitVar1/testUninitVar1.cpp, + tests.cpp: Unit Testing: Moved 'testUninitVar1' + +2008-02-16 Daniel Marjamäki + + * testclass1/err.msg, testclass1/testclass1.cpp, + testclass10/err.msg, testclass10/testclass10.cpp, + testclass12/err.msg, testclass12/testclass12.cpp, + testclass13/err.msg, testclass13/testclass13.cpp, + testclass14/err.msg, testclass14/testclass14.cpp, + testclass2/err.msg, testclass2/testclass2.cpp, testclass4/err.msg, + testclass4/testclass4.cpp, testclass4/testclass4.h, + testclass7/err.msg, testclass7/testclass7.cpp, testclass8/err.msg, + testclass8/testclass8.cpp, tests.cpp: Unit Testing: Moved + constructor and operator= checks + +2008-02-16 Daniel Marjamäki + + * cppcheck.bpf, cppcheck.bpr, tok.bpf, tok.bpr: Borland C++: Removed + project files as gcc will from now on by the primary development + environment + +2008-02-16 Daniel Marjamäki + + * testall, tests.cpp: Testing: Removed old file 'testall'. Testing + will be handled by 'tests.cpp'. + +2008-02-16 Daniel Marjamäki + + * testbufferoverrun1/err.msg, + testbufferoverrun1/testbufferoverrun1.cpp, + testbufferoverrun2/err.msg, + testbufferoverrun2/testbufferoverrun2.cpp, + testbufferoverrun3/err.msg, + testbufferoverrun3/testbufferoverrun3.cpp, + testbufferoverrun4/err.msg, + testbufferoverrun4/testbufferoverrun4.cpp, + testbufferoverrun5/err.msg, + testbufferoverrun5/testbufferoverrun5.cpp, + testbufferoverrun6/err.msg, + testbufferoverrun6/testbufferoverrun6.cpp, + testbufferoverrun7/err.msg, + testbufferoverrun7/testbufferoverrun7.cpp, tests.cpp: Unit Testing: + All tests for buffer overruns were moved + +2008-02-16 Daniel Marjamäki + + * CommonCheck.cpp, CommonCheck.h, Makefile, main.cpp, tests.cpp, + tokenize.cpp, tokenize.h: Unit Testing: Start + +2008-01-17 Daniel Marjamäki + + * CheckClass.cpp, testUninitVar1/err.msg, + testUninitVar1/testUninitVar1.cpp, testclass13/err.msg: Better + checking of uninitialized variables + +2008-01-11 Daniel Marjamäki + + * checknpp.bat: check npp472 instead of npp41 + +2008-01-10 Daniel Marjamäki + + * CheckClass.cpp, cppcheck.bpr, main.cpp, testUninitVar1/err.msg, + testUninitVar1/testUninitVar1.cpp, testbufferoverrun1/warn.msg, + testbufferoverrun2/warn.msg, testbufferoverrun3/warn.msg, + testbufferoverrun4/warn.msg, testbufferoverrun5/warn.msg, + testbufferoverrun6/warn.msg, testclass1/warn.msg, + testclass10/warn.msg, testclass12/warn.msg, testclass13/err.msg, + testclass13/warn.msg, testclass2/warn.msg, testclass4/warn.msg, + testclass7/warn.msg, testclass8/warn.msg, testcond1/warn.msg, + testdangerousfunc1/warn.msg, testdelete1/warn.msg, + testfunc2/warn.msg, testfunc3/warn.msg, testfunc4/warn.msg, + testfunc6/warn.msg, testh1/warn.msg, testh2/warn.msg, + testh3/warn.msg, testh5/warn.msg, testif1/warn.msg, + testif2/warn.msg, testif3/warn.msg, testif4/warn.msg, + testif5/warn.msg, testmemcheck1/warn.msg, testmemcheck2/warn.msg, + testmemcheck3/warn.msg, testmemcheck4/warn.msg, + testmemcheck5/warn.msg, testmemleak4/warn.msg, + testmemset1/warn.msg, teststdfunc1/warn.msg, updateall.bat: check + for uninitialized variables - less generic to increase accuracy + +2008-01-05 Daniel Marjamäki + + * testall: Added 'testall' which is a simple bash-script that runs + all tests + +2007-10-29 Daniel Marjamäki + + * CheckClass.cpp, testclass14/err.msg, testclass14/testclass14.cpp: + remove false positives (uninitialized class members) + +2007-10-23 Daniel Marjamäki + + * CheckClass.cpp: CheckClass: Treating all "std::*" as initialized. + +2007-10-23 Daniel Marjamäki + + * tokenize.cpp: tokenizer: removed some preprocessing => less false + positives + +2007-10-22 Daniel Marjamäki + + * main.cpp, testcasebreak/err.msg, testcasebreak/testcasebreak.cpp, + testcasebreak/warn.msg, testfunc5/err.msg, testfunc5/testfunc5.cpp, + testfunc5/warn.msg: disabled checks that generates false positives + +2007-08-31 Daniel Marjamäki + + * CheckClass.cpp, CheckMemoryLeak.cpp, CheckOther.cpp, + testcasebreak/warn.msg, testmemleak3/err.msg, testmemleak4/err.msg, + testmemleak4/testmemleak4.cpp, testmemleak4/warn.msg: Removing false + positives + +2007-07-27 Daniel Marjamäki + + * CheckMemoryLeak.cpp, Statements.cpp, testmemleak2/err.msg, + testmemleak2/testmemleak2.cpp, testmemleak3/err.msg, + testmemleak3/testmemleak3.cpp: Added 2 checks for memory leaks + +2007-07-26 Daniel Marjamäki + + * main.cpp: Don't allow search pattern in the filename yet. There's + no way to solve it through ANSI C. + +2007-07-26 Daniel Marjamäki + + * checkproj.bat, readme.txt: Minor update: Updated the readme and + checkproj files. + +2007-07-26 Daniel Marjamäki + + * testcond1/err.msg: TestCond1: Updated test. It didn't have a + "err.msg" file + +2007-07-26 Daniel Marjamäki + + * testcasebreak/err.msg, testcasebreak/testcasebreak.cpp, + testcasebreak/warn.msg: Added test: "testcasebreak" + +2007-07-24 Daniel Marjamäki + + * main.cpp: Searching multiple files + +2007-07-24 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, testcond1/testcond1.cpp, + testcond1/warn.msg: Added checks: * CheckIfAssignment: assignment in condition * CheckCaseWithoutBreak: case but no break/return + +2007-07-20 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckMemoryLeak.cpp, Statements.cpp, + checknpp.bat, main.cpp, testclass13/warn.msg: Command line options: + Added "--all" and "--style", removed "-w" + +2007-07-20 Daniel Marjamäki + + * bufferoverrun.txt: bufferoverrun.txt: Added file that contains + thoughts and ideas concerning buffer overruns. + +2007-07-20 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CommonCheck.cpp, CommonCheck.h, + Statements.cpp: For the highest accuracy, don't warn for all memory + leaks unless the "-w" is given + +2007-07-20 Daniel Marjamäki + + * CheckClass.cpp: Always give a warning when 'memset' is used upon a + class + +2007-07-19 Daniel Marjamäki + + * CheckBufferOverrun.cpp, main.cpp, testbufferoverrun7/err.msg, + testbufferoverrun7/testbufferoverrun7.cpp: Improved the buffer + overrun checks. Results that are not 100% certain must be enabled + through the "-w". + +2007-07-18 Daniel Marjamäki + + * Makefile, tokenize.cpp: Minor modifications to make it compile on + linux + +2007-07-18 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CommonCheck.cpp, main.cpp, + testbufferoverrun7/err.msg, + testbufferoverrun7/testbufferoverrun7.cpp: Buffer overruns, using + string with unknown length + +2007-07-17 Daniel Marjamäki + + * CheckMemoryLeak.cpp, Makefile: Minor updates to make it easier to + port to Linux + +2007-07-17 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckClass.cpp, CheckHeaders.cpp, + CheckMemoryLeak.cpp, CheckOther.cpp, Makefile, cppcheck.bpr, + main.cpp, testclass13/err.msg, testclass13/testclass13.cpp, + testclass13/warn.msg, tokenize.cpp: Minor updates to make it + portable to Linux. + +2007-06-11 Daniel Marjamäki + + * CheckHeaders.cpp: CheckHeaders: Checking if included headers are + needed + +2007-06-10 Daniel Marjamäki + + * CheckOther.cpp: CheckOther: minor bug fix + +2007-06-10 Daniel Marjamäki + + * CheckMemoryLeak.cpp, testmemleak1/err.msg, + testmemleak1/testmemleak1.cpp: CheckMemoryLeak: Detect memory leaks + for class members + +2007-06-09 Daniel Marjamäki + + * CheckOther.cpp: CheckOther: Improved the check that checks 'if + (condition) var=true;' + +2007-06-09 Daniel Marjamäki + + * CheckHeaders.cpp: CheckHeaders: Improved the check that checks + included headers. + +2007-06-08 Daniel Marjamäki + + * CheckHeaders.cpp: CheckHeaders: Updated message + +2007-06-08 Daniel Marjamäki + + * tokenize.cpp: Tokenize: generate tokens on '#define' + (CheckIncludedHeaders) + +2007-06-08 Daniel Marjamäki + + * testbufferoverrun1/warn.msg, testbufferoverrun2/warn.msg, + testbufferoverrun3/warn.msg, testbufferoverrun4/warn.msg, + testbufferoverrun5/warn.msg, testbufferoverrun6/warn.msg, + testdangerousfunc1/warn.msg, testdelete1/err.msg, + testfunc2/warn.msg, testfunc3/warn.msg, testfunc4/warn.msg, + testfunc5/err.msg, testfunc5/warn.msg, testfunc6/err.msg, + testfunc6/warn.msg, testh1/warn.msg, testh3/err.msg, testh3/h1.h, + testh3/h2.h, testh3/testh3.cpp, testh3/warn.msg, testif1/err.msg, + testif1/warn.msg, testif2/err.msg, testif2/warn.msg, + testif3/warn.msg, testif4/warn.msg, testmemcheck1/warn.msg, + testmemcheck2/warn.msg, testmemcheck3/warn.msg, + testmemcheck4/warn.msg, testmemcheck5/warn.msg, + testmemset1/warn.msg, updateall.bat: Updated the tests + +2007-06-08 Daniel Marjamäki + + * checknpp.bat: Checking Notepad++: Enabled all warnings + +2007-06-08 Daniel Marjamäki + + * CheckOther.cpp, testif5/err.msg, testif5/testif5.cpp, + testif5/warn.msg: CheckOther: Added check. 'if (condition) var=true; + else var=false;' => 'var = (condition);' + +2007-06-08 Daniel Marjamäki + + * CheckHeaders.cpp: CheckHeaders: Limit the number of warnings about + 'implementation in header' + +2007-06-08 Daniel Marjamäki + + * main.cpp: Main: More checks are only done when the '-w' flag is + given. + +2007-06-08 Daniel Marjamäki + + * CheckHeaders.cpp: CheckHeaders: Bug fix + +2007-06-08 Daniel Marjamäki + + * CheckHeaders.cpp: CheckHeaders: Bug fix + +2007-06-08 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CheckOther.cpp: Modified comments + +2007-06-08 Daniel Marjamäki + + * CheckHeaders.cpp, testh6/err.msg, testh6/testh6.cpp, + testh6/testh6.h: CheckHeaders: Check if all included headers are + needed + +2007-06-06 Daniel Marjamäki + + * CheckOther.cpp, testfunc6/err.msg, testfunc6/testfunc6.cpp: Added + check: "if (condition) var=true;" can be written as + "var|=(condition);" + +2007-06-05 Daniel Marjamäki + + * CheckBufferOverrun.cpp: Buffer overrun: also check the 'memcopy' + parameters. + +2007-06-05 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, main.cpp, testfunc5/err.msg, + testfunc5/testfunc5.cpp: Added check: suspicious usage of strtok + +2007-06-05 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, main.cpp, testfunc4/err.msg, + testfunc4/testfunc4.cpp: Invalid Function Parameter: Check calls to + strtol and strtoul + +2007-06-05 Daniel Marjamäki + + * CheckHeaders.cpp: CheckHeaders: Minor update + +2007-06-05 Daniel Marjamäki + + * CheckBufferOverrun.cpp: CheckBufferOverrun: Optimized and improved + the checking + +2007-06-05 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h, main.cpp: Added check: 'IsAlpha' + +2007-06-04 Daniel Marjamäki + + * testh1/warn.msg, testh2/warn.msg: Tests: Updated the tests. + Checking for unneeded includes + +2007-06-04 Daniel Marjamäki + + * CheckHeaders.cpp, main.cpp: CheckHeaders: Check for unnecessary + headers. some fixes. + +2007-06-03 Daniel Marjamäki + + * CheckMemoryLeak.cpp: CheckMemoryLeak: Bug fix. + +2007-06-03 Daniel Marjamäki + + * tokenize.cpp: tokenize: bug fixes. Handling typedefs. + +2007-06-02 Daniel Marjamäki + + * testif2/err.msg: Test: Updated 'testif2' which is testing the + 'a=b; if (a!=b)' + +2007-06-02 Daniel Marjamäki + + * testif4/err.msg, testif4/testif4.cpp: Test: Test that 'a=b; if + (a==b)' don't generate false positives + +2007-06-02 Daniel Marjamäki + + * testif3/err.msg, testif3/testif3.cpp: Test: Test that 'a=b; if + (a==b)' is detected + +2007-06-02 Daniel Marjamäki + + * tokenize.cpp: tokenize: Fixed the 'typedef' simplifications. Added + token '#' upon preprocessor instructions. + +2007-06-02 Daniel Marjamäki + + * testif2/err.msg, testif2/testif2.cpp: Test: Test that 'a=b; if + (a==b)' is detected + +2007-06-02 Daniel Marjamäki + + * CheckOther.cpp: CheckOther: Added check for 'a=b; if (a==b)' + +2007-05-30 Daniel Marjamäki + + * tokenize.cpp, tokenize.h: tokenizer: made the 'SizeOfType' public. + bug fix in the tokenizer (strings longer than 1000 characters). + +2007-05-30 Daniel Marjamäki + + * CheckBufferOverrun.cpp: CheckBufferOverrun.cpp: Bug fixes + +2007-05-29 Daniel Marjamäki + + * TestTok.cpp, main.cpp, tok.bpr: minor updates + +2007-05-29 Daniel Marjamäki + + * tokenize.cpp, tokenize.h: Tokenize: Replace 'typedef' + +2007-05-29 Daniel Marjamäki + + * TestTok.cpp, internaltesting/testdecl.out, main.cpp, tok.bpr, + tokenize.cpp, tokenize.h: Tokenize: Simplify declarations + +2007-05-28 Daniel Marjamäki + + * tokenize.cpp: Tokenize: Replace '*(var+num)' with 'var[num]' + +2007-05-28 Daniel Marjamäki + + * tokenize.cpp: Tokenize: improved the preprocessing of + 'sizeof(type)' + +2007-05-26 Daniel Marjamäki + + * TestTok.cpp, tok.bpf, tok.bpr: tok: Added a program that tests the + tokenizer. + +2007-05-26 Daniel Marjamäki + + * tokenize.cpp: Tokenize: Improved the tokenizer. Calculations are + done in the tokenizer. sizeof is replaced with numbers. + +2007-05-26 Daniel Marjamäki + + * testbufferoverrun6/err.msg, + testbufferoverrun6/testbufferoverrun6.cpp: Test: Added a buffer + overrun test that contains a calculation that points at an illegal + index + +2007-05-26 Daniel Marjamäki + + * Makefile: Makefile: Updated because the program has been split up + into several files. + +2007-05-26 Daniel Marjamäki + + * CheckBufferOverrun.cpp: CheckBufferOverrun: Improved checking for + types other than char + +2007-05-25 Daniel Marjamäki + + * cppcheck.bpr: cppcheck: added checkothers to the project + +2007-05-25 Daniel Marjamäki + + * CheckOther.cpp, CheckOther.h: CheckOther: Added files. This will + contain checks that don't fit in the other checking files. + +2007-05-25 Daniel Marjamäki + + * tokenize.cpp: tokenize: moved 'IsName' to commoncheck. Replace + 'sizeof(type)' with size. + +2007-05-25 Daniel Marjamäki + + * main.cpp: Main: Moved 'IsName' and 'IsNumber' to commoncheck. + Moved remaining checks to checkother and checkbufferoverrun. + +2007-05-25 Daniel Marjamäki + + * Statements.cpp: Statements: Moved 'IsName' from main to + commoncheck + +2007-05-25 Daniel Marjamäki + + * CheckClass.cpp: CheckClass: Moved 'IsName' from main to + commoncheck + +2007-05-25 Daniel Marjamäki + + * CommonCheck.cpp, CommonCheck.h: CommonCheck: Moved 'IsName' and + 'IsNumber' from main.cpp + +2007-05-25 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h: CheckBufferOverrun: + Added 'CheckDangerousFunctions' + +2007-05-24 Daniel Marjamäki + + * CommonCheck.cpp: CommonCheck: Common functions used while checking + for mistakes + +2007-05-24 Daniel Marjamäki + + * CheckMemoryLeak.cpp, CheckMemoryLeak.h: CheckMemoryLeak: Added + files (Check for memory leaks) + +2007-05-24 Daniel Marjamäki + + * CheckHeaders.cpp, CheckHeaders.h: CheckHeaders: Added files (Check + for mistakes in headers or related to headers) + +2007-05-24 Daniel Marjamäki + + * CheckClass.cpp, CheckClass.h, CommonCheck.h, Statements.cpp, + Statements.h, cppcheck.bpr, main.cpp, tokenize.cpp, tokenize.h: + CheckClass; Added files (Check for mistakes related to classes) + +2007-05-24 Daniel Marjamäki + + * CheckBufferOverrun.cpp, CheckBufferOverrun.h: CheckBufferOverrun; + Added files + +2007-05-24 Daniel Marjamäki + + * cppcheck.bpr, main.cpp, tokenize.cpp, tokenize.h: tokenize: Added + files + +2007-05-23 Daniel Marjamäki + + * readme.txt: readme: minor updates + +2007-05-21 Daniel Marjamäki + + * testbufferoverrun5/err.msg, + testbufferoverrun5/testbufferoverrun5.cpp: Tests: Added + 'TestBufferOverrun5' + +2007-05-21 Daniel Marjamäki + + * main.cpp: Replacing constants to make it easier to find bugs. + +2007-05-21 Daniel Marjamäki + + * testbufferoverrun1/err.msg: Test: minor update to + TestBufferOverrun1 + +2007-05-21 Daniel Marjamäki + + * testbufferoverrun2/testbufferoverrun2.cpp: Test: Updated + 'TestBufferOverrun2'. Bufferusage out of bounds. + +2007-05-21 Daniel Marjamäki + + * testbufferoverrun4/err.msg, + testbufferoverrun4/testbufferoverrun4.cpp: Test: Added + 'TestBufferOverrun4' + +2007-05-21 Daniel Marjamäki + + * main.cpp, testclass1/warn.msg, testclass10/warn.msg, + testclass2/warn.msg, testclass4/warn.msg, testclass7/warn.msg, + testclass8/warn.msg, testdelete1/warn.msg, testh1/warn.msg, + testh2/warn.msg, testh5/warn.msg: Testing: Added warning messages. + +2007-05-21 Daniel Marjamäki + + * main.cpp: CheckBufferOverrun: buffer overrun inside loop. The + tokenizer will convert hexadecimal values to decimal values, which + simplifies the checking. + +2007-05-21 Daniel Marjamäki + + * testbufferoverrun1/testbufferoverrun1.cpp, + testbufferoverrun2/err.msg, + testbufferoverrun2/testbufferoverrun2.cpp, + testbufferoverrun3/err.msg, + testbufferoverrun3/testbufferoverrun3.cpp: Test: Buffer overrun + +2007-05-20 Daniel Marjamäki + + * testbufferoverrun1/err.msg, + testbufferoverrun1/testbufferoverrun1.cpp: Test: Added + 'TestBufferOverrun1' + +2007-05-20 Daniel Marjamäki + + * main.cpp: CheckBufferOverrun: Array index out of bounds. + +2007-05-20 Daniel Marjamäki + + * main.cpp, testdangerousfunc1/err.msg, + testdangerousfunc1/testdangerousfunc1.cpp: Buffer Overrun: Using + dangerous functions + +2007-05-20 Daniel Marjamäki + + * main.cpp: Building statement list: SWITCH - BREAK + +2007-05-20 Daniel Marjamäki + + * testmemcheck4/err.msg, testmemcheck4/testmemcheck4.cpp, + testmemcheck5/err.msg, testmemcheck5/testmemcheck5.cpp: Test: + Updated 'testmemcheck4' and 'testmemcheck5' (continue/break) + +2007-05-20 Daniel Marjamäki + + * main.cpp: CheckMemoryLeak: Handling continue/break + +2007-05-20 Daniel Marjamäki + + * main.cpp: WarningIf: Bug fix + +2007-05-19 Daniel Marjamäki + + * internaltesting/testloop.out: Test: Updated "testloop" + +2007-05-19 Daniel Marjamäki + + * main.cpp: Build Statement List: LOOP, ENDLOOP + +2007-05-19 Daniel Marjamäki + + * : 60 1 main.cpp + +2007-05-19 Daniel Marjamäki + + * main.cpp: CheckMemleak: Don't handle conditional allocation at the + moment. + +2007-05-19 Daniel Marjamäki + + * testmemcheck4/err.msg, testmemcheck4/testmemcheck4.err: Test: File + with wrong name was renamed + +2007-05-19 Daniel Marjamäki + + * testmemcheck4/out.err, testmemcheck4/testmemcheck4.err: Test: File + with wrong name was renamed + +2007-05-19 Daniel Marjamäki + + * internaltesting/testif.out, internaltesting/testloop.out: Tests: + Updated the internaltesting tests "testif" and "testloop" + +2007-05-19 Daniel Marjamäki + + * main.cpp: Build Statement List: ENDIF + +2007-05-19 Daniel Marjamäki + + * main.cpp, testmemcheck4/out.err, testmemcheck4/testmemcheck4.cpp: + Tests: Added "testmemcheck4", memory leak from a strdup + +2007-05-19 Daniel Marjamäki + + * main.cpp: Building Statement List: MALLOC. Bug fix (strdup is a + malloc) + +2007-05-19 Daniel Marjamäki + + * internaltesting.bat, internaltesting/testloop.cpp, + internaltesting/testloop.out, main.cpp: Building Statement List: + CONTINUE, BREAK + +2007-05-18 Daniel Marjamäki + + * internaltesting.bat, internaltesting/testif.cpp, + internaltesting/testif.out, main.cpp: internaltesting: IF + +2007-05-18 Daniel Marjamäki + + * teststdfunc1/err.msg, teststdfunc1/warn.msg: Tests: Modified the + test 'teststdfunc1'. Warnings has been deactivated. + +2007-05-18 Daniel Marjamäki + + * teststdfunc1/err.msg, teststdfunc1/teststdfunc1.cpp, + warnstdfunc1/err.msg, warnstdfunc1/teststdfunc1.cpp: Tests: Renamed + 'warnstdfunc1' to 'teststdfunc1' + +2007-05-18 Daniel Marjamäki + + * testclass12/err.msg, testclass12/testclass12.cpp, + testclass12/warn.msg, warnclass12/err.msg, + warnclass12/testclass12.cpp: Testing: Renamed 'warnclass12' to + 'testclass12' + +2007-05-18 Daniel Marjamäki + + * main.cpp: * Building Statement list: MALLOC, FREE * Deactivated some warnings to make the output more interesting + +2007-05-18 Daniel Marjamäki + + * testclass12/err.msg, testclass12/testclass12.cpp, + teststdfunc1/err.msg, teststdfunc1/teststdfunc1.cpp, + warnclass12/err.msg, warnclass12/testclass12.cpp, + warnstdfunc1/err.msg, warnstdfunc1/teststdfunc1.cpp: Testing: + Deactivating some warnings + +2007-05-18 Daniel Marjamäki + + * main.cpp: Building Statement List: IF, ELSE, ELSEIF + +2007-05-18 Daniel Marjamäki + + * testmemcheck3/err.msg, testmemcheck3/testmemcheck3.cpp: Testing: + memcheck3 - new and delete (no error) + +2007-05-17 Daniel Marjamäki + + * internaltesting/testdecl.cpp, internaltesting/testdecl.out: + Testing: "return" and "delete" are not variable declarations + +2007-05-17 Daniel Marjamäki + + * testmemcheck2/err.msg, testmemcheck2/testmemcheck2.cpp: Added test + for memory checking + +2007-05-17 Daniel Marjamäki + + * main.cpp: Improving the accuracy of the memory leaks detecting + +2007-05-16 Daniel Marjamäki + + * testmemcheck1/err.msg: Test: updated the error message output by + memcheck1 + +2007-05-16 Daniel Marjamäki + + * internaltesting/testassign.out, internaltesting/testdecl.out, + internaltesting/testnew.out, internaltesting/testuse.out: Test: + Internal testing, updated the messages + +2007-05-16 Daniel Marjamäki + + * main.cpp: Bug fixing + +2007-05-16 Daniel Marjamäki + + * main.cpp: Checking for memory leaks.. only active in debug mode + since it's so inaccurate + +2007-05-16 Daniel Marjamäki + + * main.cpp: Building statement list; USE + +2007-05-16 Daniel Marjamäki + + * internaltesting.bat, internaltesting/testuse.cpp, + internaltesting/testuse.out: Test: Internal testing, added "testuse" + +2007-05-15 Daniel Marjamäki + + * readme.txt: readme: minor update + +2007-05-15 Daniel Marjamäki + + * main.cpp: Check for memory leaks + +2007-05-15 Daniel Marjamäki + + * testmemcheck1/err.msg, testmemcheck1/testmemcheck1.cpp: Test: + Added "TestMemCheck1" -> mismatching allocation and deallocation + +2007-05-15 Daniel Marjamäki + + * main.cpp: Test: Added command line option "--debug" that is used + by the tests "internaltesting" + +2007-05-15 Daniel Marjamäki + + * internaltesting.bat, internaltesting/testassign.cpp, + internaltesting/testassign.out, internaltesting/testdecl.cpp, + internaltesting/testdecl.out, internaltesting/testnew.cpp, + internaltesting/testnew.out: Test: Internal testing + +2007-05-15 Daniel Marjamäki + + * main.cpp: Building statement list; bug fixes + +2007-05-15 Daniel Marjamäki + + * Makefile: Updated the Makefile. The name of this project has + changed from 'codecheck' to 'cppcheck' + +2007-05-14 Daniel Marjamäki + + * main.cpp: Building statement list; NEW, NEWARRAY, DELETE, + DELETEARRAY + +2007-05-14 Daniel Marjamäki + + * main.cpp: Building statement list; OBRACE, EBRACE, DECL + +2007-05-11 Daniel Marjamäki + + * main.cpp: Class (unused private functions): Reactivated and + improved this check + +2007-05-10 Daniel Marjamäki + + * main.cpp: Minor updates. Make sure there is no doublechecking. + Don't perform certain checks upon c-files. + +2007-05-10 Daniel Marjamäki + + * checknpp.bat: Updated script that checks notepad++ + +2007-05-09 Daniel Marjamäki + + * testdelete1/err.msg, testh1/err.msg: updated error reports for + test cases + +2007-05-09 Daniel Marjamäki + + * main.cpp: Check 'operator=()' + +2007-05-09 Daniel Marjamäki + + * testclass12/err.msg, testclass12/testclass12.cpp: Added testcase: + bad 'operator=()' + +2007-05-09 Daniel Marjamäki + + * readme.txt: Added readme.txt + +2007-05-09 Daniel Marjamäki + + * main.cpp: Minor updates: * Refactoring. * don't warn for 'memset(this,..' + +2007-05-08 Daniel Marjamäki + + * checknpp.bat: Added script that checks the notepad++ source code + +2007-05-08 Daniel Marjamäki + + * main.cpp: Updated warning message. Shorter and simpler + +2007-05-08 Daniel Marjamäki + + * main.cpp: Inactivated tests that are not accurate + +2007-05-08 Daniel Marjamäki + + * testh1/err.msg, testh2/err.msg: Updated test cases + +2007-05-08 Daniel Marjamäki + + * testclass5/err.msg, testclass5/testclass5.cpp, + testclass6/err.msg, testclass6/testclass6.cpp, + testclass6/testclass6.h, testclass9/err.msg, + testclass9/testclass9.cpp: Removed test cases that are not currently + wanted. + +2007-05-08 Daniel Marjamäki + + * checkcode.bpf, checkcode.bpr, cppcheck.bpf, cppcheck.bpr: Files + needed to build with Borland C++ Builder + +2007-05-08 Daniel Marjamäki + + * runall.bat: Removed testing batch file. Must work on this. + +2007-05-08 Daniel Marjamäki + + * checkcode.bpf, checkcode.bpr: Added Borland C++ Builder project + files + +2007-05-07 Daniel Marjamäki + + * Added files from local repository. + From 8375d1f1aeef4273a73bd030357f373b2d360cae Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Sun, 7 Jun 2009 14:46:34 +0300 Subject: [PATCH 28/41] Fix #372 (Link error with Visual C++ 2008 Express) Add shlwapi.lib to Visual Studio project. --- cppcheck.vcproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cppcheck.vcproj b/cppcheck.vcproj index 7010c8b2d..95f65d69b 100644 --- a/cppcheck.vcproj +++ b/cppcheck.vcproj @@ -59,6 +59,7 @@ /> Date: Sun, 7 Jun 2009 18:53:47 +0200 Subject: [PATCH 29/41] Added headers to the "--errorlist" output --- src/checkautovariables.h | 1 + src/checkbufferoverrun.h | 1 + src/checkclass.h | 1 + src/checkdangerousfunctions.h | 1 + src/checkmemoryleak.h | 1 + src/checkother.h | 1 + src/checksecurity.h | 1 + src/checkstl.h | 1 + 8 files changed, 8 insertions(+) diff --git a/src/checkautovariables.h b/src/checkautovariables.h index 6dbfcd217..db0524fd4 100644 --- a/src/checkautovariables.h +++ b/src/checkautovariables.h @@ -56,6 +56,7 @@ private: void getErrorMessages() { + std::cout << "===auto variables===" << "\n"; reportError(0, "error", "autoVariables", "Wrong assignement of an auto-variable to an effective parameter of a function"); } }; diff --git a/src/checkbufferoverrun.h b/src/checkbufferoverrun.h index d8b1f47bd..afb39e49d 100644 --- a/src/checkbufferoverrun.h +++ b/src/checkbufferoverrun.h @@ -75,6 +75,7 @@ private: void getErrorMessages() { + std::cout << "===buffer overruns===" << "\n"; arrayIndexOutOfBounds(0); bufferOverrun(0); strncatUsage(0); diff --git a/src/checkclass.h b/src/checkclass.h index 3246add7a..db68e35ec 100644 --- a/src/checkclass.h +++ b/src/checkclass.h @@ -109,6 +109,7 @@ private: void getErrorMessages() { + std::cout << "===classes===" << "\n"; noConstructorError(0, "classname"); uninitVarError(0, "classname", "varname"); operatorEqVarError(0, "classname", ""); diff --git a/src/checkdangerousfunctions.h b/src/checkdangerousfunctions.h index 467c8ab53..9458ad1e3 100644 --- a/src/checkdangerousfunctions.h +++ b/src/checkdangerousfunctions.h @@ -56,6 +56,7 @@ private: void getErrorMessages() { + std::cout << "===dangerous functions===" << "\n"; dangerousFunctionmktemp(0); dangerousFunctiongets(0); dangerousFunctionscanf(0); diff --git a/src/checkmemoryleak.h b/src/checkmemoryleak.h index a714a5cfd..372b83340 100644 --- a/src/checkmemoryleak.h +++ b/src/checkmemoryleak.h @@ -133,6 +133,7 @@ private: void getErrorMessages() { + std::cout << "===memory leaks===" << "\n"; memleakError(0, "varname"); memleakallError(0, "varname"); resourceLeakError(0, "varname"); diff --git a/src/checkother.h b/src/checkother.h index 3883ef7c0..47243e19d 100644 --- a/src/checkother.h +++ b/src/checkother.h @@ -147,6 +147,7 @@ private: void getErrorMessages() { + std::cout << "===other===" << "\n"; cstyleCastError(0); redundantIfDelete0Error(0); redundantIfRemoveError(0); diff --git a/src/checksecurity.h b/src/checksecurity.h index 22e2ce9f4..1dd36348d 100644 --- a/src/checksecurity.h +++ b/src/checksecurity.h @@ -54,6 +54,7 @@ private: void getErrorMessages() { + std::cout << "===security===" << "\n"; unvalidatedInput(0); } }; diff --git a/src/checkstl.h b/src/checkstl.h index 7702a20d5..47ae57e25 100644 --- a/src/checkstl.h +++ b/src/checkstl.h @@ -98,6 +98,7 @@ private: void getErrorMessages() { + std::cout << "===stl===" << "\n"; iteratorsError(0, "container1", "container2"); dereferenceErasedError(0, "iter"); stlOutOfBoundsError(0, "i", "foo"); From d7fa3e6ddafecd07b420bcb8ad80f2a0c6f1213b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 7 Jun 2009 22:12:20 +0200 Subject: [PATCH 30/41] Refactoring: Renamed CheckFunctionUsage to CheckUnusedFunctions --- Makefile | 32 +++++++++---------- ...tionusage.cpp => checkunusedfunctions.cpp} | 12 +++---- ...functionusage.h => checkunusedfunctions.h} | 10 +++--- src/cppcheck.cpp | 7 ++-- src/cppcheck.h | 4 +-- ...ctionusage.cpp => testunusedfunctions.cpp} | 14 ++++---- 6 files changed, 39 insertions(+), 40 deletions(-) rename src/{checkfunctionusage.cpp => checkunusedfunctions.cpp} (94%) rename src/{checkfunctionusage.h => checkunusedfunctions.h} (91%) rename test/{testfunctionusage.cpp => testunusedfunctions.cpp} (89%) diff --git a/Makefile b/Makefile index d2dc83f11..df4b65069 100644 --- a/Makefile +++ b/Makefile @@ -9,12 +9,12 @@ OBJECTS = src/checkautovariables.o \ src/checkbufferoverrun.o \ src/checkclass.o \ src/checkdangerousfunctions.o \ - src/checkfunctionusage.o \ src/checkheaders.o \ src/checkmemoryleak.o \ src/checkother.o \ src/checksecurity.o \ src/checkstl.o \ + src/checkunusedfunctions.o \ src/cppcheck.o \ src/cppcheckexecutor.o \ src/errorlogger.o \ @@ -36,7 +36,6 @@ TESTOBJ = test/testautovariables.o \ test/testdangerousfunctions.o \ test/testdivision.o \ test/testfilelister.o \ - test/testfunctionusage.o \ test/testincompletestatement.o \ test/testmathlib.o \ test/testmemleak.o \ @@ -51,18 +50,19 @@ TESTOBJ = test/testautovariables.o \ test/testsuite.o \ test/testtoken.o \ test/testtokenize.o \ + test/testunusedfunctions.o \ test/testunusedprivfunc.o \ test/testunusedvar.o \ src/checkautovariables.o \ src/checkbufferoverrun.o \ src/checkclass.o \ src/checkdangerousfunctions.o \ - src/checkfunctionusage.o \ src/checkheaders.o \ src/checkmemoryleak.o \ src/checkother.o \ src/checksecurity.o \ src/checkstl.o \ + src/checkunusedfunctions.o \ src/cppcheck.o \ src/cppcheckexecutor.o \ src/errorlogger.o \ @@ -118,16 +118,13 @@ src/checkclass.o: src/checkclass.cpp src/checkclass.h src/check.h src/tokenize.h src/checkdangerousfunctions.o: src/checkdangerousfunctions.cpp src/checkdangerousfunctions.h src/check.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h $(CXX) $(CXXFLAGS) -c -o src/checkdangerousfunctions.o src/checkdangerousfunctions.cpp -src/checkfunctionusage.o: src/checkfunctionusage.cpp src/checkfunctionusage.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h - $(CXX) $(CXXFLAGS) -c -o src/checkfunctionusage.o src/checkfunctionusage.cpp - src/checkheaders.o: src/checkheaders.cpp src/checkheaders.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/filelister.h $(CXX) $(CXXFLAGS) -c -o src/checkheaders.o src/checkheaders.cpp -src/checkmemoryleak.o: src/checkmemoryleak.cpp src/checkmemoryleak.h src/check.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h +src/checkmemoryleak.o: src/checkmemoryleak.cpp src/checkmemoryleak.h src/check.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/mathlib.h $(CXX) $(CXXFLAGS) -c -o src/checkmemoryleak.o src/checkmemoryleak.cpp -src/checkother.o: src/checkother.cpp src/checkother.h src/check.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h +src/checkother.o: src/checkother.cpp src/checkother.h src/check.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/mathlib.h $(CXX) $(CXXFLAGS) -c -o src/checkother.o src/checkother.cpp src/checksecurity.o: src/checksecurity.cpp src/checksecurity.h src/check.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h @@ -136,10 +133,13 @@ src/checksecurity.o: src/checksecurity.cpp src/checksecurity.h src/check.h src/t src/checkstl.o: src/checkstl.cpp src/checkstl.h src/check.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h $(CXX) $(CXXFLAGS) -c -o src/checkstl.o src/checkstl.cpp -src/cppcheck.o: src/cppcheck.cpp src/cppcheck.h src/settings.h src/errorlogger.h src/checkfunctionusage.h src/tokenize.h src/token.h src/preprocessor.h src/filelister.h src/check.h +src/checkunusedfunctions.o: src/checkunusedfunctions.cpp src/checkunusedfunctions.h src/tokenize.h src/settings.h src/errorlogger.h src/token.h + $(CXX) $(CXXFLAGS) -c -o src/checkunusedfunctions.o src/checkunusedfunctions.cpp + +src/cppcheck.o: src/cppcheck.cpp src/cppcheck.h src/settings.h src/errorlogger.h src/checkunusedfunctions.h src/tokenize.h src/token.h src/preprocessor.h src/filelister.h src/check.h $(CXX) $(CXXFLAGS) -c -o src/cppcheck.o src/cppcheck.cpp -src/cppcheckexecutor.o: src/cppcheckexecutor.cpp src/cppcheckexecutor.h src/errorlogger.h src/settings.h src/cppcheck.h src/checkfunctionusage.h src/tokenize.h src/token.h src/threadexecutor.h +src/cppcheckexecutor.o: src/cppcheckexecutor.cpp src/cppcheckexecutor.h src/errorlogger.h src/settings.h src/cppcheck.h src/checkunusedfunctions.h src/tokenize.h src/token.h src/threadexecutor.h $(CXX) $(CXXFLAGS) -c -o src/cppcheckexecutor.o src/cppcheckexecutor.cpp src/errorlogger.o: src/errorlogger.cpp src/errorlogger.h src/settings.h src/tokenize.h src/token.h @@ -154,13 +154,13 @@ src/main.o: src/main.cpp src/cppcheckexecutor.h src/errorlogger.h src/settings.h src/mathlib.o: src/mathlib.cpp src/mathlib.h src/token.h $(CXX) $(CXXFLAGS) -c -o src/mathlib.o src/mathlib.cpp -src/preprocessor.o: src/preprocessor.cpp src/preprocessor.h src/errorlogger.h src/settings.h src/tokenize.h src/token.h +src/preprocessor.o: src/preprocessor.cpp src/preprocessor.h src/errorlogger.h src/settings.h src/tokenize.h src/token.h src/filelister.h $(CXX) $(CXXFLAGS) -c -o src/preprocessor.o src/preprocessor.cpp src/settings.o: src/settings.cpp src/settings.h $(CXX) $(CXXFLAGS) -c -o src/settings.o src/settings.cpp -src/threadexecutor.o: src/threadexecutor.cpp src/threadexecutor.h src/settings.h src/errorlogger.h src/cppcheck.h src/checkfunctionusage.h src/tokenize.h src/token.h +src/threadexecutor.o: src/threadexecutor.cpp src/threadexecutor.h src/settings.h src/errorlogger.h src/cppcheck.h src/checkunusedfunctions.h src/tokenize.h src/token.h $(CXX) $(CXXFLAGS) -c -o src/threadexecutor.o src/threadexecutor.cpp src/token.o: src/token.cpp src/token.h @@ -184,7 +184,7 @@ test/testclass.o: test/testclass.cpp src/tokenize.h src/settings.h src/errorlogg test/testconstructors.o: test/testconstructors.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkclass.h src/check.h test/testsuite.h $(CXX) $(CXXFLAGS) -c -o test/testconstructors.o test/testconstructors.cpp -test/testcppcheck.o: test/testcppcheck.cpp test/testsuite.h src/errorlogger.h src/settings.h src/cppcheck.h src/checkfunctionusage.h src/tokenize.h src/token.h +test/testcppcheck.o: test/testcppcheck.cpp test/testsuite.h src/errorlogger.h src/settings.h src/cppcheck.h src/checkunusedfunctions.h src/tokenize.h src/token.h $(CXX) $(CXXFLAGS) -c -o test/testcppcheck.o test/testcppcheck.cpp test/testdangerousfunctions.o: test/testdangerousfunctions.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkdangerousfunctions.h src/check.h test/testsuite.h @@ -196,9 +196,6 @@ test/testdivision.o: test/testdivision.cpp src/tokenize.h src/settings.h src/err test/testfilelister.o: test/testfilelister.cpp test/testsuite.h src/errorlogger.h src/settings.h src/filelister.h $(CXX) $(CXXFLAGS) -c -o test/testfilelister.o test/testfilelister.cpp -test/testfunctionusage.o: test/testfunctionusage.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h test/testsuite.h src/checkfunctionusage.h - $(CXX) $(CXXFLAGS) -c -o test/testfunctionusage.o test/testfunctionusage.cpp - test/testincompletestatement.o: test/testincompletestatement.cpp test/testsuite.h src/errorlogger.h src/settings.h src/tokenize.h src/token.h src/checkother.h src/check.h $(CXX) $(CXXFLAGS) -c -o test/testincompletestatement.o test/testincompletestatement.cpp @@ -241,6 +238,9 @@ test/testtoken.o: test/testtoken.cpp test/testsuite.h src/errorlogger.h src/sett test/testtokenize.o: test/testtokenize.cpp test/testsuite.h src/errorlogger.h src/settings.h src/tokenize.h src/token.h $(CXX) $(CXXFLAGS) -c -o test/testtokenize.o test/testtokenize.cpp +test/testunusedfunctions.o: test/testunusedfunctions.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h test/testsuite.h src/checkunusedfunctions.h + $(CXX) $(CXXFLAGS) -c -o test/testunusedfunctions.o test/testunusedfunctions.cpp + test/testunusedprivfunc.o: test/testunusedprivfunc.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkclass.h src/check.h test/testsuite.h $(CXX) $(CXXFLAGS) -c -o test/testunusedprivfunc.o test/testunusedprivfunc.cpp diff --git a/src/checkfunctionusage.cpp b/src/checkunusedfunctions.cpp similarity index 94% rename from src/checkfunctionusage.cpp rename to src/checkunusedfunctions.cpp index 765164ac7..eea3e6a80 100644 --- a/src/checkfunctionusage.cpp +++ b/src/checkunusedfunctions.cpp @@ -18,7 +18,7 @@ //--------------------------------------------------------------------------- -#include "checkfunctionusage.h" +#include "checkunusedfunctions.h" #include "tokenize.h" //--------------------------------------------------------------------------- @@ -29,22 +29,22 @@ // FUNCTION USAGE - Check for unused functions etc //--------------------------------------------------------------------------- -CheckFunctionUsage::CheckFunctionUsage(ErrorLogger *errorLogger) +CheckUnusedFunctions::CheckUnusedFunctions(ErrorLogger *errorLogger) { _errorLogger = errorLogger; } -CheckFunctionUsage::~CheckFunctionUsage() +CheckUnusedFunctions::~CheckUnusedFunctions() { } -void CheckFunctionUsage::setErrorLogger(ErrorLogger *errorLogger) +void CheckUnusedFunctions::setErrorLogger(ErrorLogger *errorLogger) { _errorLogger = errorLogger; } -void CheckFunctionUsage::parseTokens(const Tokenizer &tokenizer) +void CheckUnusedFunctions::parseTokens(const Tokenizer &tokenizer) { // Function declarations.. for (const Token *tok = tokenizer.tokens(); tok; tok = tok->next()) @@ -147,7 +147,7 @@ void CheckFunctionUsage::parseTokens(const Tokenizer &tokenizer) -void CheckFunctionUsage::check() +void CheckUnusedFunctions::check() { for (std::map::const_iterator it = _functions.begin(); it != _functions.end(); ++it) { diff --git a/src/checkfunctionusage.h b/src/checkunusedfunctions.h similarity index 91% rename from src/checkfunctionusage.h rename to src/checkunusedfunctions.h index 1f9128672..cd99cd86c 100644 --- a/src/checkfunctionusage.h +++ b/src/checkunusedfunctions.h @@ -18,18 +18,18 @@ //--------------------------------------------------------------------------- -#ifndef CheckFunctionUsageH -#define CheckFunctionUsageH +#ifndef checkunusedfunctionsH +#define checkunusedfunctionsH //--------------------------------------------------------------------------- #include "tokenize.h" #include "errorlogger.h" -class CheckFunctionUsage +class CheckUnusedFunctions { public: - CheckFunctionUsage(ErrorLogger *errorLogger = 0); - ~CheckFunctionUsage(); + CheckUnusedFunctions(ErrorLogger *errorLogger = 0); + ~CheckUnusedFunctions(); /** * Errors found by this class are forwarded to the given diff --git a/src/cppcheck.cpp b/src/cppcheck.cpp index 88f0c8a94..5e96d0e1b 100644 --- a/src/cppcheck.cpp +++ b/src/cppcheck.cpp @@ -20,7 +20,6 @@ #include "preprocessor.h" // preprocessor. #include "tokenize.h" // <- Tokenizer -#include "checkfunctionusage.h" #include "filelister.h" #include "check.h" @@ -297,7 +296,7 @@ std::string CppCheck::parseFromArgs(int argc, const char* const argv[]) unsigned int CppCheck::check() { - _checkFunctionUsage.setErrorLogger(this); + _checkUnusedFunctions.setErrorLogger(this); std::sort(_filenames.begin(), _filenames.end()); for (unsigned int c = 0; c < _filenames.size(); c++) { @@ -367,7 +366,7 @@ unsigned int CppCheck::check() if (_settings._errorsOnly == false) _errorLogger->reportOut("Checking usage of global functions.."); - _checkFunctionUsage.check(); + _checkUnusedFunctions.check(); } @@ -410,7 +409,7 @@ void CppCheck::checkFile(const std::string &code, const char FileName[]) _tokenizer.simplifyTokenList(); if (_settings._unusedFunctions) - _checkFunctionUsage.parseTokens(_tokenizer); + _checkUnusedFunctions.parseTokens(_tokenizer); // call all "runSimplifiedChecks" in all registered Check classes for (std::list::iterator it = Check::instances().begin(); it != Check::instances().end(); ++it) diff --git a/src/cppcheck.h b/src/cppcheck.h index 7ee35134f..2f1487f08 100644 --- a/src/cppcheck.h +++ b/src/cppcheck.h @@ -26,7 +26,7 @@ #include #include "settings.h" #include "errorlogger.h" -#include "checkfunctionusage.h" +#include "checkunusedfunctions.h" /** * This is the base class which will use other classes to do @@ -135,7 +135,7 @@ private: std::vector _filenames; /** Key is file name, and value is the content of the file */ std::map _fileContents; - CheckFunctionUsage _checkFunctionUsage; + CheckUnusedFunctions _checkUnusedFunctions; ErrorLogger *_errorLogger; /** Current configuration */ diff --git a/test/testfunctionusage.cpp b/test/testunusedfunctions.cpp similarity index 89% rename from test/testfunctionusage.cpp rename to test/testunusedfunctions.cpp index e439a22f7..fdd5a23f8 100644 --- a/test/testfunctionusage.cpp +++ b/test/testunusedfunctions.cpp @@ -19,15 +19,15 @@ #include "../src/tokenize.h" #include "testsuite.h" -#include "../src/checkfunctionusage.h" +#include "../src/checkunusedfunctions.h" #include extern std::ostringstream errout; -class TestFunctionUsage : public TestFixture +class TestUnusedFunctions : public TestFixture { public: - TestFunctionUsage() : TestFixture("TestFunctionUsage") + TestUnusedFunctions() : TestFixture("TestUnusedFunctions") { } private: @@ -54,9 +54,9 @@ private: errout.str(""); // Check for unused functions.. - CheckFunctionUsage checkFunctionUsage(this); - checkFunctionUsage.parseTokens(tokenizer); - checkFunctionUsage.check(); + CheckUnusedFunctions checkUnusedFunctions(this); + checkUnusedFunctions.parseTokens(tokenizer); + checkUnusedFunctions.check(); } void incondition() @@ -121,5 +121,5 @@ private: } }; -REGISTER_TEST(TestFunctionUsage) +REGISTER_TEST(TestUnusedFunctions) From fb04e84975b3992ec65b39e86dbf2933dcbdaf86 Mon Sep 17 00:00:00 2001 From: Kimmo varis Date: Mon, 8 Jun 2009 00:51:02 +0300 Subject: [PATCH 31/41] GUI: Update project file after file renaming. --- gui/gui.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/gui.pro b/gui/gui.pro index cb59b0804..7d0de70d2 100644 --- a/gui/gui.pro +++ b/gui/gui.pro @@ -36,9 +36,9 @@ HEADERS += mainwindow.h \ ../src/settings.h \ ../src/tokenize.h \ ../src/checkbufferoverrun.h \ - ../src/checkfunctionusage.h \ ../src/checkmemoryleak.h \ ../src/checkstl.h \ + ../src/checkunusedfunctions.h \ ../src/errorlogger.h \ ../src/preprocessor.h \ ../src/threadexecutor.h \ @@ -70,7 +70,6 @@ SOURCES += main.cpp \ ../src/mathlib.cpp \ ../src/threadexecutor.cpp \ ../src/checkbufferoverrun.cpp \ - ../src/checkfunctionusage.cpp \ ../src/checkother.cpp \ ../src/cppcheck.cpp \ ../src/filelister.cpp \ @@ -80,5 +79,6 @@ SOURCES += main.cpp \ ../src/checkheaders.cpp \ ../src/checksecurity.cpp \ ../src/cppcheckexecutor.cpp \ + ../src/checkunusedfunctions.cpp \ ../src/settings.cpp \ ../src/tokenize.cpp From 791d2216783a4898f62f4465a43e4ae7131fa1f4 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Mon, 8 Jun 2009 14:12:48 +0300 Subject: [PATCH 32/41] Update VS project file after files were renamed. --- cppcheck.vcproj | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cppcheck.vcproj b/cppcheck.vcproj index 95f65d69b..f168d7118 100644 --- a/cppcheck.vcproj +++ b/cppcheck.vcproj @@ -187,10 +187,6 @@ RelativePath=".\src\checkdangerousfunctions.h" > - - @@ -211,6 +207,10 @@ RelativePath=".\src\checkstl.h" > + + @@ -291,10 +291,6 @@ RelativePath=".\src\checkdangerousfunctions.cpp" > - - @@ -315,6 +311,10 @@ RelativePath=".\src\checkstl.cpp" > + + From 9cbf9e78de909898a9842dafd06a141c21275487 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Mon, 8 Jun 2009 14:58:51 +0300 Subject: [PATCH 33/41] GUI: Show application path with native separators. --- gui/applicationdialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/applicationdialog.cpp b/gui/applicationdialog.cpp index 865a31d3e..d86006e72 100644 --- a/gui/applicationdialog.cpp +++ b/gui/applicationdialog.cpp @@ -35,7 +35,7 @@ ApplicationDialog::ApplicationDialog(const QString &name, QVBoxLayout *layout = new QVBoxLayout(); mName = new QLineEdit(name); mName->setMaxLength(100); // Should be plenty for app name - mPath = new QLineEdit(path); + mPath = new QLineEdit(QDir::toNativeSeparators(path)); QString guide = tr("Here you can add applications that can open error files.\n" \ "Specify a name for the application and the application to execute.\n\n" \ @@ -93,7 +93,7 @@ void ApplicationDialog::Browse() QStringList list = dialog.selectedFiles(); if (list.size() > 0) { - mPath->setText(list[0]); + mPath->setText(QDir::toNativeSeparators(list[0])); } } } From dfb18efed31a8b4f5585434d4a52c2f4ed471a94 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Mon, 8 Jun 2009 16:22:12 +0300 Subject: [PATCH 34/41] Fix #378 (GUI doesn't start application if path contains spaces) In Windows we must surround paths including spaces with quotation marks. This patch fixes application path when it is read from Browse-dialog. --- gui/applicationdialog.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/gui/applicationdialog.cpp b/gui/applicationdialog.cpp index d86006e72..e941ee421 100644 --- a/gui/applicationdialog.cpp +++ b/gui/applicationdialog.cpp @@ -82,7 +82,6 @@ ApplicationDialog::~ApplicationDialog() //dtor } - void ApplicationDialog::Browse() { QFileDialog dialog(this); @@ -93,7 +92,18 @@ void ApplicationDialog::Browse() QStringList list = dialog.selectedFiles(); if (list.size() > 0) { - mPath->setText(QDir::toNativeSeparators(list[0])); + QString path(QDir::toNativeSeparators(list[0])); + + // In Windows we must surround paths including spaces with quotation marks. +#ifdef Q_WS_WIN + if (path.indexOf(" ") > -1) + { + path.insert(0, "\""); + path.append("\""); + } +#endif // Q_WS_WIN + + mPath->setText(path); } } } From 7ac73e0d25190a4b754e1773691f0e6f3f4d4067 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Mon, 8 Jun 2009 16:47:53 +0300 Subject: [PATCH 35/41] GUI: Show error message when the viewer application cannot be started. --- gui/resultstree.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/gui/resultstree.cpp b/gui/resultstree.cpp index ca1e3e990..4679c365a 100644 --- a/gui/resultstree.cpp +++ b/gui/resultstree.cpp @@ -23,6 +23,7 @@ #include #include #include +#include ResultsTree::ResultsTree(QSettings &settings, ApplicationList &list) : mSettings(settings), @@ -398,7 +399,19 @@ void ResultsTree::StartApplication(QStandardItem *target, int application) program.replace("(message)", data["message"].toString(), Qt::CaseInsensitive); program.replace("(severity)", data["severity"].toString(), Qt::CaseInsensitive); - QProcess::startDetached(program); + bool success = QProcess::startDetached(program); + if (!success) + { + QString app = mApplications.GetApplicationName(application); + QString text = tr("Could not start ") + app + "\n\n"; + text += tr("Please check the application path and parameters are correct."); + + QMessageBox msgbox(this); + msgbox.setWindowTitle("Cppcheck"); + msgbox.setText(text); + msgbox.setIcon(QMessageBox::Critical); + msgbox.exec(); + } } } From f146ce1aae7ea92de6cfe6996e7bae88dfeafefb Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Mon, 8 Jun 2009 16:58:26 +0300 Subject: [PATCH 36/41] GUI: If application list contains applications select the first by default. --- gui/settingsdialog.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gui/settingsdialog.cpp b/gui/settingsdialog.cpp index c7abd7b1d..b47a9e9b7 100644 --- a/gui/settingsdialog.cpp +++ b/gui/settingsdialog.cpp @@ -271,10 +271,16 @@ void SettingsDialog::DefaultApplication() void SettingsDialog::PopulateListWidget() { - for (int i = 0;i < mTempApplications.GetApplicationCount();i++) + for (int i = 0; i < mTempApplications.GetApplicationCount(); i++) { mListWidget->addItem(mTempApplications.GetApplicationName(i)); } + + // If list contains items select first item + if (mTempApplications.GetApplicationCount()) + { + mListWidget->setCurrentRow(0); + } } void SettingsDialog::Ok() From 51736bae8b896a5d2e13c98ebc164bda921fad8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 8 Jun 2009 18:36:54 +0200 Subject: [PATCH 37/41] deleted the testmemleakmp file --- test/testmemleakmp.cpp | 85 ------------------------------------------ 1 file changed, 85 deletions(-) delete mode 100644 test/testmemleakmp.cpp diff --git a/test/testmemleakmp.cpp b/test/testmemleakmp.cpp deleted file mode 100644 index e93b4319f..000000000 --- a/test/testmemleakmp.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Cppcheck - A tool for static C/C++ code analysis - * Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - -extern std::ostringstream errout; - -class TestMemleakMultiPass : public TestFixture -{ -public: - TestMemleakMultiPass() : TestFixture("TestMemleakMultiPass") - { } - - class OurCheckMemoryLeakClass : public CheckMemoryLeakClass - { - public: - OurCheckMemoryLeakClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) - : CheckMemoryLeakClass(tokenizer, settings, errorLogger) - { - } - - Token *functionParameterCode(const Token *ftok, int parameter) - { - return CheckMemoryLeakClass::functionParameterCode(ftok, parameter); - } - }; - -private: - - void run() - { - TEST_CASE(param1); - } - - void param1() - { - const char code[] = "void f(char *s)\n" - "{\n" - " ;\n" - "}\n"; - - // Tokenize.. - Tokenizer tokenizer; - std::istringstream istr(code); - tokenizer.tokenize(istr, "test.cpp"); - tokenizer.simplifyTokenList(); - - // Clear the error log - errout.str(""); - - // Check.. - Settings settings; - OurCheckMemoryLeakClass checkMemoryLeak(&tokenizer, &settings, this); - Token *tok = checkMemoryLeak.functionParameterCode(tokenizer.tokens(), 1); - - // Compare tokens.. - std::string s; - for (const Token *tok2 = tok; tok2; tok2 = tok2->next()) - s += tok2->str() + " "; - ASSERT_EQUALS("; } ", s); - Tokenizer::deleteTokens(tok); - } - -}; - -REGISTER_TEST(TestMemleakMultiPass) From 15dbf9c0856ec17ce04d184bed507aa7cb1e9021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 8 Jun 2009 18:51:17 +0200 Subject: [PATCH 38/41] Refactoring: Renaming the CheckMemoryLeakClass to CheckMemoryLeak. Deleted testmemleakmp --- Makefile | 4 --- src/checkmemoryleak.cpp | 76 +++++++++++++++-------------------------- src/checkmemoryleak.h | 21 ++++++------ test/testmemleak.cpp | 11 +++--- 4 files changed, 45 insertions(+), 67 deletions(-) diff --git a/Makefile b/Makefile index df4b65069..24a42f793 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,6 @@ TESTOBJ = test/testautovariables.o \ test/testincompletestatement.o \ test/testmathlib.o \ test/testmemleak.o \ - test/testmemleakmp.o \ test/testother.o \ test/testpreprocessor.o \ test/testredundantif.o \ @@ -205,9 +204,6 @@ test/testmathlib.o: test/testmathlib.cpp src/mathlib.h src/token.h test/testsuit test/testmemleak.o: test/testmemleak.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkmemoryleak.h src/check.h test/testsuite.h $(CXX) $(CXXFLAGS) -c -o test/testmemleak.o test/testmemleak.cpp -test/testmemleakmp.o: test/testmemleakmp.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkmemoryleak.h src/check.h test/testsuite.h - $(CXX) $(CXXFLAGS) -c -o test/testmemleakmp.o test/testmemleakmp.cpp - test/testother.o: test/testother.cpp src/tokenize.h src/settings.h src/errorlogger.h src/token.h src/checkother.h src/check.h test/testsuite.h $(CXX) $(CXXFLAGS) -c -o test/testother.o test/testother.cpp diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index 3822e0020..9c786db8c 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -31,12 +31,12 @@ // Register this check class (by creating a static instance of it) namespace { -CheckMemoryLeakClass instance; +CheckMemoryLeak instance; } //--------------------------------------------------------------------------- -bool CheckMemoryLeakClass::isclass(const Token *tok) +bool CheckMemoryLeak::isclass(const Token *tok) { if (tok->isStandardType()) return false; @@ -50,7 +50,7 @@ bool CheckMemoryLeakClass::isclass(const Token *tok) } //--------------------------------------------------------------------------- -CheckMemoryLeakClass::AllocType CheckMemoryLeakClass::GetAllocationType(const Token *tok2) +CheckMemoryLeak::AllocType CheckMemoryLeak::GetAllocationType(const Token *tok2) { // What we may have... // * var = (char *)malloc(10); @@ -136,7 +136,7 @@ CheckMemoryLeakClass::AllocType CheckMemoryLeakClass::GetAllocationType(const To -CheckMemoryLeakClass::AllocType CheckMemoryLeakClass::GetReallocationType(const Token *tok2) +CheckMemoryLeak::AllocType CheckMemoryLeak::GetReallocationType(const Token *tok2) { // What we may have... // * var = (char *)realloc(..; @@ -160,7 +160,7 @@ CheckMemoryLeakClass::AllocType CheckMemoryLeakClass::GetReallocationType(const } -CheckMemoryLeakClass::AllocType CheckMemoryLeakClass::GetDeallocationType(const Token *tok, const char *varnames[]) +CheckMemoryLeak::AllocType CheckMemoryLeak::GetDeallocationType(const Token *tok, const char *varnames[]) { int i = 0; std::string names; @@ -206,7 +206,7 @@ CheckMemoryLeakClass::AllocType CheckMemoryLeakClass::GetDeallocationType(const } //-------------------------------------------------------------------------- -const char * CheckMemoryLeakClass::call_func(const Token *tok, std::list callstack, const char *varnames[], AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz) +const char * CheckMemoryLeak::call_func(const Token *tok, std::list callstack, const char *varnames[], AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz) { // Keywords that are not function calls.. if (Token::Match(tok, "if|for|while|return|switch")) @@ -317,11 +317,11 @@ const char * CheckMemoryLeakClass::call_func(const Token *tok, std::list callstack, const char varname[], AllocType &alloctype, AllocType &dealloctype, bool classmember, bool &all, unsigned int sz) +Token *CheckMemoryLeak::getcode(const Token *tok, std::list callstack, const char varname[], AllocType &alloctype, AllocType &dealloctype, bool classmember, bool &all, unsigned int sz) { const char *varnames[2]; varnames[0] = varname; @@ -775,12 +775,12 @@ Token *CheckMemoryLeakClass::getcode(const Token *tok, std::list return rethead; } -void CheckMemoryLeakClass::erase(Token *begin, const Token *end) +void CheckMemoryLeak::erase(Token *begin, const Token *end) { Token::eraseTokens(begin, end); } -void CheckMemoryLeakClass::simplifycode(Token *tok, bool &all) +void CheckMemoryLeak::simplifycode(Token *tok, bool &all) { // Replace "throw" that is not in a try block with "return" int indentlevel = 0; @@ -1279,7 +1279,7 @@ void CheckMemoryLeakClass::simplifycode(Token *tok, bool &all) // Check for memory leaks for a function variable. -void CheckMemoryLeakClass::CheckMemoryLeak_CheckScope(const Token *Tok1, const char varname[], bool classmember, unsigned int sz) +void CheckMemoryLeak::CheckMemoryLeak_CheckScope(const Token *Tok1, const char varname[], bool classmember, unsigned int sz) { std::list callstack; @@ -1418,7 +1418,7 @@ void CheckMemoryLeakClass::CheckMemoryLeak_CheckScope(const Token *Tok1, const c // Checks for memory leaks inside function.. //--------------------------------------------------------------------------- -void CheckMemoryLeakClass::CheckMemoryLeak_InFunction() +void CheckMemoryLeak::CheckMemoryLeak_InFunction() { bool classmember = false; bool beforeParameters = false; @@ -1476,7 +1476,7 @@ void CheckMemoryLeakClass::CheckMemoryLeak_InFunction() -void CheckMemoryLeakClass::CheckMemoryLeak_ClassMembers() +void CheckMemoryLeak::CheckMemoryLeak_ClassMembers() { int indentlevel = 0; for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) @@ -1497,7 +1497,7 @@ void CheckMemoryLeakClass::CheckMemoryLeak_ClassMembers() } -void CheckMemoryLeakClass::CheckMemoryLeak_ClassMembers_ParseClass(const Token *tok1, std::vector &classname) +void CheckMemoryLeak::CheckMemoryLeak_ClassMembers_ParseClass(const Token *tok1, std::vector &classname) { // Go into class. while (tok1 && tok1->str() != "{") @@ -1546,7 +1546,7 @@ void CheckMemoryLeakClass::CheckMemoryLeak_ClassMembers_ParseClass(const Token * } } -void CheckMemoryLeakClass::CheckMemoryLeak_ClassMembers_Variable(const char classname[], const Token *tokVarname) +void CheckMemoryLeak::CheckMemoryLeak_ClassMembers_Variable(const char classname[], const Token *tokVarname) { const char *varname = tokVarname->strAt(0); @@ -1645,31 +1645,11 @@ void CheckMemoryLeakClass::CheckMemoryLeak_ClassMembers_Variable(const char clas - -//--------------------------------------------------------------------------- -// Checks for memory leaks.. -//--------------------------------------------------------------------------- - -void CheckMemoryLeakClass::CheckMemoryLeak() -{ - _listAllocFunc.clear(); - - // Check for memory leaks inside functions.. - CheckMemoryLeak_InFunction(); - - // Check that all class members are deallocated.. - if (_settings->_showAll) - CheckMemoryLeak_ClassMembers(); -} -//--------------------------------------------------------------------------- - - - //--------------------------------------------------------------------------- // Non-recursive function analysis //--------------------------------------------------------------------------- -Token * CheckMemoryLeakClass::functionParameterCode(const Token *ftok, int parameter) +Token * CheckMemoryLeak::functionParameterCode(const Token *ftok, int parameter) { int param = 1; // First parameter has index 1 @@ -1713,37 +1693,37 @@ Token * CheckMemoryLeakClass::functionParameterCode(const Token *ftok, int param } -void CheckMemoryLeakClass::memleakError(const Token *tok, const std::string &varname) +void CheckMemoryLeak::memleakError(const Token *tok, const std::string &varname) { reportError(tok, "error", "memleak", "Memory leak: " + varname); } -void CheckMemoryLeakClass::memleakallError(const Token *tok, const std::string &varname) +void CheckMemoryLeak::memleakallError(const Token *tok, const std::string &varname) { reportError(tok, "all", "memleakall", "Memory leak: " + varname); } -void CheckMemoryLeakClass::resourceLeakError(const Token *tok, const std::string &varname) +void CheckMemoryLeak::resourceLeakError(const Token *tok, const std::string &varname) { reportError(tok, "error", "resourceLeak", "Resource leak: " + varname); } -void CheckMemoryLeakClass::deallocDeallocError(const Token *tok, const std::string &varname) +void CheckMemoryLeak::deallocDeallocError(const Token *tok, const std::string &varname) { reportError(tok, "error", "deallocDealloc", "Deallocating a deallocated pointer: " + varname); } -void CheckMemoryLeakClass::deallocuseError(const Token *tok, const std::string &varname) +void CheckMemoryLeak::deallocuseError(const Token *tok, const std::string &varname) { reportError(tok, "error", "deallocuse", "Using '" + varname + "' after it is deallocated / released"); } -void CheckMemoryLeakClass::mismatchSizeError(const Token *tok, const std::string &sz) +void CheckMemoryLeak::mismatchSizeError(const Token *tok, const std::string &sz) { reportError(tok, "error", "mismatchSize", "The given size " + sz + " is mismatching"); } -void CheckMemoryLeakClass::mismatchAllocDealloc(const std::list &callstack, const std::string &varname) +void CheckMemoryLeak::mismatchAllocDealloc(const std::list &callstack, const std::string &varname) { reportError(callstack, "error", "mismatchAllocDealloc", "Mismatching allocation and deallocation: " + varname); } diff --git a/src/checkmemoryleak.h b/src/checkmemoryleak.h index 372b83340..a312cf6f4 100644 --- a/src/checkmemoryleak.h +++ b/src/checkmemoryleak.h @@ -19,8 +19,8 @@ //--------------------------------------------------------------------------- -#ifndef CheckMemoryLeakH -#define CheckMemoryLeakH +#ifndef checkmemoryleakH +#define checkmemoryleakH //--------------------------------------------------------------------------- /** \brief Check for memory leaks */ @@ -33,26 +33,27 @@ class Token; -class CheckMemoryLeakClass : public Check +class CheckMemoryLeak : public Check { public: - CheckMemoryLeakClass() : Check() + CheckMemoryLeak() : Check() { } - CheckMemoryLeakClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) + CheckMemoryLeak(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) : Check(tokenizer, settings, errorLogger) { } void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { - CheckMemoryLeakClass checkMemoryLeakClass(tokenizer, settings, errorLogger); - checkMemoryLeakClass.CheckMemoryLeak(); + CheckMemoryLeak checkMemoryLeak(tokenizer, settings, errorLogger); + checkMemoryLeak.CheckMemoryLeak_InFunction(); + if (settings->_showAll) + checkMemoryLeak.CheckMemoryLeak_ClassMembers(); } - - void CheckMemoryLeak(); - +#ifndef UNIT_TESTING private: +#endif /** What type of allocation are used.. the "Many" means that several types of allocation and deallocation are used */ enum AllocType { No, Malloc, gMalloc, New, NewArray, File, Pipe, Dir, Many }; diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index 2b3ac0f3f..bafb779df 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -19,7 +19,7 @@ - +#define UNIT_TESTING #include "../src/tokenize.h" #include "../src/checkmemoryleak.h" #include "testsuite.h" @@ -53,8 +53,9 @@ private: settings._debug = true; settings._showAll = showAll; tokenizer.fillFunctionList(); - CheckMemoryLeakClass checkMemoryLeak(&tokenizer, &settings, this); - checkMemoryLeak.CheckMemoryLeak(); + CheckMemoryLeak checkMemoryLeak(&tokenizer, &settings, this); + checkMemoryLeak.CheckMemoryLeak_InFunction(); + checkMemoryLeak.CheckMemoryLeak_ClassMembers(); } void run() @@ -2102,8 +2103,8 @@ private: settings.autoDealloc(istr); } - CheckMemoryLeakClass checkMemoryLeak(&tokenizer, &settings, this); - checkMemoryLeak.CheckMemoryLeak(); + CheckMemoryLeak checkMemoryLeak(&tokenizer, &settings, this); + checkMemoryLeak.CheckMemoryLeak_InFunction(); } From 2c07c22d9e508def405da74d5e3443636c0068d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 8 Jun 2009 20:20:43 +0200 Subject: [PATCH 39/41] Refactoring: Split up the CheckMemoryLeak into CheckMemoryLeakInFunction and CheckMemoryLeakInClass --- src/checkmemoryleak.cpp | 410 +++++++++++++-------------- src/checkmemoryleak.h | 184 ++++++++----- test/testmemleak.cpp | 593 +++++++++++++++++++++------------------- 3 files changed, 626 insertions(+), 561 deletions(-) diff --git a/src/checkmemoryleak.cpp b/src/checkmemoryleak.cpp index 9c786db8c..ef94e5fb9 100644 --- a/src/checkmemoryleak.cpp +++ b/src/checkmemoryleak.cpp @@ -31,12 +31,13 @@ // Register this check class (by creating a static instance of it) namespace { -CheckMemoryLeak instance; +CheckMemoryLeakInFunction instance1; +CheckMemoryLeakInClass instance2; } //--------------------------------------------------------------------------- -bool CheckMemoryLeak::isclass(const Token *tok) +bool CheckMemoryLeak::isclass(const Tokenizer *_tokenizer, const Token *tok) const { if (tok->isStandardType()) return false; @@ -122,15 +123,6 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::GetAllocationType(const Token *tok2) if (Token::Match(tok2, "opendir|fdopendir (")) return Dir; - // Userdefined allocation function.. - std::list::const_iterator it = _listAllocFunc.begin(); - while (it != _listAllocFunc.end()) - { - if (tok2->str() == it->funcname) - return it->alloctype; - ++it; - } - return No; } @@ -206,7 +198,90 @@ CheckMemoryLeak::AllocType CheckMemoryLeak::GetDeallocationType(const Token *tok } //-------------------------------------------------------------------------- -const char * CheckMemoryLeak::call_func(const Token *tok, std::list callstack, const char *varnames[], AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz) + +//-------------------------------------------------------------------------- + +void CheckMemoryLeak::MemoryLeak(const Token *tok, const char varname[], AllocType alloctype, bool all) +{ + if (alloctype == CheckMemoryLeak::File || + alloctype == CheckMemoryLeak::Pipe || + alloctype == CheckMemoryLeak::Dir) + resourceLeakError(tok, varname); + else if (all) + memleakallError(tok, varname); + else + memleakError(tok, varname); +} +//--------------------------------------------------------------------------- + + + + +void CheckMemoryLeak::memleakError(const Token *tok, const std::string &varname) +{ + error(tok, "error", "memleak", "Memory leak: " + varname); +} + +void CheckMemoryLeak::memleakallError(const Token *tok, const std::string &varname) +{ + error(tok, "all", "memleakall", "Memory leak: " + varname); +} + +void CheckMemoryLeak::resourceLeakError(const Token *tok, const std::string &varname) +{ + error(tok, "error", "resourceLeak", "Resource leak: " + varname); +} + +void CheckMemoryLeak::deallocDeallocError(const Token *tok, const std::string &varname) +{ + error(tok, "error", "deallocDealloc", "Deallocating a deallocated pointer: " + varname); +} + +void CheckMemoryLeak::deallocuseError(const Token *tok, const std::string &varname) +{ + error(tok, "error", "deallocuse", "Using '" + varname + "' after it is deallocated / released"); +} + +void CheckMemoryLeak::mismatchSizeError(const Token *tok, const std::string &sz) +{ + error(tok, "error", "mismatchSize", "The given size " + sz + " is mismatching"); +} + +void CheckMemoryLeak::mismatchAllocDealloc(const std::list &callstack, const std::string &varname) +{ + error(callstack, "error", "mismatchAllocDealloc", "Mismatching allocation and deallocation: " + varname); +} + + + + + +bool CheckMemoryLeakInFunction::MatchFunctionsThatReturnArg(const Token *tok, const std::string &varname) +{ + return Token::Match(tok, std::string("; " + varname + " = strcat|memcpy|memmove|strcpy ( " + varname + " ,").c_str()); +} + + +bool CheckMemoryLeakInFunction::notvar(const Token *tok, const char *varnames[], bool endpar) +{ + std::string varname; + for (int i = 0; varnames[i]; i++) + { + if (i > 0) + varname += " . "; + + varname += varnames[i]; + } + + const std::string end(endpar ? " &&|)" : " [;)&|]"); + + return bool(Token::Match(tok, ("! " + varname + end).c_str()) || + Token::Match(tok, ("! ( " + varname + " )" + end).c_str())); +} + + + +const char * CheckMemoryLeakInFunction::call_func(const Token *tok, std::list callstack, const char *varnames[], AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz) { // Keywords that are not function calls.. if (Token::Match(tok, "if|for|while|return|switch")) @@ -315,44 +390,9 @@ const char * CheckMemoryLeak::call_func(const Token *tok, std::list 0) - varname += " . "; - - varname += varnames[i]; - } - - const std::string end(endpar ? " &&|)" : " [;)&|]"); - - return bool(Token::Match(tok, ("! " + varname + end).c_str()) || - Token::Match(tok, ("! ( " + varname + " )" + end).c_str())); -} - -Token *CheckMemoryLeak::getcode(const Token *tok, std::list callstack, const char varname[], AllocType &alloctype, AllocType &dealloctype, bool classmember, bool &all, unsigned int sz) +Token *CheckMemoryLeakInFunction::getcode(const Token *tok, std::list callstack, const char varname[], AllocType &alloctype, AllocType &dealloctype, bool classmember, bool &all, unsigned int sz) { const char *varnames[2]; varnames[0] = varname; @@ -437,7 +477,7 @@ Token *CheckMemoryLeak::getcode(const Token *tok, std::list calls { if (Token::Match(tok->tokAt(2), "new %type% [(;]")) { - if (isclass(tok->tokAt(3))) + if (isclass(_tokenizer, tok->tokAt(3))) { if (_settings->_showAll) { @@ -775,12 +815,12 @@ Token *CheckMemoryLeak::getcode(const Token *tok, std::list calls return rethead; } -void CheckMemoryLeak::erase(Token *begin, const Token *end) -{ - Token::eraseTokens(begin, end); -} -void CheckMemoryLeak::simplifycode(Token *tok, bool &all) + + + + +void CheckMemoryLeakInFunction::simplifycode(Token *tok, bool &all) { // Replace "throw" that is not in a try block with "return" int indentlevel = 0; @@ -842,7 +882,7 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) // Delete extra ";" while (Token::Match(tok2, "[;{}] ;")) { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); done = false; } @@ -850,21 +890,21 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) if (Token::simpleMatch(tok2->next(), "{ }")) { tok2->next()->str(";"); - erase(tok2->next(), tok2->tokAt(3)); + Token::eraseTokens(tok2->next(), tok2->tokAt(3)); done = false; } // Delete braces around a single instruction.. if (Token::Match(tok2->next(), "{ %var% ; }")) { - erase(tok2, tok2->tokAt(2)); - erase(tok2->next()->next(), tok2->tokAt(4)); + Token::eraseTokens(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2->next()->next(), tok2->tokAt(4)); done = false; } if (Token::Match(tok2->next(), "{ %var% %var% ; }")) { - erase(tok2, tok2->tokAt(2)); - erase(tok2->next()->next()->next(), tok2->tokAt(5)); + Token::eraseTokens(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2->next()->next()->next(), tok2->tokAt(5)); done = false; } @@ -874,21 +914,21 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) // Delete empty if that is not followed by an else if (Token::Match(tok2->next(), "if ; !!else")) { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); done = false; } // Delete "if ; else ;" else if (Token::simpleMatch(tok2->next(), "if ; else ;")) { - erase(tok2, tok2->tokAt(4)); + Token::eraseTokens(tok2, tok2->tokAt(4)); done = false; } // Two "if alloc ;" after one another.. perhaps only one of them can be executed each time else if (!_settings->_showAll && Token::Match(tok2, "[;{}] if alloc ; if alloc ;")) { - erase(tok2, tok2->tokAt(4)); + Token::eraseTokens(tok2, tok2->tokAt(4)); done = false; } @@ -896,7 +936,7 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) else if (Token::Match(tok2, "; if ; else assign|use ; assign|use") || Token::Match(tok2, "; if assign|use ; else ; assign|use")) { - erase(tok2, tok2->tokAt(4)); + Token::eraseTokens(tok2, tok2->tokAt(4)); done = false; } @@ -908,12 +948,12 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) { if (_settings->_showAll) { - erase(tok2, tok2->tokAt(3)); + Token::eraseTokens(tok2, tok2->tokAt(3)); all = true; } else { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); } done = false; } @@ -921,57 +961,57 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) // Reduce "if if" => "if" else if (Token::simpleMatch(tok2, "if if")) { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); done = false; } // Reduce "if return ; alloc ;" => "alloc ;" else if (Token::Match(tok2, "[;{}] if return ; alloc ;")) { - erase(tok2, tok2->tokAt(4)); + Token::eraseTokens(tok2, tok2->tokAt(4)); done = false; } // "[;{}] if alloc ; else return ;" => "[;{}] alloc ;" else if (Token::Match(tok2, "[;{}] if alloc ; else return ;")) { - erase(tok2, tok2->tokAt(2)); // Remove "if" - erase(tok2->next(), tok2->tokAt(5)); // Remove "; else return" + Token::eraseTokens(tok2, tok2->tokAt(2)); // Remove "if" + Token::eraseTokens(tok2->next(), tok2->tokAt(5)); // Remove "; else return" done = false; } // Reduce "if ; else %var% ;" => "if %var% ;" else if (Token::Match(tok2->next(), "if ; else %var% ;")) { - erase(tok2->next(), tok2->tokAt(4)); + Token::eraseTokens(tok2->next(), tok2->tokAt(4)); done = false; } // Reduce "if ; else return use ;" => "if return use ;" else if (Token::simpleMatch(tok2->next(), "if ; else return use ;")) { - erase(tok2->next(), tok2->tokAt(4)); + Token::eraseTokens(tok2->next(), tok2->tokAt(4)); done = false; } // Reduce "if return ; if return ;" => "if return ;" else if (Token::simpleMatch(tok2->next(), "if return ; if return ;")) { - erase(tok2, tok2->tokAt(4)); + Token::eraseTokens(tok2, tok2->tokAt(4)); done = false; } // Delete first if in .. "if { dealloc|assign|use ; return ; } if return ;" else if (Token::Match(tok2, "[;{}] if { dealloc|assign|use ; return ; } if return ;")) { - erase(tok2, tok2->tokAt(8)); + Token::eraseTokens(tok2, tok2->tokAt(8)); done = false; } // Remove "if { dealloc ; callfunc ; } !!else" else if (Token::Match(tok2->next(), "if { dealloc|assign|use ; callfunc ; } !!else")) { - erase(tok2, tok2->tokAt(8)); + Token::eraseTokens(tok2, tok2->tokAt(8)); done = false; } @@ -981,7 +1021,7 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) if (Token::Match(tok2, "[;{}] if { assign|dealloc|use ; return ; } !!else")) { all = true; - erase(tok2, tok2->tokAt(8)); + Token::eraseTokens(tok2, tok2->tokAt(8)); done = false; } } @@ -992,7 +1032,7 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) // Reduce "if(var) dealloc ;" and "if(var) use ;" that is not followed by an else.. if (Token::Match(tok2, "[;{}] if(var) assign|dealloc|use ; !!else")) { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); done = false; } @@ -1000,7 +1040,7 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) if (Token::Match(tok2, "; if(!var) alloc ; !!else")) { // Remove the "if(!var)" - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); // Insert "dealloc ;" before the "alloc ;" tok2->insertToken(";"); @@ -1012,28 +1052,28 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) // Remove "catch ;" if (Token::simpleMatch(tok2->next(), "catch ;")) { - erase(tok2, tok2->tokAt(3)); + Token::eraseTokens(tok2, tok2->tokAt(3)); done = false; } // Reduce "if* ;" that is not followed by an else.. if (Token::Match(tok2->next(), "if(var)|if(!var)|ifv ; !!else")) { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); done = false; } // Reduce "else ;" => ";" if (Token::simpleMatch(tok2->next(), "else ;")) { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); done = false; } // Delete if block: "alloc; if return use ;" if (Token::Match(tok2, "alloc ; if return use ; !!else")) { - erase(tok2, tok2->tokAt(5)); + Token::eraseTokens(tok2, tok2->tokAt(5)); done = false; } @@ -1041,7 +1081,7 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) // Replace "dealloc use ;" with "dealloc ;" if (Token::simpleMatch(tok2, "dealloc use ;")) { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); done = false; } @@ -1049,7 +1089,7 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) if (! _settings->_showAll && Token::Match(tok2, "dealloc ; alloc ; if break|continue ;")) { tok2 = tok2->next()->next()->next(); - erase(tok2, tok2->tokAt(3)); + Token::eraseTokens(tok2, tok2->tokAt(3)); done = false; } @@ -1057,15 +1097,15 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) // TODO: If the loop can be executed twice reduce to "loop alloc ;" instead if (Token::simpleMatch(tok2->next(), "do { alloc ; }")) { - erase(tok2, tok2->tokAt(3)); - erase(tok2->next()->next(), tok2->tokAt(4)); + Token::eraseTokens(tok2, tok2->tokAt(3)); + Token::eraseTokens(tok2->next()->next(), tok2->tokAt(4)); done = false; } // Reduce "loop if break ; => ";" if (Token::Match(tok2->next(), "loop if break|continue ; !!else")) { - erase(tok2, tok2->tokAt(4)); + Token::eraseTokens(tok2, tok2->tokAt(4)); done = false; } @@ -1073,88 +1113,88 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) if (Token::Match(tok2->next(), "loop { assign|dealloc|use ; alloc ; if break|continue ; }")) { // erase "loop {" - erase(tok2, tok2->tokAt(3)); + Token::eraseTokens(tok2, tok2->tokAt(3)); // erase "if break|continue ; }" tok2 = tok2->next()->next()->next()->next(); - erase(tok2, tok2->tokAt(5)); + Token::eraseTokens(tok2, tok2->tokAt(5)); done = false; } // Replace "loop { X ; break ; }" with "X ;" if (Token::Match(tok2->next(), "loop { %var% ; break ; }")) { - erase(tok2, tok2->tokAt(3)); - erase(tok2->next()->next(), tok2->tokAt(6)); + Token::eraseTokens(tok2, tok2->tokAt(3)); + Token::eraseTokens(tok2->next()->next(), tok2->tokAt(6)); done = false; } // Replace "loop ;" with ";" if (Token::simpleMatch(tok2->next(), "loop ;")) { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); done = false; } // Replace "loop !var ;" with ";" if (Token::Match(tok2->next(), "loop !var ;")) { - erase(tok2, tok2->tokAt(4)); + Token::eraseTokens(tok2, tok2->tokAt(4)); done = false; } // Replace "loop !var alloc ;" with " alloc ;" if (Token::Match(tok2->next(), "loop !var alloc ;")) { - erase(tok2, tok2->tokAt(3)); + Token::eraseTokens(tok2, tok2->tokAt(3)); done = false; } // Replace "loop if return ;" with "if return ;" if (Token::simpleMatch(tok2->next(), "loop if return")) { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); done = false; } // Delete if block in "alloc ; if(!var) return ;" if (Token::Match(tok2, "alloc ; if(!var) return ;")) { - erase(tok2, tok2->tokAt(4)); + Token::eraseTokens(tok2, tok2->tokAt(4)); done = false; } // Delete if block: "alloc; if return use ;" if (Token::Match(tok2, "alloc ; if return use ; !!else")) { - erase(tok2, tok2->tokAt(5)); + Token::eraseTokens(tok2, tok2->tokAt(5)); done = false; } // Reduce "[;{}] return ; %var%" => "[;{}] return ;" if (Token::Match(tok2, "[;{}] return ; %var%")) { - erase(tok2->next()->next(), tok2->tokAt(4)); + Token::eraseTokens(tok2->next()->next(), tok2->tokAt(4)); done = false; } // Reduce "[;{}] return use ; %var%" => "[;{}] return use ;" if (Token::Match(tok2, "[;{}] return use ; %var%")) { - erase(tok2->next()->next()->next(), tok2->tokAt(5)); + Token::eraseTokens(tok2->next()->next()->next(), tok2->tokAt(5)); done = false; } // Reduce "if(var) return use ;" => "return use ;" if (Token::Match(tok2->next(), "if(var) return use ; !!else")) { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); done = false; } // Reduce "if(var) assign|dealloc|use ;" => "assign|dealloc|use ;" if (Token::Match(tok2->next(), "if(var) assign|dealloc|use ; !!else")) { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); done = false; } @@ -1162,7 +1202,7 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) // Reduce "[;{}] alloc ; dealloc ; alloc ;" => "[;{}] alloc ;" if (Token::Match(tok2, "[;{}] alloc ; dealloc ; alloc ;")) { - erase(tok2->next(), tok2->tokAt(6)); + Token::eraseTokens(tok2->next(), tok2->tokAt(6)); done = false; } @@ -1170,35 +1210,35 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) if (Token::simpleMatch(tok2->tokAt(2), "alloc ; dealloc ;") && tok2->next()->str().find("if") == 0) { - erase(tok2, tok2->tokAt(5)); + Token::eraseTokens(tok2, tok2->tokAt(5)); done = false; } // Delete second use in "use ; use ;" while (Token::Match(tok2, "[;{}] use ; use ;")) { - erase(tok2, tok2->tokAt(3)); + Token::eraseTokens(tok2, tok2->tokAt(3)); done = false; } // Delete first part in "use ; dealloc ;" if (Token::Match(tok2, "[;{}] use ; dealloc ;")) { - erase(tok2, tok2->tokAt(3)); + Token::eraseTokens(tok2, tok2->tokAt(3)); done = false; } // Delete first part in "use ; return use ;" if (Token::Match(tok2, "[;{}] use ; return use ;")) { - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); done = false; } // Delete second case in "case ; case ;" while (Token::simpleMatch(tok2, "case ; case ;")) { - erase(tok2, tok2->tokAt(3)); + Token::eraseTokens(tok2, tok2->tokAt(3)); done = false; } @@ -1239,7 +1279,7 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) { done = false; tok2->str(";"); - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); tok2 = tok2->next(); bool first = true; while (Token::Match(tok2, "case|default")) @@ -1278,8 +1318,12 @@ void CheckMemoryLeak::simplifycode(Token *tok, bool &all) + + + + // Check for memory leaks for a function variable. -void CheckMemoryLeak::CheckMemoryLeak_CheckScope(const Token *Tok1, const char varname[], bool classmember, unsigned int sz) +void CheckMemoryLeakInFunction::checkScope(const Token *Tok1, const char varname[], bool classmember, unsigned int sz) { std::list callstack; @@ -1297,7 +1341,7 @@ void CheckMemoryLeak::CheckMemoryLeak_CheckScope(const Token *Tok1, const char v for (Token *tok2 = tok; tok2; tok2 = tok2->next()) { while (Token::Match(tok2, "[;{}] ;")) - erase(tok2, tok2->tokAt(2)); + Token::eraseTokens(tok2, tok2->tokAt(2)); } if ((result = Token::findmatch(tok, "[;{}] dealloc [;{}] use|use_ ;")) != NULL) { @@ -1414,11 +1458,16 @@ void CheckMemoryLeak::CheckMemoryLeak_CheckScope(const Token *Tok1, const char v + + + + + //--------------------------------------------------------------------------- // Checks for memory leaks inside function.. //--------------------------------------------------------------------------- -void CheckMemoryLeak::CheckMemoryLeak_InFunction() +void CheckMemoryLeakInFunction::check() { bool classmember = false; bool beforeParameters = false; @@ -1459,10 +1508,10 @@ void CheckMemoryLeak::CheckMemoryLeak_InFunction() sz = 1; if (Token::Match(tok, "[{};] %type% * %var% [;=]")) - CheckMemoryLeak_CheckScope(tok->next(), tok->strAt(3), classmember, sz); + checkScope(tok->next(), tok->strAt(3), classmember, sz); else if (Token::Match(tok, "[{};] %type% %type% * %var% [;=]")) - CheckMemoryLeak_CheckScope(tok->next(), tok->strAt(4), classmember, sz); + checkScope(tok->next(), tok->strAt(4), classmember, sz); } } } @@ -1470,13 +1519,39 @@ void CheckMemoryLeak::CheckMemoryLeak_InFunction() + + + + + + + + + + + + + + + + + + + + + + + + + + //--------------------------------------------------------------------------- // Checks for memory leaks in classes.. //--------------------------------------------------------------------------- -void CheckMemoryLeak::CheckMemoryLeak_ClassMembers() +void CheckMemoryLeakInClass::check() { int indentlevel = 0; for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) @@ -1491,13 +1566,13 @@ void CheckMemoryLeak::CheckMemoryLeak_ClassMembers() { std::vector classname; classname.push_back(tok->strAt(1)); - CheckMemoryLeak_ClassMembers_ParseClass(tok, classname); + parseClass(tok, classname); } } } -void CheckMemoryLeak::CheckMemoryLeak_ClassMembers_ParseClass(const Token *tok1, std::vector &classname) +void CheckMemoryLeakInClass::parseClass(const Token *tok1, std::vector &classname) { // Go into class. while (tok1 && tok1->str() != "{") @@ -1526,7 +1601,7 @@ void CheckMemoryLeak::CheckMemoryLeak_ClassMembers_ParseClass(const Token *tok1, if (Token::Match(tok, "class %var% [{:]")) { classname.push_back(tok->strAt(1)); - CheckMemoryLeak_ClassMembers_ParseClass(tok, classname); + parseClass(tok, classname); classname.pop_back(); } @@ -1539,20 +1614,20 @@ void CheckMemoryLeak::CheckMemoryLeak_ClassMembers_ParseClass(const Token *tok1, if (tok->isName() || Token::Match(tok, "[;}]")) { - if (_settings->_showAll || !isclass(tok->tokAt(1))) - CheckMemoryLeak_ClassMembers_Variable(classname.back(), tok->tokAt(3)); + if (_settings->_showAll || !isclass(_tokenizer, tok->tokAt(1))) + variable(classname.back(), tok->tokAt(3)); } } } } -void CheckMemoryLeak::CheckMemoryLeak_ClassMembers_Variable(const char classname[], const Token *tokVarname) +void CheckMemoryLeakInClass::variable(const char classname[], const Token *tokVarname) { const char *varname = tokVarname->strAt(0); // Check if member variable has been allocated and deallocated.. - AllocType Alloc = No; - AllocType Dealloc = No; + CheckMemoryLeak::AllocType Alloc = CheckMemoryLeak::No; + CheckMemoryLeak::AllocType Dealloc = CheckMemoryLeak::No; // Loop through all tokens. Inspect member functions int indent_ = 0; @@ -1585,13 +1660,13 @@ void CheckMemoryLeak::CheckMemoryLeak_ClassMembers_Variable(const char classname if (indent == 0 || Token::Match(tok, (std::string(varname) + " =").c_str())) { AllocType alloc = GetAllocationType(tok->tokAt((indent > 0) ? 2 : 3)); - if (alloc != No) + if (alloc != CheckMemoryLeak::No) { if (Alloc != No && Alloc != alloc) - alloc = Many; + alloc = CheckMemoryLeak::Many; std::list callstack; - if (alloc != Many && Dealloc != No && Dealloc != Many && Dealloc != alloc) + if (alloc != CheckMemoryLeak::Many && Dealloc != CheckMemoryLeak::No && Dealloc != CheckMemoryLeak::Many && Dealloc != alloc) { callstack.push_back(tok); mismatchAllocDealloc(callstack, (std::string(classname) + "::" + varname).c_str()); @@ -1615,13 +1690,13 @@ void CheckMemoryLeak::CheckMemoryLeak_ClassMembers_Variable(const char classname varnames[1] = varname; dealloc = GetDeallocationType(tok, varnames); } - if (dealloc != No) + if (dealloc != CheckMemoryLeak::No) { - if (Dealloc != No && Dealloc != dealloc) - dealloc = Many; + if (Dealloc != CheckMemoryLeak::No && Dealloc != dealloc) + dealloc = CheckMemoryLeak::Many; std::list callstack; - if (dealloc != Many && Alloc != No && Alloc != Many && Alloc != dealloc) + if (dealloc != CheckMemoryLeak::Many && Alloc != CheckMemoryLeak::No && Alloc != Many && Alloc != dealloc) { callstack.push_back(tok); mismatchAllocDealloc(callstack, (std::string(classname) + "::" + varname).c_str()); @@ -1637,7 +1712,7 @@ void CheckMemoryLeak::CheckMemoryLeak_ClassMembers_Variable(const char classname functionToken = Tokenizer::FindClassFunction(functionToken->next(), classname, "~| %var%", indent_); } - if (Alloc != No && Dealloc == No) + if (Alloc != CheckMemoryLeak::No && Dealloc == CheckMemoryLeak::No) { MemoryLeak(tokVarname, (std::string(classname) + "::" + varname).c_str(), Alloc, true); } @@ -1645,85 +1720,12 @@ void CheckMemoryLeak::CheckMemoryLeak_ClassMembers_Variable(const char classname -//--------------------------------------------------------------------------- -// Non-recursive function analysis -//--------------------------------------------------------------------------- - -Token * CheckMemoryLeak::functionParameterCode(const Token *ftok, int parameter) -{ - int param = 1; // First parameter has index 1 - - // Extract the code for specified parameter... - for (; ftok; ftok = ftok->next()) - { - if (ftok->str() == ")") - break; - - if (ftok->str() == ",") - { - ++param; - if (param > parameter) - break; - } - - if (param != parameter) - continue; - - if (! Token::Match(ftok, "* %var% [,)]")) - continue; - - // Extract and return the code for this parameter.. - const char *parname = ftok->strAt(1); - - // Goto function implementation.. - while (ftok && ftok->str() != "{") - ftok = ftok->next(); - ftok = ftok ? ftok->next() : NULL; - - // Return the code.. - AllocType alloc = No, dealloc = No; - bool all = false; - std::list callstack; - Token *code = getcode(ftok, callstack, parname, alloc, dealloc, false, all, 1); - simplifycode(code, all); - return code; - } - - return NULL; -} -void CheckMemoryLeak::memleakError(const Token *tok, const std::string &varname) -{ - reportError(tok, "error", "memleak", "Memory leak: " + varname); -} -void CheckMemoryLeak::memleakallError(const Token *tok, const std::string &varname) -{ - reportError(tok, "all", "memleakall", "Memory leak: " + varname); -} -void CheckMemoryLeak::resourceLeakError(const Token *tok, const std::string &varname) -{ - reportError(tok, "error", "resourceLeak", "Resource leak: " + varname); -} -void CheckMemoryLeak::deallocDeallocError(const Token *tok, const std::string &varname) -{ - reportError(tok, "error", "deallocDealloc", "Deallocating a deallocated pointer: " + varname); -} -void CheckMemoryLeak::deallocuseError(const Token *tok, const std::string &varname) -{ - reportError(tok, "error", "deallocuse", "Using '" + varname + "' after it is deallocated / released"); -} -void CheckMemoryLeak::mismatchSizeError(const Token *tok, const std::string &sz) -{ - reportError(tok, "error", "mismatchSize", "The given size " + sz + " is mismatching"); -} -void CheckMemoryLeak::mismatchAllocDealloc(const std::list &callstack, const std::string &varname) -{ - reportError(callstack, "error", "mismatchAllocDealloc", "Mismatching allocation and deallocation: " + varname); -} + diff --git a/src/checkmemoryleak.h b/src/checkmemoryleak.h index a312cf6f4..e392d533f 100644 --- a/src/checkmemoryleak.h +++ b/src/checkmemoryleak.h @@ -33,63 +33,77 @@ class Token; -class CheckMemoryLeak : public Check +/** Base class for memory leaks checking */ + +class CheckMemoryLeak +{ +protected: + CheckMemoryLeak() { } + + /** What type of allocation are used.. the "Many" means that several types of allocation and deallocation are used */ + enum AllocType { No, Malloc, gMalloc, New, NewArray, File, Pipe, Dir, Many }; + + void MemoryLeak(const Token *tok, const char varname[], AllocType alloctype, bool all); + void MismatchError(const Token *Tok1, const std::list &callstack, const char varname[]); + AllocType GetDeallocationType(const Token *tok, const char *varnames[]); + AllocType GetAllocationType(const Token *tok2); + AllocType GetReallocationType(const Token *tok2); + bool isclass(const Tokenizer *_tokenizer, const Token *typestr) const; + + void memleakError(const Token *tok, const std::string &varname); + void memleakallError(const Token *tok, const std::string &varname); + void resourceLeakError(const Token *tok, const std::string &varname); + + void deallocDeallocError(const Token *tok, const std::string &varname); + void deallocuseError(const Token *tok, const std::string &varname); + void mismatchSizeError(const Token *tok, const std::string &sz); + void mismatchAllocDealloc(const std::list &callstack, const std::string &varname); + + // error message + virtual void error(const Token *tok, const std::string &severity, const std::string &id, const std::string &msg) = 0; + virtual void error(const std::list &callstack, const std::string &severity, const std::string &id, const std::string &msg) = 0; +}; + + + + + +class CheckMemoryLeakInFunction : public CheckMemoryLeak, public Check { public: - CheckMemoryLeak() : Check() + CheckMemoryLeakInFunction() : Check() { } - CheckMemoryLeak(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) + CheckMemoryLeakInFunction(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) : Check(tokenizer, settings, errorLogger) { } void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) { - CheckMemoryLeak checkMemoryLeak(tokenizer, settings, errorLogger); - checkMemoryLeak.CheckMemoryLeak_InFunction(); - if (settings->_showAll) - checkMemoryLeak.CheckMemoryLeak_ClassMembers(); + CheckMemoryLeakInFunction checkMemoryLeak(tokenizer, settings, errorLogger); + checkMemoryLeak.check(); } #ifndef UNIT_TESTING private: #endif + void check(); - /** What type of allocation are used.. the "Many" means that several types of allocation and deallocation are used */ - enum AllocType { No, Malloc, gMalloc, New, NewArray, File, Pipe, Dir, Many }; +private: - // Extra allocation.. - class AllocFunc - { - public: - const char *funcname; - AllocType alloctype; - - AllocFunc(const char f[], AllocType a) - : funcname(f), alloctype(a) - { } - }; - - void CheckMemoryLeak_ClassMembers_Variable(const char classname[], const Token *tokVarname); - void CheckMemoryLeak_ClassMembers_ParseClass(const Token *tok1, std::vector &classname); - void CheckMemoryLeak_ClassMembers(); - void CheckMemoryLeak_InFunction(); - void CheckMemoryLeak_CheckScope(const Token *Tok1, const char varname[], bool classmember, unsigned int sz); + bool MatchFunctionsThatReturnArg(const Token *tok, const std::string &varname); /** - * Simplify code e.g. by replacing empty "{ }" with ";" - * @param tok first token. The tokens list can be modified. + * Check if there is a "!var" match inside a condition + * @param tok first token to match + * @param varnames the varname + * @param endpar if this is true the "!var" must be followed by ")" + * @return true if match */ - void simplifycode(Token *tok, bool &all); + bool notvar(const Token *tok, const char *varnames[], bool endpar = false); - /** - * Delete tokens between begin and end. E.g. if begin = 1 - * and end = 5, tokens 2,3 and 4 would be erased. - * - * @param begin Tokens after this will be erased. - * @param end Tokens before this will be erased. - */ - void erase(Token *begin, const Token *end); + + const char * call_func(const Token *tok, std::list callstack, const char *varnames[], AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz); /** * Extract a new tokens list that is easier to parse than the "tokens" @@ -104,53 +118,71 @@ private: Token *getcode(const Token *tok, std::list callstack, const char varname[], AllocType &alloctype, AllocType &dealloctype, bool classmember, bool &all, unsigned int sz); /** - * Check if there is a "!var" match inside a condition - * @param tok first token to match - * @param varnames the varname - * @param endpar if this is true the "!var" must be followed by ")" - * @return true if match + * Simplify code e.g. by replacing empty "{ }" with ";" + * @param tok first token. The tokens list can be modified. */ - bool notvar(const Token *tok, const char *varnames[], bool endpar = false); + void simplifycode(Token *tok, bool &all); - bool MatchFunctionsThatReturnArg(const Token *tok, const std::string &varname); - void MemoryLeak(const Token *tok, const char varname[], AllocType alloctype, bool all); - void MismatchError(const Token *Tok1, const std::list &callstack, const char varname[]); - const char * call_func(const Token *tok, std::list callstack, const char *varnames[], AllocType &alloctype, AllocType &dealloctype, bool &all, unsigned int sz); - AllocType GetDeallocationType(const Token *tok, const char *varnames[]); - AllocType GetAllocationType(const Token *tok2); - AllocType GetReallocationType(const Token *tok2); - bool isclass(const Token *typestr); + void checkScope(const Token *Tok1, const char varname[], bool classmember, unsigned int sz); - std::list _listAllocFunc; - - void memleakError(const Token *tok, const std::string &varname); - void memleakallError(const Token *tok, const std::string &varname); - void resourceLeakError(const Token *tok, const std::string &varname); - void deallocDeallocError(const Token *tok, const std::string &varname); - void deallocuseError(const Token *tok, const std::string &varname); - void mismatchSizeError(const Token *tok, const std::string &sz); - void mismatchAllocDealloc(const std::list &callstack, const std::string &varname); - - - void getErrorMessages() + void error(const Token *tok, const std::string &severity, const std::string &id, const std::string &msg) { - std::cout << "===memory leaks===" << "\n"; - memleakError(0, "varname"); - memleakallError(0, "varname"); - resourceLeakError(0, "varname"); - deallocDeallocError(0, "varname"); - deallocuseError(0, "varname"); - mismatchSizeError(0, "sz"); - - std::list callstack; - mismatchAllocDealloc(callstack, "varname"); + reportError(tok, severity, id, msg); } + void error(const std::list &callstack, const std::string &severity, const std::string &id, const std::string &msg) + { + reportError(callstack, severity, id, msg); + } + + void getErrorMessages() + { } -// Experimental functionality.. -protected: - Token *functionParameterCode(const Token *ftok, int parameter); }; + + + +class CheckMemoryLeakInClass : public CheckMemoryLeak, public Check +{ +public: + CheckMemoryLeakInClass() : Check() + { } + + CheckMemoryLeakInClass(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) + : Check(tokenizer, settings, errorLogger) + { } + + void runSimplifiedChecks(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger) + { + CheckMemoryLeakInClass checkMemoryLeak(tokenizer, settings, errorLogger); + checkMemoryLeak.check(); + } + +#ifndef UNIT_TESTING +private: +#endif + void check(); + +private: + void parseClass(const Token *tok1, std::vector &classname); + void variable(const char classname[], const Token *tokVarname); + + void error(const Token *tok, const std::string &severity, const std::string &id, const std::string &msg) + { + reportError(tok, severity, id, msg); + } + + void error(const std::list &callstack, const std::string &severity, const std::string &id, const std::string &msg) + { + reportError(callstack, severity, id, msg); + } + + void getErrorMessages() + { } + +}; + + //--------------------------------------------------------------------------- #endif diff --git a/test/testmemleak.cpp b/test/testmemleak.cpp index bafb779df..5da461b69 100644 --- a/test/testmemleak.cpp +++ b/test/testmemleak.cpp @@ -29,10 +29,10 @@ extern std::ostringstream errout; -class TestMemleak : public TestFixture +class TestMemleakInFunction : public TestFixture { public: - TestMemleak() : TestFixture("TestMemleak") + TestMemleakInFunction() : TestFixture("TestMemleakInFunction") { } private: @@ -53,9 +53,8 @@ private: settings._debug = true; settings._showAll = showAll; tokenizer.fillFunctionList(); - CheckMemoryLeak checkMemoryLeak(&tokenizer, &settings, this); - checkMemoryLeak.CheckMemoryLeak_InFunction(); - checkMemoryLeak.CheckMemoryLeak_ClassMembers(); + CheckMemoryLeakInFunction checkMemoryLeak(&tokenizer, &settings, this); + checkMemoryLeak.check(); } void run() @@ -145,18 +144,6 @@ private: TEST_CASE(func12); TEST_CASE(func13); - TEST_CASE(class1); - TEST_CASE(class2); - TEST_CASE(class3); - TEST_CASE(class4); - TEST_CASE(class5); - TEST_CASE(class6); - TEST_CASE(class7); - TEST_CASE(class8); - TEST_CASE(class9); - TEST_CASE(class10); - TEST_CASE(class11); - TEST_CASE(throw1); TEST_CASE(throw2); @@ -208,7 +195,6 @@ private: TEST_CASE(vcl2); TEST_CASE(autoptr1); - TEST_CASE(free_member_in_sub_func); TEST_CASE(if_with_and); TEST_CASE(assign_pclose); @@ -1393,235 +1379,6 @@ private: - void class1() - { - check("class Fred\n" - "{\n" - "private:\n" - " char *str1;\n" - " char *str2;\n" - "public:\n" - " Fred();\n" - " ~Fred();\n" - "};\n" - "\n" - "Fred::Fred()\n" - "{\n" - " str1 = new char[10];\n" - " str2 = new char[10];\n" - "}\n" - "\n" - "Fred::~Fred()\n" - "{\n" - " delete [] str2;\n" - "}\n", true); - - ASSERT_EQUALS("[test.cpp:4]: (all) Memory leak: Fred::str1\n", errout.str()); - } - - - void class2() - { - check("class Fred\n" - "{\n" - "private:\n" - " char *str1;\n" - "public:\n" - " Fred();\n" - " ~Fred();\n" - "};\n" - "\n" - "Fred::Fred()\n" - "{\n" - " str1 = new char[10];\n" - "}\n" - "\n" - "Fred::~Fred()\n" - "{\n" - " free(str1);\n" - "}\n", true); - - ASSERT_EQUALS("[test.cpp:17]: (error) Mismatching allocation and deallocation: Fred::str1\n", errout.str()); - } - - void class3() - { - check("class Token;\n" - "\n" - "class Tokenizer\n" - "{\n" - "private:\n" - " Token *_tokens;\n" - "\n" - "public:\n" - " Tokenizer();\n" - " ~Tokenizer();\n" - " void deleteTokens(Token *tok);\n" - "};\n" - "\n" - "Tokenizer::Tokenizer()\n" - "{\n" - " _tokens = new Token;\n" - "}\n" - "\n" - "Tokenizer::~Tokenizer()\n" - "{\n" - " deleteTokens(_tokens);\n" - "}\n" - "\n" - "void Tokenizer::deleteTokens(Token *tok)\n" - "{\n" - " while (tok)\n" - " {\n" - " Token *next = tok->next();\n" - " delete tok;\n" - " tok = next;\n" - " }\n" - "}\n", true); - - TODO_ASSERT_EQUALS("", errout.str()); - } - - void class4() - { - check("struct ABC;\n" - "class Fred\n" - "{\n" - "private:\n" - " void addAbc(ABC *abc);\n" - "public:\n" - " void click();\n" - "};\n" - "\n" - "void Fred::addAbc(ABC* abc)\n" - "{\n" - " AbcPosts->Add(abc);\n" - "}\n" - "\n" - "void Fred::click()\n" - "{\n" - " ABC *p = new ABC;\n" - " addAbc( p );\n" - "}\n"); - ASSERT_EQUALS("", errout.str()); - } - - void class5() - { - check("class Fred\n" - "{\n" - "public:\n" - " void foo();\n" - "};\n" - "\n" - "void Fred::foo()\n" - "{\n" - " char *str = new char[100];\n" - "}\n"); - ASSERT_EQUALS("[test.cpp:10]: (error) Memory leak: str\n", errout.str()); - } - - void class6() - { - check("class Fred\n" - "{\n" - "public:\n" - " void foo();\n" - "};\n" - "\n" - "void Fred::foo()\n" - "{\n" - " char *str = new char[100];\n" - " delete [] str;\n" - " hello();\n" - "}\n"); - ASSERT_EQUALS("", errout.str()); - } - - void class7() - { - check("class Fred\n" - "{\n" - "public:\n" - " int *i;\n" - " Fred();\n" - " ~Fred();\n" - "};\n" - "\n" - "Fred::Fred()\n" - "{\n" - " this->i = new int;\n" - "}\n" - "Fred::~Fred()\n" - "{\n" - " delete this->i;\n" - "}\n", true); - ASSERT_EQUALS("", errout.str()); - } - - void class8() - { - check("class A\n" - "{\n" - "public:\n" - " void a();\n" - " void doNothing() { }\n" - "};\n" - "\n" - "void A::a()\n" - "{\n" - " int* c = new int(1);\n" - " delete c;\n" - " doNothing(c);\n" - "}\n"); - ASSERT_EQUALS("", errout.str()); - } - - void class9() - { - check("class A\n" - "{\n" - "public:\n" - " int * p;\n" - " A();\n" - " ~A();\n" - "};\n" - "\n" - "A::A()\n" - "{ p = new int; }\n" - "\n" - "A::~A()\n" - "{ delete (p); }\n", true); - ASSERT_EQUALS("", errout.str()); - } - - void class10() - { - check("class A\n" - "{\n" - "public:\n" - " int * p;\n" - " A() { p = new int; }\n" - "};\n", true); - ASSERT_EQUALS("[test.cpp:4]: (all) Memory leak: A::p\n", errout.str()); - } - - void class11() - { - check("class A\n" - "{\n" - "public:\n" - " int * p;\n" - " A();\n" - "};\n" - "A::A() : p(new int[10])\n" - "{ }", true); - ASSERT_EQUALS("[test.cpp:4]: (all) Memory leak: A::p\n", errout.str()); - } - - - - void throw1() { @@ -2103,8 +1860,8 @@ private: settings.autoDealloc(istr); } - CheckMemoryLeak checkMemoryLeak(&tokenizer, &settings, this); - checkMemoryLeak.CheckMemoryLeak_InFunction(); + CheckMemoryLeakInFunction checkMemoryLeak(&tokenizer, &settings, this); + checkMemoryLeak.check(); } @@ -2147,37 +1904,6 @@ private: ASSERT_EQUALS("", errout.str()); } - void free_member_in_sub_func() - { - check("class Tokenizer\n" - "{\n" - "public:\n" - " Tokenizer();\n" - " ~Tokenizer();\n" - "\n" - "private:\n" - " int *_tokens;\n" - " static void deleteTokens(int *tok);\n" - "};\n" - "\n" - "Tokenizer::Tokenizer()\n" - "{\n" - " _tokens = new int;\n" - "}\n" - "\n" - "Tokenizer::~Tokenizer()\n" - "{\n" - " deleteTokens(_tokens);\n" - " _tokens = 0;\n" - "}\n" - "\n" - "void Tokenizer::deleteTokens(int *tok)\n" - "{\n" - " delete tok;\n" - "}\n", true); - TODO_ASSERT_EQUALS("", errout.str()); - } - void if_with_and() { check("void f()\n" @@ -2438,6 +2164,311 @@ private: } }; -REGISTER_TEST(TestMemleak) +static TestMemleakInFunction testMemleakInFunction; + + + + + + + + + + + + + + +class TestMemleakInClass : public TestFixture +{ +public: + TestMemleakInClass() : TestFixture("TestMemleakInClass") + { } + +private: + void check(const char code[], bool showAll = false) + { + // Tokenize.. + Tokenizer tokenizer; + std::istringstream istr(code); + tokenizer.tokenize(istr, "test.cpp"); + tokenizer.setVarId(); + tokenizer.simplifyTokenList(); + + // Clear the error buffer.. + errout.str(""); + + // Check for memory leaks.. + Settings settings; + settings._debug = true; + settings._showAll = showAll; + tokenizer.fillFunctionList(); + CheckMemoryLeakInClass checkMemoryLeak(&tokenizer, &settings, this); + checkMemoryLeak.check(); + } + + void run() + { + TEST_CASE(class1); + TEST_CASE(class2); + TEST_CASE(class3); + TEST_CASE(class4); + TEST_CASE(class6); + TEST_CASE(class7); + TEST_CASE(class8); + TEST_CASE(class9); + TEST_CASE(class10); + TEST_CASE(class11); + + TEST_CASE(free_member_in_sub_func); + } + + + void class1() + { + check("class Fred\n" + "{\n" + "private:\n" + " char *str1;\n" + " char *str2;\n" + "public:\n" + " Fred();\n" + " ~Fred();\n" + "};\n" + "\n" + "Fred::Fred()\n" + "{\n" + " str1 = new char[10];\n" + " str2 = new char[10];\n" + "}\n" + "\n" + "Fred::~Fred()\n" + "{\n" + " delete [] str2;\n" + "}\n", true); + + ASSERT_EQUALS("[test.cpp:4]: (all) Memory leak: Fred::str1\n", errout.str()); + } + + + void class2() + { + check("class Fred\n" + "{\n" + "private:\n" + " char *str1;\n" + "public:\n" + " Fred();\n" + " ~Fred();\n" + "};\n" + "\n" + "Fred::Fred()\n" + "{\n" + " str1 = new char[10];\n" + "}\n" + "\n" + "Fred::~Fred()\n" + "{\n" + " free(str1);\n" + "}\n", true); + + ASSERT_EQUALS("[test.cpp:17]: (error) Mismatching allocation and deallocation: Fred::str1\n", errout.str()); + } + + void class3() + { + check("class Token;\n" + "\n" + "class Tokenizer\n" + "{\n" + "private:\n" + " Token *_tokens;\n" + "\n" + "public:\n" + " Tokenizer();\n" + " ~Tokenizer();\n" + " void deleteTokens(Token *tok);\n" + "};\n" + "\n" + "Tokenizer::Tokenizer()\n" + "{\n" + " _tokens = new Token;\n" + "}\n" + "\n" + "Tokenizer::~Tokenizer()\n" + "{\n" + " deleteTokens(_tokens);\n" + "}\n" + "\n" + "void Tokenizer::deleteTokens(Token *tok)\n" + "{\n" + " while (tok)\n" + " {\n" + " Token *next = tok->next();\n" + " delete tok;\n" + " tok = next;\n" + " }\n" + "}\n", true); + + TODO_ASSERT_EQUALS("", errout.str()); + } + + void class4() + { + check("struct ABC;\n" + "class Fred\n" + "{\n" + "private:\n" + " void addAbc(ABC *abc);\n" + "public:\n" + " void click();\n" + "};\n" + "\n" + "void Fred::addAbc(ABC* abc)\n" + "{\n" + " AbcPosts->Add(abc);\n" + "}\n" + "\n" + "void Fred::click()\n" + "{\n" + " ABC *p = new ABC;\n" + " addAbc( p );\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } + + void class6() + { + check("class Fred\n" + "{\n" + "public:\n" + " void foo();\n" + "};\n" + "\n" + "void Fred::foo()\n" + "{\n" + " char *str = new char[100];\n" + " delete [] str;\n" + " hello();\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } + + void class7() + { + check("class Fred\n" + "{\n" + "public:\n" + " int *i;\n" + " Fred();\n" + " ~Fred();\n" + "};\n" + "\n" + "Fred::Fred()\n" + "{\n" + " this->i = new int;\n" + "}\n" + "Fred::~Fred()\n" + "{\n" + " delete this->i;\n" + "}\n", true); + ASSERT_EQUALS("", errout.str()); + } + + void class8() + { + check("class A\n" + "{\n" + "public:\n" + " void a();\n" + " void doNothing() { }\n" + "};\n" + "\n" + "void A::a()\n" + "{\n" + " int* c = new int(1);\n" + " delete c;\n" + " doNothing(c);\n" + "}\n"); + ASSERT_EQUALS("", errout.str()); + } + + void class9() + { + check("class A\n" + "{\n" + "public:\n" + " int * p;\n" + " A();\n" + " ~A();\n" + "};\n" + "\n" + "A::A()\n" + "{ p = new int; }\n" + "\n" + "A::~A()\n" + "{ delete (p); }\n", true); + ASSERT_EQUALS("", errout.str()); + } + + void class10() + { + check("class A\n" + "{\n" + "public:\n" + " int * p;\n" + " A() { p = new int; }\n" + "};\n", true); + ASSERT_EQUALS("[test.cpp:4]: (all) Memory leak: A::p\n", errout.str()); + } + + void class11() + { + check("class A\n" + "{\n" + "public:\n" + " int * p;\n" + " A();\n" + "};\n" + "A::A() : p(new int[10])\n" + "{ }", true); + ASSERT_EQUALS("[test.cpp:4]: (all) Memory leak: A::p\n", errout.str()); + } + + + void free_member_in_sub_func() + { + check("class Tokenizer\n" + "{\n" + "public:\n" + " Tokenizer();\n" + " ~Tokenizer();\n" + "\n" + "private:\n" + " int *_tokens;\n" + " static void deleteTokens(int *tok);\n" + "};\n" + "\n" + "Tokenizer::Tokenizer()\n" + "{\n" + " _tokens = new int;\n" + "}\n" + "\n" + "Tokenizer::~Tokenizer()\n" + "{\n" + " deleteTokens(_tokens);\n" + " _tokens = 0;\n" + "}\n" + "\n" + "void Tokenizer::deleteTokens(int *tok)\n" + "{\n" + " delete tok;\n" + "}\n", true); + TODO_ASSERT_EQUALS("", errout.str()); + } +}; + +static TestMemleakInClass testMemleakInClass; + From a3bf63524949d43458be086e6b633015da3bedb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 8 Jun 2009 20:54:49 +0200 Subject: [PATCH 40/41] Doxygen: Added a few simple doxygen comments for the leaks checking --- src/checkmemoryleak.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/checkmemoryleak.h b/src/checkmemoryleak.h index e392d533f..2e5fffae5 100644 --- a/src/checkmemoryleak.h +++ b/src/checkmemoryleak.h @@ -23,7 +23,13 @@ #define checkmemoryleakH //--------------------------------------------------------------------------- -/** \brief Check for memory leaks */ +/** + * Check for memory leaks + * + * The checking is split up into two specialized classes. + * CheckMemoryLeakInFunction can detect when a function variable is allocated but not deallocated properly. + * CheckMemoryLeakInClass can detect when a class variable is allocated but not deallocated properly. + */ #include "check.h" @@ -66,7 +72,15 @@ protected: - +/** + * Check function variables. + * + * The checking is done by looking at each function variable separately. By repeating these 4 steps over and over: + * 1. locate a function variable + * 2. create a simple token list that describes the usage of the function variable. + * 3. simplify the token list. + * 4. finally, check if the simplified token list contain any leaks. + */ class CheckMemoryLeakInFunction : public CheckMemoryLeak, public Check { @@ -142,6 +156,10 @@ private: +/** + * Check class variables + * variables that are allocated in the constructor should be deallocated in the destructor + */ class CheckMemoryLeakInClass : public CheckMemoryLeak, public Check { From 54d861f99e9c6746451a0dddc7b17511202882c8 Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Tue, 9 Jun 2009 00:15:29 +0300 Subject: [PATCH 41/41] GUI: Add readme file with instructions for running and compiling the GUI. --- gui/readme.txt | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 gui/readme.txt diff --git a/gui/readme.txt b/gui/readme.txt new file mode 100644 index 000000000..5e1b9caf4 --- /dev/null +++ b/gui/readme.txt @@ -0,0 +1,38 @@ +cppcheck GUI +============ +This is a GUI for cppcheck. It allows selecting folder or set of files to check +with cppcheck and shows list of found errors. + +Running +------- +You need QT4 libraries installed in your system. Packages/files to install +depends on your operating system: +- Windows download QT4 from http://www.qtsoftware.com +- Linux install QT4 using your package manager, look for packages having QT4 + in their name, e.g. for Ubuntu install libqt4-core and libqt4-gui + +Compiling +--------- +Windows: +- The easy way is to download Qt SDK from http://www.qtsoftware.com and use + Qt Creator and/or command line tools to build the GUI. +- The harder way is to download QT sources and build QT with Visual Studio + (Express Edition works). Compiling QT alone may take over 4 hours! + +Linux: +- Install QT development packages (make sure qmake -tool gets installed!). The + names depend on distribution, but e.g. for Ubuntu the needed packages are: + * libqt4-core + * libqt4-gui + * libqt4-dev + * qt4-dev-tools + * qt4-qmake + +After you have needed libraries and tools installed, open command +prompt/console, go to gui directory and run command: +- qmake (in Linux and in Windows if build with MinGW/gcc) +- qmake -tp vc (In Windows if build with Visual Studio) + +These commands generate makefiles to actually build the software. After that +the actual building is done in IDE or command line as usual. Note that you +don't need to run qmake again unless you add/remove files from the project.