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
Daniel Marjamäki
03f6a19dbd
astyle formatting
2012-08-27 15:52:03 +02:00
PKEuS
671f1b83d9
Fixed false positive: Return value of std::remove() ignored when std::remove(char*) is called ( #4093 )
2012-08-27 14:28:16 +02:00
PKEuS
4b1075b34b
Fixed #3729 : Don't suggest recursive call to optimize away c_str()
2012-08-26 10:56:46 +02:00
PKEuS
bb068d2f78
Fixed false positive #4039 : Handle operator precedence in CheckStl::size()
2012-08-25 12:36:13 +02:00
PKEuS
a5bca705a5
New check: Ensure that the return value of std::remove() is used.
2012-08-21 02:30:27 -07:00
PKEuS
4550cd2cd6
Refactorizations:
...
- Removed unnecessary 'if'
- Use symboldatabase instead of tokenizer to detect references and pointers
2012-08-20 08:27:43 -07:00
PKEuS
c7e2490f2b
Refactorized iterator check:
...
- Handles reassignment (fix for #4062 )
- Better support of execution paths
- Use symboldatabase for better performance
2012-08-20 04:57:24 -07:00
PKEuS
a15e307df0
Replaced two more indentation counters
2012-08-12 04:12:17 -07:00
PKEuS
c8773b891d
Refactorization: Make use of Token::scope() replacing certain indentation counters
2012-08-12 03:13:07 -07:00
PKEuS
70de691551
Fixed false positive #4032
2012-08-10 06:26:07 -07:00
PKEuS
4ed15d87b6
Properly fixed test failure and line numbers in uselessCallsEmpty error
2012-07-13 05:15:58 -07:00
PKEuS
5a91d6a0f5
Check for useless calls of .empty() ( #3816 )
...
Messages from CheckStl::uselessCalls() only shown when correct severity is enabled.
2012-07-12 03:23:52 -07:00
PKEuS
e8f4dce25f
Added check to CheckInternal: detect invalid patterns like "%typ%"
...
Replaced some Token::Match by Token::simpleMatch (suggestions of internal checks)
2012-07-11 08:45:16 -07:00
Daniel Marjamäki
2b3e5abef8
Fixed #3865 (Suspicious condition. The result of find is an iterator, but it is not properly checked.)
2012-06-07 19:33:18 +02:00
PKEuS
9dc8123151
Refactorizations:
...
- Use const string references instead of const strings copies when possible
- Fixed cppcheck warning about postfix increment in CheckIO
- Use symbolDatabase to detect pointers in CheckOther::checkAssignBoolToPointer
2012-05-25 03:09:41 -07:00
PKEuS
dc64ac2918
Removed unnecessary variable Function::start - The value is already stored in Function::functionScope->classStart.
2012-05-22 12:58:46 -07:00
Daniel Marjamäki
2fbd77c5a1
Fixed #3715 (false positive checking a map bounds)
2012-05-07 12:03:33 -07:00
Ettl Martin
5d088aa99c
fixed wrong spelled words in comments. No function change.
2012-05-05 15:21:27 +02:00
PKEuS
dd5e9aa454
Make use of recently implemented Token::type() functionality
2012-04-25 09:56:07 +02:00
PKEuS
710fefeef0
Refactorizations:
...
- Replaced some indendation counters by Token::link() or usage of symbolDatabase
- Use Token::nextArgument() to jump to target parameter
2012-04-21 23:05:37 +02:00
PKEuS
1793bf8928
Fixed false positive in stlBoundries check ( #3740 )
2012-04-18 10:08:59 +02:00
PKEuS
8e5949c6ce
Added several C++11 algorithms and containers to CheckStl
...
Added pattern "> %varid%" to CheckStl::stlBoundries()
Fixed message in checkOther (#1320 )
2012-04-17 12:54:01 +02:00
PKEuS
82cd022646
Refactorized CheckStl::mismatchingContainersError:
...
- Improved error message
- Made patterns more generic by using Token::nextArgument()
2012-04-17 12:21:41 +02:00
Reijo Tomperi
4e2946a8d0
Fix spelling error: unecessary unnecessary
2012-04-16 21:33:16 +03:00
Daniel Marjamäki
c6ba3ba3ca
Fixed #3714 (segmentation fault of cppcheck checking libtiff)
2012-04-14 18:36:19 +02:00
Daniel Marjamäki
b8d233f1a2
false poitive - invalid iterator after break
2012-04-09 07:19:39 +02:00
PKEuS
d6cfbc6483
Improved checks in CheckStl:
...
- Generalized check for inefficient emptiness check to detect !%var%.size() calls also outside of if and while; detect it also for %var%.size() when linked with && or ||.
Refactorizations in CheckStl:
- Removed an indendation counter and an offset variable
- Reduced distance given to tokAt calls in CheckStl::redundantCondition
- Rearranged code in CheckStl::missingComparison to use more efficient comparision of varIds instead of variable names. Use varId in pattern instead of variable name.
2012-04-04 19:44:57 +02:00