Commit Graph

200 Commits

Author SHA1 Message Date
Frank Zingsheim 54e7c8f6a2 Implemented support for move constructors:
Adapt code to Function::eMoveConstructor
introduced in commit eb2962792f
2013-04-10 21:57:22 +02:00
Daniel Marjamäki 38680e3440 Fixed #4677 (Message for 'possible null pointer dereference, otherwise it is redundant to check..' is warning but says error) 2013-04-07 03:41:02 +02:00
PKEuS 51685f24c5 Improved expression parsing in CheckNullPointer::isPointerDeRef() - fixed #4692 2013-04-03 01:27:08 -07:00
Daniel Marjamäki 2b51993b9f Fixed Cppcheck warning. Function can be const 2013-03-29 17:55:29 +01:00
PKEuS 0105f8223c Simplified several Token::Match/simpleMatch calls when match string consists of a single pattern
Fixed two CheckInternal error messages
2013-03-01 03:42:04 -08:00
PKEuS 670c4de8a9 Changed behaviour of Token::is*Op() functions:
- Rename Token::isOp() to Token::isConstOp() (indicating that the operator does _not_ modify the input variables)
- Create new Token::isOp(), returning true also for ++, -- and assignment operators
- Make Token::isExtendedOp() returning also true for all assignment and ++/-- operators
2013-02-28 12:50:29 -08:00
zblair ed03e2c845 Fixed #4539 (False positive: Possible null pointer dereference) 2013-02-27 23:45:21 -08:00
Daniel Marjamäki 1e550f9fdf Reverted fix for #4547: It causes fp. See #4573 2013-02-12 16:13:08 +01:00
Robert Reif 42588e9729 Fixed #4535 (Simplify checks by caching symbol database Variable pointer in Token) 2013-02-06 06:39:58 +01:00
Frank Zingsheim d9de7f7052 Travis: Fixed Cppcheck warnings (related to #4547) 2013-02-05 23:31:53 +01:00
Daniel Marjamki abd536b84c Null pointer: Changed 'possible null pointer dereference - otherwise condition is redundant' to warning 2013-02-02 15:46:29 +01:00
Daniel Marjamäki a04f7b1a94 CheckNullPointer::isPointerDeRef: Refactoring - use tok->variable(). Ticket: #4535 2013-02-01 19:10:14 +01:00
Robert Reif ec1c86c152 Symbol database: more function/variable cleanup. Ticket: #4494 2013-01-31 06:41:18 +01:00
Daniel Marjamäki fc42aa3a30 Fixed #4523 (false positive: (error) Possible null pointer dereference) 2013-01-30 16:52:12 +01:00
Daniel Marjamäki 509dd9a989 Fixed #4523 (false positive: (error) Possible null pointer dereference) 2013-01-29 17:12:14 +01:00
Robert Reif 859793731d SymbolDatabase: Refactor findFunction handling. Ticket: #4494 2013-01-28 06:47:48 +01:00
Thomas Jarosch f97015e244 Don't use Token::Match() for simple string comparison 2013-01-22 13:16:23 +01:00
Frank Zingsheim 096cb1bd88 Fixed #3686: false positive: Possible null pointer dereference (inconclusive) 2013-01-21 19:38:59 +01:00
Andrew C. Martin 4a73c93750 Fix compiler warnings and comment/string typos
- fix g++ warning:

> lib/checkother.cpp:3779: warning: comparison between signed and unsigned integer expressions

 - fix suncc warning (see [everything2](http://everything2.com/title/C%252B%252B%253A+static+extern+%2522C%2522)):

> "lib/checkmemoryleak.cpp", line 578: Warning (Anachronism): Formal argument __compar of type extern "C" int(*)(const void*,const void*) in call to bsearch(const void*, const void*, unsigned long, unsigned long, extern "C" int(*)(const void*,const void*)) is being passed int(*)(const void*,const void*).

- prefer empty() / isEmpty() over "size() > 0" (cases not caught by stlSize)

- fix word misspellings (mostly comments, a few output lines)

  - Parenthesis => Parentheses (both variations were used in the codebase)

  - fix typo and wording ("never alwayw") in gui/test/data/benchmark/simple.cpp's CheckOther::unsignedPositive():

```
-  "An unsigned variable will never alwayw be positive so it is either pointless or "
+  "An unsigned variable can't be negative so it is either pointless or "
```
2013-01-16 07:37:07 -07:00
Zachary Blair 309edbbdc5 Fixed #4389 (False positive: Possible null pointer dereference if the default parameter value is used) 2013-01-09 23:22:54 -08: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 f127d56719 Null pointer: Fixed FP when there are 'return p?p->x:0;' 2012-12-25 14:23:50 +01:00
Edoardo Prezioso f6c23fa1e7 runastyle and fix checkInternal messages. 2012-12-01 03:17:55 +01:00
Daniel Marjamäki 1c4afbce8c Cleanup: Removed += and -= patterns from the checks. These should be simplified. 2012-11-30 07:08:16 +01:00
Edoardo Prezioso 0f4cdc9e87 More CheckNullPointer speed ups, related to #4266. 2012-11-25 14:55:31 +01:00
Edoardo Prezioso 927d3e8ce2 Speed up the new CheckNullPointer checking.
Related to commit 095824373a, using the new precomputed vector of functions, related to ticket #4266.
2012-11-25 12:40:14 +01:00
Zachary Blair 095824373a Fixed #3302 (new check: nullpointer dereference) 2012-11-20 23:56:17 -08:00
PKEuS 4ee955fc8c Improved CheckNullPointer::isPointerDeRef():
- Fixed #4240
- Added support for wstring/wchar_t
2012-11-10 19:53:20 +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
Daniel Marjamäki fefd8529c6 Fixed #4007 (False positive: 'Possible null pointer dereference' when using short-circuit evaluation) 2012-10-07 19:06:49 +02:00
Daniel Marjamäki c9c04f9691 Fixed #4038 (FP: possible null pointer dereference) 2012-09-23 09:20:16 +02:00
Daniel Marjamäki ffd5c82b4f Fixed #4118 (False null-pointer warning when check is indirect) 2012-09-18 19:16:28 +02:00
PKEuS 508e9394d3 Added some nullpointer-checks and removed some redundant ones based on VS2012 code analysis results. 2012-09-17 15:22:51 +02:00
PKEuS 547d3e94b2 Fixed some sign conversion messages from clang. 2012-09-16 16:41:15 +02:00
PKEuS 22a8e3f4e6 Replaced Tokenizer::getFunctionTokenByName() by SymbolDatabase::findFunctionByName(), which handles scopes slightly better. 2012-09-11 18:03:47 +02:00
PKEuS a4b5824dec New internal check: checkRedundantNextPrevious().
Fixed findings by new internal check
2012-09-07 12:36:40 +02:00
PKEuS 31e7e41098 Fixed and refactorized broken CheckNullPointer::CanFunctionAssignPointer():
- return true if parameter is passed by reference (fixes #4111)
- Use symboldatabase
- Improved handling of inconclusive
2012-09-06 18:33:15 +02:00
PKEuS 839f7a32a4 It is ok to pass a nullpointer as first argument to mbstowcs and wcstombs, which then just return how long the buffer has to be to store the result. 2012-08-26 10:41:48 +02:00
PKEuS c8773b891d Refactorization: Make use of Token::scope() replacing certain indentation counters 2012-08-12 03:13:07 -07:00
PKEuS 31129aad40 Refactorizations in checknullpointer.cpp:
- Removed CheckNullPointer::nullPointerAfterLoop(), improved CheckNullPointer::nullPointerByCheckAndDeRef() to cover tests
- Enhanced CheckNullPointer::nullPointerByDeRefAndChec() to check also 'else if' and 'while'
2012-08-05 02:07:38 -07:00
PKEuS 25ecd3ed71 Message refactorization: checknullpointer.cpp
Removed a duplicate test in checknullpointer.cpp
2012-08-05 01:38:48 -07:00
PKEuS 643f3890b4 Fixed #4003: tmpnam may be called with a nullpointer 2012-07-27 01:36:22 -07:00
Daniel Marjamäki a733c9b603 Fixed #3914 (false positive null pointer dereference, assignment in conditional) 2012-07-23 10:05:55 +02:00
Daniel Marjamäki edea4ef131 Refactoring: Renamed CheckNullPointer::isPointer to Token::isUpperCaseName 2012-06-21 19:00:53 +02:00
PKEuS c463d97386 Refactorization:
- Implemented consistent behaviour of Variable::typeStartToken/typeEndToken: Skip const and static on all variables.
- Simplified patterns containing "static|" or "const|" when matching typeStartToken.
2012-06-08 09:05:02 -07:00
Daniel Marjamäki d1b4bea304 Fixed #3807 (False positive: possible null pointer dereference) 2012-05-31 18:41:00 +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 e8cd119ebd Improved parsing of functions that accept nullpointers but no uninitialized data (Fixed #3811) 2012-05-16 00:56:39 -07:00
PKEuS 06a77679d4 Refactorizations:
- Added support for pointers in self assignement check
- Removed redundant for loop in checknullpointer.cpp
- Fixed warning about signed/unsigned mismatch in cppcheck.cpp by making Settings::_maxConfig unsigned
2012-05-11 10:38:19 -07:00
PKEuS ec00824fd3 Fixed #3357:
- Print "inconclusive" tag in cli
- Fixed inconclusive handling in checkbufferoverrun.cpp
- Merged reportInconclusiveError into reportError by adding an additional parameter "bool inconclusive" which is false per default
2012-05-06 10:37:41 -07:00