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
PKEuS
bef2caf489
Improved checks in CheckStl:
...
- Improved message of stlIfStrFind according to discussion on github (77d9ed1877
)
- Generalized pattern for substr in CheckStl::uselessCalls; added check for substr calls like ".substr(%any%,0)" which result in an empty string.
2012-04-04 19:40:28 +02:00
PKEuS
77d9ed1877
Fixed #3162 : Check whole condition for suspicious find calls.
2012-04-03 20:59:45 +02:00
PKEuS
8492685531
Fixed #3697 .
2012-04-02 11:02:41 +02:00
PKEuS
e938235385
Store functions which are declared but not implemented in the function list of the containing scope -> Fixed #3679
...
Refactorizations:
- Simplified some code
- Improved condition in findVariableType to reduce unnecessary comparisions of empty strings.
2012-03-23 17:59:51 +01:00
PKEuS
9431fb1b7e
Improved STL checks:
...
- Added performance checking for .c_str() for return values and function parameters (#1079 )
- Added more containers (basic_string, C++11 containers) and more functions to checking (.at, .resize, .reserve, ...)
- Make use of symboldatabase in missingComparision check
2012-02-25 12:43:27 +01:00
PKEuS
c294b15360
Removed more indendation counters.
2012-01-15 12:31:49 +01:00
Edoardo Prezioso
4399fca769
Code style: Use 'linkAt' instead of 'tokAt(..)->link'.
2012-01-14 15:21:45 +01:00
Edoardo Prezioso
c76f06c01b
Fixed ticket #3447 (Improve void CheckStl::if_find())
2012-01-02 23:12:59 +01:00
Reijo Tomperi
8cae17fda8
Update year to 2012
2012-01-01 01:05:37 +02:00
Daniel Marjamäki
0bf8e6206c
STL: Fixed false positive when using string::find
2011-12-27 11:02:43 +01:00
Daniel Marjamäki
2d05cae13b
Fixed #3201 (Checking iterators from different objects)
2011-12-26 10:30:39 +01:00
Daniel Marjamäki
c81a055caa
C++ Builder: Fixed compiler error (weird error)
2011-12-24 08:10:16 +01:00
Daniel Marjamäki
deccb1df06
Fixed #3433 (False positive: Same iterator is used with both myVector and myMap)
2011-12-21 06:16:06 +01:00
PKEuS
b6b97fa43d
Fixed #3427 (False positive: (error) Dangerous usage of c_str(). The returned value by c_str() is invalid after this call.)
2011-12-18 19:44:38 +01:00
PKEuS
f306246c7f
Improved support for references and pointers in SymbolDatabase
...
Replaced several isPointer functions by Variable::isPointer function
Refactorizations & Make use of symbolDatabase more often
2011-12-17 19:04:03 +01:00
PKEuS
2fa0168e55
Patch that improves STL checking: Make use of SymbolDatabase, solved TODO (about returning .c_str() value), check for deleting iterators by value.
2011-12-17 11:21:34 +01:00
PKEuS
9fc7453917
Memory leaks: Code cleanups
2011-12-10 11:55:14 +01:00
PKEuS
91a0a071d0
Take symbol database into use or improve its usage in some checks.
2011-12-09 23:28:10 +02:00
PKEuS
167a7e3e51
Various code cleanups
2011-12-08 21:28:34 +01:00
Marek Zmysłowski
9a8c48b36e
Fixed #3255 (Error message for std::string::c_str() is not descriptive)
2011-11-20 19:26:07 +01:00
Edoardo Prezioso
11dd3c09ce
Change every 'tokAt(1)->' to 'next()->' because 'tokAt(1) == 0' is equivalent to 'next() == 0', hence the equivalent cppcheck crash.
2011-11-20 15:09:57 +01:00
Edoardo Prezioso
42e369a4b4
Change every 'tokAt(..)->link()' to 'linkAt(..)'.
2011-11-20 14:24:27 +01:00
Edoardo Prezioso
2c64d299ca
Change every 'tokAt(...)->str()' to 'strAt(...)'.
2011-11-13 13:10:59 +01:00
Edoardo Prezioso
b28a44dc3b
Change: 'next()->next()'->'tokAt(2)', 'previous()->previous()'->'tokAt(-2)'.
2011-11-12 22:33:03 +01:00
Richard Quirk
7f88b66842
Fix namespaced types for auto_ptr new[] errors
...
This fixes false negatives for code such as:
std::auto_ptr<foo::bar> p(new foo::bar[10]);
The idea is to find a "new", search for the end token ";", then see if
the declaration ends in a closing square bracket. Also fixes other cases
that checked for "new %type% [" so that they work with namespaces.
2011-11-06 21:20:24 +01:00
Richard Quirk
68202d8ffb
Extra check for auto_ptr new[]
...
This fixes cases like this:
auto_ptr<foo> bar(new foo[10]);
which previously did not work correctly.
2011-11-05 15:45:59 +01:00
Thomas Jarosch
4342fd254c
Fixed #3266 (False positive on dangerous usage of .c_str())
2011-11-04 19:21:19 +01:00
Daniel Marjamäki
b18778129c
STL: updated error messages for 'useless call to find/swap/substr'. Ticket: #3258
2011-10-31 21:32:30 +01:00
Edoardo Prezioso
433f4640a9
Fix some GCC warnings regarding the sign conversion.
2011-10-30 18:34:49 +01:00
Marek Zmysłowski
950460c0a7
Fixed #3261 (Function 'find' useless call. The variable 'str' is using function 'find' against itself)
2011-10-29 09:24:05 +02:00
Thomas Jarosch
54adb910ec
Use Token::simpleMatch instead of Token::Match for simple patterns
2011-10-27 15:59:22 +02:00
Thomas Jarosch
43e9c1f0bd
STL check: Detect return of implict string conversion + .c_str()
...
Examples are:
std::string msg;
return ("ERROR: " + msg).c_str();
or
return ("ERROR: " + std::string("crash me")).c_str();
2011-10-26 22:14:47 +02:00
Thomas Jarosch
c4dabd61e9
STL check: Check if someone tries to return std::string(crash_me).c_str()
2011-10-26 21:45:27 +02:00
Thomas Jarosch
03fd308dbf
STL check: Look for string.c_str() / stringstream.str().c_str() "return" usage (object is destroyed on return)
2011-10-26 21:12:06 +02:00
Marek Zmysłowski
190139f441
Fixed #3174 (New check: Useless calls of STL functions)
2011-10-24 23:25:23 +02:00
Reijo Tomperi
bf2759118b
Added support for C++11's cend/crend/cbegin/crbegin functions in some STL checks
...
Patch from: PKEuS <philipp.kloke@web.de>
2011-10-22 23:38:03 +03:00
PKEuS
dc15641954
Fixed #3223 (Improve check: Check more STL algorithms for missmatching containers check)
2011-10-18 21:55:41 +02:00