PKEuS
36c5815ddb
Fixed false positive about redundant variable assignment in try-scopes if the variable is read in catch block ( #6555 )
2015-11-11 17:21:55 +01:00
Simon Martin
1ec3175c99
Silence clang warning (-Wparentheses mode).
2015-11-10 08:12:36 +01:00
PKEuS
f15f8514f6
Fixed crash on garbage code ( #7120 )
2015-11-09 17:25:20 +01:00
PKEuS
c7987ad11a
Refactorization: Removed redundant nullptr checks. The existence of the tokens is guaranteed by previous Token::Match() call
2015-11-09 11:12:32 +01:00
PKEuS
ee58587706
Fixed false positive unreachableCode when ternary operator is used ( #6664 )
2015-10-26 08:29:43 +01:00
PKEuS
f637b84192
Fixed various false positives with --check-library ( #6545 , #6630 )
2015-10-26 08:16:50 +01:00
PKEuS
2eb8492993
Fixed crash on garbage code #7034
2015-10-09 13:49:17 +02:00
Daniel Marjamäki
a500f6f703
Improved handling of 'long double' and address-of in ValueType. Removed Tokenizer::simplifyFloatCasts() to handle float casts better.
2015-10-08 19:50:10 +02:00
Daniel Marjamäki
f5d9ba9cf3
Rewrote the charvar checker. It now uses valueflow also to limit false negatives.
2015-10-06 17:30:51 +02:00
Dmitry-Me
662e3c8b8c
Omit unneeded match checks
2015-09-07 18:35:15 +03:00
Dmitry-Me
cd4f3cf8db
Treat checks as mutually exclusive
2015-09-04 10:42:26 +03:00
Dmitry-Me
7287b1a251
Avoid unneeded match checks
2015-09-03 18:30:05 +03:00
Dmitry-Me
0f073ad27e
Quick check to omit useless heavy matches
2015-09-03 13:09:57 +03:00
PKEuS
c5a8ecb6f9
New check: Detect unused 'goto' labels ( #5124 )
2015-08-30 16:45:47 +02:00
Simon Martin
6fb19b02d0
Properly differentiate arrays of pointers and pointers to arrays.
2015-08-25 21:19:19 +02:00
PKEuS
ab8afec3eb
Refactorizations:
...
- Avoid unnecessary loop iterations
- Avoid unnecessary condition checking
- Reduced code duplication in symboldatabase.cpp
2015-08-16 14:23:07 +02:00
PKEuS
b77912a0b5
Support namespaces in CheckOther::checkIgnoredReturnValue()
2015-08-15 12:19:14 +02:00
PKEuS
4d80df2f4a
Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
...
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
Matthias Krüger
391194579c
CheckOther::checkComparisonFunctionIsAlwaysTrueOrFalseError: "evaluates always" -> "always evaluates"
2015-08-11 13:27:55 +02:00
Alexander Mai
66676b8e55
Warning selfAssignment was only issued if style was enabled.
2015-08-09 13:45:35 +02:00
Daniel Marjamäki
c9e239afbf
Fixed #6908 (False positive: Same expression on both sides of '+='.)
2015-08-07 20:28:25 +02:00
Daniel Marjamäki
ec3d76be5e
astyle formatting
2015-08-07 20:27:32 +02:00
amai2012
53feb88614
Merge pull request #630 from Dmitry-Me/detectRaceInInterlockedAccess
...
Prototype for detecting non-interlocked check after InterlockedDecrement()
2015-08-06 15:43:10 +02:00
Dmitry-Me
43800a9419
Detect non-interlocked check after InterlockedDecrement()
2015-08-05 12:20:28 +03:00
Daniel Marjamäki
e598b07a6d
Moved functions to astutils
2015-08-03 09:20:50 +02:00
Alexander Mai
96c3c111fc
Refactoring: Move some AST related functions to distinct source file
2015-08-02 21:57:32 +02:00
Alexander Mai
965a034afd
Fix some more false positives on zerodiv: error should be issued if type of epxression is known to be integral
2015-08-01 18:42:17 +02:00
Alexander Mai
f91ad9bbf6
5402 false positive: (error) Division by zero -- with boost::format
2015-08-01 17:28:54 +02:00
Daniel Marjamäki
503fb485cf
Removed hardcoding of functions from checkZeroDivision
2015-07-30 13:48:51 +02:00
Daniel Marjamäki
594d30f7ae
Fix Cppcheck warning about unused variable
2015-07-29 20:26:00 +02:00
Daniel Marjamäki
6790d91fbb
Improve error messages for conditional values. make valueFlowSwitchVariable values conditional that depend on the case. Partial fix for #6884 .
2015-07-29 19:54:57 +02:00
PKEuS
738057229c
Improved astIsFloat(): Handle function calls and sizeof, fixed ordering of checks
...
Handle sizeof in isSameExpression() (#6851 )
2015-07-29 14:28:24 +02:00
Daniel Marjamäki
389aec51ae
Fixed #6598 (False positive zerodivcond - cast to double ignored)
2015-07-26 22:08:36 +02:00
Daniel Marjamäki
75f922e799
cleanup checkother
2015-07-22 18:48:43 +02:00
Daniel Marjamäki
0dd008e068
Fixed Cppcheck warning about possible null pointer dereference
2015-07-08 16:06:35 +02:00
Daniel Marjamäki
5a9328f26a
Fixed Cppcheck warning about possible null pointer dereference
2015-07-08 13:41:27 +02:00
Alexander Mai
56e90f95d9
Corrections for non-Microsoft compilers
2015-06-28 12:34:08 +02:00
amai2012
649a89d308
Refactoring: Expose some previously local functions to public and add Tokenizer as argument to distinguish between C and C++ code (e.g. in isSameExpression).
...
Refactoring: Improve type-safety for TestFixture::assertEquals to allow tests with types which were not handled correctly (e.g. unsigned long long)
2015-06-28 12:08:36 +02:00
amai2012
99524b1f59
#6780 segmentation fault (invalid code) in Token::multiCompare. Simple fix in CheckOther
2015-06-22 11:12:46 +02:00
Alexander Mai
4172011e78
Missing update for Makefile. CheckMemoryLeakInFunction::getcode(): skip some C++ token matching in C mode. Minor refactoring
2015-06-20 22:49:28 +02:00
Daniel Marjamäki
63f39ea48f
Change unusedScopedObject severity from error to style. The checker does not determine that there is ub or wrong behaviour.
2015-06-20 11:22:15 +02:00
Alexander Mai
13c1c2c035
Refactoring (use const std::set for strings). Omit some matching for C++ stuff within C code.
2015-06-17 22:28:15 +02:00
Daniel Marjamäki
3986c0dc64
fixed cppcheck warnings
2015-06-10 19:07:04 +02:00
Daniel Marjamäki
0836bf3d33
astyle formatting
2015-05-27 20:26:26 +02:00
amai2012
729b240d9c
Refactoring (compiler warnings and a typo)
2015-05-25 23:15:59 +02:00
Alexander Mai
e28e9be82f
Add TODO testcase for #5738 . Refactoring: add some const
2015-05-25 08:20:14 +02:00
PKEuS
22fbc18fb7
Fixed false positive for *a++ in for-loop condition
...
Moved unit test to testgarbage.cpp
2015-05-07 20:34:57 +02:00
Daniel Marjamäki
88f59ad7e8
Partial fix for #6656 (Allow that CWE is mapped for error message)
2015-04-25 17:48:11 +02:00
Matthias Krüger
42f0955e3f
Move more setting checks out of loops and use const bools instead. Reorder a few related checks.
...
Follow up to eedcb6abcb
.
2015-04-10 14:31:19 +02:00
Matthias Krüger
eedcb6abcb
move setting flags checks out of for loops, make them const.
2015-04-07 07:23:28 +02:00
Matthias Krüger
988acf11b4
don't print warning message if --enable=warning is not given.
...
message was of type:
(warning) Passing value 0 to foo() leads to implementation-defined result.
2015-04-06 13:37:27 +02:00
Dmitry-Me
ba423185b8
Omit uneeded checks
2015-04-02 10:26:19 +03:00
PKEuS
d6751a7987
Merge pull request #537 from Dmitry-Me/decouplePatternMatchingFromOtherChecks
...
Decouple pattern matching from other checks
2015-03-15 08:50:59 +01:00
Dmitry-Me
43a19dee8b
Remove unneded deep copy, make reference const
2015-03-14 13:45:21 +03:00
Dmitry-Me
74417699db
Remove redundant break
2015-03-06 18:55:47 +01:00
Daniel Marjamäki
6646a896f9
Fixed #6446 (FP zerodivcond on double arithmetics)
2015-03-03 15:50:31 +01:00
Dmitry-Me
10b762da98
Decouple pattern matching from other checks
2015-02-27 13:09:06 +03:00
Dmitry-Me
d7365519a5
Cache and reuse value
2015-02-26 11:48:15 +03:00
Daniel Marjamäki
fb5cc6fded
Fixed #5905 (isSameExpression: comparisons 'a<b' and 'a>b' are same)
2015-02-23 16:38:55 +01:00
PKEuS
5f31242ee8
CheckOther::checkRedundantAssignment(): Bail out on inline assembly ( #6525 )
2015-02-22 12:03:53 +01:00
PKEuS
bae95b4560
Fixed noise in CheckOther::checkLibraryMatchFunctions().
2015-02-21 12:39:02 +01:00
PKEuS
6227abac73
Fixed GCC (testsymboldatabase.cpp) and MSVC (checkother.cpp) warnings
2015-02-18 21:19:36 +01:00
Alexander Mai
0a6babea74
#6181 Drop redundantGetAndSetUserId. Ensure (style-) warnings are issued if setuid()/getuid() and some related functions are ignored. Move strdupa()/strndupa() from posix.cfg to gnu.cfg
2015-02-16 22:19:51 +01:00
Dmitry-Me
56747e4af9
Reorder checks
2015-02-16 12:11:13 +03:00
Dmitry-Me
5674b3c49d
early break in loop for readability
2015-02-13 16:36:20 +01:00
Dmitry-Me
1f31dd749b
Break loop early
2015-02-04 10:47:58 +03:00
PKEuS
b2835051df
Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0.
2015-01-31 12:32:04 +01:00
PKEuS
0488f45a5f
Removed standalone check CheckOther::checkDoubleFree(), integrated (most of) the functionality into CheckLeakAutoVar. Added support for new/delete to checkLeakAutoVar.
2015-01-28 17:38:43 +01:00
Daniel Marjamäki
3285f85ebf
Fixed #6460 (Library: better function/type matching)
2015-01-27 17:55:18 +01:00
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