Thomas Jarosch
58cb6cc116
Add new "style" check to catch redundant pointer operations
...
Doing "&*some_ptr_var" is redundant and might be the remainder
of a refactoring. Warnings for expanded macros are excluded though:
They are often used with and without pointers and
do something like this: "func(&(*macroarg))".
The new check is fully AST based and was given
strong false positive testing on a large code base.
2015-01-18 00:34:07 +01:00
Daniel Marjamäki
6a8293a8b7
Library: More strict matching of functions
2015-01-08 19:31:41 +01:00
Robert Reif
ba1c24ee65
Fixed #6422 (symbol database: put function flags into a single flag variable)
2015-01-08 05:45:31 +01:00
Daniel Marjamäki
fb685f096a
CheckOther:checkNegativeBitwiseShift: Fix FP when shift is protected by ?:
2015-01-05 10:01:04 +01:00
PKEuS
267552779d
Improved check ( #6391 ): Detect identical code in both branches of ternary operator
2015-01-03 18:01:49 +01:00
Daniel Marjamäki
ff11ba9847
Updated copyright year to 2015
2015-01-03 12:14:58 +01:00
PKEuS
a3fbc5aee5
Refactorization: Avoid stringification of second branch if first branch was empty in CheckOther::checkDuplicateBranch()
2015-01-02 11:24:28 +01:00
PKEuS
9e8a66ee40
Fixed #6373 : Support bitops in clarifyCalculation check
2014-12-30 17:55:29 +01:00
PKEuS
990d14f3e2
Fixed #6328 : Use isAttributeNoreturn() whereever we also check Library::isnoreturn().
2014-12-27 11:07:36 +01:00
Daniel Marjamäki
0c086cf247
Incomplete statement: tweaked bailout for '0;' statement using isExpandedMacro()
2014-12-24 21:47:37 +01:00
Daniel Marjamäki
90bd38a972
Renamed isCasted to isCast
2014-12-24 10:35:40 +01:00
Daniel Marjamäki
de1a91f30d
Incomplete statement: tweaked bailout for '(void*)0' using isCasted()
2014-12-23 18:19:33 +01:00
Thomas Jarosch
d5e10c18d3
checkUnreachableCode(): fix FP for statements that just hide compiler warnings about unused function arguments
...
Seen throughout the rockbox codebase.
2014-12-22 11:18:23 +01:00
Daniel Marjamäki
293dc1efc7
Fixed #6327 (Unwanted constStatement on (void)0)
2014-12-21 13:42:21 +01:00
Dmitry-Me
c0d2933ec7
Reorder checks to avoid redundant actions
2014-11-30 16:14:53 +03:00
PKEuS
4163f1e122
Fixed #6260 - C++11 style array initialization
2014-11-18 19:50:09 +01:00
Dmitry-Me
353b885948
CheckOther::invalidPointerCast: Incorrect interpretation of settings
2014-11-14 20:22:17 +01:00
Dmitry-Me
fefb0ca912
Reuse previously computed values
2014-11-14 13:24:56 +03:00
Dmitry-Me
cb9a6c1cb5
Don't show warning for same expressions alongside == in static_assert
2014-11-13 16:04:34 +01:00
Frank Zingsheim
7e0fc3d481
Fixed #6252 (False positive "freed twice")
...
--HG--
extra : rebase_source : 24f801452fbefa3a59ab2cca62c3cf02aea513b6
2014-11-03 21:24:34 +01:00
PKEuS
662283cab8
Refactorization: Avoid iterations over whole token list, limited several checks to function scopes.
2014-10-31 11:42:54 +01:00
PKEuS
b5ea677180
Some fixes for CheckOther::checkIgnoredReturnValue():
...
- Fixed name of the function
- Fixed false positive for code like "class strcmp { strcmp() {} };"
- Fixed FP #6233 on checking side (no AST generated for function call)
2014-10-30 23:24:13 +01:00
PKEuS
b7996bd0b0
Handle overloads and custom implementations of functions checkReturnIgnoredReturnValue() to avoid false positives
2014-10-30 21:26:32 +01:00
Daniel Marjamäki
0a1a34b9b7
Fixed Cppcheck warning, possible null pointer dereference of tok.
2014-10-18 10:59:48 +02:00
Samuel Degrande
96e8b83bf8
Fixed newline in verbose message
2014-10-16 09:08:39 +02:00
orbitcowboy
5a4526e997
Fixed typos in comments, no functional changes.
2014-10-02 04:39:41 +02:00
PKEuS
374ea8f039
Fixed false positive ignoredReturnValue on unknown member function log() ( #6197 )
2014-09-29 19:55:32 +02:00
Martin Ettl
a7c870bdc8
Fixed crash on garbage code in CheckOther::checkVariableScope(). The corresponding backtrace is hosted at https://github.com/orbitcowboy/cppcheck_crash_files/blob/master/crash223.cpp
2014-09-29 19:44:25 +02:00
PKEuS
1495a411eb
Fixed false positive ignoredReturnValue for variables initialized with constructor syntax ( #6194 )
2014-09-29 10:15:29 +02:00
PKEuS
03b1afc28c
Loops over all varIds should start at 1.
2014-09-28 09:47:11 +02:00
PKEuS
210294443e
New check: Check for unused return values ( #653 )
2014-09-27 21:31:04 +02:00
PKEuS
cafddcb109
Fixed wrong function log10 being recommended instead of log1p
2014-09-14 13:36:12 +02:00
Daniel Marjamäki
0e55f12140
Fixed #6165 (Remove old checkUnsignedDivision checker that uses neither AST nor ValueFlow. The CheckType::checkSignConversion should be much more accurate)
2014-09-12 16:59:16 +02:00
PKEuS
6f92557478
Use information about pure/leak-ignore from library to improve accuracy of several bailouts
2014-09-11 20:27:07 +02:00
PKEuS
c1b0bfe4ee
Simplified code
2014-09-11 20:27:01 +02:00
PKEuS
fb0d145b34
Don't show inconclusive message redundantCopyLocalConst if --inconclusive is not set.
...
Ran AStyle
2014-09-11 19:45:52 +02:00
Daniel Marjamäki
7847263451
Fixed #6158 (New check: dangerous sign conversion)
2014-09-11 18:10:19 +02:00
PKEuS
865fc9aa67
Fixed #6154 : Don't suggest to reduce scope if inner scope is a lambda.
2014-09-10 20:56:34 +02:00
Daniel Marjamäki
a46f5c00a8
Minor tweaks for new CheckOther::checkIntegerOverflow checker
2014-09-10 17:26:20 +02:00
Daniel Marjamäki
974c8688c3
Fixed #1751 (Undefined Behavior: Signed integer overflow)
2014-09-10 17:02:18 +02:00
Daniel Marjamäki
a36b0e55be
CheckOther::checkTooBigBitwiseShift: improving error messages
2014-09-09 17:06:45 +02:00
Daniel Marjamäki
f111a89639
Fixed #1757 (Undefined Behavior: Shift too many bits)
2014-09-09 07:24:59 +02:00
Martin Ettl
0ced0c33e5
Fixed #6149 : (gcc) warning: comparing floating point with == or != is unsafe. Using Tokenizer::isOneNumber function to compare a floating point number being 1.0.
2014-09-08 20:02:04 +02:00
PKEuS
301b668eb5
Fixed internal warning of cppcheck
2014-09-07 11:47:40 +02:00
PKEuS
ff4fc6a234
New check: Recommend expm1, log1p, erfc ( #5392 )
2014-09-07 11:38:49 +02:00
Alexander Mai
efab840b50
#5230 Explicit reinterpret_cast should not give a warning. Lower all invalidPointerCast messages to 'portability'
2014-09-06 13:09:02 +02:00
Alexander Mai
29b46cb505
#6132 crash: daca: kvirc CheckOther::checkRedundantAssignment()
2014-09-05 20:03:34 +02:00
PKEuS
e8f7279039
Refactorization: Moved detection of STL strings to SymbolDatabase
2014-09-05 12:03:08 +02:00
PKEuS
800b57d87e
Merge pull request #415 from Dmitry-Me/reducePatternsDuplication
...
Reduce patterns duplication
2014-09-04 07:46:59 +02:00
Alexander Mai
45dc4ca6be
Fix compiler warning. Re-order if-expression for performance reasons
2014-09-02 19:18:30 +02:00