Commit Graph

4412 Commits

Author SHA1 Message Date
Daniel Marjamäki e63f2c3b5b Uninitialized struct member: Avoid false positive when struct member is passed by address 2013-01-20 13:12:40 +01:00
Daniel Marjamäki 67c9720299 Tokenizer: fixed simplification of static constants 2013-01-19 21:14:15 +01:00
Daniel Marjamäki bff6ed7af0 Fixed #3500 (false negative: (error) Returning pointer to local array variable) 2013-01-19 13:39:23 +01:00
Daniel Marjamäki f1c195e652 Fixed #3506 (false negative: not initialized variables ( struct timeval)) 2013-01-19 12:48:56 +01:00
Daniel Marjamäki 3cf0e88fbe Uninitialized struct members: Improved checking when struct member is used in expression 2013-01-19 10:09:58 +01:00
Zachary Blair 8647e4c0d0 Fixed a false positive in #4109 (if (c == 1) c == 0; Isn't picked up) 2013-01-18 16:34:15 -08:00
Daniel Marjamäki 7c615f0f12 Fixed #4497 (False positive: uninitialized struct (writing/reading member)) 2013-01-18 21:26:28 +01:00
Zachary Blair a1cbed3df8 Fixed #4109 (if (c == 1) c == 0; Isn't picked up) 2013-01-17 23:03:04 -08:00
Daniel Marjamäki 77e9f65e6b Uninitialized struct members: Fixed unit test 2013-01-17 23:55:13 +01:00
Daniel Marjamäki 2c6b383822 Uninitialized member variables: Improvements 2013-01-17 21:04:22 +01:00
Daniel Marjamäki 93fb6b0c6a Fixed #4493 (FP: uninit struct member (struct is assigned)) 2013-01-17 17:01:04 +01:00
Daniel Marjamäki 5773e69ab1 Uninitialized variables: Add experimental checking of struct members 2013-01-16 20:28:29 +01:00
Daniel Marjamäki 4cd8c7c608 Merge pull request #128 from acmyo/master
Fix compiler warnings and comment/string typos
2013-01-16 08:00:59 -08:00
Daniel Marjamäki 0fb2d309a6 Fixed #4490 (False positive: unused function (function pointer is taken in global scope)) 2013-01-16 16:52:57 +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
Daniel Marjamäki 27eedcd0a3 Merge pull request #127 from rofl0r/master
sanitize the descriptive text displayed for "varFuncNullUB"
2013-01-15 21:34:03 -08:00
rofl0r 623e30d677 fix unit test for varFuncNullUB 2013-01-15 20:45:53 +01:00
Daniel Marjamäki 2fa35a6f8d Fixed #4429 (unused functions: handle function declarations better) 2013-01-15 17:00:28 +01:00
Daniel Marjamäki d46789ee4a varFuncNullUB: fixed false positive when non-variadic argument is NULL (#4482) 2013-01-14 06:44:52 +01:00
Erik Lax 723d95597b Fixed #4481 (Simplify %str% [ %num% ]) 2013-01-13 20:52:38 +01:00
Daniel Marjamäki f0ce26a2aa Preprocessor: Let the Tokenizer handle NULL 2013-01-13 15:01:31 +01:00
Daniel Marjamäki 2e56928834 Fixed #4482 (add test for UB due to usage of NULL in variadic functions) 2013-01-13 12:02:10 +01:00
Daniel Marjamäki 97b928b2bc Fixed #4476 (Tokenizer: wrong simplification of static anonymous-type struct array declaration) 2013-01-10 18:24:01 +01: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
Edoardo Prezioso 6236e1dc38 Token::Match: removed harmless special code for initial '!!foo' patterns. 2013-01-09 20:13:33 +01:00
Thomas Jarosch 7dd07d8e77 Properly implement %op% for Token::multiCompare
Use tok->isOp() instead of doing it "manually".

This fixes false positives for the C++ template case since
the brackets in "template < something >" are not comparison operators.

Profiling showed using tok->isOp() is actually faster than before (-O2).
2013-01-09 17:05:53 +01:00
Thomas Jarosch 29c66dd9bc Add another TODO test case for Token::Match 2013-01-08 00:19:12 +01:00
Thomas Jarosch 818362f496 Add TODO test case for a bug in Token::Match multicompare
The result of the %op% operator is wrong in the multicompare
case for C++ templates. Detected by comparing the output
of the compiled matches with the on-the-fly match parser.
2013-01-07 23:47:20 +01:00
Frank Zingsheim 498d03458f Fixed #4385: lock_guard RAII throws unreadVariable 2013-01-07 20:28:43 +01:00
Daniel Marjamäki eebfea2b23 Fixed #4381 (Inline type declaration on statics causes warning) 2013-01-07 19:20:15 +01:00
Zachary Blair f3c3b7c910 Fixed #4405 (False positive: Memory in freed twice (throw)) 2013-01-05 19:02:19 -08:00
PKEuS f5ebbff0a3 Fixed #4460: Ensure that memset/memcpy is called on a pointer to a class instance. 2013-01-05 12:27:55 -08:00
Edoardo Prezioso 4c73c29cdd Revert partially the previous commit:
The two formulas are true iff 2n = 2 <=> n = 1.
2013-01-05 17:31:08 +01:00
Edoardo Prezioso 1c0c0471df Simplify some generalized math formulas:
Now the 'sin^2+cos^2=1' and the 'sinh^2-cosh^2=-1' code can handle, for example: sin^4+cos^4=1, sinh^10-cosh^10=-1.
Also, the arguments can be also multitokens, so that it's possible to simplify, for example: 'sin^2(k())+cos^2(k())=1'.
2013-01-04 13:06:09 +01:00
Edoardo Prezioso 5485e6866f Fixed wrong tokenization of some math formulas:
The two formulas: sin^2+cos^2 = 1 and sinh^2-cosh^2 = -1 are true iff the two arguments are the same.
2013-01-04 11:28:01 +01:00
Robert Reif d37906041b Fixed #4458 (False positive: noCopyConstructor in template class) 2013-01-04 10:35:24 +01:00
Daniel Marjamäki a3ee72a51d Fixed #4409 (Cppcheck 1.58 dev hangs when checking mhz.c of lmbench3 (attached code)) 2013-01-03 19:14:44 +01:00
Daniel Marjamäki 70059c06de Fixed #4456 (std::string::compare(char const*) crash) 2013-01-03 08:44:32 +01:00
Daniel Marjamäki 6e58ed3040 Fixed #4454 (False positive: class member (POD) not initialized (when initialized to 0 in initializer list)) 2013-01-02 13:59:57 +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
Robert Reif d2e8ab9c86 Fixed #4302 (Member variable not initialized in public delegate constructor) 2013-01-01 09:53:40 +01:00
Daniel Marjamäki 4378357d7e Fixed #4372 (Tokenizer misidentifying which function a variable belongs to) 2012-12-29 21:07:41 +01:00
Daniel Marjamäki 4d085dd3fd Fixed #4316 (False positive: (constStatement) Redundant code) 2012-12-29 17:13:06 +01:00
Daniel Marjamäki e7aa1ec396 Fixed #4411 (Variable is assigned a value that is never used.) 2012-12-29 12:45:37 +01:00
Daniel Marjamäki 8491df31ca Merge pull request #126 from SimonKagstrom/for-upstream
Misc fixes for the --include= option
2012-12-28 23:58:14 -08:00
Daniel Marjamäki 9af51a75e6 Tokenizer::setVarId: Proper handling of 'void f(struct foobar). Ticket: #4444' 2012-12-29 08:54:39 +01:00
Daniel Marjamäki 38d1b064e8 Symbol database: Add support for unnamed array arguments to functions (#4444) 2012-12-29 08:32:43 +01:00
Robert Reif 07d118dee5 Fixed #4449 (segfault in CheckClass::initializeVarList()) 2012-12-29 08:30:14 +01:00
Thomas Jarosch 1f87c6d669 Fix crash on empty brackets
Relevant parts from the backtrace:
2012-12-28 20:16:51 +01:00
Daniel Marjamäki 1769240e15 Fixed #4022 (false positive: (style) Variable 'sort_entry' is assigned a value that is never used) 2012-12-28 18:18:36 +01:00