Commit Graph

288 Commits

Author SHA1 Message Date
seb777 f1782799cb run astyle 2011-06-20 23:06:18 +02:00
seb777 172903cde4 fix 2846 (false positive for auto_ptr check with container element) 2011-06-20 23:02:05 +02:00
seb777 20de3f90ef fix 2838 (Token::Match called with varid 0 on auto_ptr check) cleanup code and better check varid 2011-06-17 21:09:27 +02:00
seb777 5b940c0c7f fix #747 and #748 (incorrect use of auto_ptr - new check) 2011-06-16 20:26:00 +02:00
Daniel Marjamäki 1c841535ee Fixed #2798 (False positive: Invalid iterator check doesn't respect code paths) 2011-05-22 17:17:24 +02:00
Daniel Marjamäki 9e97da8a57 Reverted fix for string::size. Ticket: #2756 2011-05-05 20:57:17 +02:00
Robert Reif a2938b7212 fix 2011-04-28 19:08:18 -04:00
Robert Reif 1aca09a8bf add support for checking struct/class member container in CheckStl::size() 2011-03-28 19:31:23 -04:00
Daniel Marjamäki 6bd56dbe20 Fixed #2643 (False positive: iterator increment and insert) 2011-03-12 20:29:54 +01:00
Robert Reif e305a155af convert CheckStl::size() to use symbol database, fix false positives, and remove inconclusive 2011-03-07 19:49:43 -05:00
Pete Johns 098f0bf3e6 Fixed #2526 (Make TODO_ASSERT_EQUALS take three arguments (value, to_be, as_is)?...
Removed replaced EXPECTED with...

WANTED (to-be):     The future expected value.
CURRENT (as-is):    Documenting how cppcheck behaves now.

This removes the need for an ASSERT_EQUALS but enforces the check for every TODO_ASSERT_EQUALS.
2011-01-30 23:20:11 +11:00
Daniel Marjamäki 87e3e9e703 Fixed #2488 (false positive with updating iterator in a for loop) 2011-01-20 20:48:35 +01:00
Daniel Marjamäki a21f8eec7c Fixed #2481 (false positive with break: After insert, the iterator '*' may be invalid) 2011-01-20 19:26:52 +01:00
Daniel Marjamäki 70eadb37bd Fixed #2481 (false positive with 'break;': After insert, the iterator '*' may be invalid) 2011-01-19 21:00:46 +01:00
Daniel Marjamäki 00b49a51da Fixed #2451 (False positive when incrementing map value via iterator) 2011-01-14 19:50:07 +01:00
Daniel Marjamäki b247d7d56e Fixed #2450 (False positive when iterator reused) 2011-01-13 20:57:44 +01:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Daniel Marjamäki 68de938d23 Uninitialized variables. Fixed false positive when there are multiple related conditions. ticket: #2399 2011-01-05 19:54:56 +01:00
Kimmo Varis bb719774b1 Improve suspicious condition (string::find) message.
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2011-01-04 23:19:23 +02:00
Kimmo Varis 66e8b7bc1e Improve dangerous iterator usage (after erase()) message.
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2011-01-04 23:18:48 +02:00
Kimmo Varis f5f2a2ce2a Improve message for container type range check.
See thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192&start=0
2010-12-26 23:44:02 +02:00
Daniel Marjamäki 335d164cdf Fixed #2356 (False positive reported with iterator deletion) 2010-12-24 10:33:48 +01:00
Kimmo Varis d14b5039ce Improve 'Use x.empty() instead of x.size() for emptiness' warning.
Improve the performance warning message as discussed at dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192#p926
2010-12-04 10:15:48 +02:00
Robert Reif f12c0c7ada Tokenizer: add assert(_settings) to Tokenizer to insure the tokenizer always has settings. Ticket: #2219 2010-12-01 18:00:55 +01:00
Kimmo Varis f467e3120e Improve redundant STL container condition -message.
Have separate summary and verbose messages. Se discusion at forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-11-29 20:24:08 +02:00
Kimmo Varis 2ed14431fe Ticket #2237 (Too long "short" message about iterator increment)
Improve the message for suspicious iterator increment in loop.
2010-11-27 10:57:26 +02:00
Daniel Marjamäki 7b630cc581 Fixed #2154 (false positive: The loop might unintentionally skip an element in the container) 2010-10-30 11:22:30 +02:00
Daniel Marjamäki 20674e08d0 Stl: improved check for dangerous usage of c_str 2010-10-19 20:21:58 +02:00
Daniel Marjamäki 0864a0700a Fixed #2108 (False positive: the loop might unintentionally skip an element in the container.) 2010-10-18 20:05:54 +02:00
Daniel Marjamäki e54129fa8d STL: check for dangerous usage of string::c_str(). Ticket: #1116 2010-10-17 19:18:46 +02:00
Daniel Marjamäki 92a1e9e76e Severities: Added 'warning' and 'performance' severities. No changes to the command line options nor to the XML format. Ticket: #2106 2010-10-17 14:41:00 +02:00
Daniel Marjamäki 0b6948a805 Fixed #2101 (list in vector iterator usage) 2010-10-15 18:11:41 +02:00
Daniel Marjamäki 81aed3fbd7 Tokenize: Fixed bug in Tokenize::simplifyKnownVariables 2010-10-10 19:27:42 +02:00
Daniel Marjamäki f427fdb856 STL: Added TODO test case for the new double-increment check 2010-10-10 17:55:14 +02:00
Daniel Marjamäki ef4ce6f46b STL: fixed false positives in the new double-increment check when iterator shadows outer iterator 2010-10-10 14:28:14 +02:00
Daniel Marjamäki ae0528ef59 STL: fixed false positives for the new double-increment check 2010-10-10 11:22:44 +02:00
Daniel Marjamäki 835b511bee STL: Added double-increment check. 2010-10-10 10:52:41 +02:00
Daniel Marjamäki 068317bed1 STL: Fixed TODO test case TestStl::erase5 2010-10-09 07:15:34 +02:00
Daniel Marjamäki f2ba1c6171 Unit testing: Added TODO test case TestStl::erase5 2010-10-08 21:52:18 +02:00
Daniel Marjamäki 50603f44eb Unit testing: activated TODO test 2010-10-08 21:41:52 +02:00
Daniel Marjamäki 7b4e08385d STL: refactoring CheckStl::erase so ExecutionPath is used 2010-10-05 20:54:13 +02:00
Daniel Marjamäki e2ef26cb2e STL: added TODO test case 2010-09-18 20:08:34 +02:00
Daniel Marjamäki 395f10aa6d Fixed #2053 (false positive on list erase) 2010-09-18 16:46:38 +02:00
Daniel Marjamäki f843678a07 Redundant conditions: some refactorings
* removed the 'redundant null pointer' check. sometimes it's unsafe to delete NULL pointer. and this check doesn't point out errors anyway.
 * moved the 'redundant condition' check for set::remove. Moved it to CheckStl.
2010-09-16 18:49:23 +02:00
Daniel Marjamäki 1faaa5471c Fixed #1946 ('Dereferenced iterator erased' false positive) 2010-08-17 18:56:11 +02:00
Erik Lax 032d2678aa Fixed #1930 (false negative: bad iterators checks fails to detect bugs with preincrement) 2010-08-13 20:54:31 +02:00
Daniel Marjamäki a1ce80806e Fixed #1844 (False positive: invalid iterator when erase() is used in if-else (with continue)) 2010-07-14 09:42:10 +02:00
Daniel Marjamäki 2531bb73d7 Fixed #1834 (False positive: invalid iterator when erase() is used in if-else) 2010-07-09 10:50:24 +02:00
Daniel Marjamäki dc12a9b3b5 Fixed #1545 (new check: usage of iterator pointing to invalid memory after reserve) 2010-06-15 19:53:09 +02:00
Daniel Marjamäki 6edb2e77b4 Refactoring: Removed Severity::possibleStyle 2010-05-16 14:43:42 +02:00
Erik Lax c0149d3cd1 Fixed #1679 (Bad iterators checks fails to detect bugs with indent levels) 2010-05-15 20:00:41 +02:00
Erik Lax 0510d9a2b0 Fixed #1680 (Bad iterators checks fail to detect invalidation of iterator for deletion by value) 2010-05-15 19:46:42 +02:00
Daniel Marjamäki 8971d697b2 Fixed #1656 (dangerous usage of erase not detected: for (; it != it2; ++it) ints.erase(it);) 2010-05-08 20:11:15 +02:00
Daniel Marjamäki 136b84eaf5 STL: added testcase for 'if (str.find(%any%)) ..' 2010-05-01 21:56:39 +02:00
Daniel Marjamäki 9cd8bd842e STL: fixed false negative when erasing invalidated iterator 2010-04-17 13:37:04 +02:00
Daniel Marjamäki e417d3080a Unit Testing: Added assert for todo testcase to catch changes. 2010-04-17 12:49:27 +02:00
Daniel Marjamäki c0e9a546f7 Refactoring: Refactoring the Settings class 2010-04-17 09:23:54 +02:00
Daniel Marjamäki c9fb5f87e0 Fixed #1600 (false positive: After insert, the iterator 'aI' may be invalid) 2010-04-16 16:56:55 +02:00
Daniel Marjamäki c718a7c595 astyle: Update to astyle 1.24 2010-04-15 20:08:51 +02:00
Reijo Tomperi 35d2a27b9c Update copyright year in all source files 2010-04-13 22:23:17 +03:00
Daniel Marjamäki e9b4ea44a2 Refactoring: Disable inconclusive checks. They can still be activated for debugging/testing purposes 2010-04-10 14:05:33 +02:00
Daniel Marjamäki 7763d25847 Fixed #1357 (problem in stl insert method of set template) 2010-04-10 10:22:34 +02:00
Daniel Marjamäki 6acb304ef2 Cleanup: Removed unfinnished checking of std::find 2010-04-03 15:33:13 +02:00
Daniel Marjamäki 0cad22314e Reverted 'astyle fix'. Those changes are not in sync with my astyle configuration/setup. 2010-04-02 07:30:58 +02:00
Martin Ettl 193aa7d1d3 astyle fix 2010-04-02 02:21:53 +02:00
Daniel Marjamäki e207da18a2 STL: don't warn about the suspicious string::find condition because it's not always a bug 2010-03-03 17:11:31 +01:00
Daniel Marjamäki 4407aabe55 STL: suspicious condition when using std::find 2010-02-28 07:04:58 +01:00
Daniel Marjamäki 69d6453ea8 STL: suspicious conditions when using find. Added ok testcases and assert that no error message is written 2010-02-27 21:35:33 +01:00
Daniel Marjamäki 4de700c9de STL: suspicious condition when using find on strings and containers 2010-02-27 21:26:11 +01:00
Daniel Marjamäki 18e7813e04 Fixed #1373 (###### If you see this, there is a bug ######) 2010-02-09 18:11:06 +01:00
Daniel Marjamäki db0466eb19 Fixed #1278 (Confusing style message formatting) 2010-01-26 19:37:22 +01:00
Reijo Tomperi 7817d5b142 Fix #1279 (Change error message: Invalid number of character ({). Can't process file.)
http://sourceforge.net/apps/trac/cppcheck/ticket/1279
2010-01-23 23:18:11 +02:00
Daniel Marjamäki 4d7ac2f82e STL: fixed false positive when using erase 2010-01-23 22:03:38 +01:00
Daniel Marjamäki 61e61c1584 Robert Reif: Fixed #1158 ((possible style) message with regular check) 2009-12-28 18:06:26 +01:00
Daniel Marjamäki 72bf1c1dbe Fixed #1095 (Non-obvious error message: Dangerous usage of erase) 2009-12-21 20:49:16 +01:00
Daniel Marjamäki 95f652a2b4 robert reif: Fixed #1118 (new check: use empty() instead of checking size() against zero) 2009-12-19 15:24:59 +01:00
Daniel Marjamäki 69a98d81fc Fixed #1107 (False positive: Dangerous usage of erase, when using std::list) 2009-12-18 20:55:51 +01:00
Daniel Marjamäki b470ea06b8 Fixed #931 (Invalid interator false positive with identical variable names) 2009-11-10 19:07:04 +01:00
Daniel Marjamäki 51f983629b Fixed #932 (false positive: Dereferenced iterator 'i' has been erased) 2009-11-10 17:20:20 +01:00
Reijo Tomperi 00b62442b6 Fix #894 (Invalid line number in "Invalid number of character")
http://sourceforge.net/apps/trac/cppcheck/ticket/894
2009-11-03 22:21:28 +02:00
Daniel Marjamäki 87800185c4 STL: refactoring and fixing 2009-11-02 21:53:01 +01:00
Daniel Marjamäki 89d94895a4 Refactoring 2009-11-02 21:17:33 +01:00
Daniel Marjamäki bc3b12db72 astyle formatting 2009-11-02 20:25:08 +01:00
Daniel Marjamäki df3ffa2eda STL: added check for dangerous usage of std::find (#829) 2009-11-02 20:24:38 +01:00
Daniel Marjamäki 395ce30d81 Fixed #877 (False positive: After insert, iterator may be invalid) 2009-10-31 15:27:33 +01:00
Daniel Marjamäki 09859c1019 refactoring the folder structure 2009-10-25 12:49:06 +01:00
Daniel Marjamäki 0e56e4cd37 STL: checking that containers are matching 2009-10-18 18:42:01 +02:00
Daniel Marjamäki ffbf8e38ac stl: after vector::insert, iterators may become invalid 2009-10-15 21:29:56 +02:00
Daniel Marjamäki a33b4744a3 stl: better checking for invalid iterator after push_back 2009-10-13 20:55:33 +02:00
Reijo Tomperi 014ad937cf Optimize speed and fix one false positive with stl checks. 2009-10-07 23:38:21 +03:00
Reijo Tomperi fdde2182b9 Fix GPL comments in all files. ">." was missing from the end. 2009-09-27 18:08:31 +03:00
Slava Semushin 7e2208b5cc Detects invalid iterator inside for() when postfix form of increment used. 2009-09-27 15:10:21 +07:00
Slava Semushin 5285635354 Fixed #735 (Detects invalid iterator after push_back() when iterator declared inside for())
http://sourceforge.net/apps/trac/cppcheck/ticket/735
2009-09-27 14:59:19 +07:00
Daniel Marjamäki 0b3a139b3b Fixed #710 (False positive: invalid vector iterator after push_back) 2009-09-26 11:49:09 +02:00
Slava Semushin eebe7457c9 Fixed #631 (False positive matching iterator which is dereferenced)
http://sourceforge.net/apps/trac/cppcheck/ticket/631
2009-09-01 23:49:17 +07:00
Slava Semushin 5f3baba178 Fixed ticket #573 (False positive of set range check when we dereferencing iterator)
http://sourceforge.net/apps/trac/cppcheck/ticket/573
2009-08-09 02:07:33 +07:00
Daniel Marjamäki a0a4008e17 Fixed #525 (false positive: vector range checking with <) 2009-08-07 16:23:28 +02:00
Slava Semushin 347802f819 Fixed ticket #503 (Dereferencing after erase() not work if we try to get access to member)
http://sourceforge.net/apps/trac/cppcheck/ticket/503
2009-07-31 00:49:38 +07:00
Slava Semushin 367efe31ea Fixed ticket #524 (Containers range check shouldn't stop at first founded error)
http://sourceforge.net/apps/trac/cppcheck/ticket/524
2009-07-29 03:55:23 +07:00
booga 9fa8c0ee9c astyle FTW (should have read about that sooner) 2009-07-24 19:23:30 -04:00
booga 52e2e775b2 Fix #476 STL Container checks.
Fix #473 Add post increment check for STL objects and Classes.
2009-07-24 18:36:15 -04:00
Slava Semushin aab06eaeab Fixed ticket #477 (Bug in Token::Match() during process TestStl::pushback3)
http://sourceforge.net/apps/trac/cppcheck/ticket/477
2009-07-18 17:06:51 +07:00
Daniel Marjamäki 456c20b705 fixed todo test case - detect iterator usage after push_front|push_back 2009-07-14 12:40:47 +02:00
Daniel Marjamäki 17008879ac minor refactoring: header cleanup. use forward declarations instead of includes 2009-07-13 19:11:31 +02:00
Slava Semushin 52a8368b02 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 07:43:55 +07:00
Slava Semushin e5c0383594 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-06-01 02:50:25 +07:00
Reijo Tomperi 58eda6e978 Fix ticket #325 (Replace developer names in source files with AUTHORS file)
http://apps.sourceforge.net/trac/cppcheck/ticket/325
2009-05-30 08:48:12 +03:00
Daniel Marjamäki 2e61201c18 STL: It is ok to compare vector iterators with <
https://apps.sourceforge.net/trac/cppcheck/ticket/313
2009-05-17 18:58:32 +02:00
Reijo Tomperi e83db8ac7b Fix ticket #288 (Tokenizer::syntaxError should use error logger instead of std::cout)
http://apps.sourceforge.net/trac/cppcheck/ticket/288
2009-05-11 22:52:04 +03:00
Reijo Tomperi dd8b738f7f 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 23:17:29 +03:00
Daniel Marjamäki 80fe293c19 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 21:55:04 +02:00
Daniel Marjamäki 3819c66f36 stl: Fixed ticket #277 - dereferencing an iterator that has been erased 2009-05-03 07:37:39 +02:00
Daniel Marjamäki 0dacb4b1ca stl: added a ticket for the todo test case TestStl::eraseDereference 2009-05-02 21:35:35 +02:00
Daniel Marjamäki 50567c164f stl: added todo test case, invalid iterator after insert 2009-05-02 20:49:58 +02:00
Daniel Marjamäki b46777235d stl: added todo test case, erasing invalid iterator 2009-05-02 20:39:51 +02:00
Daniel Marjamäki e11449bd58 stl: added test case, dereferencing an iterator that has been erased 2009-05-02 19:58:57 +02:00
Daniel Marjamäki ad4c7993d1 stl: checking that iterator is used against a single container 2009-04-29 20:16:04 +02:00
Daniel Marjamäki 2a200cff00 stl: added todo test case about using same iterator with different containers 2009-04-29 17:32:38 +02:00
Daniel Marjamäki b90fdfed1d changed todo comment to TODO_ASSERT_EQUALS 2009-04-28 21:44:31 +02:00
Daniel Marjamäki f9795988eb checkstl: Check for invalid pointer to vector element 2009-04-28 21:18:02 +02:00
Daniel Marjamäki ebd15cec0f push_back: updated the checking of push_back (#263) 2009-04-25 17:14:02 +02:00
Daniel Marjamäki ef54e446db push_back: added a few todo test cases for the checking of push_back 2009-04-25 16:32:37 +02:00
Daniel Marjamäki 7750f327ff STL boundries: added new check written by Bill Eggert (#247) 2009-04-13 17:48:13 +02:00
Reijo Tomperi 1f53fb7149 Fix ticket #248 (STL erase check broken?)
http://apps.sourceforge.net/trac/cppcheck/ticket/248
2009-04-10 14:27:36 +03:00
Daniel Marjamäki aee39ae929 refactoring - handling the stlOutOfBounds error message the new way 2009-03-21 14:20:10 +01:00
Daniel Marjamäki bcad5afb26 refactoring - fixed the unit tests 2009-03-21 14:02:58 +01:00
Daniel Marjamäki 3fab99a5cb astyle formatting 2009-03-19 19:35:47 +01:00
Daniel Marjamäki 75171cae08 refactoring: fixed the teststl so it is runnable again 2009-03-19 19:35:08 +01:00
Daniel Marjamäki a573c62cd5 refactoring: first step - started with checkstl 2009-03-18 22:40:38 +01:00
Daniel Marjamäki 128215d692 Added test case for detecting false positive in the STL size handling 2009-03-17 18:54:50 +01:00
Reijo Tomperi 6fcb89f136 Fix segmentation fault that happens with invalid code. 2009-03-05 23:22:00 +02:00
Reijo Tomperi fc8f47145a Copyrights updated 2009-03-01 19:52:33 +00:00
Daniel Marjamäki 2b04c94b95 stl push_back: Added check (invalid iterator) 2009-02-18 19:57:43 +00:00
Daniel Marjamäki f4a3119c18 stl dangerous usage of erase: Added test cases about using return and goto 2009-02-11 16:20:32 +00:00
Daniel Marjamäki eda1290e40 dangerous usage of erase: added check 2009-02-11 05:08:29 +00:00
Daniel Marjamäki 71b4e5a912 stl: added testcase for bad iterator usage 2009-02-10 20:01:39 +00:00
Reijo Tomperi 4660b7648d Moved stloutofbounds check to CheckStl class. 2009-02-10 19:56:00 +00:00
Daniel Marjamäki c1638996f9 STL: added check for iterator usage 2009-02-10 19:40:21 +00:00