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
Robert Reif
67385cfc4b
Symboldatabase: improved look up of delegate constructors
2014-11-13 06:29:51 +01:00
Daniel Marjamäki
189dfd64f7
Revert "Fixed #6230 (SymbolDatabase: Wrong function() is set for token)"
...
This reverts commit 685fce6b91
.
2014-11-11 07:29:16 +01:00
Daniel Marjamäki
ea765c24f2
Fixed #3262 (Tokenizer: wrong 'return a=1,b=2,...;' simplification;)
2014-11-10 17:31:19 +01:00
Simon Martin
cc6b51f2d9
Ticket #6059 : Properly handle class... in parameter lists.
2014-11-07 23:08:54 +01:00
Daniel Marjamäki
685fce6b91
Fixed #6230 (SymbolDatabase: Wrong function() is set for token)
2014-11-07 11:10:20 +01:00
Daniel Marjamäki
8012ac9562
Fixed #5993 (FP: memleak (linux list))
2014-11-07 07:44:12 +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
e5d63195cb
Fixed #5983 : Support storing pointers/references to member variables in CheckClass::checkConst()
2014-11-02 13:38:03 +01:00
Robert Reif
df6855c216
SymbolDatabase: reintroduce test, move symboldatabase cleanup code to SymbolDatabase destructor
2014-11-02 10:36:52 +01:00
Frank Zingsheim
0e4c508d7b
Fixed #4272 and #6237 (Crash from running out of memory with many templates)
2014-11-01 22:07:24 +01:00
Alexander Mai
fe468ac142
cppcheck compilation fails with g++4.6.3. Patch from mavik1
2014-11-01 20:21:15 +01:00
Robert Reif
4eb33e7479
SymbolDatabase: Refactoring of findFunction
2014-11-01 14:36:17 +01:00
Daniel Marjamäki
b766071272
Fixed #4970 (false positive: conditionally initialized variable used in if-clause (git/notes.c))
2014-11-01 14:03:02 +01:00
PKEuS
c7d315fba3
Refactorization: Changed simplifyMathFunctions() to a single pass simplifier
2014-10-31 23:08:11 +01:00
PKEuS
f8371f65f0
Refactorization: Avoid string copying.
2014-10-31 22:36:44 +01:00
PKEuS
9b0b7a77b6
Removed unnecessary conditions and avoid string copying in Tokenizer::simplifyMathFunctions()
2014-10-31 13:59:39 +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
5bc775e43e
Refactorization: avoid string copying in Path::getPathFromFilename()
2014-10-30 23:48:23 +01:00
PKEuS
d29117c4b2
Rearranged some code in simplifyTypedef
2014-10-30 23:48:23 +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
Robert Reif
f75aca1921
SymbolDatabase: change symboldatabase::findFunction to only check function arguments for function calls
2014-10-30 13:47:20 +01:00
PKEuS
6fdaf65cea
Fixed createLinks2() when > is followed by ; ( #6242 )
2014-10-30 11:15:24 +01:00
Daniel Marjamäki
6088ba7951
Merge pull request #456 from simartin/ticket_6817_take2
...
Ticket #6187 : Avoid infinite loop if eraseDeadCode does not remove anything (this time without memory corruption).
2014-10-23 09:43:02 +02:00
Daniel Marjamäki
4483c3e820
Fixed #6234 (FP : shift by too many bits is undefined on a QT container)
2014-10-23 06:52:19 +02:00
Simon Martin
c6e2107d99
Ticket #6187 : Avoid infinite loop if eraseDeadCode does not remove anything (this time without memory corruption).
2014-10-22 20:25:36 +02:00
Frank Zingsheim
71c5d4bd60
Ticket #6232 (cppOut of bounds array access)
...
--HG--
extra : rebase_source : 79ed3533a12a486ea3ed3f09f9bc55b1a4771161
2014-10-21 22:56:53 +02:00
Daniel Marjamäki
dd6ade9831
Fixed #6231 (mingw compiler error: Path::getAbsoluteFilePath)
2014-10-21 18:46:09 +02:00
Daniel Marjamäki
a3efa1e180
Fixed #4776 (FP: Assignment of function parameter has no effect outside the function, with goto)
2014-10-21 16:21:33 +02:00
Daniel Marjamäki
e965d8de67
Merge pull request #455 from Dmitry-Me/refactorNumberIsX
...
Reuse code in isXNumber() to avoid duplication and unneeded computations
2014-10-21 15:30:19 +02:00
Dmitry-Me
c3fa85b282
Reuse code in isXNumber() to avoid duplication and unneeded computations
2014-10-21 16:02:35 +04:00
Robert Reif
42f709c09d
Fixed #6229 (Move Windows builtin types __intXX to library)
2014-10-21 06:11:19 +02:00
Daniel Marjamäki
d8b50e73df
Fixed #6002 (Defect: False positive due to pointer address not being associated with variable in for loop)
2014-10-20 15:54:02 +02:00
Robert Reif
d5908f03b7
Fixed #6226 (false negative: printf format check for user defined array type)
2014-10-20 06:33:36 +02:00
Robert Reif
e2f72b4cb1
Fixed #6215 (Move Windows platform types into library)
2014-10-19 07:34:40 +02:00
Daniel Marjamäki
0ed2b580b2
doc: updated wiki syntax for --doc output
2014-10-18 21:20:29 +02:00
Daniel Marjamäki
de88c10e6b
1.67: set version
2014-10-18 11:35:00 +02:00
Daniel Marjamäki
0a1a34b9b7
Fixed Cppcheck warning, possible null pointer dereference of tok.
2014-10-18 10:59:48 +02:00
Daniel Marjamäki
0fd6586fcc
Fixed #6219 (valueFlowForward: better multivariable analysis needed to avoid FP)
2014-10-17 06:50:33 +02:00
Frank Zingsheim
41a54fceba
Fixed false positives about uninitialized member variables if variable has a default value ( #5500 )
2014-10-16 21:57:43 +02: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
079f495455
Added missing relational operators to pattern, as suggested in #6189
2014-10-16 20:37:21 +02:00
PKEuS
a99fd364ef
Restored functionality to detect std::string(0) calls as null pointer dereferences ( #6189 )
2014-10-16 19:12:02 +02:00
Daniel Marjamäki
7107286be6
Fixed #5891 (AST: wrong ast generated for 'x = (int)(double(123)*i);')
2014-10-16 15:57:05 +02:00
PKEuS
eefaddf980
Fixed bug in Tokenizer::simplifyReference() ( #6133 )
2014-10-16 11:43:42 +02:00
PKEuS
6955e719cf
Collected garbage code tests and moved them to testgarbage.cpp
2014-10-16 10:59:46 +02:00
Frank Zingsheim
9dd3bce98b
Fixed #6214 : non-static member initializer causes false positive
2014-10-16 09:11:09 +02:00
Samuel Degrande
96e8b83bf8
Fixed newline in verbose message
2014-10-16 09:08:39 +02:00
Daniel Marjamäki
ecd17d84fb
Reverted f088588c
fix for #6187 that fixes infinite loop, the fix cause a use-after-free regression.
2014-10-16 06:32:06 +02:00
Frank Zingsheim
eab0878b8a
Support {} initialization in initializer list ( #6216 )
2014-10-15 21:33:21 +02:00
Daniel Marjamäki
228206f556
Fixed #6067 (ValueFlow: subfunction, condition with && or ||)
2014-10-15 16:34:03 +02:00
Daniel Marjamäki
17cab08cba
Tokenizer::setVarId: Refactored fix to avoid varId for function name
2014-10-15 06:47:09 +02:00
Daniel Marjamäki
36297f1025
Tokenizer::varId: don't set varid for function name in code 'bool f(X x, int=3);'
2014-10-14 20:37:32 +02:00
Daniel Marjamäki
82972b7b0d
SymbolDatabase: fix debug output
2014-10-14 19:39:08 +02:00
Daniel Marjamäki
24ecaf8b0a
leakautovar: handling of unknown/non-pod types in c++
2014-10-14 16:40:30 +02:00
Daniel Marjamäki
94c677905b
ast: don't hang when invalid code with new is found 'new (var1,var2,var3);'
2014-10-13 19:12:20 +02:00
Daniel Marjamäki
77cffcde38
Fixed #6190 (SymbolDatabase: variable info not set properly when reinterpret_cast is used)
2014-10-12 16:06:50 +02:00
Frank Zingsheim
11867e3210
Fixed #6214 (non-static member initializer causes false positive (function call; initializer))
2014-10-12 15:06:07 +02:00
Daniel Marjamäki
aac9e66147
AST: fixed ast for 'new (char *)[10]'
2014-10-12 12:57:01 +02:00
Daniel Marjamäki
f72a8d3f15
AST: fixed ast for 'a(new A(1)), b(new B(2))'
2014-10-12 12:13:01 +02:00
Daniel Marjamäki
649e2dfa97
AST: fixed ast for 'a = new (b) ::X;'
2014-10-12 11:12:25 +02:00
Daniel Marjamäki
f96ea94048
AST: fixed ast for 'a(new (X), 5);'
2014-10-12 10:20:03 +02:00
Daniel Marjamäki
c537c98751
AST: fixed ast for 'a(new (X));'
2014-10-12 09:24:43 +02:00
Daniel Marjamäki
30353d4b61
Tokenizer::setVarId: better handling of c++ casts
2014-10-11 18:35:06 +02:00
Daniel Marjamäki
31d8cac8c9
Fixed #6138 (ValueFlow: entry can't be 0 in loop code 'while (entry = get()) entry->value;')
2014-10-11 17:48:51 +02:00
Simon Martin
70561682eb
Tokenizer::simplifyConstTernaryOp: Properly detect the end of the 'false' part of ternary operators when it contains '>'.
2014-10-11 17:01:55 +02:00
Daniel Marjamäki
8c8e85d2db
Tokenizer::setVarId: A variable declaration can't start with the typedef keyword
2014-10-11 16:30:51 +02:00
Daniel Marjamäki
489fc6cce7
AST: more fixes of new statements in clang test suite. some of it is not handled very well.
2014-10-11 13:20:48 +02:00
Daniel Marjamäki
4783a67042
AST: fixes for more new statements from clang test suite
2014-10-11 11:27:13 +02:00
Daniel Marjamäki
dd6ae3033f
Tokenizer::simplifyRedundantParentheses: dont remove parentheses in 'void * operator new(SIZE_TYPE, int);'
2014-10-11 09:18:43 +02:00
Daniel Marjamäki
e6708c1ae2
AST: fixed hang for 'new (int S::*[3][4][5])()' (clang test suite)
2014-10-11 08:32:49 +02:00
Daniel Marjamäki
5891bae59e
AST: generilized handling of auto usage in new statement
2014-10-10 19:05:31 +02:00
Daniel Marjamäki
b0b86f5607
Fixed internal error, use Token::simpleMatch for pattern 'const new' instead of Token::Match
2014-10-10 18:58:04 +02:00
Daniel Marjamäki
19a05b1f53
Tokenizer::setVarId: don't set varid for 'auto' keyword
2014-10-10 16:46:31 +02:00
Daniel Marjamäki
d0d2a0faf8
simplifyCalculations: Fix simplification of '( %num% )' when parentheses must be kept
2014-10-10 13:19:25 +02:00
Daniel Marjamäki
66d4614a87
AST: don't hang when using auto in new statement
2014-10-10 12:47:01 +02:00
Daniel Marjamäki
b5faf3a0cc
AST: improved handling of new
2014-10-10 10:37:54 +02:00
Daniel Marjamäki
cca003490b
Fixed #6203 (AST: fix problem with '; static_cast<...')
2014-10-10 08:18:24 +02:00
amai2012
85500dcdbd
Merge pull request #453 from simartin/ticket_5625
...
Ticket #5625 : Simplify constant ternary operator in template parameters.
2014-10-06 09:01:08 +02:00
amai2012
cddb4af10b
Merge pull request #450 from simartin/ticket_6187
...
Ticket #6187 : Avoid infinite loop if eraseDeadCode does not remove anything
2014-10-06 08:59:56 +02:00
Simon Martin
9ddf857dc7
Ticket #5625 : Simplify constant ternary operator in template parameters.
2014-10-04 20:49:57 +02:00
PKEuS
b48bf1dbad
Fixed GUI bug: file test.cpp is loaded from file if scratchpad is empty.
...
The underlying problem was in lib and is fixed by changing the behaviour of CppCheck::check(). Checking is performed on empty content without attempt to load from file.
2014-10-03 10:40:48 +02:00
PKEuS
a02712cb66
Some small refactorizations:
...
- Removed redundant calls to std::string constructor
- Use default parameters in some places
2014-10-03 10:02:46 +02:00
PKEuS
bb8c8d53cc
Support do-loops in CheckStl::stlOutOfBounds()
2014-10-02 20:38:55 +02:00
PKEuS
621644b17a
Added support for member variables in Check64BitPortability::pointerassignment()
2014-10-02 20:38:54 +02:00
PKEuS
542cb1cd8e
Reduce RAM usage: Avoid keeping a copy of the preprocessed source files content during checking.
2014-10-02 19:44:17 +02:00
orbitcowboy
5a4526e997
Fixed typos in comments, no functional changes.
2014-10-02 04:39:41 +02:00
Dmitry-Me
23bfd21bbc
Don't proceed to outer scope once match is found
2014-10-02 12:24:19 +04:00
PKEuS
7c7fcf36af
Support :: prefix in front of allocation function.
2014-10-01 15:33:03 +02:00
PKEuS
14f15d65e7
Support more patterns when replacing stuff like 'or' ( #6201 )
2014-10-01 08:41:55 +02:00
Simon Martin
f088588c88
Ticket #6187 : Avoid infinite loop if eraseDeadCode does not remove anything (invalid goto into a dead loop's body).
2014-09-30 19:43:22 +02:00
orbitcowboy
f36aaae732
Fixed a typo in a comment. No functional changes.
2014-09-30 14:54:59 +02:00
Daniel Marjamäki
fbc6323a9b
doc: changed --doc output to Markdown syntax
2014-09-30 14:56:12 +02:00
PKEuS
8788e58cbb
Fixed false positive #5327 : fclose as inner function call
2014-09-30 13:55:21 +02:00
PKEuS
c0e2adf723
Detect "var += fclose(f)" as deallocation (fixes false positive #6016 )
2014-09-30 13:19:53 +02:00
PKEuS
ccb5384645
Fixed false positive memoryLeak #6013
2014-09-30 13:02:02 +02:00
PKEuS
936043d47d
Fixed false positive 'unusedVar' with C++11 initialization ( #6160 )
2014-09-30 12:39:27 +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
Martin Ettl
2ca47601cd
Running astyle
2014-09-28 22:05:05 +02:00
Martin Ettl
b677d3d17f
Fix crash on garbage code in tokenlist. The corresponding backtrace along with a testcase is hosted at: https://github.com/orbitcowboy/cppcheck_crash_files/blob/master/crash220.cpp
2014-09-28 22:04:25 +02:00
PKEuS
38af865560
Fixed false positive: Member variable not initialized in the constructor with array and (*this) ( #5754 )
2014-09-29 16:49:20 +02:00
PKEuS
cbb8360b30
Added version attribute to .cfg files ( #5928 )
2014-09-29 16:26:17 +02:00
PKEuS
68b26f8faa
Fixed subsequent false negatives in CheckBufferOverrun::checkInsecureCmdLineArgs() ( #5835 )
2014-09-29 15:38:33 +02:00
PKEuS
1df1b9c2bd
Fixed #5836 : Make showing $ in stringified tokens optional
2014-09-29 14:50:00 +02:00
PKEuS
448195f255
Added variable name to debug message about typeStartToken()
...
Fixed cppcheck message
2014-09-29 14:36:03 +02:00
PKEuS
0ae09c0029
SymbolDatabase: A token with a varId cannot be a function declaration
2014-09-29 13:05:51 +02:00
PKEuS
58fe668fc4
Fixed AST for operator:: after template ( #6195 )
2014-09-29 11:01:37 +02:00
PKEuS
55b14853d0
Fixed AST: Compile expression inside [] brackets of operator new. ( #6193 )
2014-09-29 10:26:15 +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
Alexander Mai
ccd80e3407
#6141 FP: Unknown type is assumed to have size 0.
2014-09-27 21:51:11 +02:00
PKEuS
210294443e
New check: Check for unused return values ( #653 )
2014-09-27 21:31:04 +02:00
PKEuS
e1218cf846
Support allocation of array of pointers with operator new in checkmemoryleak.cpp
2014-09-27 11:25:08 +02:00
PKEuS
812bc6bdaf
CheckVaarg::va_list_usage(): Bailout when try{} block is encountered ( #6186 )
2014-09-27 11:03:58 +02:00
Alexander Mai
21c85118d6
#6189 assign with operator= a '\0' to a std::string is not an error
2014-09-26 20:40:44 +02:00
PKEuS
de13ad7eca
Improved simplifications of redundant loops:
...
- Execute simplifyWhile0 after simplifyKnownVariables (#394 )
- Support declaration of variable in loop header in removeRedundantFor
2014-09-26 10:47:05 +02:00
Robert Reif
1729ea6f0f
Fixed #6182 (Format specifier check confused by ternary operator)
2014-09-24 16:45:06 +02:00
PKEuS
0cc5b67bf6
Avoid copying std::list object in valueFlowAfterAssign
2014-09-24 13:22:22 +02:00
Robert Reif
194e4a71a4
Symbol database: handle anonymous namespace
2014-09-24 06:09:08 +02:00
PKEuS
1e8c7e102d
Revert "run dmake"
...
This reverts commit 8ccf9eed09
.
2014-09-23 21:04:31 +02:00
PKEuS
6dc5b1725e
Restored files removed in 1cc872f5b2
2014-09-23 21:02:46 +02:00
Matthias Krüger
8ccf9eed09
run dmake
2014-09-23 16:20:19 +02:00
Lauri Nurmi
1cc872f5b2
Change "obsolete" in all filenames into "obsolescent", and also update all references to such files.
...
Neither the C standard, the C++ standard, or POSIX talks about "obsolete". All of them use the word "obsolescent", which is a different word with a different meaning.
2014-09-23 16:18:04 +02:00
Daniel Marjamäki
ee93d30d94
ValueFlow: improved valueflow for loops that assign variable and then break
2014-09-23 16:06:02 +02:00
Dmitry-Me
b17f2eea16
Cache search result to avoid dual search
2014-09-22 15:54:17 +04:00
Dmitry-Me
ebf1764bcc
Move variable declarations, remove unneeded assignments, remove comparison duplication
2014-09-19 11:29:31 +04:00
amai2012
77f341be97
Merge pull request #440 from Dmitry-Me/renameVariablesReduceActions
...
Cleanup variable names, reduce unneeded operations
2014-09-17 18:39:17 +02:00
Jonathan Thackray
2b3ef83f26
Fixed #5747 (When socket() returns -1 on error, this shouldn't be marked as a resource leak)
2014-09-17 18:37:41 +02:00
Dmitry-Me
57c379d300
Cleanup variable names, reduce unneeded operations
2014-09-17 15:52:03 +04:00
Dmitry-Me
32f7a789df
Merge overlapping patterns, move declarations
2014-09-17 10:54:53 +04:00
amai2012
776e720d8f
Merge pull request #438 from Dmitry-Me/moveDeclarationReorderCheck
...
Move declaration, run check earlier
2014-09-16 20:50:04 +02:00
Daniel Marjamäki
f93cf9d1b7
Fixed #6170 (Tokenizer: sizeof on array in 2d-array is not handled properly)
2014-09-16 17:21:17 +02:00
Dmitry-Me
7c4b9bed9e
Move declaration, run check earlier
2014-09-16 13:34:16 +04:00
Dmitry-Me
6f9730b1d8
Reorder checks, unwrap code
2014-09-16 10:17:06 +04:00
Dmitry-Me
b479948f0f
Refactoring: Merge overlapping Token::Match function calls
2014-09-16 06:22:16 +02:00
Daniel Marjamäki
bbbe2c1b94
Fixed #6169 (False positive: passing uninitialized struct buffer member to strncpy)
2014-09-15 15:58:21 +02:00
PKEuS
cafddcb109
Fixed wrong function log10 being recommended instead of log1p
2014-09-14 13:36:12 +02:00
Daniel Marjamäki
29a49d0641
removed some redundant null pointer checks before calling Token::Match
2014-09-14 11:35:04 +02:00
Simon Martin
53b58f0ed9
Refactoring. Use Token::Match instead of hardcoded patterns to increase readability.
2014-09-14 11:26:16 +02:00
Daniel Marjamäki
d354cdc02c
Fixed #6168 (False positive: sign conversion for inner calculation)
2014-09-14 10:29:58 +02:00
Daniel Marjamäki
865a252c89
astyle formatting
...
[ci skip]
2014-09-14 10:29:12 +02:00
Simon Martin
4b750997cb
Ticket #6121 : Report a syntax error for invalid enum initializers.
2014-09-13 20:46:53 +02:00
Simon Martin
01cf008792
Ticket #6134 : Improve the mechanism differentiating template declarations from template definitions.
2014-09-13 16:44:05 +02:00
PKEuS
210d01c274
Merge pull request #430 from Dmitry-Me/mergeDuplicatePatterns
...
Merge partially duplicate patterns
2014-09-12 21:28:18 +02:00
Daniel Marjamäki
8cbd013d7f
checkSignConversion: dont warn for + and -
2014-09-12 18:58:31 +02:00
Dmitry-Me
961a1b65ae
Merge partially duplicate patterns
2014-09-12 19:10:41 +04: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
Daniel Marjamäki
d60cf16eb8
Sign conversion: Improved check. When its not explicit that 'int' variable is signed but it can have negative values, assume its signed
2014-09-12 16:18:42 +02:00
PKEuS
0b7281803e
Merge pull request #428 from Dmitry-Me/detectArrowAccessesViaUninitPtrs
...
Detect -> accesses on uninitialized pointers
2014-09-12 09:19:59 +02:00
Dmitry-Me
a2b30c7801
Detect -> accesses on uninitialized pointers
2014-09-12 10:19:00 +04:00
Daniel Marjamäki
7119550dde
Too big shift: fix FP when cast is used
2014-09-12 06:45:45 +02:00
Daniel Marjamäki
0ab7abded1
AST: fixed cast for 'return (long long)c << 40;'
2014-09-12 06:43:52 +02:00
PKEuS
e2136adf5b
Merge pull request #427 from Dmitry-Me/reorderChecksMoveDeclaration
...
Reorder checks, move declaration closer to where it's needed
2014-09-11 21:46: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
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
PKEuS
87e6a3501a
Added checktype.cpp to VS solution; Fixed MSVC warning about signed/unsigned mismatch
2014-09-11 18:47:28 +02:00
Daniel Marjamäki
7847263451
Fixed #6158 (New check: dangerous sign conversion)
2014-09-11 18:10:19 +02:00
Dmitry-Me
f58a25bebd
Reorder checks, move declaration closer to where it's needed
2014-09-11 17:14:06 +04:00
Dmitry-Me
e050fba414
Move declaration closer to where it is used
2014-09-11 11:26:35 +04: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
PKEuS
0a416910c4
Improved speed of testrunner: Avoid repeated loading of the same library
2014-09-10 20:29:44 +02:00
PKEuS
3fade4d28c
Improved performance of library loading (~5%):
...
- Use std::string for comparison, convert to string only once
- Avoid calling tinyxml functions multiple times
2014-09-10 20:29:44 +02:00
PKEuS
c3ac91eb42
Fixed ID of message about purged configurations.
2014-09-10 20:19:21 +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
Dmitry-Me
0a1b8c22d6
Simplify null pointer handling
2014-09-09 13:11:41 +04:00
Daniel Marjamäki
f111a89639
Fixed #1757 (Undefined Behavior: Shift too many bits)
2014-09-09 07:24:59 +02:00
Dmitry-Me
f7824bfd00
CheckNullPointer::isPointerDeRef: Improve handling of static member variables and functions
2014-09-09 05:36:09 +02:00
Matthias Krüger
323fd1b3dc
tokenize.cpp: fix internal warning: Found simple pattern inside Token::Match() call: ") :"
2014-09-08 22:00:57 +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
Frank Zingsheim
8c5013adda
Fixed #6073
2014-09-07 21:53:32 +02:00
Daniel Marjamäki
db929ffd19
Fixed CID 1037074. Useless null pointer check. Created ticket #6144 .
2014-09-07 13:50:55 +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
Daniel Marjamäki
7142edf03e
Improved fix for Cppcheck warning. Remove useless conditions instead of adding a new one.
2014-09-07 09:56:07 +02:00
PKEuS
605fb9039a
Merge pull request #391 from Dmitry-Me/resolveIssue1037098
...
Resolve CID 1037098
2014-09-06 23:17:52 +02:00
PKEuS
117e45f8af
Merge pull request #395 from Dmitry-Me/fixBufferOverrun
...
Fix potential buffer overrun
2014-09-06 23:03:02 +02:00
PKEuS
4859b55ce6
Merge pull request #422 from simartin/ticket_6023
...
Ticket #6023 : Properly handle template'd default template parameter values
2014-09-06 22:55:45 +02:00
Alexander Mai
e4d0435976
Merge branch 'master' of https://github.com/danmar/cppcheck
2014-09-06 22:27:38 +02:00
Alexander Mai
6b26b6ed31
Fix read access to uninitialized variable
2014-09-06 22:27:13 +02:00
Simon Martin
6e10603227
Ticket #6023 : Properly handle template'd default template parameter values.
2014-09-06 20:39:04 +02:00
PKEuS
35b00a5e05
Support rValue references in typedef ( #1823 )
2014-09-06 19:00:26 +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
Martin Ettl
8a15486370
Fixed CID-1234716: Dereference after null check in lib/checkio.cpp
2014-09-01 09:00:05 +02:00
PKEuS
e8f7279039
Refactorization: Moved detection of STL strings to SymbolDatabase
2014-09-05 12:03:08 +02:00
PKEuS
4940da06c0
Calculate checksum only if necessary ( #6129 )
2014-09-05 11:05:21 +02:00
Simon Martin
eeeb816db9
Ticket #6103 : Simplify "new (type)" constructs into "new type" to avoid confusion upon certain input.
2014-09-05 08:02:18 +02:00
PKEuS
8c24553229
Support inherited member variables in setVarId ( #4101 )
2014-09-04 22:22:09 +02:00
Alexander Mai
5a96413220
#6127 crash on patch(?)-".c" file. Avoid segfault.
2014-09-04 21:28:18 +02:00
Alexander Mai
65f599bd9e
Fix version number macros
2014-09-04 21:18:15 +02:00
Daniel Marjamäki
b3e4abd82a
Fixed Cppcheck warnings
2014-09-04 18:08:56 +02:00
Daniel Marjamäki
05617d7285
Fixed #6118 (False positive: divide by zero - if condition not evaluated properly)
2014-09-04 17:52:14 +02:00
PKEuS
800b57d87e
Merge pull request #415 from Dmitry-Me/reducePatternsDuplication
...
Reduce patterns duplication
2014-09-04 07:46:59 +02:00
PKEuS
5d0aa15002
Merge pull request #416 from Dmitry-Me/removeDuplicateChecks
...
Remove duplicate checks
2014-09-04 07:46:45 +02:00
PKEuS
e4a81f9666
Improved checksum algorithm to fix configurations being purged by coincidence ( #6126 ):
...
- Better distribution of values by rotating the bits of the checksum for each token
2014-09-03 23:10:38 +02:00
Alexander Mai
270f59e76a
Fix doxygen warning and astyle formatting
2014-09-03 20:38:41 +02:00
Dmitry-Me
68d650e9ac
Remove duplicate checks
2014-09-03 14:17:34 +04:00
PKEuS
6d27ca6c9a
Fixed SymbolDatabase if unnamed struct is casted and returned ( #6125 )
2014-09-03 11:15:05 +02:00
PKEuS
bf2f76e70c
Detect and purge duplicate configurations by calculating a checksum.
2014-09-02 22:35:52 +02:00
Alexander Mai
a632f68345
#6122 segmentation fault (invalid code) in in valueFlowForLoop2. Simple fix and testcase.
2014-09-02 19:41:50 +02:00
Alexander Mai
45dc4ca6be
Fix compiler warning. Re-order if-expression for performance reasons
2014-09-02 19:18:30 +02:00
Dmitry-Me
46d24c7bfb
Reduce patterns duplication
2014-09-02 19:51:22 +04:00
Dmitry-Me
7342a81ea7
Minor refactorings. rename token. cleanup if/else.
2014-09-02 16:10:51 +02:00
PKEuS
a52401cf1b
Fixed some compiler warning about signed/unsigned conversions.
2014-09-02 11:44:51 +02:00
PKEuS
3e65cb446e
Remove "auto" keyword (storage class specifier) from C++03 and C code ( #4990 ).
2014-09-02 11:21:47 +02:00
PKEuS
2d608890a5
Improved message 'mismatchSize' ( #4167 )
2014-09-02 09:38:40 +02: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
428f7a6f26
Attempt to fix crashs on clang test suite.
2014-09-01 23:29:15 +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
PKEuS
80df3dc642
Disabled several checks and simplifications for C code, if they are C++-only. Do not match arguments for C code, since there can't be overloads.
2014-09-01 18:43:24 +02:00
amai2012
9bc0e3afd6
Merge pull request #412 from Dmitry-Me/moveChecksEarlier
...
Move cheap checks earlier to avoid more expensive ones
2014-09-01 17:49:45 +02:00
Dmitry-Me
f937dde1e0
Improve C style casts detection
2014-09-01 16:40:28 +04:00
PKEuS
0995b85c09
Attempt to fix crashs when self-checking cppcheck introduced by previous commit
2014-09-01 14:12:43 +02:00
PKEuS
40e5dab9dc
Refactorization in checkmemoryleak.cpp:
...
- Use Library to detect noreturn/notnoreturn functions
- Removed realloc from std.cfg as long as there is no proper way to configure such functions
2014-09-01 13:54:33 +02: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
Dmitry-Me
a6219adc9b
Move cheap checks earlier to avoid more expensive ones
2014-09-01 12:52:27 +04: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
47764321f2
Several fixes to invalidScanfFormatWidthError():
...
- Different IDs for different messages (#5809 )
- severity is warning, not style, so check _settings->isEnabled() properly
- Removed never shown message text
2014-09-01 09:33:58 +02:00
amai2012
d1d3c24f3e
Merge pull request #411 from Dmitry-Me/moveDeclarationsCloserToWhereTheyreNeeded
...
Move declarations closer to where they're first used
2014-09-01 08:48:46 +02:00
PKEuS
59cccb83ce
Reimplemented version.h:
...
- Use macros to form version number and string. CPPCHECK_MAJOR, CPPCHECK_MINOR and CPPCHECK_DEVMINOR now contain the parts of the version number.
- "dev" status is now detected by comparison of CPPCHECK_MINOR and CPPCHECK_DEVMINOR, version string created accordingly.
Fixed two comments.
2014-09-01 08:48:25 +02:00
Dmitry-Me
9199dde560
Move declarations closer to where they're first used
2014-09-01 10:05:59 +04:00
PKEuS
288c94a47f
Extended Message "fflushOnInputStream" to files opened for reading.
2014-08-31 21:03:33 +02:00
PKEuS
b07f61170d
Changed severity of fflushOnInputStream to portability: The behaviour of fflush(stdin) is defined on Linux.
2014-08-31 20:56:05 +02:00
PKEuS
e1bc5f5248
Fixed false positive #4788 (break; in BOOST_FOREACH)
2014-08-31 20:40:52 +02:00
PKEuS
8722bba52a
Fixed false positive #4648
2014-08-31 20:33:27 +02:00
PKEuS
3ccdae78ba
Support __declspec(property) ( #4700 )
2014-08-31 20:17:18 +02:00
PKEuS
b8918906e6
Fixed false positive #5466
2014-08-31 19:46:30 +02:00
PKEuS
8f4662de92
No unused variable messages about std::unique_ptr|shared_ptr|auto_ptr ( #4355 )
2014-08-31 19:18:02 +02:00
PKEuS
78932094c8
Fixed crash on garbage code #6106
2014-08-31 12:12:03 +02:00
PKEuS
9733a751ec
SymbolDatabase: Several small refactorizations
2014-08-31 11:27:32 +02:00
PKEuS
862b18e0e2
SymbolDatabase: New scope type eLambda
2014-08-31 10:21:27 +02:00
Daniel Marjamäki
97005d7d87
remove redundant declaration of isSameExpression. fixes gcc compiler warning.
2014-08-30 19:23:31 +02:00
Dmitry-Me
eace67ee1c
Use logical instead of bitwise operators to save cpu
2014-08-30 11:35:25 +02:00
PKEuS
e9fdfc6cd0
Fix on checking side for #6099
2014-08-30 11:18:48 +02:00
Daniel Marjamäki
3ac5f16668
Makefile: generate new Makefile with dmake
2014-08-29 18:32:50 +02:00
PKEuS
06a92e8981
Moved several condition checks from checkOther to checkCondition (former checkAssignIf)
2014-08-29 17:06:46 +02:00
Daniel Marjamäki
eeeb8aa0a7
ValueFlow: Fix crash for lambda function
2014-08-27 17:27:34 +02:00
Daniel Marjamäki
2dc3945017
astyle formatting
2014-08-27 17:27:14 +02:00
Daniel Marjamäki
ae8a20b197
Fixed #6086 (False positive: valueFlow, conditional code returns)
2014-08-27 16:59:18 +02:00
amai2012
c242faf45e
Merge pull request #408 from Dmitry-Me/continueEarlyToOmitUnneededActions2
...
Continue early to omit unneeded operations
2014-08-27 16:36:19 +02:00
Matthias Krüger
cd33d784d5
run dmake
2014-08-27 09:45:50 +02:00
PKEuS
eba8c6f6c5
Refactorization:
...
- Added missing separating comments between checks in checkother.cpp
- Moved checks related to strings into own file
2014-08-27 09:42:09 +02:00
Dmitry-Me
44ba0ca347
Continue early to omit unneeded operations
2014-08-27 11:32:14 +04:00
Daniel Marjamäki
23ec9fea8e
Fixed #6024 (False positive (nullPointer) using in 1.66)
2014-08-26 18:48:11 +02:00
PKEuS
6a4319f050
Improved simplifications:
...
- Rearranged their order to solve problems with typedefs. If we simplify chained declarations before typedef parsing, we have less complex expressions to deal with (#4777 ).
- Fixed detection of variables hiding enums
2014-08-26 15:21:19 +02:00
PKEuS
a8dc17c1d9
Fixed false positive #5566 .
2014-08-26 11:29:26 +02:00
PKEuS
5e2ea8b6cd
Fixed crash #6089 by using information stored in Variable instead of accessing Variable::nameToken
2014-08-26 11:08:21 +02:00
PKEuS
c15ead7855
Merge pull request #406 from Dmitry-Me/removeCodeDuplicationCleanupVariableNames
...
Reduce code duplication, cleanup variable names
2014-08-26 10:42:22 +02:00
PKEuS
2326e78381
Fixed #6058 : Don't detect class with unknown macro as variable.
...
Commented out crashing unit test tokenize33() in VS12
2014-08-26 10:40:00 +02:00
amai2012
e02741c82c
#5780 Crash on template code below Tokenizer::setVarId(). Fix several crashes with same location.
2014-08-26 09:12:10 +02:00
Daniel Marjamäki
cd75b2d83d
AST: fix hang for code 'MACRO({.x=1,.y=2})'
2014-08-25 19:10:16 +02:00
Dmitry-Me
d72b98bbaa
Reduce code duplication, cleanup variable names
2014-08-25 11:49:17 +04:00
Dmitry-Me
67ea470275
Break loop early, cleanup declarations
2014-08-24 20:17:41 +02:00
Daniel Marjamäki
789b01aad2
ValueFlow: fixed one more hang in valueFlowForward
2014-08-24 08:50:01 +02:00
Daniel Marjamäki
1060b30e52
AST: better AST for placement new expression 'new (a) MyClass;'
2014-08-23 13:21:36 +02:00
PKEuS
0dc4b75565
Fixed crash on invalid code #6080
2014-08-23 12:36:42 +02:00
PKEuS
7f2be2f57c
Fixed template bracket linkage in while loop simplification
...
Ran AStyle
2014-08-23 12:28:54 +02:00
amai2012
976966fe81
#5639 String literal compared with char buffer in a struct.
2014-08-23 09:41:40 +02:00
PKEuS
f01d7543f6
#6077 : Don't warn about memcpy/memmove on class containing floats.
2014-08-20 15:12:53 +02:00
PKEuS
c678937538
Fixed more false positives of #6056 :
...
- Implemented nextArgument() for usages before < and > are linked
- slightly optimized nextArgument()
2014-08-20 15:02:52 +02:00
PKEuS
8188578cf2
SymbolDatabase: Fixed handling of nested types for function arguments
...
Removed unnecessary loops between var->typeStartToken() and var->typeEndToken()
2014-08-19 11:55:00 +02:00
PKEuS
69b7f91034
Support :: in some more places
2014-08-19 11:36:32 +02:00
PKEuS
5d50e7e9ae
Changed heuristics to detect variable constructor initialization syntax ( #6071 )
2014-08-19 11:06:52 +02:00
PKEuS
96c5983409
Merge pull request #404 from Dmitry-Me/continueEarlyToOmitUnneededActions
...
Continue early to omit unneeded actions
2014-08-19 09:45:54 +02:00
Daniel Marjamäki
b6355b991f
Fixed #6070 (false positive: Array 'array[8192]' accessed at index 8192, which is out of bounds)
2014-08-19 07:03:00 +02:00
Dmitry-Me
93b5b28c3d
Continue early to omit unneeded actions
2014-08-19 07:58:45 +04:00
PKEuS
eac2d58c9e
Fixed fix for #6056
2014-08-18 20:40:43 +02:00
PKEuS
49bafa10a0
Merge pull request #402 from Dmitry-Me/emiminateDuplicateStatements
...
Remove duplicate return statements.
2014-08-18 18:39:46 +02:00
Daniel Marjamäki
b2288e5ada
Fixed #6022 (Defect: False positive due to bug in determining bounds of for loop 'for (i = 2; i < 1; ++i)')
2014-08-18 16:45:22 +02:00
Dmitry-Me
443e846b2e
Remove duplicate return statements.
2014-08-18 16:02:35 +04:00
Dmitry-Me
a386fbb665
Avoid mutually exclusive checks
2014-08-18 14:30:52 +04:00
Dmitry-Me
120e8c0674
Make loop termination more explicit.
2014-08-18 14:00:25 +04:00
PKEuS
5483c8ed5e
Removed obsolete function from checkNullPointer
2014-08-18 11:42:50 +02:00
PKEuS
e7754be316
Fixed #6056 - properly detect member functions in setVarId()
2014-08-18 11:07:56 +02:00
PKEuS
a69860eb70
Fixed false positive #6066 : va_list may be used after being copied.
2014-08-18 10:40:39 +02:00
PKEuS
5c54f8d0d8
Support namespaces and static member variables in setVarId (only one depth) ( #6061 )
2014-08-18 10:25:30 +02:00
PKEuS
0bf7b03f96
Refactorization: Support :: in some places in checkother.cpp
2014-08-18 10:25:30 +02:00
PKEuS
df080ab5c3
Refactorization in valueflow.cpp: Removed redundant loop, rearranged code.
2014-08-18 10:25:30 +02:00
Daniel Marjamäki
d44d6ad94a
incorrect logic operator: fixed crashes
2014-08-18 05:37:07 +02:00
Alexander Mai
66d767b4b5
#6050 arithmetic on void** - fix false positive
2014-08-17 19:14:55 +02:00
Daniel Marjamäki
a52c122229
Tokenizer::createLinks2: set no template-links in 'if (a < b || c > d)'
2014-08-17 19:03:06 +02:00
Daniel Marjamäki
ebc0b6cd44
astIsFloat: Fix crash when there is no second operand for '.'
2014-08-17 14:28:31 +02:00
Daniel Marjamäki
f7f44f24c7
Fixed #5132 (False negative: incorrectLogicOperator in simple if-clause)
2014-08-17 14:04:40 +02:00
Daniel Marjamäki
5cdbe0f42d
ValueFlow: Improved value flow after for loop
2014-08-17 10:40:22 +02:00
Daniel Marjamäki
75ec97ad23
Tokenizer::simplifyKnownVariables: Fixed bad simplification in for loop header
2014-08-17 07:39:42 +02:00
Daniel Marjamäki
7ca742c454
Fixed #5062 (ValueFlow: Handle comma operator in abstract interpretation)
2014-08-17 06:42:16 +02:00
Daniel Marjamäki
65f10edcb6
Fixed #5866 (False negative: useless condition or null pointer dereference (null object after while loop, method))
2014-08-16 18:32:25 +02:00
Daniel Marjamäki
76510e0006
null pointer: perform proper null pointer checking when no --enable=warning is given.
2014-08-16 12:48:20 +02:00
Dmitry-Me
e91a63c834
Resolve CID 1037101. break after loop if tok is null because tok is dereferenced below. Ticket: #6055
2014-08-15 18:39:15 +02:00
Daniel Marjamäki
364c975701
Fixed #5557 (astIsFloat: better handling of '.')
2014-08-15 16:48:53 +02:00
Dmitry-Me
7e442cf75d
Some safe coding. Check that pointer is not null.
2014-08-14 16:10:12 +02:00
Daniel Marjamäki
543589564d
Merge pull request #394 from Dmitry-Me/resolve1132030
...
Resolve CID 1132030
2014-08-14 13:28:59 +02:00
Daniel Marjamäki
6db3eabadb
Merge pull request #393 from Dmitry-Me/furtherResolve1222223
...
Further resolve CID 1222223
2014-08-14 09:54:13 +02:00
Daniel Marjamäki
b8e356462a
Dead pointer: Fixed FP for subfunction pointer argument
2014-08-14 06:47:19 +02:00
Daniel Marjamäki
e83f08a825
Fixed #6044 (hang: darkplaces / cl_particles.c)
2014-08-14 06:13:42 +02:00
Daniel Marjamäki
f0cb6ef33d
Change fix for hang so there won't be FP
2014-08-13 05:36:17 +02:00
Daniel Marjamäki
bdfe43d82c
Fix hang in libdmtx package. found through daca2.
2014-08-13 04:03:17 +02:00
Dmitry-Me
406239dfc7
Fix potential buffer overrun
2014-08-12 17:44:20 +04:00
Dmitry-Me
b022afae75
Resolve CID 1132030
2014-08-12 13:04:32 +04:00
Dmitry-Me
0991d42cb9
Further resolve CID 1222223
2014-08-12 11:14:28 +04:00
Dmitry-Me
fd9009c494
Resolve CID 1037098
2014-08-12 10:02:54 +04:00
Daniel Marjamäki
970fda9e79
ValueFlow: Fixed nullpointer FP warning in checksizeof
2014-08-11 16:21:20 +02:00
PKEuS
5d302716e7
Refactorized Variable::isIntegralType() and Variable::isFloatType():
...
- Cached property
- Make use of it in several checks
- float* is flagged as floating point type
2014-08-09 11:45:13 +02:00
PKEuS
2d06786c3f
Merge pull request #388 from Dmitry-Me/resolveIssue1037100
...
Resolve CID 1037100: possible dereference of _errorLogger nullpointer
2014-08-09 10:35:18 +02:00
PKEuS
728d0fb9dc
Merge pull request #390 from Dmitry-Me/suppressGccShadowingWarning
...
Avoid GCC name shadowing warning.
2014-08-09 10:34:36 +02:00
PKEuS
865df4e207
Fixed false negative #4306 : Detect loop access of empty STL container
2014-08-09 10:06:44 +02:00
PKEuS
5ddee75b5d
Removed newline from divideBySizeofError message
2014-08-08 09:59:55 +02:00
PKEuS
5c238692e6
New check: Division by sizeof() as parameter to memset/memcpy/memmove/etc. as they expect a size in bytes ( #5698 )
...
Refactorizations in sizeof checking:
- Changed severity of sizeofwithsilentarraypointer to warning
- Made pointerSize message conclusive - there seems to be no reason for inconclusive
2014-08-08 09:49:09 +02:00
PKEuS
c4635cf698
Improved check: portability message when calling memset on a class with floating point numbers ( #5421 )
2014-08-08 09:49:09 +02:00
PKEuS
a1b7ab277b
Changed handling of unhandled characters:
...
- Don't abort checking (reverts 42140b6488
)
- Modified error message: New Id unhandledCharacter, removed redundant line information, improved message text
2014-08-08 09:49:09 +02:00
PKEuS
56ba4b6a92
Fixed crash if va_start is passed less arguments than expected
2014-08-06 20:53:13 +02:00
PKEuS
076c1bd06c
Fixed crash in CheckVaarg::va_start_argument ( #6032 )
2014-08-06 19:35:09 +02:00
PKEuS
b708022e97
Fixed cppcheck message
2014-08-06 14:31:09 +02:00
PKEuS
639f1fa85a
Fixed another variable shadowing warning.
2014-08-06 14:27:03 +02:00
Matthias Krüger
b5cf56790c
dmake: update
2014-08-06 14:25:49 +02:00
PKEuS
5f7b4ad0ae
Added several new va_arg related checks:
...
- Wrong parameter passed to va_start() (#3850 )
- Reference passed to va_start() (#3849 )
- Missing va_end() (#3295 )
- Using va_list before it is opened (#3295 )
- Subsequent calls to va_start/va_copy()
2014-08-06 14:20:46 +02:00
PKEuS
e4b55cf843
Fixed a bug and two warnings introduced recently.
2014-08-06 13:35:39 +02:00
Dmitry-Me
3ec821df34
Avoid GCC name shadowing warning.
2014-08-06 15:35:04 +04:00
PKEuS
c3577bc8dd
Fixed crash, simplified code in testassert.cpp
2014-08-06 12:24:21 +02:00
PKEuS
d3a567bf96
Fixed false positive #5824 : Variables that might be used for va_start() must not be passed by reference.
2014-08-06 12:06:36 +02:00
PKEuS
adcc8b1634
Implement support for __attribute__((used)) ( #3408 )
2014-08-06 11:13:58 +02:00
PKEuS
8da61ab71a
Refactorized CheckAssert::assertWithSideEffects():
...
- Removed crap
- Error message on calling non-const member function in assert()
- Fixed false positive #5311 and TODO_ASSERT
2014-08-06 10:15:48 +02:00
Dmitry-Me
51fab1f9f1
Resolve CID 1037100
2014-08-06 11:20:04 +04:00
PKEuS
fd5ff1bb8b
Fixed false positive #6030 : inheriting classes is not a variable declaration.
2014-08-06 09:04:03 +02:00
PKEuS
e7605d6f77
Merge pull request #387 from Dmitry-Me/resolveIssue1037105
...
Resolve CID 1037105
2014-08-06 08:42:01 +02:00
PKEuS
83a80cebeb
Fixed order of simplifications ( #6029 )
2014-08-06 08:39:23 +02:00
Dmitry-Me
644d83e91b
Resolve CID 1037105
2014-08-06 10:05:32 +04:00
Daniel Marjamäki
8bbbb54f94
Refactoring valueFlowSubFunction
2014-08-06 06:33:06 +02:00
Moshe Kaplan
4894d3807d
Improved invalidScanf error message
2014-08-06 06:08:28 +02:00
Daniel Marjamäki
f2fdc4fb14
Merge pull request #385 from Dmitry-Me/resolveIssue1222223
...
Resolve CID 1222223.
2014-08-05 17:48:04 +02:00
PKEuS
8130fda4ae
Implemented support for C++11 uniform initialization in several checks.
2014-08-05 16:11:42 +02:00
PKEuS
f3e0df7501
Support C++11 style initialization with {}:
...
-> Support in setVarId and SymbolDatabase (#4344 )
-> Fixed false positives in unused variable checking (#5491 , #5494 )
Side-effect: Support global variables initialized with brackets (C++03 style) in SymbolDatabase
2014-08-05 15:33:57 +02:00
PKEuS
4207b3cb66
Fixed error message.
2014-08-05 11:59:53 +02:00
PKEuS
804e055eee
New check: initialization by itself in initializer list ( #3982 )
...
Refactorizations:
- Rearranged code in checkclass.cpp to increase readability
- Several fixes for testclass.cpp tests.
2014-08-05 11:50:08 +02:00
Daniel Marjamäki
9eb28cb8af
ValueFlow: Improved analysis of assignments
2014-08-05 08:28:46 +02:00
Daniel Marjamäki
a2f776b1b7
Dead pointer: Added checking for dead pointer usage when pointer alias local variable that has gone out of scope.
2014-08-05 06:24:23 +02:00
Daniel Marjamäki
eac337b955
Fixed Cppcheck warning about 'null pointer dereference or redundant condition'
2014-08-04 15:15:41 +02:00
Daniel Marjamäki
d35ce5f0db
ValueFlow: Better handling of calculated function arguments in valueFlowSubFunction
2014-08-04 12:31:04 +02:00
Daniel Marjamäki
344016f7ab
ValueFlow: Handle string values in valueFlowSubFunction
2014-08-04 12:13:15 +02:00
PKEuS
ac59485e7e
Refactorized CheckAutoVariables::assignFunctionArg():
...
- Splitted message into style message (assigning non-pointers) and warning message (assigning pointers)
- Support operator++/-- (#4793 )
2014-08-04 11:45:24 +02:00
PKEuS
4a3d719386
Fixed recently introduced FP when C-Style casting nullpointers
2014-08-04 11:42:14 +02:00
PKEuS
4c80ca4e8e
Improved cstyleCast check:
...
- Detect casting of literals
- Check initializer lists (#3630 )
2014-08-04 11:21:25 +02:00
Daniel Marjamäki
47a2b35e98
BufferOverrun: Use ValueFlow string values more
2014-08-04 08:25:10 +02:00
Dmitry-Me
8cd6e490d9
Resolve CID 1222223.
2014-08-04 10:00:53 +04:00
Daniel Marjamäki
ab958e7710
Fixed Cppcheck warning
2014-08-04 06:30:20 +02:00
Daniel Marjamäki
79fc549de0
ValueFlow: start adding valueflow handling of strings and pointer aliases
2014-08-03 20:11:22 +02:00
PKEuS
57c055fcc4
Fixed false negative #5985 : default argument values should not affect variable usage checking.
2014-08-03 19:13:37 +02:00
PKEuS
de66ed4071
Added missing message to --errorlist output, changed Id to avoid duplicate
2014-08-02 20:55:59 +02:00
PKEuS
6d5603af45
Increased version to 1.66.99/1.67 dev
2014-08-02 18:07:01 +02:00
Daniel Marjamäki
1c8c26a488
1.66: Set version
2014-08-02 11:58:30 +02:00
PKEuS
e486e8cc62
Updated WiX installer and VS solution to VS12 and Qt5
2014-08-02 11:52:37 +02:00
PKEuS
6d3cb86d2a
Merge pull request #382 from Dmitry-Me/bringDeclarationsCloserToWhereTheyAreNeeded
...
Bring variable declarations closer to where they're first used.
2014-08-02 11:12:34 +02:00
Daniel Marjamäki
f2e3700142
Merge pull request #383 from moshekaplan/patch-1
...
Updated message for strncat usage
2014-08-02 11:10:16 +02:00
Daniel Marjamäki
7237b01979
Fixed Cppcheck warning
2014-08-02 10:07:23 +02:00
Daniel Marjamäki
4dc73e3a5b
Use Token::simpleMatch for simple pattern
2014-08-01 17:47:02 +02:00
Daniel Marjamäki
3f5da22d2b
Tokenizer: Added FIXME for keywords handling
2014-08-01 17:27:35 +02:00
Daniel Marjamäki
a943a0739a
Tokenizer: Don't remove struct member in Tokenizer::simplifyKeyword()
2014-08-01 17:19:08 +02:00
Daniel Marjamäki
f908959196
ValueFlow: improved analysis in for loops to avoid fp
2014-08-01 16:12:57 +02:00
Daniel Marjamäki
544a5957e1
Token: Added utility function getStrSize as a complement to getStrLength
2014-08-01 13:12:18 +02:00
Daniel Marjamäki
404c13ef4b
Fixed ValueFlow --debug output
2014-08-01 09:50:30 +02:00
Daniel Marjamäki
688b798b88
ValueFlow: Cleanup variable
2014-08-01 08:59:07 +02:00
Daniel Marjamäki
57c2e928d1
ValueFlow: Simple multivariable control flow analysis to avoid FP when 'control variable' is used
2014-08-01 07:35:15 +02:00
PKEuS
95afa51b24
Fixed crash #5991 : Don't crash when lambda is incomplete
...
Fixed crash #6004 : Support struct initializations in AST
2014-07-31 23:15:36 +02:00
Moshe Kaplan
e881495eaf
Updated message for strncat usage
2014-07-31 13:51:29 -04:00
Daniel Marjamäki
5de1e35350
CheckBufferOverrun: Fixed minsize checking of string literals. Check sizeof string instead of strlen.
2014-07-30 20:35:21 +02:00
Daniel Marjamäki
25846cf223
ValueFlow: Fix for if/else valueflow analysis
2014-07-30 18:12:33 +02:00
Daniel Marjamäki
473b1bdb2b
Multicondition: Fixed FP when using dynamic_cast
2014-07-30 11:23:09 +02:00
Dmitry-Me
ee180787eb
Bring variable declarations closer to where they're first used.
2014-07-29 13:59:45 +04:00
Daniel Marjamäki
905a383ac2
Merge pull request #381 from Dmitry-Me/checkBooleanFlagFirst
...
Run cheaper check first, don't check the same condition twice.
2014-07-28 18:02:49 +02:00
Daniel Marjamäki
8a1c5d6fce
Fixed #6011 (crash: libreoffice/binfilter svt_enhwmf.cxx)
2014-07-28 16:33:42 +02:00
Daniel Marjamäki
fdfea717c6
Suspicious string comparison: Refactoring using AST. Fixed FP in Lac.
2014-07-28 14:27:35 +02:00
Dmitry-Me
dc03b98e60
Run cheaper check first, don't check the same condition twice.
2014-07-28 14:58:19 +04:00
Robert Reif
90bc59e0fa
Fixed #6009 (Detect type mismatch in printf-like function when type is returned)
2014-07-28 09:16:35 +02:00
Daniel Marjamäki
76020d2ad0
astIsFloat: expression 'floatvar ? 0x40 : 0' is not float
2014-07-26 09:09:58 +02:00
Dmitry-Me
431453f53e
Reuse previously computed values, use more const.
2014-07-25 15:05:13 +04:00
Daniel Marjamäki
216ecd06e1
Fix Cppcheck warning. Make function Preprocessor::readpreprocessor static instead of const.
2014-07-25 12:43:55 +02:00
Dmitry-Me
f104aa237f
Bring declarations closer to where they're needed.
2014-07-24 18:34:13 +04:00
Dmitry-Me
a4d597451b
Resolve CID 1214637.
2014-07-24 16:54:20 +04:00
Dmitry-Me
615eb32fdc
Use temp variables to avoid repeated actions in code.
2014-07-23 18:51:23 +04:00
Dmitry-Me
07c120f1af
Cache option flags and check them first.
2014-07-23 17:06:27 +04:00
Daniel Marjamäki
2e60f30bfc
Merge pull request #372 from Dmitry-Me/dontUseArrayAtWhenItWouldntThrow
...
Use [], not at() when the index is guaranteed to be valid.
2014-07-23 14:15:42 +02:00
Daniel Marjamäki
c5e9da2984
xml dump: add more token attributes
2014-07-21 12:44:53 +02:00
Dmitry-Me
cd13232062
Use [], not at() when the index is guaranteed to be valid.
2014-07-21 10:37:08 +04:00
Daniel Marjamäki
5ae6234729
Fixed #5978 (false positive: Array 'm_pool_vector[-1]' accessed at index 0, which is out of bounds.)
2014-07-20 11:44:25 +02:00
Daniel Marjamäki
1e5eab8f17
xml dump: Added function attribute in scope
2014-07-20 11:44:01 +02:00
Daniel Marjamäki
328cc7b8f5
Fixed #5996 (false positive: Clarify calculation precedence for '+' and '?'.)
2014-07-19 18:29:53 +02:00
Daniel Marjamäki
af2b94e322
Fixed #5826 (Change error message for 'throw in destructor' check)
2014-07-19 03:29:50 +02:00
Daniel Marjamäki
c252885bf8
Merge pull request #369 from Dmitry-Me/useBoolFlagToAvoidComparisonDuplication
...
Use boolean flag to avoid comparison duplication
2014-07-18 18:11:53 +02:00
Daniel Marjamäki
2cc31acabb
Fixed #5922 (FP: passedByValue for std::string::value_type)
2014-07-18 15:51:59 +02:00
Dmitry-Me
fae9d975cf
Use boolean flag to avoid comparison duplication
2014-07-18 13:31:31 +04:00
Daniel Marjamäki
946c139043
Merge pull request #367 from Dmitry-Me/fixVariableCapitalization
...
Fix variable capitalization.
2014-07-18 11:15:17 +02:00
Alexander Mai
55e45add4a
Fix compiler warnings
2014-07-17 20:04:56 +02:00
Dmitry-Me
f995f67a11
Fix variable capitalization.
2014-07-17 12:38:09 +04:00
Daniel Marjamäki
425e7527bb
Merge pull request #366 from Dmitry-Me/useTempVariableToOmitRecomputation
...
Use temp variable to omit recomputing the same value.
2014-07-17 10:27:47 +02:00
PKEuS
8c96cc59c9
Fixed false positive #5976 : Properly handle shift from stream.
2014-07-17 10:03:58 +02:00
Daniel Marjamäki
15bb447fdc
Fixed #5965 (False positive zerodiv - loop iterating over double variable)
2014-07-17 08:44:55 +02:00
Dmitry-Me
c829dff2b9
Use temp variable to omit recomputing the same value.
2014-07-17 10:44:19 +04:00
Daniel Marjamäki
b1e5b015df
xml dump: output some more info in the dump
2014-07-16 15:27:13 +02:00
Daniel Marjamäki
51c2245a07
Merge pull request #364 from Dmitry-Me/tempVariablesAndBetterNames
...
Shorten code by using temp variables, cleanup variable names.
2014-07-16 15:22:11 +02:00
Dmitry-Me
13234a7366
Shorten code by using temp variables, cleanup variable names.
2014-07-14 12:20:00 +04:00
Dmitry-Me
2989f70898
Get rid of tokAt() and strAt() in trivial cases.
2014-07-14 11:44:58 +04:00
Daniel Marjamäki
954400a382
Add simple xml debug output. When both --xml and --debug is used there will be xml debug output.
2014-07-13 17:21:45 +02:00
orbitcowboy
af6f21308f
Tokenizer: Added missing comma in string array initialization (This fixes Coverity-ID: 1226263 Missing comma in a string array initialization).
2014-07-12 12:52:49 +02:00
orbitcowboy
6e5a05104b
Fixed copy and paste error (Coverity-ID: 1226262 Copy-paste error).
2014-07-12 12:48:05 +02:00
Daniel Marjamäki
5bdd197b01
Fixed #5981 (FP: nullPointer on repeated switch)
2014-07-16 09:12:56 +02:00
Daniel Marjamäki
d41ef3a6d0
TemplateSimplifier: Fixed crash caused by null pointer dereference. I don't have a testcase. But the code is suspicious, in the loop we check if tok3 is null and then in the loop head we call tok3->next().
2014-07-15 21:28:52 +02:00
Daniel Marjamäki
c531749d7a
ValueFlow: Small cleanups
2014-07-15 10:36:13 +02:00
Daniel Marjamäki
b6a9c53826
xml dump: fixed some bad xml output in the token list dump
2014-07-14 19:49:31 +02:00
Daniel Marjamäki
2f7b8fe4b2
xml dump: fixed some minor issues in symboldatabase dump
2014-07-14 19:25:30 +02:00
Daniel Marjamäki
84ec573d0a
xml dump: Fixed segfault when dumping symboldatabase variables
2014-07-14 19:17:39 +02:00
Daniel Marjamäki
6732556eb8
xml dump: output a <variables> with all variables
2014-07-14 18:35:15 +02:00
Daniel Marjamäki
2e7a72856a
xml dump: remove duplicate attribute
2014-07-14 18:13:27 +02:00
Daniel Marjamäki
8db5836e3f
Fixed #5982 (Add xml dump)
2014-07-14 15:51:45 +02:00
Daniel Marjamäki
bf5b4d9ece
astyle formatting
...
[ci skip]
2014-07-14 14:38:40 +02:00