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
Thomas Jarosch
cf64fd3dad
Add more complex variation of the #6406 unit test
...
This is a false negative right now.
2015-01-15 14:45:10 +01:00
Thomas Jarosch
0286abfb45
Add unit test for #6406
2015-01-14 23:05:33 +01:00
Daniel Marjamäki
a80101f277
CheckMemoryLeak: Fix FP for allocation functions that register memory before returning it
2015-01-05 13:23:38 +01:00
Daniel Marjamäki
fb685f096a
CheckOther:checkNegativeBitwiseShift: Fix FP when shift is protected by ?:
2015-01-05 10:01:04 +01:00
Daniel Marjamäki
7bafbfbd6e
Tokenizer: cleanup simplification of '!= 0' to avoid FP in 'x[(y & 0x80) != 0]' (linux)
2015-01-04 13:50:54 +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
9e8a66ee40
Fixed #6373 : Support bitops in clarifyCalculation check
2014-12-30 17:55:29 +01:00
Robert Reif
9e60f584d9
Fixed #6321 : Implemented function Token::swapWithNext().
2014-12-27 10:53:26 +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
orbitcowboy
4cbbca3db0
Refactoring: Avoid to load posix.cfg multiple times while testing (testother.cpp) ( #6336 )
2014-12-17 16:33:55 +01:00
Thomas Jarosch
6b78ae7c46
Add mmap() / mmap64() / munmap() to posix.cfg. Enables basic leak tracking
...
Includes function prototype in posix.cfg as comment
for easier overview of the function arguments.
2014-12-14 13:30:24 +01:00
Thomas Jarosch
269a4419f0
Fixed false positives about strdupa() / strndupa() memleak
...
strdupa() / strndupa() allocates memory on the stack using alloca().
This memory is freed automatically once the current function is left.
2014-12-10 22:23:52 +01:00
Daniel Marjamäki
051d42ae6b
astyle formatting
2014-11-20 14:20:09 +01:00
orbitcowboy
f5d804f71a
running astyle
2014-11-20 10:13:03 +01: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
Frank Zingsheim
3923618b8d
Fixed #6222 (Missing varid for multiple braced initialized variables)
...
-> Fixed broken code in unit tests
2014-10-16 20:46:57 +02:00
PKEuS
49a14d72e7
Fixed C&P-error in unit test that was added in previous commit
2014-09-29 19:57:27 +02:00
PKEuS
374ea8f039
Fixed false positive ignoredReturnValue on unknown member function log() ( #6197 )
2014-09-29 19:55:32 +02:00
PKEuS
1495a411eb
Fixed false positive ignoredReturnValue for variables initialized with constructor syntax ( #6194 )
2014-09-29 10:15:29 +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
Dmitry-Me
1e298a31cf
Refactoring tests. Use utility function to warn about unsimplified code in tests.
2014-09-13 12:59:32 +02:00
Simon Martin
bf3a8686ec
Ticket #6164 : Added test case that now works (failed in 1.66).
2014-09-12 21:56:13 +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
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
974c8688c3
Fixed #1751 (Undefined Behavior: Signed integer overflow)
2014-09-10 17:02:18 +02:00
Daniel Marjamäki
f111a89639
Fixed #1757 (Undefined Behavior: Shift too many bits)
2014-09-09 07:24:59 +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
Dmitry-Me
7d9342d16a
More test cases for pointer sign detection
2014-09-04 15:51:18 +04:00
PKEuS
ddc19febb5
Merge pull request #413 from Dmitry-Me/improveCStyleCastsDetection
...
Improve C style casts detection
2014-09-02 08:07:53 +02:00
PKEuS
00044aabb0
Handle ternary operator in redundantAssignment check ( #5964 )
2014-09-01 23:16:52 +02:00
Alexander Mai
a4ff30301a
#5805 'Passing value -1.0 to sqrt() leads to undefined result' is incorrect. Degrade wrongmathcall from error to warning, since it deals with implementation-defined behaviour
2014-09-01 19:31:32 +02:00
Dmitry-Me
f937dde1e0
Improve C style casts detection
2014-09-01 16:40:28 +04:00
PKEuS
c92230dfee
Fixed crash on garbage code introduced by recent commit.
2014-09-01 12:41:30 +02:00
PKEuS
20a066bb14
Run unreachableCode checking only on executable scopes ( #5789 )
2014-09-01 11:29:39 +02:00
PKEuS
b5e064e737
Fixed unreachableCode message if a lambda is returned ( #6008 ).
2014-09-01 11:10:42 +02:00
PKEuS
353a9e9a64
Bailout for duplicateBranch check if branches are empty ( #5354 )
2014-09-01 10:19:14 +02:00
PKEuS
e35329aba3
Fixed reporting of unmatched suppressions for unusedFunction ( #4946 )
2014-09-01 10:13:03 +02:00
PKEuS
6f222e4d1f
Added unit test for #5534 .
2014-08-31 19:58:03 +02:00
PKEuS
06a92e8981
Moved several condition checks from checkOther to checkCondition (former checkAssignIf)
2014-08-29 17:06:46 +02:00