Commit Graph

185 Commits

Author SHA1 Message Date
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
Daniel Marjamäki d5442280b1 Fixed #3597 (Errors in evaluation of chained assignment operators) 2012-05-01 07:06:14 +02:00
PKEuS 8e362ad5f7 Fixed #3771
Stronger testing for false positives in inconclusive checking in checknullpointer.cpp
2012-04-30 12:36:41 +02:00
PKEuS f1511dd795 Fixed #3766 2012-04-27 10:17:07 +02:00
PKEuS c3578e88b6 Reverted erroneously committed lines at the end of nullpointer. Sorry for that 2012-04-26 17:55:31 +02:00
PKEuS ddca2e2f85 Added a lot of functions of the C standard library to nullpointer/uninitialized buffer checking. 2012-04-26 17:53:21 +02:00
PKEuS dd5e9aa454 Make use of recently implemented Token::type() functionality 2012-04-25 09:56:07 +02:00
PKEuS fc8749e952 Improved nullpointer check:
- Fixed #3673
- Fixed potential issue with constructor calls (like #3697)
- Added support for operator+ on std::string
2012-04-02 12:12:02 +02:00
PKEuS 0340764726 Improved nullpointer check: Detect dereferences by streams (#410)
Refactorizations:
- Replaced || by %oror% in Token::Match patterns
- Replaced some simple patterns by direct comparisions, replaced Match call with simpleMatch
- Increased data encapsulation by making more members private in CheckNullpointer
2012-03-16 17:24:03 +01:00
August Sodora e0bee0e037 Fixed #3567 (False positives in boolean expressions) 2012-03-07 20:31:23 +01:00
PKEuS 2e13a51d08 Fixed #3591 2012-02-13 19:46:45 +01:00
Erik Lax f1dbd1a89a Fixed #3518 (False negative: Possible null pointer dereference (in the same condition)) 2012-02-11 16:15:38 +01:00
PKEuS 42f418db54 - Improved nullpointer check: Fixed #1171
- Improved accuracy of function analysis in symboldatabase
- Code cleanups
2012-02-11 12:26:48 +01:00
Daniel Marjamäki 036b2a84bf Fixed #3570 (False Postive for 'nullPointer' check) 2012-02-01 20:38:47 +01:00
Edoardo Prezioso bb703f4d0b Fixed: (warning) Found simple pattern inside Token::Match() call. 2012-01-28 20:31:12 +01:00
Daniel Marjamäki 01f6bbda62 Null pointers: fixed false positive when '?' is used in return statement. Ticket: #3560 2012-01-28 08:06:03 +01:00