Commit Graph

259 Commits

Author SHA1 Message Date
Alexander Mai 9876cf2312 #6626 crash: Token::astOperand2() const ( do while ). Fix two segmentation faults on invalid code. 2015-04-06 17:23:48 +02:00
Matthias Krüger 22d97fdbd6 don't print style message if --enable=style is not specified.
message was of type:
(style) Redundant checking of STL container element existence before removing it.
2015-04-06 14:26:15 +02:00
Simon Martin 2587ebf189 Restore build on Mac OS X on which we're force to use GNU's STL, that does not have cend()... 2015-03-19 20:25:57 +01:00
Jakub Melka a49efb13f6 Added auto_ptr checking for malloc 2015-03-19 06:41:54 +01:00
PKEuS b2835051df Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0. 2015-01-31 12:32:04 +01:00
PKEuS 432ff8fa7b Fixed GCC warnings in checkstl.cpp 2015-01-04 14:32:20 +01:00
PKEuS e06a4cdf00 Refactorized CheckStl::if_find():
- Added support for find()-like functions to Library::Container
- Use <container> information from library
- Fixed false positive #6402
2015-01-04 12:43:50 +01:00
PKEuS 11fa185cae Fixed crash on range-based for-loop 2015-01-03 22:36:39 +01:00
PKEuS 7ece58c3a0 CheckStl::stlOutOfBounds() now uses <container> information from Libraries 2015-01-03 22:18:33 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
PKEuS 1355f49af7 Fixed false positive: Support assignments in CheckStl::if_find() 2015-01-03 11:29:13 +01:00
PKEuS 8885ac3eba Fixed #6217, refactorized CheckStl::if_find(): allow all comparison operators, use AST, fixed wrong unit tests 2015-01-03 11:07:11 +01:00
Thomas Jarosch 69b31a0743 Fix up extra whitespaces in match patterns
Detected by new internal check.
2014-12-30 14:53:43 +01:00
PKEuS 8b59c39c42 Refactorization: Removed whitespaces at the end of Token::Match patterns 2014-12-27 11:09:54 +01:00
Dmitry-Me 298021af1f Remove redundant variable and manipulation thereof 2014-11-22 12:17:49 +01:00
Daniel Marjamäki 051d42ae6b astyle formatting 2014-11-20 14:20:09 +01:00
orbitcowboy f5d804f71a running astyle 2014-11-20 10:13:03 +01:00
Alexander Mai 85c02df56c Fix compiler warning. run astyle 2014-11-18 19:36:47 +01:00
Dmitry-Me 34bd612ea9 Omit unneeded operations 2014-11-18 16:35:36 +03:00
PKEuS bb8c8d53cc Support do-loops in CheckStl::stlOutOfBounds() 2014-10-02 20:38:55 +02:00
PKEuS e8f7279039 Refactorization: Moved detection of STL strings to SymbolDatabase 2014-09-05 12:03:08 +02:00
Daniel Marjamäki 2dc3945017 astyle formatting 2014-08-27 17:27:14 +02:00
Dmitry-Me 44ba0ca347 Continue early to omit unneeded operations 2014-08-27 11:32:14 +04:00
Dmitry-Me 93b5b28c3d Continue early to omit unneeded actions 2014-08-19 07:58:45 +04:00
PKEuS 865df4e207 Fixed false negative #4306: Detect loop access of empty STL container 2014-08-09 10:06:44 +02:00
Dmitry-Me 644d83e91b Resolve CID 1037105 2014-08-06 10:05:32 +04:00
Daniel Marjamäki eac337b955 Fixed Cppcheck warning about 'null pointer dereference or redundant condition' 2014-08-04 15:15:41 +02:00
Dmitry-Me 431453f53e Reuse previously computed values, use more const. 2014-07-25 15:05:13 +04:00
Dmitry-Me 07c120f1af Cache option flags and check them first. 2014-07-23 17:06:27 +04:00
Daniel Marjamäki d40b77dce2 Removed special 'else if' handling. this is redundant since these are simplified. 2014-07-02 16:16:19 +02:00
Alexander Mai b6a40fceb7 Fix some compiler warnings 2014-06-26 20:34:07 +02:00
amai2012 c61d2b9f41 #5926 Dangerous iterator comparison using operator< on 'std::deque'.
std::deque features a random access iterator, so warning stlBoundaries
is a false positive
2014-06-16 20:50:47 +02:00
PKEuS 076f7a7542 Fixed some coverity findings about dead code, fixed a misleading comment 2014-04-14 22:46:51 +02:00
Mark de Wever b4b340b7be Fixed #5677 (Fix overzealous substr() warning) 2014-04-13 19:04:35 +02:00
Philipp Kloke c1c1ded766 Refactorized CheckStl::pushback():
- Use method from CheckNullPointer to find pointer dereference
- Replaced indendation counter by symboldatabase usage
2014-04-12 23:41:58 +02:00
Philipp Kloke ddf34440b6 Refactorization: Replaced several Token::findmatch calls by symboldatabase usage 2014-04-12 23:41:46 +02:00
Philipp Kloke 776ad32a0b Refactorized CheckStl::redundantCondition():
- Use symboldatabase
- Support erase() method
2014-04-12 23:41:46 +02:00
PKEuS 8cb3b13e56 Support "else if" and do-loop in CheckStl::checkDereferenceInvalidIterator() 2014-04-12 20:03:07 +02:00
PKEuS e8ac355b39 Refactorized iterator checking:
- Fixed false positive #5669
- Use symboldatabase in CheckStl::pushback()
- Improved support for erase on std::vector and find
2014-04-12 20:03:07 +02:00
Daniel Marjamäki 59cd1879db Fixed #5467 (False positive incorrectly claiming use after erase) 2014-04-09 10:32:56 +02:00
Alexander Mai e1c565357a Invalid code cause SIGSEGV since loop variable tok2 was not checked properly 2014-03-22 10:32:24 +01:00
PKEuS af161fc361 Rewrote CheckStl::readingEmptyStlContainer(), resolving all its false positives shown on CppChecks own code 2014-03-18 12:38:22 +01:00
Lucas Manuel Rodriguez 47ecdf58b2 Fixed #4804 (Improve check for 'std::string::data()' - identical to 'std::string::c_str()') 2014-03-16 15:04:44 -03:00
Thomas Jarosch 93341f4449 Use simple match where possible
Fixes these warnings found by "--enable=internal":

[lib/checkclass.cpp:972]: (warning) Found simple pattern inside Token::Match() call: "* *"
[lib/checkbufferoverrun.cpp:635]: (warning) Found simple pattern inside Token::Match() call: "."
[lib/checkbufferoverrun.cpp:1397]: (warning) Found simple pattern inside Token::Match() call: ";"
[lib/checksizeof.cpp:299]: (warning) Found simple pattern inside Token::Match() call: "."
[lib/checksizeof.cpp:301]: (warning) Found simple pattern inside Token::Match() call: ")"
[lib/checksizeof.cpp:303]: (warning) Found simple pattern inside Token::Match() call: "]"
[lib/checksizeof.cpp:318]: (warning) Found simple pattern inside Token::Match() call: ")"
[lib/checknullpointer.cpp:413]: (warning) Found simple pattern inside Token::Match() call: "delete"
[lib/checkio.cpp:1336]: (warning) Found simple pattern inside Token::Match() call: "> ("
[lib/checkstl.cpp:1509]: (warning) Found simple pattern inside Token::findmatch() call: ";"
[lib/checkstl.cpp:1512]: (warning) Found simple pattern inside Token::findmatch() call: ";"
[lib/checkstl.cpp:1594]: (warning) Found simple pattern inside Token::Match() call: "="
[lib/checkstl.cpp:1598]: (warning) Found simple pattern inside Token::Match() call: "] ="
[lib/checkunusedvar.cpp:755]: (warning) Found simple pattern inside Token::Match() call: "goto"
[lib/checkunusedvar.cpp:793]: (warning) Found simple pattern inside Token::Match() call: "="
[lib/checkuninitvar.cpp:376]: (warning) Found simple pattern inside Token::Match() call: "> ("
[lib/checkother.cpp:86]: (warning) Found simple pattern inside Token::Match() call: "> ("
[lib/checkother.cpp:2181]: (warning) Found simple pattern inside Token::Match() call: "> {"
[lib/valueflow.cpp:54]: (warning) Found simple pattern inside Token::Match() call: "&"
[lib/valueflow.cpp:409]: (warning) Found simple pattern inside Token::Match() call: "do"
[lib/valueflow.cpp:425]: (warning) Found simple pattern inside Token::Match() call: ") {"
[lib/valueflow.cpp:487]: (warning) Found simple pattern inside Token::Match() call: ") {"
[lib/valueflow.cpp:511]: (warning) Found simple pattern inside Token::Match() call: "} else {"
[lib/valueflow.cpp:615]: (warning) Found simple pattern inside Token::Match() call: "for ("
[lib/symboldatabase.cpp:80]: (warning) Found simple pattern inside Token::Match() call: "= {"
[lib/symboldatabase.cpp:1069]: (warning) Found simple pattern inside Token::Match() call: "std ::"
[lib/tokenize.cpp:2207]: (warning) Found simple pattern inside Token::Match() call: "< >"
[lib/tokenize.cpp:2730]: (warning) Found simple pattern inside Token::Match() call: ";"
[lib/tokenize.cpp:4234]: (warning) Found simple pattern inside Token::Match() call: "try {"
[lib/tokenize.cpp:4235]: (warning) Found simple pattern inside Token::Match() call: "} catch ("
[lib/tokenize.cpp:5500]: (warning) Found simple pattern inside Token::Match() call: "INT8"
[lib/tokenize.cpp:5752]: (warning) Found simple pattern inside Token::Match() call: "}"
[lib/tokenize.cpp:5752]: (warning) Found simple pattern inside Token::Match() call: "do"
2014-03-14 16:27:47 +01:00
Daniel Marjamäki dbfe7e0b6b Fixed cppcheck warnings 2014-03-03 19:00:32 +01:00
Pranav Khanna f8a4fb91fe Fixed #3796 (new check: redundant initialization with empty string) 2014-03-03 18:27:45 +01:00
Lauri Nurmi 70a67eaf85 Change some more 0 literals into nullptr. 2014-02-16 13:38:50 +02:00
Daniel Marjamäki fb5c2d4b48 use nullptr in lib/checkother.cpp 2014-02-15 08:46:28 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Lucas Manuel Rodriguez a34d2eb7b3 Fixed #4938: (.empty() method false positive for non-STL classes) 2014-01-30 18:09:24 -03:00