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
Lucas Manuel Rodriguez
ad0269eeeb
Refactor checks using Variable::isStlType()
2014-01-30 01:26:48 -03:00
Lucas Manuel Rodriguez
7fdc4ab6cc
Refactor isContainerSizeSlow() to use Variable::isStlType()
2014-01-28 13:31:23 -03:00
Daniel Marjamäki
8687e85e56
Fixed #4850 (False positive: invalidIterator1 detected when iterator container is member of some struct)
2013-10-26 17:48:20 +02:00
Steve Duan
cf0c666d79
Fixed #5041 (Improve check: support 'auto' for 'Iterator used after element has been erased')
2013-09-28 11:50:45 +02:00
Daniel Marjamäki
9c67af058a
SymbolDatabase: Renamed Variable::varId() to Variable::declarationId() to make it more clear how it works.
2013-07-20 12:31:04 +02:00
Daniel Marjamäki
287782a679
Fixed #4390 (False alarm 'Object pointed by an auto_ptr is destroyed using operator delete. You should not use auto_ptr for pointers obtained with operator new[].')
2013-05-01 11:11:57 +02:00
PKEuS
95756409bc
Fixed MSVC warning
2013-04-08 02:26:58 -07:00
zblair
ecfe4eb5be
Fixed #3372 (New check: dereference iterator and then checking it)
2013-04-04 21:14:59 -07:00
Alexander Mai
b9c27699b3
Fixed #4684 (cppcheck crash in template function call.)
2013-03-29 19:29:23 +01:00
PKEuS
641ac5c02a
Fixed #4352 : Ensure that class provides an iterator interface.
2013-03-14 09:00:22 -07:00
PKEuS
0f03995995
Added support for different containers, while-loops and if to CheckStl::stlOutOfBounds()
2013-03-04 10:59:46 -08:00
Ettl Martin
cc6d138209
fixed gcc warning about missing braces
2013-03-04 14:30:01 +01:00
PKEuS
34b1d75a10
Fixed handling of std::vector::insert() in CheckStl::pushback()
2013-03-04 02:57:09 -08:00
PKEuS
d78c06dc3f
Replaced _settings->isEnabled("style") by _settings->isEnabled("warning") wherever warnings are issued
2013-03-03 02:41:59 -08:00
PKEuS
0d316af4f2
Fixed false positive stlSize for code like "foo + 1 > bar.size()" ( #4584 )
2013-02-16 02:50:25 -08:00
Daniel Marjamki
452dc23742
Fixed #4480 (False positive : Inefficient usage of string::find)
2013-02-14 19:14:20 +01:00
Daniel Marjamäki
08ada4cc63
Fixed #2652 (container .size() check too strict)
2013-02-14 16:59:58 +01:00
Andrew C. Martin
bd0d9b9639
fix misspellings & gcc v3.4.6 warnings
...
1. fix typos / misspellings
- Fix misspelling within comments, variable/function names, stdout messages
- changes the name of an error code: ```stlBoundries``` changed to ```stlBoundaries```. Alias old name (```stlBoundries```) to the new one.
2. fix gcc v3.4.6 32bit & 64bit warnings
- fixes gcc v3.4.6 warnings, except for those in tinyxml and "-Wmissing-declarations" makefile warnings
- in Preprocessor::handleIncludes(), replace a ```vector <bool>``` with ```stack<bool>``` (see ```vector<bool>``` warning below).
- this is the only ```vector<bool>``` in the codebase
- ```vector <bool>``` is actually a case of template specialization, and is not recommended, according to the following links:
http://stackoverflow.com/q/6461487
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2160.html
http://stackoverflow.com/q/670308
- in the codebase before and after this change, testrunner SEGVs in a number of places on gcc v3.4.6, including ```Check::~Check()```, among others
- fc42fc95
fixes this particular runtime issue for DJGPP & __sun
2013-02-09 23:43:09 -07:00
Robert Reif
3e3b728a9c
CheckStl: Use Token::variable. ticket: #4535
2013-02-05 06:46:26 +01:00
Robert Reif
ec1c86c152
Symbol database: more function/variable cleanup. Ticket: #4494
2013-01-31 06:41:18 +01:00
Robert Reif
859793731d
SymbolDatabase: Refactor findFunction handling. Ticket: #4494
2013-01-28 06:47:48 +01:00
Thomas Jarosch
b1eec7c6b7
Small refactoring to compile more matches
...
*** Timing of the test suite ***
Four runs were used to calculate the average run time.
Before: ~1,103s
After: ~1,066s
Speed up: 3,35%
*** Timing of internal projects using STL ***
Before: ~8,301s
After: ~8,207s
Speed up: 1,13%
So the real world speed up is roughly 1%.
2013-01-17 10:26:03 +01:00
Reijo Tomperi
5d5f7085bf
Updating year 2012 -> 2013 to .cpp and .h files and man page.
2013-01-01 18:29:08 +02:00
Daniel Marjamäki
db123c2c9b
Fixed #4431 (FP: Erroneous 'Ineffective call of function empty()' in ?: test)
2012-12-25 12:50:38 +01:00
PKEuS
0db2675912
Removed unnecessary pattern "const|" - typeStartToken() never points to "const"
2012-11-29 10:47:52 -08:00