Commit Graph

215 Commits

Author SHA1 Message Date
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
Daniel Marjamäki ba3833c692 Fixed #3678 (stlcstrReturn for classes which don't provide a std::string) 2012-11-29 07:10:56 +01:00
Daniel Marjamäki 40719c56db Fixed #4183 (false positive with method named c_str()) 2012-11-28 08:48:48 +01:00
Robert Reif ffe657128f Fixed #4364 (Segfault in CheckStl::stlBoundries) 2012-11-20 06:12:14 +01:00
Robert Reif 6b8e83a181 speed up checks by caching commonly looked up stuff in the symbol database (checkother, checkstl, checkunusedvar). Ticket: #4266 2012-11-16 06:50:49 +01:00
PKEuS 17b720ef7d Refactorization: Removed unnecessary code. Variable::typeStartToken() and Variable::typeEndToken() never point to "const".
Ran AStyle
2012-11-11 13:32:19 +01:00
PKEuS 704f285c90 Refactorized CheckStl::pushback():
- insert(), reserve() and clear() also invalidate iterators
- Properly support return and throw statements: Bailout after semicolon
- "." is also bad usage of invalid iterator.
2012-11-11 13:03:58 +01:00
Jose Roquette e8d3a4300d Fixed #4197 - False negative: invalidIterator2 not detected 2012-11-11 12:01:52 +01:00
PKEuS f75826c3e2 Added wstring to pattern where I forgot in bbe06c65c0 2012-11-09 20:25:50 +01:00
PKEuS bbe06c65c0 Added support for wide-strings (wcs* functions, std::wstring, std::*wstringstream) at many places. 2012-11-06 10:54:52 -08:00
Andrew Martin 7c370ec873 Fixed #4305 (improve check: 'vector.size() < 1' should result in 'inefficient checking for '...' emptiness.') 2012-11-04 16:15:26 +01:00
Edoardo Prezioso c1718ae38d Fixed g++ -Wshadow warning message. 2012-10-17 00:29:06 +02:00
PKEuS 2aae8381cc Message refactorization: checkstl.cpp 2012-10-14 11:16:48 +02:00
Daniel Marjamäki 0115bb8d24 Fixed #4102 (False positive: 'find('=') + 1U' can't be replaced with compare) 2012-10-07 12:43:14 +02:00
PKEuS 22a8e3f4e6 Replaced Tokenizer::getFunctionTokenByName() by SymbolDatabase::findFunctionByName(), which handles scopes slightly better. 2012-09-11 18:03:47 +02:00
PKEuS 5940d77a62 Disabled C++ specific checks and simplifications when checking a C or non-C++ file. 2012-09-10 19:02:32 +02:00
PKEuS 1e5d082251 Moved remaining part of c_str() checking to checkstl.cpp. Fixed false positive #4157. 2012-09-10 15:20:38 +02:00
PKEuS e87ebcc602 Added support for std::unique and std::remove_if to CheckStl::uselessCalls(). 2012-09-07 14:23:32 +02:00
PKEuS a8cdd15738 Fixed false positive #4077. 2012-09-06 16:30:10 +02:00
PKEuS 6edec7bdce Fixed false positive #4123. 2012-09-06 16:10:51 +02:00