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