orbitcowboy
d53f2f583c
Fixed #6388 : Support strncasecmp
2015-01-02 14:04:55 +01:00
PKEuS
c4fd8919a2
Fixed #6014 : Added plausibility check before issuing null pointer messages on function calls defined in library
2015-01-02 13:35:39 +01:00
PKEuS
88990bac59
Fixed #6386 : Improved behaviour on unknown language (header file)
2015-01-02 12:32:23 +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
Daniel Marjamäki
2831bbd420
ValueFlow: better handling of goto to avoid false positives
2015-01-01 14:29:49 +01:00
Alexander Mai
d2caf89706
#6385 crash in Variable::getFlag(). Catch token without variable in fix for #6095 .
2014-12-31 18:19:10 +01:00
Daniel Marjamäki
5c2a2a5c22
Fixed #6095 (False positive oppositeInnerCondition - neglecting statements with side-effects)
2014-12-31 15:14:22 +01:00
PKEuS
58f4660c94
Fixed #5223 : Bailout in valueFlowForLoop1() for complex conditions
...
Refactorization: Reuse result instead of calling MathLib::toLongNumber() twice
2014-12-30 19:56:47 +01:00
PKEuS
5dc45bd4ac
Fixed #5497 : Support designated initializers in array size detection
2014-12-30 19:23:01 +01:00
PKEuS
ec826a0e0e
Fixed #6022 : Support ++%var% in valueFlowForLoop1
...
Fixed TODO unit test: properly handle loops that are never executed
2014-12-30 18:50:22 +01:00
PKEuS
9e8a66ee40
Fixed #6373 : Support bitops in clarifyCalculation check
2014-12-30 17:55:29 +01:00
Thomas Jarosch
69b31a0743
Fix up extra whitespaces in match patterns
...
Detected by new internal check.
2014-12-30 14:53:43 +01:00
Thomas Jarosch
17b47f1ce0
New internal check: Catch extra whitespace in match patterns
...
Inspired by a recent commit from PKEuS.
2014-12-30 14:21:18 +01:00
Daniel Marjamäki
208761f0c3
Fixed #6361 (crash: CheckBufferOverrun)
2014-12-28 10:05:08 +01:00
PKEuS
8b59c39c42
Refactorization: Removed whitespaces at the end of Token::Match patterns
2014-12-27 11:09:54 +01:00
PKEuS
990d14f3e2
Fixed #6328 : Use isAttributeNoreturn() whereever we also check Library::isnoreturn().
2014-12-27 11:07:36 +01:00
Robert Reif
9e60f584d9
Fixed #6321 : Implemented function Token::swapWithNext().
2014-12-27 10:53:26 +01:00
Dmitry-Me
14f13afa0a
Don't care which type protected operator= returns
2014-12-26 15:38:22 +01:00
Daniel Marjamäki
6194a4eefd
Fixed #6357 (Improve check: pointer arithmetic 'p+x' overrun, conditional x)
2014-12-26 09:12:00 +01:00
Daniel Marjamäki
7ab12cea63
Improved pointer arithmetic message
2014-12-25 14:31:46 +01:00
Daniel Marjamäki
bc594d52c8
Fixed #6349 (Pointer arithmetic: clarify message)
2014-12-25 10:05:55 +01:00
Thomas Jarosch
26aa049724
Fix C++11 compat wrapper for clang
...
clang identifies itself as gcc 4.2.
The preprocessor macros can be dumped with:
clang++ -dM -E -x c /dev/null
2014-12-25 01:28:02 +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
7cfa54f0e0
Fixed #6353 (False positive: CheckBufferOverrun checking reassigned array function parameter)
2014-12-24 14:03:52 +01:00
Daniel Marjamäki
06803ee333
Refactoring Tokenizer::simplifyAttribute
2014-12-24 13:03:38 +01:00
Daniel Marjamäki
fb3f5a159d
Token: Added flag for attribute noreturn ( #6328 )
2014-12-24 12:50:51 +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
Daniel Marjamäki
1b2a23b3fe
Fixed #6350 (Tokenizer::simplifyCast: set Token::isCasted when cast is removed)
2014-12-23 16:16:14 +01:00
Daniel Marjamäki
e16a934fb3
CheckBufferOverrun: Added comment in code to clarify why severity is portability for pointerOutOfBounds message.
2014-12-22 15:41:46 +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
10ae551fef
CheckBufferOverrun: Use portability warning for pointer arithmetic UB. It can be used by intention and usually works as intended.
2014-12-22 10:56:17 +01:00
Thomas Jarosch
dca65ce3da
Fix FP if sizeof is used without parentheses on struct members
...
Right now we only support checking basic pointer types.
Pointers inside structs are not supported yet.
Consider the tokens "foo@1 . bar@2",
Token::Match( "sizeof ( %varid% )" ) won't match it.
Token::Match( "sizeof %varid%" ) did match it -> FP.
2014-12-22 09:44:08 +01:00
Daniel Marjamäki
93ac5a41cd
Fixed #6346 (pointer calculation overflow)
2014-12-22 09:38:00 +01:00
Daniel Marjamäki
293dc1efc7
Fixed #6327 (Unwanted constStatement on (void)0)
2014-12-21 13:42:21 +01:00
PKEuS
e03f49360f
Merge pull request #484 from simartin/ticket_6181
...
Ticket #6181 : Properly handle >> terminating template parameter lists.
2014-12-21 12:21:17 +01:00
Lauri Nurmi
d543a85510
Fix compilation with GCC 4.4.
...
It was broken by fe468ac142
.
2014-12-21 02:15:53 +02:00
Daniel Marjamäki
a95e5bff2b
Fixed #6344 (false positive: out of bounds access when array size is unknown)
2014-12-20 18:50:08 +01:00
Daniel Marjamäki
f24e1b82cf
astyle formatting
2014-12-20 18:47:40 +01:00
Daniel Marjamäki
b8371ebd87
Revert 2e45df3b
. Because there are FP.
2014-12-18 06:37:15 +01:00
Matthias Krüger
cc7f69da54
fix two internal warnings:
...
[lib/checkuninitvar.cpp:1668]: (style) Call to 'Token::tokAt()' followed by 'Token::str()' can be simplified.
[lib/checkuninitvar.cpp:1669]: (style) Call to 'Token::tokAt()' followed by 'Token::str()' can be simplified.
2014-12-17 19:06:13 +01:00
orbitcowboy
2e45df3b72
Fixed #6341 : false negative uninitvar pattern "return foo ( %var%"
2014-12-17 17:43:31 +01:00
Daniel Marjamäki
a1537e1a6e
Fixed #6339 (false negative: array index out of bounds on allocated buffer using valueflow)
2014-12-17 16:23:48 +01:00
Simon Martin
4c7a8c5497
Ticket #6181 : Properly handle >> terminating template parameter lists.
2014-12-14 15:14:27 +01:00
PKEuS
010eb1c8cb
Merge pull request #483 from simartin/ticket_6172
...
Ticket #6172 : Properly grok %type%... template parameters.
2014-12-14 17:01:25 +01:00
Simon Martin
859c6381cc
Ticket #6172 : Properly grok %type%... template parameters.
2014-12-14 14:33:37 +01:00
Daniel Marjamäki
5490fad8c7
Fixed #5840 (False positive (inconclusive): Possible nullpointer dereference - use before for-loop over nested list)
2014-12-14 14:10:42 +01:00
Thomas Jarosch
2f1ba89567
Improve readability of Library::load()
...
by caching often used node names.
Also constify existing name caches.
2014-12-12 22:18:22 +01:00
PKEuS
ff5ede342b
Fixed #6266 : Support noexcept(false)
2014-12-09 23:53:50 +01:00
PKEuS
4d81945ac5
Fixed a couple of #6276 integer over/underflow issues
2014-12-09 23:28:22 +01:00
PKEuS
493ab541ab
Fixed #6291 and #6293 : Support :: in front of function name in checkUnusedFunctions
...
Simplified code in CheckUnusedFunctions
2014-12-09 22:04:51 +01:00
PKEuS
e9bc3b7acf
Fixed #6308 : Properly associate Function with Scope for destructors in SymbolDatabase
2014-12-09 21:36:09 +01:00
Alexander Mai
cef324435f
Remove dead code in CheckMemoryLeakInFunction::call_func() (Coverity CID 1257017)
2014-12-09 20:34:30 +01:00
Dmitry-Me
ff6604e289
Make expensive string manipulation depend on settings
2014-12-09 06:08:38 +01:00
Alexander Mai
ec2c4aa2e3
#6301 Unused shared lock variable. Add exception for std::shared_lock() to CheckUnusedVar::checkFunctionVariableUsage_iterateScopes()
2014-12-07 15:32:09 +01:00
Daniel Marjamäki
64e6b5186d
astyle formatting
2014-12-05 06:41:47 +01:00
Alexander Mai
c2584aa635
#6303 crash in CheckBufferOverrun. Add check on loop variable in CheckBufferOverrun::checkScope().
2014-12-04 20:49:58 +01:00
Matthias Krüger
7a6cd54059
Fix [lib/tokenize.cpp:6184]: (warning) Found simple pattern inside Token::Match() call: ") {"
2014-12-04 11:11:47 +01:00
Daniel Marjamäki
e3892a95b5
Fixed #6290 (Tokenizer: Because 'and' is not simplified to '&&' there are false positives)
2014-12-03 16:32:05 +01:00
Dmitry-Me
7d259c073a
Cache and reuse value
2014-12-02 16:19:52 +03:00
Daniel Marjamäki
0b9d80c95d
Refactoring CheckUnusedFunctions so it uses new infrastructure for multifile analysis
2014-12-02 06:41:18 +01:00
Dmitry-Me
cf3f8c2f38
Refactoring: Replace names with underscores with camelCase names
2014-12-01 16:22:56 +01:00
Dmitry-Me
c0d2933ec7
Reorder checks to avoid redundant actions
2014-11-30 16:14:53 +03:00
Dmitry-Me
6482fefe3e
Cache and reuse previously computed value
2014-11-30 13:00:27 +01:00
Dmitry-Me
5e37275b2a
Code cleanup. Use 'isDelete' instead of token match
2014-11-28 17:50:23 +01:00
Dmitry-Me
828fdb6c47
Code cleanup. Omit redundant check.
2014-11-28 17:48:23 +01:00
Robert Reif
418c2e51a0
Fixed #3314 (cppcheck incorrectly reporting Syntax error.)
2014-11-28 17:44:36 +01:00
Robert Reif
0dad8b64e8
Fixed #6268 (False positive functionStatic (inconclusive) - nested namespaces)
2014-11-27 06:29:33 +01:00
Daniel Marjamäki
139414bd5c
astyle formatting
2014-11-26 16:13:57 +01:00
Daniel Marjamäki
465555e39d
Fixed memory leaks for non-solaris compilers.
2014-11-26 16:13:40 +01:00
amai2012
0913a51ccd
Merge pull request #469 from lasergnu/SEGV
...
Fix SEGV on Solaris x86
2014-11-25 17:01:00 +01:00
Dmitry-Me
f926958acb
Fix false positive about return type when there's =delete in operator= declaration
2014-11-25 15:52:52 +01:00
Jay Sigbrandt
f7eeb82ca4
Fix SEGV on Solaris x86
...
On Solaris x86, with both GCC 4.8 and 4.9, running cppcheck causes a segmentation fault when process terminates.
The backtrace (dbx) where
=>[1] _ZNSt14_List_iteratorIP5CheckEppEv(0x804798c, 0x8047994, 0xc0d61d6, 0x291a), at 0x8291b7c
[2] std::list<Check*, std::allocator, <Check*>void>::remove(0x84ab328, 0x80479c8, 0x80479d4, 0x82d96fc), at 0x82da984
[3] Check::~Check(0x84a9fc4, 0x83d232c, 0xfef411fb, 0x83d135c), at 0x82d9709
[4] CheckExceptionSafety::~CheckExceptionSafety(0x84a9fc4, 0xfee82a40, 0xfee82a40, 0xfedcf000), at 0x8311e7d
[5] __static_initialization_and_destruction_0(0x0, 0xffff, 0xfedd4c80, 0xfedcf000), at 0x81b01f8
[6] _GLOBAL__sub_D__ZN20CheckExceptionSafety11destructorsEv(0x83d135c, 0xfedd4f18, 0x8047a50, 0x828a5f5, 0xfedcf000, 0x8047a68), at 0x81b023c
[7] __do_global_dtors_aux(0xfedcf000, 0x8047a68, 0xfece28cd, 0x8047b08, 0x8047a48, 0xfedcf000), at 0x8185b90
[8] _fini(0x8047b08, 0x8047a48, 0xfedcf000, 0xfedd4f00, 0x8047a80, 0xfecd4e72), at 0x828a5f5
[9] _exithandle(0xfeffb7d8, 0x8185a1a, 0x0, 0x0, 0x0, 0x0), at 0xfece28cd
[10] exit(0x1, 0x8047b70, 0x0, 0x8047ba3, 0x8047bba, 0x8047ce6), at 0xfecd4e72
The destructor order is somehow getting messed up on this platform.
This fix moves the code away from header file and ensures _instances remains valid during termination.
2014-11-25 14:03:46 +01:00
Daniel Marjamäki
a002654c47
Reverted refactoring 828417c
for now. It caused a major slowdown in the unused functions checking.
2014-11-24 06:37:08 +01:00
Dmitry-Me
298021af1f
Remove redundant variable and manipulation thereof
2014-11-22 12:17:49 +01:00
Frank Zingsheim
9497732ac8
Fixed #6238 (false positive with double fopen)
2014-11-20 22:19:39 +01:00
Alexander Mai
d4e59065df
Fix some (clang) compiler warnings
2014-11-20 20:49:05 +01:00
Daniel Marjamäki
051d42ae6b
astyle formatting
2014-11-20 14:20:09 +01:00
orbitcowboy
4a2a4474c9
Fixed #6281 : MathLib: Long integer suffix i64 is not supported.
2014-11-20 10:23:09 +01:00
orbitcowboy
f5d804f71a
running astyle
2014-11-20 10:13:03 +01:00
Robert Reif
d12f14844a
Fixed #6279 (False Positive: Member variable 'Fred::i' is not initialized in the constructor)
2014-11-20 06:18:29 +01:00
Robert Reif
b7c9187539
Fixed #6280 (MathLib: binary literals are integers)
2014-11-19 06:43:52 +01:00
PKEuS
4163f1e122
Fixed #6260 - C++11 style array initialization
2014-11-18 19:50:09 +01:00
PKEuS
428587f3d4
Fixed #6275 : Simplification of = (NULL); to = 0;
2014-11-18 19:39:38 +01:00
Alexander Mai
85c02df56c
Fix compiler warning. run astyle
2014-11-18 19:36:47 +01:00
PKEuS
ad8749c0bd
Fixed #6278 : Remove casts to references to pointers in Tokenizer::simplifyCasts()
2014-11-18 19:23:59 +01:00
Dmitry-Me
34bd612ea9
Omit unneeded operations
2014-11-18 16:35:36 +03:00
Dmitry-Me
e12d280e90
Code cleanup. Omit redundant actions.
2014-11-18 06:38:19 +01:00
Alexander Mai
8bcf833bb7
Cure null pointer access within Scope::findFunction introduced by recent cs
2014-11-17 23:10:00 +01:00
Robert Reif
c5e15950df
Fixed #6230 (SymbolDatabase: Wrong function() is set for token)
2014-11-17 16:04:44 +01:00
Robert Reif
7c4a137e14
Fixed #6274 (MathLib::isFloat doesn't recognize long double literal suffix L or l)
2014-11-17 06:53:32 +01:00
Alexander Mai
45ff012b2c
Small doxygen fixes
2014-11-16 19:40:04 +01:00
Daniel Marjamäki
828417c934
CheckUnusedFunction: Refactorings to use same infrastructure for whole program analysis as CheckUninitVar and CheckBufferOverrun
2014-11-15 18:44:23 +01:00
Daniel Marjamäki
de7e9223b8
Fixed #6272 (Improve check: multifile checking in checkbufferoverrun)
2014-11-15 10:43:49 +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
orbitcowboy
b9a9f51fe0
MathLib: Added test for isDec() and removed not required state.
2014-11-14 04:29:35 +01:00
Alexander Mai
5300ba2074
Make single-argument constructors explicit
2014-11-13 21:39:14 +01:00
Alexander Mai
0f007fa24e
Increase CPPCHECK_DEVMINOR to 68
2014-11-13 21:36:57 +01:00
Dmitry-Me
cb9a6c1cb5
Don't show warning for same expressions alongside == in static_assert
2014-11-13 16:04:34 +01:00