PKEuS
d93d7401c6
Moved getSourceFilePath(), isC() and isCPP() from Tokenizer to TokenList
...
Conflicts:
lib/tokenize.cpp
2014-06-04 18:36:25 +02:00
PKEuS
6aa88248ac
Fixed timer name
2014-06-04 18:34:45 +02:00
orbitcowboy
8fe163285f
MathLib: Added missing testcase for incdec.
2014-06-04 08:41:30 +02:00
orbitcowboy
60e80b6fb1
Fixed #5885 - fsanitize=undefined: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' in lib/tokenize.cpp.
2014-05-29 18:25:01 +02:00
orbitcowboy
e9144d1a78
Fixed #5890 - crash: wesnoth desktop_util.cpp / unicode.hpp.
2014-05-29 02:58:18 +02:00
Robert Reif
e5ae575ace
Fixed #5867 (invalid debug warnung: Scope::checkVariable : varid0)
2014-06-02 06:18:32 +02:00
Alexander Mai
ad1662a201
#5875 fix 'lib/checksizeof.cpp:142:26: runtime error: member call on null pointer of type 'Token'. Improve error handling in CheckSizeof::checkSizeofForPointerSize()
2014-06-01 22:18:17 +02:00
Daniel Marjamäki
42140b6488
Preprocessor: set error flag when unhandled characters are found so checking can bailout
2014-06-01 11:24:10 +02:00
Martin Ettl
af369b4925
astyle run [ci skip]
2014-05-16 23:01:21 +02:00
amai2012
6f31ce334d
#5875 Fix 'lib/mathlib.cpp:559:43: runtime error: division by zero'. Several fixes to MathLib::divide(): avoid division by zero, handle various representation of 0 value, use 'nan.' instead of '-nan.0'
2014-05-31 18:25:23 +02:00
Daniel Marjamäki
46bf23aa6d
TokenList: added assertion that makes sure the Preprocessor doesn't let through extended ascii wrongly.
2014-05-31 18:02:19 +02:00
amai
98ea1397b3
#5875 clang ubsan errors: lib/checkassignif.cpp:58:34: runtime error: member call on null pointer of type 'Token'
2014-05-31 15:12:04 +02:00
Daniel Marjamäki
66ad3c97b9
Fixed #5857 (strPlusChar: Crash on invalid code 'int+;')
2014-05-31 10:34:00 +02:00
PKEuS
86dede14c0
Merge pull request #327 from simartin/only_fill_if_needed
...
Only fill total_size in CheckBufferOverrun::checkFunctionParameter when useful
2014-05-30 20:56:33 +02:00
Daniel Marjamäki
70b4c945de
Fixed #5874 (False positive: 'opposite conditions in nested if' with arrays)
2014-05-30 19:19:24 +02:00
Simon Martin
f7356dd8c7
Only fill total_size in CheckBufferOverrun::checkFunctionParameter when it's useful.
2014-05-29 23:51:13 +02:00
Simon Martin
139f87af18
Ticket #5615 : Avoid calling the same function n times when once is enough.
2014-05-29 19:58:09 +02:00
Daniel Marjamäki
bc2ba1706b
cleanup redundant valueflow check. if there are no values the getValue will return NULL.
2014-05-28 21:03:16 +02:00
PKEuS
c23afbd04a
Merge pull request #325 from simartin/checkio_types_match_factorize
...
Factorize type name equality checks in CheckIO
2014-05-27 21:46:07 +02:00
Simon Martin
d2223ce419
Factorize type name equality checks in CheckIO.
2014-05-27 19:20:19 +02:00
Simon Martin
966491d40b
Added a test for out-of-bounds character array access.
2014-05-27 16:21:13 +02:00
Daniel Marjamäki
ed78d3e148
Library: Better error reporting when loading fails
2014-05-26 17:00:41 +02:00
PKEuS
1cb14f687f
Merge pull request #322 from simartin/del_useless_fwd_decl
...
Remove unnecessary declaration (one line before the actual definition...)
2014-05-25 23:54:20 +02:00
PKEuS
8f083af1e4
Attempt to fix travis build
2014-05-25 22:11:56 +02:00
Simon Martin
c027c526a9
Remove unnecessary declaration (one line before the actual definition...
2014-05-25 22:04:51 +02:00
PKEuS
a407b55945
Added support for lambdas to AST
...
Fixed bug that return statement left an operand on the stack
2014-05-25 21:55:39 +02:00
PKEuS
04f3caf8e8
Fixed debug message #5159
2014-05-25 14:16:03 +02:00
PKEuS
55c87248ba
Fixed crash on complex cast.
2014-05-24 20:21:08 +02:00
PKEuS
d42275c5f1
Fixed TODO in checkAssignBoolToFloat
2014-05-24 20:06:45 +02:00
Alexander Mai
e6a394d514
CheckBool::checkAssignBoolToFloat() - don't crash on unknown variables
2014-05-24 19:15:43 +02:00
PKEuS
38aaa46804
Stabilized AST:
...
- Fixed broken simplification causing crashs when cast was followed by unary minus (real world examples from arch/parisc/math-emu/ (linux-kernel))
- Stabilized determination of unary and binary operators
2014-05-24 19:05:04 +02:00
Alexander Mai
2c8087e34f
#4375 New check: add style warning about 'double d=false;' Add a new check to CheckBool. Also implement Variable::isFloatingType()
2014-05-24 18:35:49 +02:00
PKEuS
effa38c322
Fixed #5863 (False positive: array index is used before limits check)
2014-05-24 17:50:01 +02:00
Daniel Marjamäki
bb8973aac7
Updated Makefile
2014-05-24 12:54:16 +02:00
PKEuS
a04036337d
Fixed #5860 : Don't show returnTempReference for calculations on unknown types
2014-05-24 12:50:04 +02:00
PKEuS
adf38fcfd0
Further include cleanup
2014-05-24 12:50:04 +02:00
PKEuS
1fc1ff1993
Moved implementation of two functions to new file check.cpp -> Don't include <iostream> everywhere
2014-05-24 12:50:04 +02:00
PKEuS
8f79dc3ff8
Cleaned up includes and forward declarations in checkers:
...
- Removed definitely unnecessary forward declarations (e.g. "class Token"; token.h is already included by check.h, so a definition is unnecessary)
- Removed unused includes
2014-05-24 12:50:03 +02:00
amai2012
00e28de3b7
Merge pull request #315 from simartin/ticket_5823
...
Ticket #5823 : Properly count template parameters in TemplateSimplifier::useDefaultArgumentValues
2014-05-24 11:47:14 +02:00
PKEuS
b78131cfcf
Improved cast detection in AST:
...
-> Make use of it in checkother.cpp
Use tokenizer simplification instead of reimplementation for test suite
2014-05-24 11:29:32 +02:00
PKEuS
b0b0562247
Removed obsolete piece of code from checkbufferoverrun.cpp
2014-05-24 11:29:32 +02:00
Simon Martin
2b809800b6
Ticket #5823 : Properly count template parameters in TemplateSimplifier::useDefaultArgumentValues and handle casts in template parameters' default values.
2014-05-23 23:38:40 +02:00
Simon Martin
fcff8d39d9
Ticket #5816 : Properly handle template'd template parameters in enum initializers.
2014-05-23 21:25:42 +02:00
orbitcowboy
d299cae5ef
Fixed typo in comment, no functional changes [ci-skip]
2014-05-23 22:31:01 +02:00
orbitcowboy
6183f21070
Fixed CID 1037088 Dereference after null check in Tokenizer::simplifyLabelsCaseDefault.
2014-05-23 21:38:56 +02:00
orbitcowboy
7920afdc60
Fixed CID 1037101 Dereference after null check in ExecutionPath::checkScope.
2014-05-23 18:27:34 +02:00
orbitcowboy
85496cfadc
Fixed CID 1192595: Dereference null return value in checkother.
2014-05-23 18:11:44 +02:00
PKEuS
bc0682d1e9
Enhancements related to duplicate expression checking:
...
- Fixed astIsFloat() for complex expressions
- Enhanced support for commutative operators (#5260 )
2014-05-22 21:46:48 +02:00
PKEuS
f7a41057ad
Use AST in CheckIO::checkCoutCerrMisusage() - fixes #3254 .
2014-05-22 20:25:54 +02:00
PKEuS
9dd4ac68c0
Refactorization in CheckNullPointer:
...
- Use AST to detect dereferences
- Added more unit tests
- Removed handling of unknown constructs in CheckNullPointer::isPointerDeRef()
Added link to verbose message cstyleCast.
2014-05-22 19:48:00 +02:00
PKEuS
f1c303d399
Fixed recently introduced verbose message for cstyleCast
...
[ci skip]
2014-05-22 15:46:28 +02:00
PKEuS
6635abbe55
Improved check: Complain about returning reference to literals or reference to calculation result ( #4317 )
2014-05-22 11:39:11 +02:00
orbitcowboy
d19f676547
Fixed travis build warning (Check Internal).
2014-05-22 18:00:06 +02:00
orbitcowboy
ee5cd91d51
MathLib: removed duplicated #include
2014-05-22 17:53:13 +02:00
orbitcowboy
031020ae4a
#Fixed 5485: Wrong simplification of numbers like 1e+007 to 1e+007.0
2014-05-22 17:40:15 +02:00
PKEuS
3275881056
Improved checkBufferOverrun::classInfo ( #4667 )
2014-05-22 09:13:29 +02:00
PKEuS
35528ca708
Added verbose message for "C-style pointer casting" ( #4140 )
2014-05-22 08:57:45 +02:00
Alexander Mai
cccddc20bf
#5843 MathLib::toLongNumber()/MathLib::toULongNumber() now use min/max values for bigint/biguint type in case the number to converted cannot be converted properly
2014-05-21 21:36:17 +02:00
PKEuS
4cad064c3c
Fixed false positive on C code introduced by last commit
2014-05-21 20:36:19 +02:00
PKEuS
d19eabde42
New Check: Compare pointer with '\0' ( #4070 )
2014-05-21 19:12:07 +02:00
PKEuS
cdfed32500
Merged checkSelfAssignment() into checkDuplicateExpression():
...
- Fixed false negatives on self assignments of more complex expressions like "a.b"
- New false negative on self assignment in initialization
- Support this->... pattern in isSameExpression()
- Fixed #5819 : Check type of operands
2014-05-21 18:19:42 +02:00
PKEuS
7b1eca700b
Fixed bug in setVarId: VarIds for member functions defined inline in class were not properly set
2014-05-21 17:30:58 +02:00
PKEuS
d500f50670
Fixed problem in VS solution if spaces are in the solution path
2014-05-21 15:42:05 +02:00
PKEuS
48c3d02fc3
Fixed false positives and false negatives in 'oppositeInnerCondition' (among others: #5808 )
2014-05-21 14:38:41 +02:00
PKEuS
01a0154daa
Fixed false positive #5848
2014-05-21 13:45:36 +02:00
orbitcowboy
e3009bdd0b
Tokenizer:simplifyKeyword(): Improved matching when the static keyword is removed.
2014-05-13 16:47:55 +02:00
orbitcowboy
90c1016c74
Fixed #5842 : remove C99 static keyword between [] in tokenizer.
2014-05-13 16:28:28 +02:00
Alexander Mai
be9a566d48
Refactoring/small corrections to fix warnings from clang -fsanitize=undefined 'member call on null pointer'
2014-05-20 21:55:08 +02:00
orbitcowboy
ac8d283afb
Fixed CID 1214638: Dereference before null check (REVERSE_INULL).
2014-05-12 17:18:51 +02:00
Robert Reif
e993e2927c
Fixed #5831 (FP in 1.65: call of pure virtual function 'throw' in destructor)
2014-05-20 06:10:34 +02:00
PKEuS
d3d3803ae4
Merge pull request #312 from matthiaskrgr/travis
...
travis: compile one pair of jobs with -DCHECK_INTERNAL and run --enable=internal,...
2014-05-19 22:36:45 +02:00
PKEuS
d1c4777053
Fixed two bugs in AST compilation ( #5830 ):
...
- Correctly parse operators .* and ->*
- Support empty branch in ternary expression (a?:c)
2014-05-19 21:54:59 +02:00
Matthias Krüger
879023b6b2
travis: compile one pair of jobs with -DCHECK_INTERNAL and run --enable=internal,...
...
suppress warnings in testtoken.cpp
fix warnings in valueflow
2014-05-19 21:44:00 +02:00
PKEuS
5c566e838c
Fixed false positive "multiplySizeof" in TortoiseSVN
2014-05-19 20:57:13 +02:00
PKEuS
8cb1f09fc2
Silenced travis errors (avoid false positive)
2014-05-19 20:56:05 +02:00
PKEuS
09e03fa6ef
Fixed some complaints of PVS Studio
2014-05-19 14:37:54 +02:00
Philipp Kloke
ed7d0b321b
Bugfixes for AST and AST testing:
...
- Validate AST in test suite: Check for operand1 being set if operand2 is non-zero
- Fixed buggy unit tests in AST
- Fixed detection unary operator* after return statement (MPC-HC false positive)
2014-05-19 11:17:37 +02:00
Mark de Wever
d6db261213
Fixed #5827 (Invalid token match patterns)
2014-05-19 06:31:38 +02:00
PKEuS
5fbd58d98d
Fixed messages of CheckInternal, fixed a false positive.
2014-05-18 20:39:52 +02:00
PKEuS
9cb544241d
Internal checking is now enabled by the macro CHECK_INTERNAL
2014-05-18 19:50:06 +02:00
PKEuS
e713ad45cb
Refactorizations:
...
- Simplified pattern ".|->" to "."
- Use nextArgument() where appropriate
2014-05-18 17:07:21 +02:00
PKEuS
b162560755
Refactorizations:
...
- Removed some duplicate nullpointer checks
- Simplified tok->link() on '<' usage.
2014-05-18 17:07:21 +02:00
PKEuS
780719665f
Fixed crash when checking tinyxml introduced by previous commit
2014-05-18 13:40:49 +02:00
PKEuS
20753f4697
Refactorization: Use AST in CheckOther::checkRedundantCopy(), CheckOther::clarifyStatement() and CheckPostfixOperator::postfixOperator().
2014-05-18 13:00:58 +02:00
PKEuS
683d0b7e82
Partially rewritten AST compilation:
...
- More straightforward approach for handling right-to-left associativity
- More straightforward approach to handling unary operators
- Improved handling of brackets
This fixes #5784 , #5795 , #5797 , #5799 , #5810 and a bunch of other problems
2014-05-18 12:10:39 +02:00
Alexander Mai
91e7116de1
Fix regression from first attempt fixing #5811 ( 9dce9bddcb
)
2014-05-17 19:14:29 +02:00
Alexander Mai
9dce9bddcb
#5811 false postive: (error) Null pointer dereference
2014-05-17 18:18:20 +02:00
Simon Martin
69d294c6c4
Ticket #5816 : Skip typename in template arguments for enum initializers.
2014-05-17 08:50:12 +02:00
Simon Martin
92cc17110d
Ticket #5814 : Handle A::B as template parameter for enum initializers.
2014-05-15 21:52:57 +02:00
Simon Martin
e61e1cb13d
Ticket #5786 : Properly handle cv-qualified member pointers as template parameter.
2014-05-14 22:27:31 +02:00
Daniel Marjamäki
7ecdb30308
Fixed #5771 (false positive: (warning) When using 'char' variables in bit operations, sign extension can generate unexpected results.)
2014-05-13 15:53:31 +02:00
Alexander Mai
146bf11aa7
#5793 - False positive: Deallocation of an auto-variable (at reference notation)
2014-05-12 19:53:49 +02:00
PKEuS
a3bb8bf39c
AST: Parse ternary and assignment operators as right-to-left and on the same precedence level
2014-05-11 17:50:58 +02:00
PKEuS
70dfb55f21
Simplified some Token::Match patterns
2014-05-11 17:50:58 +02:00
Alexander Mai
6fe2f8b01b
#5782 Endless recursion in CheckClass::checkReturnPtrThis(). Break endless recursion by remembering the callstack (missing header file)
2014-05-11 12:27:43 +02:00
Alexander Mai
b139ae3209
#5782 Endless recursion in CheckClass::checkReturnPtrThis(). Break endless recursion by remembering the callstack
2014-05-11 12:26:24 +02:00
Daniel Marjamäki
0dfbbd0f80
Fixed #5479 (Tokenizer: don't remove parentheses in code 'a<b<c>>(2)')
2014-05-11 08:22:28 +02:00
Daniel Marjamäki
827cfac91e
Refactoring of CheckOther::checkModuloAlwaysTrueFalse using AST
2014-05-10 20:49:29 +02:00
Daniel Marjamäki
8cc1f664d8
Uninitialized member variable: Fixed false negative when struct is read
2014-05-10 20:20:55 +02:00
Daniel Marjamäki
4c344adcf1
Uninitialized struct member: fixed false negative when struct assignment is seen
2014-05-10 19:56:44 +02:00
PKEuS
04fbbdb5e8
Refactorized CheckBufferOverrun::arrayIndexThenCheck() and fixed false negative
2014-05-10 13:00:44 +02:00
PKEuS
59418e605f
Increased version number to 1.65.99/1.66 dev.
2014-05-10 12:57:33 +02:00
Daniel Marjamäki
c0131eea9e
1.65: Set version
2014-05-10 12:02:06 +02:00
Daniel Marjamäki
f31ec37d52
Fixed 2 Cppcheck warnings. Function can be static|const
2014-05-10 11:49:14 +02:00
Daniel Marjamäki
4e2c0617d3
Merge pull request #303 from simartin/ticket_5297
...
Ticket #5297 : simplifyCalculations should pass once more on simplified tokens
2014-05-10 10:18:29 +02:00
Simon Martin
1e4902cb65
Ticket #5297 : simplifyCalculations should pass once more on tokens being simplified.
2014-05-10 09:37:56 +02:00
Daniel Marjamäki
2905593cf6
Merge pull request #302 from simartin/ticket_5774
...
Ticket #5774 : Properly handle "typename..." in template parameter list.
2014-05-10 09:32:06 +02:00
Simon Martin
46d8d81176
Ticket #5774 : Properly handle "typename..." in template parameter list.
2014-05-09 22:20:22 +02:00
PKEuS
edd84c0906
Fixed #5773 : Don't prepend "std::" to function definitions
2014-05-09 21:58:28 +02:00
PKEuS
c0fc47643f
Fixed false positive #5772 : Use AST to check if modulo operation is preceded by an arithmetical operation.
2014-05-09 21:58:28 +02:00
Daniel Marjamäki
1541e27e4a
Fixed #5533 (False positive: 'Assignment of function parameter has no effect outside the function.')
2014-05-09 18:43:29 +02:00
Daniel Marjamäki
cb43bee10d
Same expression: don't warn for same expressions when there is assignment
2014-05-09 06:16:27 +02:00
Simon Martin
512e22d1ba
Ticket #5315 : Memory leak analysis confused by ((variable).attribute) notation.
2014-05-08 20:58:24 +02:00
Daniel Marjamäki
25f40b8b97
Merge pull request #298 from simartin/clang_s-getFlag_warn
...
Silence clang -Wsign-conversion warning with Token::setFlag.
2014-05-08 15:54:25 +02:00
Daniel Marjamäki
331d7e2e42
Merge pull request #297 from simartin/ticket_5605_5759
...
Fix ticket #5605 (take 3)
2014-05-08 15:51:42 +02:00
Simon Martin
53d5df8cef
Silence clang -Wsign-conversion warning with Token::setFlag.
2014-05-08 14:16:43 +02:00
Simon Martin
2a6acdf357
Ticket #5605 : Don't consider '>' as a default template parameter value. Don't choke on template parameters with erroneous default values.
...
Ticket #5759 : Properly handle pointers to class members in template parameter lists.
Ticket #5762 : Handle template specialization tokens.
2014-05-08 13:54:56 +02:00
Daniel Marjamäki
9fc8bdcbac
Fixed #5770 (AST: better handling of 'a.b[c.d]==0')
2014-05-08 06:48:53 +02:00
Daniel Marjamäki
4710c5c4f1
Merge pull request #296 from mpaladin/master
...
Fix redundantConditionError check description
2014-05-07 16:01:26 +02:00
Robert Reif
0bdecfd9cb
Fixed #5767 (move bool Variable flag into flag variable)
2014-05-07 15:59:21 +02:00
Massimo Paladin
5e996bc63b
Fix redundantConditionError check description
2014-05-07 14:54:50 +02:00
Daniel Marjamäki
5ad3ac2653
Fixed #5695 (FP: Mismatching assignment and comparison)
2014-05-06 19:35:47 +02:00
Daniel Marjamäki
b354de6b23
Fixed #5750 (FP:Opposite conditions in nested 'if' blocks lead to a dead code block)
2014-05-06 16:15:12 +02:00
Robert Reif
2d2847ddbd
Fixed #5764 (Store Token flags in a single variable)
2014-05-06 06:35:48 +02:00
Daniel Marjamäki
6e25280c90
Reverted fix for #5605 since it cause this crash: #5759
2014-05-05 21:11:47 +02:00
Daniel Marjamäki
d17f926422
Merge pull request #294 from simartin/typo_520aaf71
...
Reinstate error message.
2014-05-04 20:49:01 +02:00
Robert Reif
ae96491d6c
Fixed #5756 (declspec(nothrow) not supported)
2014-05-04 20:47:20 +02:00
Daniel Marjamäki
7d583e639c
AST: Fixed handling of '(((typeof(x))*)0)'
2014-05-04 18:36:04 +02:00
Simon Martin
8519a954a0
Reinstate error message.
2014-05-04 17:06:38 +02:00
Daniel Marjamäki
42b85088c5
Double free: Improved handling of noreturn functions. Partial revert of previous fix.
2014-05-04 13:11:21 +02:00
Daniel Marjamäki
636a15ac55
Doublefree: Fixed FP when exit() is called
2014-05-04 12:02:55 +02:00
Daniel Marjamäki
5edb6092a1
Merge pull request #293 from simartin/ticket_5709
...
Ticket #5709 : Comma operator not properly tokenized.
2014-05-04 11:46:04 +02:00
Robert Reif
888fd44039
Fixed #5609 (Wrong warning: %zu requires 'size_t' - but type is 'std::size_t')
2014-05-04 07:55:23 +02:00
Simon Martin
b03f36cd71
Ticket #5709 : Comma operator not properly tokenized.
2014-05-03 21:35:04 +02:00
Daniel Marjamäki
1903d95015
Fixed #5661 (--suppress=missingInclude has no effect)
2014-05-03 19:31:15 +02:00
Daniel Marjamäki
ed1d63ffc0
Fixed #5636 (FP: matrix out of bounds)
2014-05-03 18:12:06 +02:00
Daniel Marjamäki
2f3f42d7f1
astyle formatting
...
[ci skip]
2014-05-03 18:10:49 +02:00
Simon Martin
ffe6a0be2b
Ticket #5605 : Don't consider '>' as a default template parameter value. Don't choke on template parameters with erroneous default values.
2014-05-03 16:26:14 +02:00
Daniel Marjamäki
5a23b739da
ValueFlow: Improved bailout when variable is reassigned
2014-05-03 12:49:07 +02:00
Daniel Marjamäki
4b7aaba159
AST: assignment operators are executed from right to left
2014-05-03 12:08:42 +02:00
Alexander Mai
d3e8bbdc51
#5618 False positive: (performance) Use const reference for 'temp' to avoid unnecessary data copying. - redundantCopyLocalConst/CheckOther::checkRedundantCopy() is prone to false positives. As a quick fix that check becomes inconclusive.
2014-05-02 20:09:38 +02:00
Robert Reif
7d762ca9f7
Made 'unhandled exception' inconclusive and style message. #5751
2014-05-02 06:57:23 +02:00
Daniel Marjamäki
fadc27092e
Fixed #5752 (FP (error) Possible null pointer dereference)
2014-05-01 15:15:26 +02:00
Robert Reif
f6aaf6cc0d
Unhandled exceptions: Dont warn when there are unhandled exceptions in main() function. #5751
2014-05-01 13:41:01 +02:00
Alexander Mai
d2ebd718a9
#5691 False positive: autovarInvalidDeallocation - function name 'delete' in C code
2014-05-01 07:32:37 +02:00
PKEuS
ab4f58a146
Partially reverted 1317063b21
. enum class is not part of the common subset of supported C++11 functions of the compilers supported by cppcheck. ( Fixes #5745 )
2014-04-30 21:06:01 +02:00
PKEuS
71264fb672
Fixed assertion failure in VS debug mode
2014-04-30 21:06:01 +02:00
Alexander Mai
a25cb53c19
#5751 - Warning unhandledExceptionSpecification is issued even if warnings are not enabled
2014-04-30 19:33:17 +02:00
orbitcowboy
e48550d8d7
Merge branch 'master' of https://github.com/danmar/cppcheck
2014-04-23 01:24:01 +02:00
Alexander Mai
4815e3c4c5
Fix some segmentation faults seen while reducing #5743 (sorry, no test cases supplied)
2014-04-29 20:16:50 +02:00
Daniel Marjamäki
b5e023a46c
Fixed #5472 (sizeof not handled as operator with respect to null pointer dereference)
2014-04-29 20:09:11 +02:00
Daniel Marjamäki
fc24d491cc
Fixed #5560 (false positive: C-style pointer casting)
2014-04-29 06:21:30 +02:00
Daniel Marjamäki
648479d909
AST: Fixed tree for 'a.b[5]'
2014-04-29 06:09:26 +02:00
Daniel Marjamäki
36895674ce
Refactoring. Simplified condition using Token::Match.
2014-04-29 04:45:45 +02:00
Robert Reif
4de9e29adc
Fixed #5706 (operators with noexcept broken)
2014-04-29 04:37:13 +02:00
Daniel Marjamäki
1233d8e47f
Fixed #5657 (false positive: (error) Possible null pointer dereference: p)
2014-04-28 15:54:54 +02:00
Daniel Marjamäki
3300d39854
Fixed #5721 (valueFlowBeforeCondition: stop when goto label is seen)
2014-04-28 06:21:48 +02:00
Alexander Mai
ead3f28e06
Small enhancements for doxygen
2014-04-27 21:42:10 +02:00
Daniel Marjamäki
9c74d914d7
Fixed #5667 (Tokenizer: simplify 'void (X::*f)()' to 'void *f')
2014-04-27 19:49:21 +02:00
Daniel Marjamäki
d279f3fb41
Fixed #5736 (AST: proper handling of 'a=(b).c;')
2014-04-27 18:03:50 +02:00
Daniel Marjamäki
9f2e37da37
AST: fixed 'a.b++' and '*c[5]--'
2014-04-27 16:02:24 +02:00
PKEuS
ecec4b0b46
Fixed false positive #5187 : arithOperationsOnVoidPointerError when referencing void*
2014-04-27 12:18:33 +02:00
PKEuS
866ab1ce14
Fixed false positive #5689 : Care about usage of return values of memory functions
2014-04-27 12:18:33 +02:00
PKEuS
ea23a0467b
Fixed false positive #5732 : autovarInvalidDeallocation on pointer to array
2014-04-27 12:18:33 +02:00
Daniel Marjamäki
bde6698bcd
Fixed #5731 (False positive with opposite conditions)
2014-04-27 10:21:20 +02:00
Daniel Marjamäki
7317785e32
astyle formatting
...
[ci skip]
2014-04-27 10:20:21 +02:00
Alexander Mai
17ec0af6a7
#5734 A FP literalWithCharPtrCompare was issued upon comparison with a char referenced within a string literal
2014-04-27 09:40:13 +02:00
Alexander Mai
520aaf71b8
Fix some doxygen comments and add shortcut for tok==NULL to Token::simpleMatch()
2014-04-27 09:32:02 +02:00
Alexander Mai
1317063b21
Fix some more (clang++) compiler warnings
2014-04-26 20:44:21 +02:00
Robert Reif
ca9386859b
Tokenizer: replace ') const| {' pattern to detect function start
2014-04-26 18:31:56 +02:00
Robert Reif
cd6332d960
Tokenizer: replace ') const| {' pattern to detect function start
2014-04-26 18:30:09 +02:00
Alexander Mai
b5c580a59e
Fix some clang warnings - most related to semantic doxygen errors
2014-04-26 16:17:26 +02:00
Alexander Mai
b74e997435
Fix false positive nullPointer messages within sqlite3 after goto by adding a suitable bailout inside valueFlowAfterAssign()
2014-04-26 14:41:28 +02:00
Daniel Marjamäki
11856b51aa
AST: Fixed handling of 'a=b(c**)+1'
2014-04-26 13:32:08 +02:00
Daniel Marjamäki
c34616a6ba
AST: Fixed handling of 'a = b.c[++(d.e)];'
2014-04-26 13:16:34 +02:00
Frank Zingsheim
ffa55bbaa0
Fixed #5725 (FP: multicondition Expression is always false because 'else if' in pngwrite.cxx (LibreOffice))
2014-04-26 11:59:38 +02:00
Daniel Marjamäki
853d56030b
Fixed #5559 (false positive: (error) Possible null pointer dereference: pSTRunner)
2014-04-26 11:27:58 +02:00
Reijo Tomperi
ae23ab64b7
Change encoding to UTF-8 for two header files that were not using UTF-8.
2014-04-26 00:41:33 +03:00
Daniel Marjamäki
8602d13dc9
Fixed #5722 (AST: wrong handling of 'x = ((a[i])->getx)();' - the 'x' is an operand of the =)
2014-04-25 06:06:54 +02:00
Dmitry-Me
a7c7b00407
Reuse variable value, return earlier.
2014-04-24 12:24:40 +04:00
Daniel Marjamäki
9406f3428a
IncompleteStatement: Fixed false positive when '({..})' blocks are used
2014-04-24 06:32:29 +02:00
Alexander Mai
5c98e4d039
Merge branch 'master' of https://github.com/danmar/cppcheck
2014-04-23 20:50:48 +02:00
Alexander Mai
9412f9d216
#5717 Segmentation fault when providing multiple --include=/path/to/header arguments.
2014-04-23 20:50:16 +02:00
Daniel Marjamäki
d144197d7e
Fixed segfault
2014-04-23 19:49:16 +02:00
Daniel Marjamäki
aea528c763
enum: don't simplify enum constant that is assigned
2014-04-23 17:10:17 +02:00
Daniel Marjamäki
272fcc18d8
Don't warn about redundant number statement in '({ do_something(); 0; })'
2014-04-23 16:23:19 +02:00
Dmitry-Me
9b74d43473
Rename local variable plus return a bit earlier on edge condition.
2014-04-23 11:18:09 +04:00
Frank Zingsheim
87354bf9d2
Fixed #5707 (false negative: unreachable code is not detected (code after return))
2014-04-23 07:58:43 +02:00
Daniel Marjamäki
3c5cf299e3
Fixed #5708 (Improve oppositeInnerCondition)
2014-04-23 07:57:13 +02:00
orbitcowboy
a6af8f5dcf
#5748 : Fixed FP (wrongmathcall) do not warn if an object calls a function foo.log(0).
2014-04-23 01:23:38 +02:00
Daniel Marjamäki
fe80f858d1
ValueFlow: Improved analysis in the valueFlowAfterAssign
2014-04-22 16:10:20 +02:00
Alexander Mai
2c3807f089
#5703 - Segfault recursive loop - Patch by zingsheim
2014-04-21 22:13:02 +02:00
Alexander Mai
623e5db0b2
#5702 crash: clang: test/Parser/cxx0x-member-initializers.cpp (bailout withn an internal error)
2014-04-21 21:44:17 +02:00
Mark de Wever
6f3e3f5e2e
Fixed #5701 (FP for std::unordered_map::operator[]; there is no const version)
2014-04-21 16:39:44 +02:00
Daniel Marjamäki
52e0e4453b
Fixed #5646 (FP: pointer to array is not assigned a value.)
2014-04-21 16:14:49 +02:00
Daniel Marjamäki
c98beafb6d
Fixed #5675 (wrong AST generated for 'a>>=b')
2014-04-21 13:05:34 +02:00
Daniel Marjamäki
a202956471
Uninitvar: Refactoring. Use AST instead of token matching to see if variable is used in RHS of assignment.
2014-04-21 12:01:02 +02:00
Daniel Marjamäki
04cd261ee2
Fixed #5664 (false positive: (error) Uninitialized variable: j (Comma operator in for loop))
2014-04-21 10:32:29 +02:00
Daniel Marjamäki
0ced16d17a
CheckExceptionSafety: Fixed crash when a function is missing function scope
2014-04-21 08:01:01 +02:00
Robert Reif
6ff5de2118
Fixed #5697 (Check for throw in __attribute__((nothrow)) function)
2014-04-20 20:40:55 +02:00
Daniel Marjamäki
01d14d0388
Library: Refactoring alloc/dealloc functions. Normally the token should be passed so extra validation can be made
2014-04-20 14:59:16 +02:00
Daniel Marjamäki
5fc43f85b1
ValueFlow: Refactoring. Created utility function isVariableChanged()
2014-04-20 14:21:43 +02:00
Daniel Marjamäki
44a66e6a5a
Fixed #1416 (false negative resource leak when calling fdopen)
2014-04-20 10:50:32 +02:00
Robert Reif
36f4431481
Fixed #4800 (Check unhandled exceptions)
2014-04-20 08:58:36 +02:00
Daniel Marjamäki
0c5707ebf1
Fixed #5512 (library (memory): extending standard free deallocator with allocators in custom cppcheck configuration file)
2014-04-19 13:15:06 +02:00
Alexander Mai
96d2666a6c
Fix crash in SymbolDatabase - errorLogger may be 0
2014-04-18 21:19:49 +02:00
Alexander Mai
aecb072fc6
Merge branch 'master' of https://github.com/danmar/cppcheck
2014-04-18 20:42:46 +02:00
Alexander Mai
7d9ec01bdc
#5593 - hang or --report-progress broken (does not report progress) : add reportProgress() call to SymbolDatabase
2014-04-18 20:42:22 +02:00
Daniel Marjamäki
2d645f57b9
Fixed #5576 (false positive: (POSIX) (error) Resource leak: sockfd)
2014-04-18 18:18:47 +02:00
Daniel Marjamäki
a9943fe6d0
Fixed #5525 (Closing a socket file descriptor gives an error: Mismatching allocation and deallocation)
2014-04-18 17:05:44 +02:00
Daniel Marjamäki
b909aa0e4f
CheckMemoryLeak: moved 'popen' into posix scope
2014-04-18 16:30:16 +02:00
Daniel Marjamäki
56eb717b8a
Fixed #5656 (false positive: (error) Possible null pointer dereference: f)
2014-04-18 16:10:18 +02:00
Daniel Marjamäki
6146c8f5bb
Tokenizer: Fixed bad simplifyComma for code 'return a ? b = c , d : e ;'
2014-04-18 13:38:48 +02:00
Alexander Mai
ccba934cb1
#5684 The scope of the variable 'p' can be reduced - But it can not.
2014-04-17 21:32:56 +02:00
Daniel Marjamäki
064844f8db
Tokenizer: Fixed bad simplifyComma for code 'a ? b = c , d : e ;'
2014-04-17 18:47:55 +02:00
Daniel Marjamäki
8d5a9893d5
Fixed #5682 (False positive: (style) Same expression on both sides of '&&')
2014-04-16 16:04:46 +02:00
Daniel Marjamäki
5c116c622d
AST: Fixed iscast detection in '*((DWORD*)&buf[0])'
2014-04-15 15:46:26 +02:00
orbitcowboy
3d0217b69e
Implemented a slower but shorter version of MathLib::isNullValue() as suggested by PKeuS. Removed not needed test cases. Improved doxygen documentation for MathLib::IsNullValue().
2014-04-14 05:27:38 +02:00
Daniel Marjamäki
28751c8ad0
astyle formatting
...
[ci skip]
2014-04-15 06:32:25 +02:00
Daniel Marjamäki
4b6164087e
Use constant instead of magic number for AST recursion limit
...
[ci skip]
2014-04-15 06:31:09 +02:00
Daniel Marjamäki
cb830cb999
Code cleanup of stack depth tracking. Replaced class with simple POD variable.
2014-04-15 06:18:15 +02:00
PKEuS
076f7a7542
Fixed some coverity findings about dead code, fixed a misleading comment
2014-04-14 22:46:51 +02:00
Alexander Mai
ac24635056
Convert MathLib::toLongNumber() from template member function to toLongNumber() and toULongNumber() to avoid various problems compiling with Visual Studio
2014-04-14 20:30:38 +02:00
Daniel Marjamäki
5ee85ee88a
ValueFlow: Improved handling of bitand against a single-bit integer literal
2014-04-14 06:45:39 +02:00
Alexander Mai
1ef99e2662
Try to avoid compiler warning for unary minus operator inside MathLib::toLongNumber<biguint>()
2014-04-13 19:20:44 +02:00
Mark de Wever
b4b340b7be
Fixed #5677 (Fix overzealous substr() warning)
2014-04-13 19:04:35 +02:00
PKEuS
dbf2c44a81
Simplified check registration:
...
- Use sorted insert instead of calling std::list<Check*>::sort() on each insertion
- Removed DJGPP/__sun hack in check.h (should be obsolete by our compiler requirements for C++11
2014-04-13 13:35:15 +02:00
Alexander Mai
40be775efa
#5592 (fix implementation detail to avoid warnings from cppcheck)
2014-04-13 13:08:38 +02:00
Daniel Marjamäki
79942df842
Fixed #5602 (false positive on std::vector - after unknown macro around the function header)
2014-04-13 13:05:30 +02:00
Alexander Mai
547803f581
#5592 - crash: gcc: testsuit: gcc.c-torture/compile/limits-declparen.c (Limit stack depth below createAst()
2014-04-13 12:47:54 +02:00
PKEuS
9bfc2b618b
Fixed crashes random crashes in multithreading caused by useless creation of CheckUnusedFunctions instance per thread.
2014-04-13 11:56:38 +02:00
Alexander Mai
73fc3d6a13
#5300 - Invalid encoding in XML output (use escape sequence string for non-printable characters)
2014-04-13 09:50:57 +02:00
Philipp Kloke
c1c1ded766
Refactorized CheckStl::pushback():
...
- Use method from CheckNullPointer to find pointer dereference
- Replaced indendation counter by symboldatabase usage
2014-04-12 23:41:58 +02:00
Philipp Kloke
dfd9d32c4b
Refactorization: Removed whitespaces at the end of a token
...
Removed a redundant 'void'
2014-04-12 23:41:46 +02:00
Philipp Kloke
ddf34440b6
Refactorization: Replaced several Token::findmatch calls by symboldatabase usage
2014-04-12 23:41:46 +02:00
Philipp Kloke
776ad32a0b
Refactorized CheckStl::redundantCondition():
...
- Use symboldatabase
- Support erase() method
2014-04-12 23:41:46 +02:00
PKEuS
8cb3b13e56
Support "else if" and do-loop in CheckStl::checkDereferenceInvalidIterator()
2014-04-12 20:03:07 +02:00
PKEuS
e8ac355b39
Refactorized iterator checking:
...
- Fixed false positive #5669
- Use symboldatabase in CheckStl::pushback()
- Improved support for erase on std::vector and find
2014-04-12 20:03:07 +02:00
Martin Ettl
82092e412a
MathLib::isNullValue(): Fixed bug in detecting zero values. Improved test coverage of MathLib::IsNullValue().
2014-04-12 02:14:50 +02:00
Daniel Marjamäki
9d51bfd015
Fixed #5397 (False positive: Same expression on both sides of '&')
2014-04-12 16:06:31 +02:00
PKEuS
7ffc313748
Save "->" in Token::originalName if simplified to "."; Fix false positive #4890 .
2014-04-12 12:04:56 +02:00
PKEuS
9c921ab657
Fixed handling of member function pointers in setVarId and SymbolDatabase ( #4577 )
2014-04-12 12:04:55 +02:00
PKEuS
83f4657e69
Fixed remaining issue in #3503 : Member function taking a function pointer must not be "simplified" to a variable initialization
2014-04-12 12:04:55 +02:00
PKEuS
92839ab4d2
Refactorizations:
...
- Rearranged members of Value to reduce structures size
- Removed redundant ctor of Value
- Fixed VS warning in tokenize.cpp
2014-04-12 12:04:55 +02:00
Alexander Mai
718e42f5ca
Fix some clang warnings about type conversions
2014-04-11 23:35:53 +02:00
Alexander Mai
6da6508913
Extract new function MathLib::isDec() our of isInt()
2014-04-11 22:15:25 +02:00
orbitcowboy
6be53376f4
MathLib:IsNullValue(): removed commented out code.
2014-04-11 01:28:16 +02:00
orbitcowboy
9c08885caf
MathLib:IsNullValue(): using a Finite State Machine to determine a string value contains a numeric NULL value. The NULL value can be Integer, Binary, Hex, Octal. The corresponding unit test cases are also included.
2014-04-11 01:27:05 +02:00
Philipp Kloke
1fafc7f4dc
Refactorization: use MathLib::isNullValue in CheckOther::checkMemsetInvalid2ndParam(); Fixed it to support also float literals like "0.f"
2014-04-11 14:17:36 +02:00
Philipp Kloke
cf30fab413
Refactorized inefficient usage of Token::findmatch in two checks in checkother.cpp
2014-04-11 14:17:35 +02:00
Philipp Kloke
20c3a5baf0
Refactorized switchCaseFallThrough: Removed lots of obsolete code
2014-04-11 14:17:35 +02:00
Robert Reif
7eb3988415
Fixed #5659 (False negative: mismatching allocation / deallocation whith using namespace)
2014-04-11 05:40:37 +02:00
Alexander Mai
ab2f8bfba3
Tidy up MathLib::isInt() - using a state machine approach
2014-04-10 22:46:55 +02:00
PKEuS
b10fce304e
Don't suggestInitializationList for arrays used as initializer ( #5640 )
2014-04-10 22:28:02 +02:00
PKEuS
2aaae741dd
Fixed cppcheck message
2014-04-10 21:58:53 +02:00
PKEuS
c33498fa0b
Fixed false positive redundantAssignment when operator() is called ( #5568 )
2014-04-10 21:56:30 +02:00
Alexander Mai
559a2bc2c8
Avoid FP exceptThrowInNoThrowFunction and exceptThrowInNoexecptFunction
2014-04-10 21:55:49 +02:00
PKEuS
e39b89efc3
Throw more syntaxErrors from SymbolDatabase, fixing #5663
2014-04-10 20:11:03 +02:00
PKEuS
25b1f2f541
Fixed #5643 (crash on address-of-operator& in condition) as suggested by serval2412
2014-04-10 19:49:21 +02:00
Alexander Mai
e19129a409
Fix #4724 (Error in calculation shift operation: wrong sign: 1UL << 63)
2014-04-10 19:22:14 +02:00
Robert Reif
b0af67f369
Fixed #5486 (false positive: (warning) %zd in format string (no. 1) requires 'ssize_t' but the argument type is 'ssize_t {aka long}'.)
2014-04-10 17:25:11 +02:00
Robert Reif
847d28d283
Fixed #5638 (is there any plan to check noexcept correctness?)
2014-04-10 16:17:10 +02:00
Robert Reif
4ae204e46b
Fixed #5659 (False negative: mismatching allocation / deallocation whith using namespace)
2014-04-10 16:11:11 +02:00
Daniel Marjamäki
c8ae1e4751
Fixed #5658 (false positive: (error) Uninitialized variable: s)
2014-04-10 15:59:37 +02:00
Daniel Marjamäki
9b1d058410
Fixed #5660 (false positive: (error) Uninitialized variable: result)
2014-04-10 06:40:53 +02:00
Daniel Marjamäki
59cd1879db
Fixed #5467 (False positive incorrectly claiming use after erase)
2014-04-09 10:32:56 +02:00
Alexander Mai
89dc652af9
#5631 Typo and misleading error message in negativeMemoryAllocationSize
2014-04-08 20:23:00 +02:00
Daniel Marjamäki
d7e2e3bd5e
Fixed #5502 (FP: Dereferencing 'b' after it is deallocated / released)
2014-04-06 18:45:24 +02:00
Daniel Marjamäki
456e33fc7b
Code cleanup
...
[ci skip]
2014-04-05 08:27:52 +02:00
Daniel Marjamäki
049d68ae7d
AST: Fixed bad syntax tree for 'if (x()[0]==1);'
2014-04-05 08:03:24 +02:00
Alexander Mai
173a2e9ea2
#5641 fix crash within CheckClass::initializeVarList()
2014-04-04 22:13:51 +02:00
Daniel Marjamäki
0788e64eb8
Removed unused function expressionsHasSideEffects()
2014-04-04 07:04:19 +02:00
Daniel Marjamäki
8dcb3bae47
Refactoring checks of overlapping conditions in if and else-if
2014-04-03 19:35:50 +02:00
Daniel Marjamäki
1a83338faf
Refactoring. Created utility function isOppositeCond()
2014-04-03 17:08:42 +02:00
Daniel Marjamäki
110f956029
code cleanup for invertOperatorForOperandSwap()
2014-04-03 16:22:07 +02:00
Daniel Marjamäki
ffac614f7e
Fix Cppcheck warning. Use reference to avoid redundant data-copy
2014-04-03 16:16:39 +02:00
PKEuS
d9358de8b4
Refactorization: Use templates and rValue references
...
-> Performance gain of up to 15% on entire checking time (depends on setup; Result was checked with VS12 (x64), matchcompiled version, ran on tinyxml and cppcheck itself)
2014-04-03 15:03:37 +02:00
Daniel Marjamäki
dcc245be9e
Merge pull request #283 from Dmitry-Me/bracemacroparameter
...
Macro parameter was not braced.
2014-04-03 07:22:34 +02:00
Daniel Marjamäki
9f80f3a4e8
Small cleanups in the code
2014-04-03 06:37:02 +02:00
Daniel Marjamäki
a115bbbbb5
Refactoring CheckOther::checkCharVariable() using AST
2014-04-03 06:27:29 +02:00
Daniel Marjamäki
a6557f8c74
Null pointer: Fixed false positive discovered by Travis when self-checking cppcheck
2014-04-02 19:39:42 +02:00
Daniel Marjamäki
189360ae20
ValueFlow: changed back bailout message
2014-04-02 19:22:40 +02:00
Daniel Marjamäki
f13be7fb6c
Travis: Fixed possible null pointer dereference reported by travis
2014-04-02 19:08:44 +02:00
PKEuS
a6e134e811
Removed compatibility code for Borland and Sun compilers which should not be necessary for a compiler supporting C++11 (as required by cppcheck).
2014-04-02 17:26:59 +02:00
Dmitry-Me
3244a61cac
Macro parameter was not braced.
2014-04-02 09:25:13 +04:00
Daniel Marjamäki
3c64c70ce2
ValueFlow: Added utility functions getValueLE and getValueGE to simplify usage
2014-04-02 06:49:28 +02:00
Daniel Marjamäki
bc9bb17025
Refactor CheckOther::oppositeInnerCondition() using AST and isSameExpression()
2014-04-02 16:54:01 +02:00
PKEuS
e9411e05ba
Refactorized inefficient usage of std::string and const char[].
2014-04-02 13:56:34 +02:00
Daniel Marjamäki
f4cdb2c46a
CheckOther::checkCharVariable: Refactoring using AST
2014-04-01 19:16:06 +02:00
PKEuS
5953f02654
Refactorization: Simplifications in symboldatabase
2014-04-01 10:13:00 +02:00
Daniel Marjamäki
830249d72e
Fixed #5510 (FP: nullPointer - variable initialized in function call)
2014-04-01 07:06:20 +02:00
PKEuS
e0574feabd
Fixed problems with unknown macros for inline class methods in SymbolDatabase ( #5621 )
2014-03-31 21:04:01 +02:00
PKEuS
025850d961
Support unknown THROW()-style macros in symboldatabase; Fixed #5056 .
...
Simplified related code.
2014-03-31 20:33:01 +02:00
Daniel Marjamäki
484483bd5d
AST: fixed ast for 'for (*x=0;y;z)'
2014-03-31 17:16:13 +02:00
Daniel Marjamäki
225fb96554
Fixed #5627 (False positive assignBoolToPointer)
2014-03-31 15:55:54 +02:00
Daniel Marjamäki
088664d626
Fixed compiler warning 'conversion from unsigned long to unsigned int, may loose value'
2014-03-31 06:50:59 +02:00
Daniel Marjamäki
640431c569
Fixed #5611 (segfault when checking pcsc-cyberjack. either symboldatabase or checkMemset)
2014-03-30 17:38:07 +02:00
PKEuS
060f9035c9
Fixed crashs on garbage code ( #5604 )
2014-03-30 11:38:01 +02:00
PKEuS
aa527cb408
Refactorization: Store sizes as int, not as string in Tokenizer::simplifySizeof().
2014-03-30 11:21:40 +02:00
PKEuS
345a80f4d5
Fixed #5621 and slightly simplified symboldatabase code.
2014-03-30 11:06:44 +02:00
Alexander Mai
5fc89656c0
Fix some uninitialized variables
2014-03-30 10:22:06 +02:00
Alexander Mai
70885c78e4
Fix endless recursion within CheckClass::isConstMemberFunc() caused by incomplete/missing template declaration
2014-03-30 10:09:57 +02:00
Alexander Mai
bf335217cd
Fix #5605 part 2 - now endless recursion within CheckClass::isMemberFunc()
2014-03-30 08:31:02 +02:00
Daniel Marjamäki
348c26f59c
fixed segmentation fault in case typeStartToken() returns 0
2014-03-29 21:01:21 +01:00
Daniel Marjamäki
efc84ac310
Fix segmentation fault when checking build/tokenize.cpp
2014-03-29 20:41:17 +01:00
Daniel Marjamäki
deef4642d4
Buffer overrun: removed some old code that is not based on valueflow
2014-03-29 20:22:35 +01:00
Daniel Marjamäki
e5301b2b7a
ValueFlow: Improved valueflow of for loop 'for (i=a; i<10; i++)' => unknown start value but end value is known
2014-03-29 20:20:22 +01:00
Daniel Marjamäki
407c9fdf9d
Refactored checkNegativeBitwiseShift() so it uses ast and valueflow
2014-03-29 13:01:30 +01:00
Alexander Mai
d1b1699bb0
Fix #5606 - Endless recursion in CheckClass::isMemberVar(). New function Type::hasCircularDependencies() is supposed to detect loops within the class hierarchy which was causing the problem
2014-03-29 12:21:35 +01:00
Alexander Mai
34d1f885a3
Ticket #4296 : Improve message text for operatorEq
2014-03-28 20:29:33 +01:00
PKEuS
4ad7ef69c6
Updated german translation
...
ran lupdate gui.pro
Reverted accidential change in checkio.cpp
2014-03-28 19:06:48 +01:00
PKEuS
a01bfcb62d
Fixed a few cppcheck messages
2014-03-28 18:55:16 +01:00
PKEuS
4e19645d62
Added C++11 keywords / C11 types 'char16_t' and 'char32_t' ( #3301 )
2014-03-28 18:24:39 +01:00
Daniel Marjamäki
502ba95383
Simplification. Code 'else if ..' is simplified to 'else { if ..'
2014-03-28 18:21:56 +01:00
PKEuS
a16d631813
Further improvements to setVarId and function/array pointer detection in SymbolDatabase ( #2872 )
2014-03-28 17:43:40 +01:00
PKEuS
1c58628223
Handle pointer/reference to array in setVarId ( #2645 )
2014-03-28 16:10:27 +01:00
PKEuS
50a94885ce
Fixed oppositeInnerCondition check:
...
- Resolved false positives #4170 and #4186 , as well as numerous other potential false positives
- Improved message to point to both locations
- Inner condition could also be a while loop; Outer if could also be 'else if'
- Made the check non-experimental again (#3645 )
2014-03-28 14:55:17 +01:00
PKEuS
a6ca3cf2cf
Throw syntaxError when encounter one in symboldatabase ( fixes #5572 )
2014-03-27 19:06:13 +01:00
PKEuS
efe3f834be
Refactorized handling of syntaxError: Print debug output, removed a few return values that are no longer required
2014-03-27 18:41:52 +01:00
Daniel Marjamäki
ab25741fee
Merge pull request #277 from Dmitry-Me/getridofassertinisdigit
...
Get rid of assert in isdigit
2014-03-27 17:18:06 +01:00
Daniel Marjamäki
581886636d
CheckBool::checkComparisonOfBoolExpressionWithInt: Rewrite the check using AST instead of token list
2014-03-27 16:10:43 +01:00
PKEuS
9b307cf8e0
Improved readability of testsuite output when ASSERT_EQUALS_MSG fails.
...
Fixed another true positive in checkbufferoverrun.cpp
AStyle
2014-03-27 16:06:30 +01:00
PKEuS
e8c7a723f5
Fixed five new true positives in cppcheck, silenced one new false positive (see #5618 )
2014-03-27 15:50:30 +01:00
PKEuS
7e4081f7f5
Treat syntaxError and cppcheckError as InternalErrors (throw as exception, #4268 )
2014-03-27 13:15:21 +01:00
PKEuS
b23aebf2f0
Show redundantCopyLocalConst for STL types ( #4331 )
2014-03-27 11:15:17 +01:00
PKEuS
379807a8ea
Fixed TODO_ASSERT_EQUAL and #5614 caused by bad simplification of return values.
2014-03-27 11:04:31 +01:00
Dmitry-Me
d0b3728328
Get rid of assert in isdigit() when processing cyrillic characters.
2014-03-27 10:23:47 +04:00
Daniel Marjamäki
2248cdfea0
CheckBool::checkAssignBoolToPointer: Refactor to use AST.
2014-03-27 05:39:48 +01:00
Dmitry-Me
d0e51fb5f0
Make use of Visual C++ runtime memory leak tracing
2014-03-26 19:43:12 +04:00
PKEuS
f71a4ad216
Improved information message on missing headers when included with <> ( #4772 )
2014-03-26 15:22:22 +01:00
PKEuS
6c4e8761c8
Fixed false positive "unused function" #5113 .
2014-03-26 12:34:21 +01:00
PKEuS
848d079c71
Refactorized detection of function usage in CheckUnusedFunction, fixed #5358
2014-03-26 09:12:41 +01:00
PKEuS
02f38772cc
Refactorization: Use SymbolDatabase to find functions in CheckUnusedFunctions
2014-03-26 08:54:56 +01:00
Daniel Marjamäki
d22da5e683
astyle formatting
...
[ci skip]
2014-03-26 06:56:13 +01:00
Daniel Marjamäki
fa7ae1ae5b
Fixed segfault when checking libusbx (daca2)
2014-03-26 06:51:56 +01:00
Daniel Marjamäki
8eeda150cf
ValueFlow: Improved simplification inside for-loops
2014-03-25 21:40:36 +01:00
Daniel Marjamäki
87daf5783e
buffer overflow: clean up old checking for negative index
2014-03-25 20:37:32 +01:00
Troshin V.S
840fba7672
CLI: Add -l command line option
2014-03-25 18:35:59 +01:00
Daniel Marjamäki
c8004a8d31
Buffer overruns: Use ValueFlow to detect negative index
2014-03-25 18:22:22 +01:00
PKEuS
5083dd4273
Fixed two visual studio warnings
2014-03-24 18:14:23 +01:00
Daniel Marjamäki
aa05bf0f16
ValueFlow: Improved abstract interpretation
2014-03-24 06:48:06 +01:00
Daniel Marjamäki
2a0716449f
Fixed #5498 (C++0x11 default values for class fields and missing constructor)
2014-03-24 06:15:51 +01:00
Daniel Marjamäki
dbc8273cb7
ValueFlow: improved abstract interpretation of for loops
2014-03-24 00:16:02 +01:00
Daniel Marjamäki
c14a3d67bb
ValueFlow: Handle division by zero better in abstract interpretation
2014-03-23 20:37:56 +01:00
PKEuS
1be7bfa7fe
Fixed crash on invalid code ( #5603 )
2014-03-23 20:08:16 +01:00
Daniel Marjamäki
30fa187b30
Fixed #5549 (ValueFlow: Handle static variables better in valueFlowAfterAssign)
2014-03-23 17:57:27 +01:00
PKEuS
5f2067e401
Refactorized dead code elimination:
...
- Use library to get noreturn functions
- Fixed do-while simplification (#4940 )
2014-03-23 10:59:41 +01:00
PKEuS
77c17100ec
Bailout in private function usage checking for operators ( #5059 ).
2014-03-23 10:06:14 +01:00
PKEuS
8d5be8c4a4
Fixed related issues to #5601
2014-03-22 22:35:20 +01:00
PKEuS
58c2f372b9
Fixed false positive when noreturn function is defined ( #5601 , second attempt)
2014-03-22 19:55:13 +01:00
PKEuS
6395cb9b95
Syntax error on invalid enum ( #5600 )
2014-03-22 19:31:01 +01:00
Daniel Marjamäki
b6276058da
Value Flow: Improved abstract interpretation of arithmetical expressions
2014-03-22 19:02:33 +01:00
PKEuS
77c871035b
Fixed false positive when noreturn function is defined ( #5601 )
2014-03-22 18:57:19 +01:00
Daniel Marjamäki
7d2357de8d
Refactoring. Use astIsFloat()
2014-03-22 18:42:29 +01:00
PKEuS
560cf397d3
Fixed C++11 right angle bracket issue #5150
2014-03-22 13:34:15 +01:00
Alexander Mai
6a08c27183
Fix segfault in variableIsUsedInScope() - loop variable not check against NULL
2014-03-22 11:14:11 +01:00
Alexander Mai
e1c565357a
Invalid code cause SIGSEGV since loop variable tok2 was not checked properly
2014-03-22 10:32:24 +01:00
Alexander Mai
cdd6d4df27
Removing a useless variable to fix cppcheck warning in its own code
2014-03-21 22:11:10 +01:00
Alexander Mai
37befc75ef
In case of a loop within the class hierarchie Function::isImplicitlyVirtual_rec() was entering an endless loop. Tracking the previously analyzed types shall prevent this.
2014-03-22 08:49:28 +01:00
PKEuS
49b25b05d9
Fixed crash in CheckBufferOverrun on garbage code ( #5595 )
2014-03-21 13:20:44 +01:00
Daniel Marjamäki
045e9e692b
ValueFlow: restricted bailouts in for loops
2014-03-21 08:48:49 +01:00
Daniel Marjamäki
fc014f055f
ValueFlow: Removed wrong bailout
2014-03-21 08:33:45 +01:00
Daniel Marjamäki
54e7f34f4a
Fixed #5584 (FP: Division by zero when function not declared)
2014-03-20 16:12:58 +01:00
XhmikosR
be0fcefe1d
Tabs to spaces.
...
[ci skip]
2014-03-20 09:02:14 +02:00
Daniel Marjamäki
22a5881bee
Uninitialized variables: Experimental checking for passing const pointer to partially initialized struct to function. Ticket: #5586
2014-03-20 07:19:35 +01:00
Daniel Marjamäki
8de4246713
Uninitialized variables: Improved handling of function calls when struct members are checked
2014-03-20 06:48:17 +01:00
Daniel Marjamäki
e48dfb0e6a
cygwin: apply cygwin compilation tweaks. thanks ir0nh34d.
2014-03-19 21:20:30 +01:00
Robert Reif
5c88934431
CheckIo: Fixed FIXME
2014-03-19 20:57:33 +01:00
Robert Reif
806ef44509
Fixed #5328 (Does not handle __attribute((xxx)) in typedefs)
2014-03-19 05:38:23 +01:00
PKEuS
b564986d5d
Added missing casts causing assertion failures on Windows ( #5391 )
...
-> Changed much more occurences, especially in preprocessor.cpp.
2014-03-18 21:41:47 +01:00
Daniel Marjamäki
ebb0c50aac
Tokenizer: Fix crash in Token::previous() method ('this' is NULL)
2014-03-18 20:29:37 +01:00
Daniel Marjamäki
01c29ed15f
Fixed #5518 (FP regression in 1.64: Array accessed out of bounds)
2014-03-18 17:04:33 +01:00
PKEuS
a3f5beb75d
Fixed problems with code "enum class { };" (which is valid C)
2014-03-18 16:23:30 +01:00
PKEuS
3a4b7e5c07
Fixed false positive #5578
2014-03-18 13:44:27 +01:00
PKEuS
af161fc361
Rewrote CheckStl::readingEmptyStlContainer(), resolving all its false positives shown on CppChecks own code
2014-03-18 12:38:22 +01:00
Daniel Marjamäki
177bf6fcb3
Fixed #5244 (FP: (error) Uninitialized variable: ptr - initialization within if-clause)
2014-03-18 06:37:19 +01:00
Daniel Marjamäki
e240282443
Value Flow: Another try with the abstract interpretation of for loops
2014-03-17 18:43:47 +01:00
PKEuS
2568baa473
#5528 : Raise duplicateExpressionError on operators /, % and -.
2014-03-17 18:35:36 +01:00
PKEuS
fab6b56360
Improved check ( #5553 ): Detect stricmp(var.c_str(), var.c_str())
2014-03-17 17:41:45 +01:00
PKEuS
5f67bc1b0a
Fixed varId problem #5293 (and its duplicate #5577 ): Classes inside functions are non-executable scopes.
2014-03-17 16:15:42 +01:00
Daniel Marjamäki
06618b31bb
Fixed #5574 (False positive: mismatchAllocDealloc using realloc() and free)
2014-03-17 16:10:54 +01:00
PKEuS
521734faa2
Fixed setVarId-Bugs #5294 and #5295 .
2014-03-17 14:19:46 +01:00
PKEuS
b6b374cf3d
Added verbose message for "memsetClass" error. ( #5183 )
2014-03-17 13:23:23 +01:00
PKEuS
e0b34de090
Implemented #5262 : VS solution copies cfg files to output folder.
2014-03-17 12:58:46 +01:00
PKEuS
ebd0b43c4f
Fixed #5382 : False positive "scope can be reduced" when initializing two-dimensional array.
2014-03-17 12:34:39 +01:00
PKEuS
d325d14b11
Fixed false positive #5535 : Reference named like its type.
2014-03-17 12:01:39 +01:00
PKEuS
50f6bb5d36
Fixed crash #5511 .
2014-03-17 11:50:45 +01:00
PKEuS
86e6bb430a
New check: Warning, if positioning operation (fseek) is performed on a file opened in "a" mode
2014-03-17 11:02:03 +01:00
PKEuS
1e57f54917
Fixed #5481 : std::array is POD, so using memcpy (etc.) is allowed on it.
2014-03-16 19:55:32 +01:00
Lucas Manuel Rodriguez
47ecdf58b2
Fixed #4804 (Improve check for 'std::string::data()' - identical to 'std::string::c_str()')
2014-03-16 15:04:44 -03:00
Lucas Manuel Rodriguez
9a08da17be
Fixed #4928 (C++ operator aliases result in false 'assigned a value that is never used' warning)
2014-03-16 14:51:05 -03:00
PKEuS
e05fb847df
Fixed #3852 : Support simplification of C++11 "enum class", fixed existing simplifications
2014-03-16 18:24:46 +01:00
PKEuS
6b16b519a2
Fixed crash on wrong __attribute__((constructor)) syntax
2014-03-16 16:39:07 +01:00
Alexander Mai
825bb0f027
Fixed #5286 (Add signal/exception handling to cppcheck and cppcheck-gui)
2014-03-16 12:04:13 +01:00
Alexander Mai
cba1879fee
Fixed #5571 (Clean up MathLib::isInt())
2014-03-16 11:55:44 +01:00
Daniel Marjamäki
8c3f2c2ad9
Revert 894a65b0
. abstract interpretation of for loops. there was some crashes and performance problems. I will fix those problems when I have time and recommit.
2014-03-16 08:38:52 +01:00
Alexander Mai
40ddcabab6
Fixed #4461 (Warn about memset/memcpy on class with references as members)
2014-03-15 18:22:29 +01:00
Daniel Marjamäki
894a65b0b1
ValueFlow: Refactor the for-loop handling. Use abstract interpretation.
2014-03-15 11:29:33 +01:00
Daniel Marjamäki
ce1aa1e011
Library: I had misunderstood const/pure a little so I corrected cfg and code
2014-03-14 20:08:34 +01:00
Robert Reif
2ba3a36f2c
Partial fix for #5555 . Improved pure/const attributes handling
2014-03-14 19:06:05 +01:00
Robert Reif
e26bd5b99c
Fixed #5563 (add __attribute__((destructor)) and improve __attribute__((constructor)) support)
2014-03-14 18:17:21 +01:00
Daniel Marjamäki
b2708987c3
Merge pull request #264 from thomasjfox/simplematch
...
Use simple match where possible
2014-03-14 17:51:45 +01:00
Alexander Mai
ff5fc82704
Fixed #4722 (Debugging enhancement: Tokenizer::simplifyTokenList() shall continue)
2014-03-14 17:48:20 +01:00
Daniel Marjamäki
a929b2146e
Improved checking of const functions in checkIncorrectLogicOperator
2014-03-14 17:37:53 +01:00
Thomas Jarosch
93341f4449
Use simple match where possible
...
Fixes these warnings found by "--enable=internal":
[lib/checkclass.cpp:972]: (warning) Found simple pattern inside Token::Match() call: "* *"
[lib/checkbufferoverrun.cpp:635]: (warning) Found simple pattern inside Token::Match() call: "."
[lib/checkbufferoverrun.cpp:1397]: (warning) Found simple pattern inside Token::Match() call: ";"
[lib/checksizeof.cpp:299]: (warning) Found simple pattern inside Token::Match() call: "."
[lib/checksizeof.cpp:301]: (warning) Found simple pattern inside Token::Match() call: ")"
[lib/checksizeof.cpp:303]: (warning) Found simple pattern inside Token::Match() call: "]"
[lib/checksizeof.cpp:318]: (warning) Found simple pattern inside Token::Match() call: ")"
[lib/checknullpointer.cpp:413]: (warning) Found simple pattern inside Token::Match() call: "delete"
[lib/checkio.cpp:1336]: (warning) Found simple pattern inside Token::Match() call: "> ("
[lib/checkstl.cpp:1509]: (warning) Found simple pattern inside Token::findmatch() call: ";"
[lib/checkstl.cpp:1512]: (warning) Found simple pattern inside Token::findmatch() call: ";"
[lib/checkstl.cpp:1594]: (warning) Found simple pattern inside Token::Match() call: "="
[lib/checkstl.cpp:1598]: (warning) Found simple pattern inside Token::Match() call: "] ="
[lib/checkunusedvar.cpp:755]: (warning) Found simple pattern inside Token::Match() call: "goto"
[lib/checkunusedvar.cpp:793]: (warning) Found simple pattern inside Token::Match() call: "="
[lib/checkuninitvar.cpp:376]: (warning) Found simple pattern inside Token::Match() call: "> ("
[lib/checkother.cpp:86]: (warning) Found simple pattern inside Token::Match() call: "> ("
[lib/checkother.cpp:2181]: (warning) Found simple pattern inside Token::Match() call: "> {"
[lib/valueflow.cpp:54]: (warning) Found simple pattern inside Token::Match() call: "&"
[lib/valueflow.cpp:409]: (warning) Found simple pattern inside Token::Match() call: "do"
[lib/valueflow.cpp:425]: (warning) Found simple pattern inside Token::Match() call: ") {"
[lib/valueflow.cpp:487]: (warning) Found simple pattern inside Token::Match() call: ") {"
[lib/valueflow.cpp:511]: (warning) Found simple pattern inside Token::Match() call: "} else {"
[lib/valueflow.cpp:615]: (warning) Found simple pattern inside Token::Match() call: "for ("
[lib/symboldatabase.cpp:80]: (warning) Found simple pattern inside Token::Match() call: "= {"
[lib/symboldatabase.cpp:1069]: (warning) Found simple pattern inside Token::Match() call: "std ::"
[lib/tokenize.cpp:2207]: (warning) Found simple pattern inside Token::Match() call: "< >"
[lib/tokenize.cpp:2730]: (warning) Found simple pattern inside Token::Match() call: ";"
[lib/tokenize.cpp:4234]: (warning) Found simple pattern inside Token::Match() call: "try {"
[lib/tokenize.cpp:4235]: (warning) Found simple pattern inside Token::Match() call: "} catch ("
[lib/tokenize.cpp:5500]: (warning) Found simple pattern inside Token::Match() call: "INT8"
[lib/tokenize.cpp:5752]: (warning) Found simple pattern inside Token::Match() call: "}"
[lib/tokenize.cpp:5752]: (warning) Found simple pattern inside Token::Match() call: "do"
2014-03-14 16:27:47 +01:00
Thomas Jarosch
c625606f45
Remove redundant code
2014-03-14 15:56:40 +01:00
Thomas Jarosch
c80f272176
Run astyle
2014-03-14 15:51:15 +01:00
Daniel Marjamäki
8c7cf090c4
Merge pull request #261 from orbitcowboy/master
...
MathLib:isHex(): fix detection of missing suffixes (U,L).
2014-03-14 13:00:35 +01:00
orbitcowboy
74d10cd6d9
Added function MathLib::isValidSuffix()
2014-03-14 11:46:41 +01:00
orbitcowboy
71ee625aab
MathLib: replaced isHexDigit function by isxdigit.
2014-03-14 09:33:20 +01:00
Daniel Marjamäki
401b43c36a
Merge pull request #263 from trulabs/master
...
Fix the detection of methods called from Qt's invokeMethod
2014-03-14 08:21:53 +01:00
Daniel Marjamäki
8d8913a168
Partial fix for #5555 . Add const,pure attributes to library.
2014-03-14 06:38:45 +01:00
Robert Reif
8c993c1363
Partial fix for #5555 . Remember function attributes: pure, const, constructor, destructor
2014-03-14 05:40:17 +01:00
Daniel Marjamäki
5698f7b337
astyle formatting
2014-03-14 05:36:44 +01:00
Sam Truscott
5dc13f3538
Tidy up the code for cppcheck style.
2014-03-13 16:47:00 +00:00
Sam Truscott
3d0524ecc6
Update the detection of the arguments in Qt's invokeMethod.
...
invokeMethod can invoke functions by name (string) rather than a
direct function call (i.e. reflection). The old code wasn't
correctly parsing out the argument which contained the name
of the function to call.
This resulted in that function being reported as unused when it is.
2014-03-13 16:43:25 +00:00
Daniel Marjamäki
61eb262244
Fixed #5215 (segmentation fault (invalid code) in TemplateSimplifier::useDefaultArgumentValues)
2014-03-12 19:36:22 +01:00
Robert Reif
cb1fc06a80
Fixed #5079 (CheckIO::checkFileUsage doesn't support wide char and microsoft functions)
2014-03-12 19:22:44 +01:00
Frank Zingsheim
b1dc51ba9c
Fixed #4796 (Missing semicolon after simplified template class)
2014-03-12 06:09:45 +01:00
Robert Reif
d1eb04c539
Fixed #4302 (Member variable not initialized in public delegate constructor)
2014-03-12 05:48:13 +01:00
Daniel Marjamäki
618c26f6bf
Merge pull request #260 from orbitcowboy/master
...
MathLib::isOct() fix missing detection of U and L suffix combinations an...
2014-03-12 05:30:35 +01:00
Daniel Marjamäki
3b4d024e06
Reverted info message that only applies to CLI
2014-03-11 20:55:02 +01:00
orbitcowboy
ed793793db
MathLib:isHex(): fix detection of missing suffixes (U,L).
2014-03-11 20:02:04 +01:00
Daniel Marjamäki
94454df14f
Fixed #2732 (Make it easier for users to tell 'How to supply header files')
2014-03-11 16:05:19 +01:00
Sam Truscott
385478d89e
Reflection no longer part of markup. Some tokeniser not done on markup.
2014-03-11 15:57:28 +01:00
Daniel Marjamäki
af0cf9bbc1
Merge pull request #258 from orbitcowboy/master
...
MathLib::isBin(): fix missing detection of U and L suffix combinations. ...
2014-03-11 06:36:31 +01:00
orbitcowboy
5b4ece4f9c
MathLib::isBin(): fix missing detection of U and L suffix combinations. Added missing test cases.
2014-03-10 17:23:07 +01:00
Julian Santander
fae8ef48b8
Fixed #5529 (Further control in selecting what configurations to consider)
2014-03-10 15:49:02 +01:00
Martin Ettl
0360840753
MathLib::isOct() fix missing detection of U and L suffix combinations and unittests.
2014-03-09 21:14:14 +01:00
Frank Zingsheim
5e0a575091
Optimization: tokenlist::addtoken
2014-03-09 17:54:49 +01:00
Frank Zingsheim
bc1ab4c48a
Optimization preprocessor.cpp use string::compare for charT
2014-03-09 14:26:16 +01:00
Frank Zingsheim
6e9e20d5b1
Optimization Tokenizer::simplifyMathFunctions. Make an a priori check whether the token combination can be a function call at all.
2014-03-09 13:22:58 +01:00
Daniel Marjamäki
4d06bc086d
astyle formatting
2014-03-09 08:49:32 +01:00
Daniel Marjamäki
7fa73c0d64
Merge pull request #256 from xypron/5505
...
5505: FP: Array accessed out of bounds
2014-03-09 08:47:18 +01:00
Daniel Marjamäki
c7f09d4350
Merge pull request #257 from simartin/ticket_5373_2
...
Ticket #5373 : delete can match %type% in C (take #2 )
2014-03-09 08:26:06 +01:00
Alexander Mai
3f30753122
Fixed #5537 (crash: clang ./lib/Basic/FileManager.cpp , since 354e84e7c8
, /lib/symboldatabase.h:288)
2014-03-09 08:17:24 +01:00
Simon Martin
a3d1cac79c
Ticket #5373 : Keep track whether tokens come from a C or C++ file to properly handle %type% in Token::Match with "delete"
2014-03-08 21:26:06 +01:00
Heinrich Schuchardt
bd67db96f1
5505: FP: Array accessed out of bounds
...
CheckBufferOverrun::checkFunctionParameter alreacy considered usage of a
function parameter inside an if block as a special case.
With the patch the same is done for switch statements.
A test is added.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2014-03-07 19:51:13 +01:00
Daniel Marjamäki
569db24756
astyle formatting
2014-03-06 16:21:57 +01:00
Alexander Mai
354e84e7c8
Fixed #2298 (new check: passing stack-address to free())
2014-03-06 06:32:30 +01:00
Daniel Marjamäki
ca0509e20b
Library: Fixed bug I caused when I cleaned up patch
2014-03-06 06:27:01 +01:00
Alexander Mai
1d4839b8a6
Fixed #1374 (false negative: using uninitialized variable in printf)
2014-03-06 06:16:14 +01:00
Daniel Marjamäki
bcd230d90d
Merge pull request #251 from matthiaskrgr/copyright
...
man, htdocs, gui, test, tools: bump a few more copyrights to 2014
2014-03-04 05:44:50 +01:00
Daniel Marjamäki
dbfe7e0b6b
Fixed cppcheck warnings
2014-03-03 19:00:32 +01:00
Pranav Khanna
f8a4fb91fe
Fixed #3796 (new check: redundant initialization with empty string)
2014-03-03 18:27:45 +01:00
PKEuS
470f1579c1
Incremented version to 1.65dev/1.64.99
2014-03-03 15:07:54 +01:00
Matthias Krüger
a9df4a3288
man, htdocs, gui, test, tools: bump a few more copyrights to 2014
2014-03-03 11:03:17 +01:00
Simon Martin
8baf8dbebb
Ticket #5425 : Avoid infinite recursion in checkMemsetType for invalid input
2014-03-03 07:19:32 +01:00
Daniel Marjamäki
4dee3da1bd
Merge pull request #245 from simartin/ticket_5478
...
Ticket #5478 : Only functions and equal operators might return a temporary
2014-03-02 14:53:25 +01:00
Daniel Marjamäki
4842115a56
1.64 : Update versions
2014-03-02 09:55:39 +01:00
Simon Martin
875a3f47e7
Ticket #5478 : Only functions and equal operators might return a temporary.
2014-03-02 09:39:10 +01:00
Daniel Marjamäki
aec3f18d77
Merge pull request #244 from simartin/ticket_5506
...
Ticket #5506 : Don't crash upon invalid template declaration
2014-03-02 08:54:07 +01:00
Simon Martin
3518e02d23
Ticket #5506 : Skip template parameters when determining whether a template is a declaration or a definition.
2014-03-01 14:58:47 +01:00
Daniel Marjamäki
bef4739853
Library: the bug in tinyxml has been fixed so the workaround can be removed now
2014-03-01 14:09:03 +01:00
PKEuS
357f5076db
Updated tinyxml
2014-03-01 11:15:08 +01:00
Daniel Marjamäki
a41a32ba8a
Fixed #5469 (CheckBufferOverrun: Use nullptr)
2014-02-28 17:02:03 +01:00
Alexander Mai
50a184c3e9
Fixed #5166 (segmentation fault (invalid code) in lib/checkother.cpp:329 ( void * f { } void b ( ) { * f } ))
2014-02-27 18:24:51 +01:00
Daniel Marjamäki
87c4508954
Spell fix: dont => do not
2014-02-27 16:40:42 +01:00
Alexander Mai
a02bbfa47e
Fixed #5492 (Fix small bug in MathLib::isFloat())
2014-02-27 16:08:49 +01:00
Daniel Marjamäki
dea4107245
Fix Cppcheck warning
2014-02-26 06:38:48 +01:00
Daniel Marjamäki
7dbfd67da3
Fixed #5493 (False positive: Found a statement that begins with numeric constant / string constant - in the presence of initialization list.)
2014-02-26 06:18:52 +01:00
Daniel Marjamäki
8550289722
Fixed #5452 (AST: wrong handling of unary ::)
2014-02-25 06:36:10 +01:00
Alexander Mai
0747b55485
Fixed #5304 (Wrong simplification of numbers like 001E+07 to 1.0)
2014-02-24 18:52:31 +01:00
Daniel Marjamäki
acf5723bdd
AST: improved AST printout when --verbose is used
2014-02-24 17:22:29 +01:00
Daniel Marjamäki
8dd7f02e45
Fixed #5381 (Some false positives that came up when using --enable=performance file.c)
2014-02-23 11:02:39 +01:00
Daniel Marjamäki
f6b42633e8
Fixed #5434 (FP: Out-of-bounds access with ternary operator in loop)
2014-02-22 17:59:12 +01:00
Daniel Marjamäki
34730f623a
Fixed #5301 (False positive: (error) Division by zero - variables read from input stream)
2014-02-22 12:09:54 +01:00
Daniel Marjamäki
910a90e4c1
Revert "cxx11.h: removed the 'evil workaround'"
...
This reverts commit 2cb9032d76
.
2014-02-21 20:06:55 +01:00
Alexander Mai
82a2279425
Fixed #5304 (Wrong simplification of numbers like 001E+07 to 1.0)
2014-02-20 16:56:49 +01:00
Daniel Marjamäki
ed9153ee80
Symbol database: added simple mismatch check in Scope::findFunction when passing address to function that expects a reference
2014-02-19 06:35:51 +01:00
Daniel Marjamäki
690c37633b
ValueFlow: Fixed bad values after break/continue
2014-02-17 20:07:38 +01:00
Daniel Marjamäki
c050a92bae
Fixed #5468 (crash: freebsd: llvm/RegionPrinter.cpp - AST failure)
2014-02-17 17:37:39 +01:00
Daniel Marjamäki
d37359217c
Merge pull request #241 from lanurmi/more-nullptr
...
Change some more 0 literals into nullptr.
2014-02-16 23:29:23 +01:00
Lauri Nurmi
70a67eaf85
Change some more 0 literals into nullptr.
2014-02-16 13:38:50 +02:00
Daniel Marjamäki
fdcb325d70
DuplicateBranch: Made warning inconclusive since it's in most cases noise
2014-02-16 11:04:27 +01:00
Daniel Marjamäki
23efc68dd7
use nullptr
2014-02-16 10:32:10 +01:00
Lucas Manuel Rodriguez
052840f8f5
Fixed #4818 (New check: Check memset() 2nd parameter)
2014-02-15 15:06:00 -03:00
Daniel Marjamäki
2cb9032d76
cxx11.h: removed the 'evil workaround'
2014-02-15 16:19:50 +01:00
Daniel Marjamäki
f0220c5340
astyle formatting
2014-02-15 16:18:13 +01:00
Daniel Marjamäki
209dffbe1b
use nullptr in lib/checkmemoryleak.cpp
2014-02-15 16:17:56 +01:00
Daniel Marjamäki
68119f0230
use nullptr in lib/checknullpointer.cpp
2014-02-15 16:12:37 +01:00
Daniel Marjamäki
fb5c2d4b48
use nullptr in lib/checkother.cpp
2014-02-15 08:46:28 +01:00
Daniel Marjamäki
720bd48a98
use nullptr in lib/library.cpp
2014-02-15 08:41:17 +01:00
Daniel Marjamäki
9eb789bdb2
use nullptr in lib/preprocessor.cpp
2014-02-15 08:37:57 +01:00
Daniel Marjamäki
5fe78d1534
use nullptr in lib/token.cpp
2014-02-15 08:05:54 +01:00
Daniel Marjamäki
384ffb4173
use nullptr in lib/tokenize.cpp
2014-02-15 08:04:54 +01:00
Lauri Nurmi
91340d4043
Emulate the C++11 'nullptr' and 'static_assert'
2014-02-15 07:52:17 +01:00
Daniel Marjamäki
fd3a8a2a18
Update copyright
2014-02-15 07:45:39 +01:00
Daniel Marjamäki
a1d9873558
Fixed #5465 (crash: AST doesnt produce good output for 'class C:public : 🅰️ :b<c>{..};')
2014-02-14 06:30:51 +01:00
Lucas Manuel Rodriguez
828609bb11
Fixed two doxygen errors - http://cppcheck.sourceforge.net/devinfo/doxygen-errors.txt
2014-02-09 16:46:49 -03:00
Daniel Marjamäki
8305015dea
astyle formatting
2014-02-08 08:51:38 +01:00
Pavel Roschin
19a8cfd960
Library: add new "define" tag
...
This tag will allow to add some preprocessor defs into library.
It would be useful to provide more information about libraries
implementation details. As example GLib's library include tag
was added that helps to detect more memory leaks.
2014-02-07 10:13:36 +04:00
Daniel Marjamäki
3c6bfac89c
Merge pull request #234 from scriptum/rpg-use-whitelist-from-library
...
CheckMemoryLeak: use library while checking whitelist functions
2014-02-05 11:41:47 +01:00
Daniel Marjamäki
ec80068cd9
Merge pull request #228 from simartin/osx_build_restore
...
RFC: Restore build on OSX
2014-02-05 11:30:34 +01:00
Pavel Roschin
0dd227419d
CheckMemoryLeak: use library while checking whitelist functions
2014-02-05 12:16:50 +04:00
Daniel Marjamäki
6ac9e180e0
ast: fixed hang when checking beid
2014-02-05 06:05:48 +01:00
Daniel Marjamäki
2ed3b40937
ast: fixed hang when checking bin-prot
2014-02-04 19:33:26 +01:00
Daniel Marjamäki
486a3192c0
Fixed #5246 (false positive: (warning) Logical conjunction always evaluates to false: t > 0 && t < 1.)
2014-02-04 06:50:29 +01:00
Daniel Marjamäki
ec61143623
Merge pull request #233 from orbitcowboy/master
...
Fixed #389 : Providing negative value to memory allocation function.
2014-02-02 10:47:37 -08:00
Heinrich Schuchardt
6bfd4af5f7
5355: False postive var not assigned
...
Avoid false positive "variable not assigned" for
struct Fred{
};
void foo () {
Fred fred;
throw fred;
}
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2014-02-01 22:40:35 +01:00
Martin Ettl
6ca7daec10
Fixed #389 : Providing negative value to memory allocation function.
2014-02-01 22:38:29 +01:00
Simon Martin
8ff9696374
OSX's compiler supports C++11 but one needs to use GNU's STL to build cppcheck, that does not have cbegin/end.
2014-02-01 07:40:08 +01:00
Daniel Marjamäki
b3bfd5014d
Fixed #5433 (FP:Possible null pointer dereference)
2014-01-31 15:43:34 +01:00
Daniel Marjamäki
9aa9530e0d
Fixed #5426 (crash: btrfs-progs cmds-inspect.c)
2014-01-31 06:19:36 +01:00
Lucas Manuel Rodriguez
a34d2eb7b3
Fixed #4938 : (.empty() method false positive for non-STL classes)
2014-01-30 18:09:24 -03:00
Daniel Marjamäki
d6e3b3d3f3
ast: fixed syntax tree for 'a=(b)?1:0'. The parentheses should not be in the syntax tree
2014-01-30 17:31:06 +01:00
Lucas Manuel Rodriguez
ad0269eeeb
Refactor checks using Variable::isStlType()
2014-01-30 01:26:48 -03:00
Daniel Marjamäki
30b56437c1
Merge pull request #226 from scriptum/rpg-fix-function-parameter
...
CheckMemoryLeak: improve leak checking in function parameters
2014-01-28 20:32:56 -08:00
Lucas Manuel Rodriguez
b69fedf70b
Fix '-Wshadow' warning (from 'Fixed #5423 ' commit)
2014-01-28 23:16:29 -03:00
Lucas Manuel Rodriguez
7fdc4ab6cc
Refactor isContainerSizeSlow() to use Variable::isStlType()
2014-01-28 13:31:23 -03:00
Kamil Dudka
dee18d10a8
Fixed #5423 (fix parsing of #line NNNN "file.c")
2014-01-28 17:15:07 +01:00
Daniel Marjamäki
abe8439917
Fixed #5416 (False positive: Array accessed at index, which is out of bounds.)
2014-01-28 16:55:10 +01:00
Lucas Manuel Rodriguez
2048313915
Add Variable::isStlType function
2014-01-28 11:44:56 -03:00
Pavel Roschin
2396073262
CheckMemoryLeak: improve leak checking in function parameters
2014-01-28 17:30:36 +04:00
Daniel Marjamäki
2108251851
Fixed #5417 (ast: avoid hang when '({})' is used)
2014-01-28 06:11:53 +01:00
Daniel Marjamäki
c8a1424e10
Fixed #5406 (crash inside valueFlowBeforeCondition() on files from kernel-git)
2014-01-27 06:18:42 +01:00
Daniel Marjamäki
2b8cf462c9
CheckMemoryLeak: Move posix-opendir/closedir to library
2014-01-26 17:02:36 +01:00
Daniel Marjamäki
0c47555423
CheckNullPointer: use library instead of hard coded info
2014-01-26 16:19:49 +01:00
Daniel Marjamäki
be082a8e4a
value flow: added bailout for conditional return/continue/break when number_of_if is bigger than 0
2014-01-26 15:50:25 +01:00
Daniel Marjamäki
c5971b7137
value flow: fix fp when conditional value is assigned
2014-01-25 20:14:49 +01:00
Daniel Marjamäki
c1e35e1df1
value flow: fixed multivariable problem in condition
2014-01-25 19:13:33 +01:00
Daniel Marjamäki
d227ed245f
cleanup
2014-01-25 18:51:55 +01:00
Daniel Marjamäki
df0995edf5
Fixed #5403 (Value flow: FP because post increment/decrement is not handled correctly)
2014-01-25 18:31:02 +01:00
Daniel Marjamäki
bc9ad08831
Fixed #5245 (false positive: Uninitialized variable (assignment inside ternary operator))
2014-01-25 10:12:50 +01:00
Daniel Marjamäki
35b51468cb
value flow: Fixed FP for division then check in for loop: 'for (a=b/x;x>0;x--)'
2014-01-25 09:22:32 +01:00
Daniel Marjamäki
4647a9fc93
Fixed #5401 (value flow: fp when there are increment/decrement)
2014-01-24 18:22:38 +01:00
Daniel Marjamäki
1cac7e1686
value flow: better handling in function call bailout of casting address of variable
2014-01-24 17:47:49 +01:00
Daniel Marjamäki
135998abba
value flow: use const when possible
2014-01-24 06:16:23 +01:00
Heinrich Schuchardt
de20ba6763
[PATCH] Types in isRecordTypeWithoutSideEffects
...
The type definition of the iterator should match the type definition of the map <const Type *, bool>.
2014-01-24 06:10:19 +01:00
Daniel Marjamäki
85b6495cce
value flow: fixed comments
2014-01-23 19:40:47 +01:00
Daniel Marjamäki
ec034c1d59
Fixed #5386 (ast: hang when code is 'for (T a : b)')
2014-01-23 06:13:24 +01:00
Daniel Marjamäki
0dbb86f0cb
Cleanup ExecutionPath from CheckBufferOverrun
2014-01-22 21:25:37 +01:00
Daniel Marjamäki
1d7bb05faf
Remove ExecutionPath from CheckNullPointer
2014-01-22 20:24:51 +01:00
Daniel Marjamäki
f3f7e6d302
value flow: replacing executionpath checking of null pointers
2014-01-22 20:16:31 +01:00
Daniel Marjamäki
43db1ee797
value flow: use more specific bailouts when analysing value flow after assignment
2014-01-22 06:38:25 +01:00
Daniel Marjamäki
cc38dec3ad
value flow: a bit better handling of assigned variable
2014-01-22 06:10:17 +01:00
Daniel Marjamäki
2b7a991c1a
temporarily hide gcc warnings
2014-01-21 21:17:03 +01:00
Daniel Marjamäki
a27ccbd0f8
value flow: start implementing value flow analysis of assigned value
2014-01-21 21:13:49 +01:00
Daniel Marjamäki
a84fdf98cc
Null pointer: remove old checking that is replaced by value flow checking
2014-01-21 19:50:52 +01:00
Daniel Marjamäki
20b73747e0
value flow: refactor. added Token::getMaxValue()
2014-01-21 16:58:23 +01:00
Daniel Marjamäki
b91f42453b
value flow: improved handling of cast
2014-01-20 22:26:55 +01:00
Daniel Marjamäki
bb3cc67aaa
value flow: improved calculations that depends on variable
2014-01-20 21:45:30 +01:00
Daniel Marjamäki
69109784e8
value flow: cleanup usage of valueflow. utility function Token::getValue was added.
2014-01-20 06:49:45 +01:00
Daniel Marjamäki
add84187cc
CheckOther: Removed old zero division check
2014-01-20 06:31:13 +01:00
Daniel Marjamäki
7ff7bc1c2e
Fixed #5376 (false positive: zerodivcond (style) Either the condition 'B>0' is useless or there is division by zero)
2014-01-19 20:16:55 +01:00
Daniel Marjamäki
84c5f47eb1
value flow: bailout for class variables that are non-const
2014-01-19 11:55:02 +01:00
Daniel Marjamäki
ccda78f347
value flow: fixed todo assertion for handling of conditions
2014-01-19 09:31:40 +01:00
Daniel Marjamäki
cdaa7abf7e
value flow: better handling of conditional code below || && ?: operators
2014-01-19 09:05:48 +01:00
Daniel Marjamäki
2d0a68cac2
cleanup redundant variable inconclusive
2014-01-18 19:51:57 +01:00
Daniel Marjamäki
77f3f6c21a
valueflow: added setTokenValue that perform calculations using set value
2014-01-18 19:30:44 +01:00
Daniel Marjamäki
6a3a9ee8e7
ast: fixed tree for 'sizeof(struct S)'
2014-01-18 13:18:11 +01:00
Daniel Marjamäki
c7032a8867
value flow: improved handling of loops
2014-01-18 11:54:00 +01:00
Daniel Marjamäki
498cdb8610
added debug output for the value flow
2014-01-18 09:58:32 +01:00
Ryan Pavlik
32bf275447
Fix case-insensitive string compare function on MinGW
2014-01-17 15:29:53 -06:00
Daniel Marjamäki
3e23e243f6
BufferOverflow: Updated message for out of bounds array index or redundant condition
2014-01-17 19:44:45 +01:00
Daniel Marjamäki
57d318b2e5
valueflow: better handling of increment/decrement
2014-01-17 19:28:28 +01:00
Daniel Marjamäki
18d6285ad2
BufferOverrun: Improved error message when array index is used before checking that its in limits
2014-01-17 18:56:46 +01:00
Daniel Marjamäki
b2b5590f2b
Refactoring: Moved astStringify to the Token class and renamed it to expressionString. This can often be useful when reporting error messages that contains source code.
2014-01-17 18:37:49 +01:00
Daniel Marjamäki
30cae358d8
Removed the --value-flow flag. ValueFlow analysis will always be enabled from now on.
2014-01-17 18:07:05 +01:00
Daniel Marjamäki
5721e1d745
CheckNullPointer: Removed some of the old checking that doesn't use ValueFlow
2014-01-17 17:47:59 +01:00
Daniel Marjamäki
311059f603
Tokenizer: Removed commented-out simplification
2014-01-17 17:44:33 +01:00
Daniel Marjamäki
3facc06cb7
CheckOther: Removed non-valueflow check for division by possible zero before condition
2014-01-17 17:42:54 +01:00
Daniel Marjamäki
0203a4a6f5
Tokenizer: Removed simplifyGoto as it's the cause of various FPs I see
2014-01-17 17:36:45 +01:00
Daniel Marjamäki
4eb746d7cc
Tokenizer: Removed simplifyComparisonOrder
2014-01-17 17:25:56 +01:00
Daniel Marjamäki
0b4de97e2b
value flow: Use ValueFlow in CheckBufferOverrun
2014-01-16 19:23:14 +01:00
Daniel Marjamäki
85b73f7c24
ast: fixed hang for weird loop: 'for (each_window(list,p))'
2014-01-16 16:58:50 +01:00
Daniel Marjamäki
e72ec830ef
ast: fixed hang in for-loop handling
2014-01-16 06:45:35 +01:00
Daniel Marjamäki
141e089329
ast: different handling of for loops. create a syntax tree for whole 'f(a;b;c)'.
2014-01-15 17:32:14 +01:00
Daniel Marjamäki
c547c9a108
value flow: fixed fp when variable is used in for-loop condition
2014-01-14 17:57:50 +01:00
Daniel Marjamäki
e45a2e2c61
Fixed #5347 (False positive: uninitialized variable (try catch))
2014-01-14 06:24:09 +01:00
Robert Reif
d679a4c1f7
Fixed #5248 (False positive: Invalid argument in scanf for %zd)
2014-01-14 06:09:13 +01:00
Daniel Marjamäki
c1c2f4bbc6
value flow: fixed crash reported in #5343 when typeStartToken and typeEndToken are misplaced.
2014-01-13 20:54:09 +01:00
Daniel Marjamäki
7981e3d38f
value flow: fix fp when gotos are used
2014-01-13 16:07:25 +01:00
Daniel Marjamäki
bfc67a536a
value flow: fixed fp when self-checking checkbool.cpp. added some comments.
2014-01-13 06:15:21 +01:00
Daniel Marjamäki
b1bbb23225
value flow: fixed fp when checking symboldatabase
2014-01-13 05:52:28 +01:00
Daniel Marjamäki
f6c7be91a9
Fixed cppcheck warning
2014-01-12 21:19:20 +01:00
Daniel Marjamäki
8b6f001f94
value flow: inconclusive handling of unknown functions
2014-01-12 19:48:20 +01:00
Daniel Marjamäki
5d2a39b580
CheckNullPointer: improved function call checking when new value flow analysis is used
2014-01-12 19:27:26 +01:00
Daniel Marjamäki
2e67ca06c0
value flow: some simplifications in unknown functions when there is library configuration
2014-01-12 18:19:00 +01:00
Daniel Marjamäki
ab866be03a
Tokenizer: Move 'else if' simplification to tokenize
2014-01-12 17:47:02 +01:00
Daniel Marjamäki
d700114edf
value flow: bailout if condition is defined by macro
2014-01-12 17:16:51 +01:00
Heinrich Schuchardt
f6510a6b45
Fixed #5339 (Tokenizer::setVarId : function-pointer function argument not getting variable id, causing FP)
2014-01-12 15:15:09 +01:00
Daniel Marjamäki
3d79613f2b
value flow: more bailouts when return/break/continue/goto is reached. TODO: handle these better.
2014-01-12 15:07:58 +01:00
Daniel Marjamäki
155990cb0e
value flow: improved checking of do-while loops for non-local variables
2014-01-12 15:02:58 +01:00
Daniel Marjamäki
5b679fc732
value flow: fixed fp for data member
2014-01-12 14:37:26 +01:00
Alexander Mai
86763b401c
Fixed #5340 (Preprocessor: not using errorLogger when reporting syntax errors)
2014-01-12 13:15:54 +01:00
PKEuS
b775714e3d
Moved several hardcoded function names in format string checking into libraries (std.cfg and windows.cfg).
...
Added support for loading a library in test suite.
2014-01-12 03:44:24 -08:00
Daniel Marjamäki
21d317b7d6
value flow: fixed redundant null pointer check
2014-01-12 12:38:41 +01:00
Daniel Marjamäki
d8262963d9
value flow: condition in loop, bailout valueflow analysis before loop if there is assignment inside the loop
2014-01-12 11:58:10 +01:00
Daniel Marjamäki
e3496080c8
Fixed #5334 (False positive: same expression on both sides of '||')
2014-01-12 07:40:56 +01:00
Daniel Marjamäki
f58e1ab80e
value flow: fixed fp in switch
2014-01-11 21:21:00 +01:00
Daniel Marjamäki
3625d179e5
value flow: don't perform value flow analysis in sizeof/typeof expressions
2014-01-11 21:10:01 +01:00
Daniel Marjamäki
680d3f1312
value flow: fixed fp for nested assignments
2014-01-11 20:53:23 +01:00
Daniel Marjamäki
4d045879aa
value flow: fixed fp when while condition contains variable that is changed in loop body
2014-01-11 20:25:49 +01:00
Daniel Marjamäki
75f9111775
value flow: bailout when variable is used in assignment to itself
2014-01-11 15:36:09 +01:00
Daniel Marjamäki
1fc2c9fe79
ast: fixed syntax tree for statement enclosed in parentheses ';(expr);'
2014-01-11 15:18:39 +01:00
Daniel Marjamäki
ceca6be22b
Fixed #5334 (False positive: same expression on both sides of '||')
2014-01-11 15:15:01 +01:00
Daniel Marjamäki
eaf8c83db5
value flow: refactoring. broke out function for skipping value simplifications in expressions.
2014-01-11 14:54:10 +01:00
Daniel Marjamäki
85dcb14813
value flow: bailout in valueFlowBeforeCondition if variable can be assigned by subfunction
2014-01-11 14:31:51 +01:00
Daniel Marjamäki
225001a45c
value flow: changed astparent lookup
2014-01-11 12:47:47 +01:00
Daniel Marjamäki
02b92efd1a
value flow: improved analysis of expressions below ?, && and || operators
2014-01-11 12:44:55 +01:00
Daniel Marjamäki
60348da1b5
value flow: fixed fp for rhs in && and || expressions
2014-01-11 11:30:34 +01:00
Daniel Marjamäki
1ad94a8be5
value flow: loosen up bailouts in valueFlowSubFunction
2014-01-11 07:52:25 +01:00
Daniel Marjamäki
57d241793f
value flow: fix segfault if var is null
2014-01-10 18:30:41 +01:00
Daniel Marjamäki
c687933e9f
value flow: improved handling of for loops
2014-01-10 18:19:24 +01:00
Daniel Marjamäki
3eebc8a9f1
test1
2014-01-10 16:51:58 +01:00
Daniel Marjamäki
3e7f692d4d
value flow: stop checking global variable when going out of function scope
2014-01-10 16:17:19 +01:00
Daniel Marjamäki
acb103e214
value flow: skip scopes that don't contain variable
2014-01-10 16:13:39 +01:00
Daniel Marjamäki
81513b4346
value flow: Readded safety check that tok->astOperand1() is not NULL
2014-01-10 05:54:03 +01:00
Daniel Marjamäki
d085705e8f
value flow: assume that value of global const variable is not changed
2014-01-10 05:47:56 +01:00
Daniel Marjamäki
a26c5736da
Library: Allow loading xml data from memory
2014-01-09 21:58:56 +01:00
Daniel Marjamäki
752e9d0fb7
Tokenizer::varId: Fixed wrong varid for shadow types with same names as class members
2014-01-09 21:44:29 +01:00
Daniel Marjamäki
1be30bf022
ast: fixed handling of templates
2014-01-09 17:14:16 +01:00
XhmikosR
f9dd9676be
Fix the C4099 warning.
2014-01-09 16:58:42 +02:00
Daniel Marjamäki
04cb56e070
ast: fixed trouble with 'ab=a+(b/(c))+d;' where the '(c)' could be mistaken for a cast
2014-01-08 21:49:42 +01:00
Daniel Marjamäki
4f11086505
Tokenizer: Don't remove parentheses in 'a?b:(c>0?d:e)'
2014-01-08 20:53:33 +01:00
Daniel Marjamäki
32f2ee422f
value flow: fixed segfault and added more handling of unsigned values
2014-01-08 20:10:38 +01:00
Daniel Marjamäki
644004573b
Preprocessor: fixed 8.0E+007 in macros
2014-01-08 18:05:14 +01:00
Daniel Marjamäki
7c4a7ac3d5
value flow: starting to refactor CheckNullPointer::nullPointerDeRefThenCheck
2014-01-08 17:37:39 +01:00
Daniel Marjamäki
26a72d73fe
value flow: improved subfunction handling when using && or || in function argument
2014-01-08 16:49:15 +01:00
Daniel Marjamäki
a2fe1ebe92
value flow: pass result of bool operator to function
2014-01-08 16:17:47 +01:00
Daniel Marjamäki
6d22c9deaa
value flow: if unsigned variable is compared against 1 with either >= or <= then assume it can have the value 0
2014-01-08 06:53:17 +01:00
Daniel Marjamäki
1e3c43e708
value flow: improved bailouts in ?:
2014-01-08 06:39:15 +01:00
Daniel Marjamäki
dfee044925
value flow: Fixed wrong value in subfunction after conditional return
2014-01-08 06:04:51 +01:00
Daniel Marjamäki
1fb0b1750c
value flow: Fixed FP in ?:
2014-01-07 19:46:13 +01:00
Daniel Marjamäki
740f72fdbd
value flow: simple handling of for loops
2014-01-07 19:20:56 +01:00
Martin Ettl
fa04273473
Merge branch 'master' of https://github.com/danmar/cppcheck
2014-01-06 18:51:15 +01:00
Daniel Marjamäki
126f2ed423
Fixed Visual Studio compiler error
2014-01-06 18:14:29 +01:00
Daniel Marjamäki
a6320a35e0
value flow: added experimental subfunction handling
2014-01-06 16:37:52 +01:00
Daniel Marjamäki
58fb2e756b
Value flow: added bailout on }
2014-01-06 11:27:56 +01:00
Daniel Marjamäki
39b47cc1e7
value flow: improved error message output for conditional division by zero
2014-01-06 10:51:17 +01:00
Daniel Marjamäki
a5b79bc968
value flow: fixed bailout so it really bails out
2014-01-06 10:23:17 +01:00
Zachary Blair
4a2da09491
minor cleanups. initialize members in initialization list
2014-01-06 08:02:04 +01:00
Daniel Marjamäki
c4fa3bb137
value flow: added bailouts for global variables and assignments
2014-01-06 07:44:58 +01:00
Daniel Marjamäki
c32d0f1992
CheckInternal: Improved checking of multiCompare patterns. The multiCompare pattern can contain any %cmd% until there is non-%cmd% used. For instance %var%|%num% is handled ok.
2014-01-05 23:03:36 +01:00
Daniel Marjamäki
a98c66b048
Fixed Token::Match pattern. See also #5310
2014-01-05 23:02:07 +01:00
Daniel Marjamäki
4620284cbf
astyle formatting
2014-01-05 22:06:11 +01:00
Daniel Marjamäki
62c608141d
CheckInternal: Improved checking of multiCompare patterns
2014-01-05 21:15:41 +01:00
Daniel Marjamäki
0877adb542
astyle formatting
2014-01-05 21:12:32 +01:00
Daniel Marjamäki
afaf1473a8
Value flow: refactorings, write debug warning if iterating too far
2014-01-05 20:06:46 +01:00
Graham Whitted
86201c13cb
Fixed #5097 (TemplateSimplifier::expandTemplate assertion failure)
2014-01-05 19:19:52 +01:00
Alexander Mai
77362fd671
Fixed #5289 (Crash: Stack overflow in isImplicitlyVirtual_rec when checking SVN)
2014-01-05 19:10:16 +01:00
Daniel Marjamäki
29c64cc34c
Merge pull request #209 from simartin/ticket_5266
...
Ticket #5266 : Properly tokenize "complex" static variable declarations.
2014-01-05 04:44:22 -08:00
Daniel Marjamäki
deb3699bd8
value flow: Updated Visual Studio files
2014-01-05 09:52:37 +01:00
Daniel Marjamäki
9fabc7991a
value flow: fixed segfault when checking lib/mathlib.cpp
2014-01-04 21:28:15 +01:00
Daniel Marjamäki
45278eadc7
value flow: fixed bugs
2014-01-04 21:23:17 +01:00
Daniel Marjamäki
d8270c710a
Add new experimental value flow analysis
2014-01-04 20:57:02 +01:00
Daniel Marjamäki
f1054a50f6
Merge pull request #208 from simartin/ticket_5201
...
Ticket #5201 : Get rid of internal error when checking valid C input for leaks
2014-01-04 05:18:44 -08:00
Daniel Marjamäki
93a9cb40df
Fixed #5310 (Internal error: match compiler returned different result than parsed match)
2014-01-04 13:53:54 +01:00
Simon Martin
d2cf9fd77c
Ticket #5266 : Properly tokenize "complex" static variable declarations.
2014-01-04 10:49:27 +01:00
PKEuS
55f68535b2
Set version to "1.64 dev"/1.63.99. Use version.h in cppcheck.cpp.
2014-01-04 10:41:13 +01:00
Daniel Marjamäki
6515691a47
1.63: Set version numbers
2014-01-04 09:32:37 +01:00
Simon Martin
6019f45249
Ticket #5201 : Get rid of internal error when checking valid C input for memory leaks.
2014-01-03 23:27:56 +01:00
Daniel Marjamäki
7125682d1a
Fixed #5274 (TokenList: macro handling)
2014-01-03 18:53:37 +01:00
Robert Reif
cbe3862599
Fixed #5264 (Size specifier in printf functions is wrong for some types)
2014-01-03 15:58:45 +01:00
Alexander Mai
10ff45b54a
Fixed #5306 (Implement --showtime=top5)
2014-01-03 10:45:14 +01:00
Alexander Mai
ea10a722fc
Fixed #5306 (Implement --showtime=top5)
2014-01-03 10:24:57 +01:00
Zachary Blair
7a6386bc4b
Fixed #4867 (Memory Leak: Return value of malloc)
2014-01-03 10:12:32 +01:00
Alexander Mai
f93d21c8df
Fixed #5303 (Possible NULL pointer dereference in checkassert.cpp)
2014-01-03 09:32:05 +01:00
Daniel Marjamäki
a94fccf51a
astyle formatting
2014-01-02 21:47:35 +01:00
Sam Truscott
4333dd3c75
Update Qt to support Markup structure
2014-01-02 18:18:24 +01:00
Daniel Marjamäki
b08880f20f
Library: Changed ignorefunction to a set
2014-01-02 17:28:24 +01:00
Daniel Marjamäki
372c29c24e
Fixed #5284 (duplicateExpression falsely reported by members of a union in some circumstances)
2014-01-02 16:58:07 +01:00
Daniel Marjamäki
2f91539d1d
Preprocessor: don't insert macroChar inside .1 and 1. tokens
2014-01-02 11:21:23 +01:00
Daniel Marjamäki
a1b0d190df
Fixed #3688 (false positive: (inconclusive, posix) (warning) The buffer 'cBuffer' is not zero-terminated after the call to readlink().)
2014-01-02 10:46:19 +01:00
Alexander Mai
12df5300ba
Fixed #5290 (Doxygen fixes ( 32be409
))
2014-01-01 20:46:00 +01:00
Martin Ettl
5a5277f2fa
Tokenizer::simplifyVarDecl: Fixed crash when checking garbage code.
2014-01-01 19:15:32 +01:00
Martin Ettl
0dccd3a632
Tokenizer:simplifyFlowControl(): Fixed crash on garbage code.
2014-01-01 19:04:02 +01:00
Daniel Marjamäki
d62055277d
Fixed #4787 (False Positive: Unused private function)
2014-01-01 18:36:51 +01:00
Alexander Mai
5539e9ea0f
Fixed #5279 (False positive: warning (uninitMemberVar): Member variable 'ToDoubleArray::mfNaN' is not initialized in the constructor. (modified #5170 example))
2014-01-01 18:34:39 +01:00
Daniel Marjamäki
cd65d8e54f
Fixed #5169 (Preprocessor::removeComments : Bad handling of __asm)
2014-01-01 12:44:59 +01:00
Daniel Marjamäki
32be4094e7
Symbol database: only put variables in variable list
2013-12-31 17:51:56 +01:00
PKEuS
621cf6e777
Support arrays as template parameters in TemplateSimplifier::templateParameters
2013-12-31 13:59:32 +01:00
PKEuS
6f76dfcb22
Forward declare tinyxml type used in library.h to avoid problems with dynamic linked configuration.
2013-12-31 12:30:17 +01:00
Daniel Marjamäki
803182bf45
Reverted 'GUI: Added CFGDIR qmake flag' there are various installation problems and this only fixes one of them.
2013-12-31 10:35:34 +01:00
Daniel Marjamäki
7e71c41ba7
Preprocessor: Don't insert macroChar inside 1.f and 1.e+7 as that mess it up later. Thanks ettlmartin for telling me about this.
2013-12-31 10:24:14 +01:00
Daniel Marjamäki
8da0d84905
Library: fixed crash in Library::load if exename is NULL
2013-12-30 18:35:27 +01:00
Daniel Marjamäki
99703e1a3f
Preprocessor: make sure 1E-7, 1E+7, 1e+7 in macros is output as a single token. Putting a macroChar before the 7 mess it up later.
2013-12-30 18:03:24 +01:00
PKEuS
4f0121ee2f
Splitted simplification out of tokenize()
2013-12-30 17:45:28 +01:00
Daniel Marjamäki
c143b02e67
GUI: Added CFGDIR qmake flag
2013-12-30 09:01:44 +01:00
Daniel Marjamäki
582baa5648
Preprocessor: make sure 1e-7 is output as a single token. puttin a macroChar before the 7 mess it up later.
2013-12-29 21:51:01 +01:00
Daniel Marjamäki
41e4194573
Tokenizer: set links for <> in 'a=new b<c>;' code
2013-12-29 15:37:27 +01:00
Daniel Marjamäki
f2661dae4c
astyle formatting
2013-12-29 13:44:13 +01:00
Daniel Marjamäki
e13aa0dbc3
Fixed #5275 (FP mismatchAllocDealloc: user defined opendir()/closedir() on non-POSIX system)
2013-12-29 09:51:29 +01:00
Daniel Marjamäki
ef3d3f2d40
Temporary fix for #5263 until tinyxml2 handle folders better. When https://github.com/leethomason/tinyxml2/issues/147 is fixed this should be reverted.
2013-12-28 21:57:13 +01:00
Daniel Marjamäki
4b72f01e99
clarify calculation: Fixed FP for 'a = (*p ? 1 : 2)'
2013-12-28 11:02:39 +01:00
Daniel Marjamäki
e0eb000ac3
AST: Fixed problem with decrement
2013-12-27 14:40:59 +01:00
Daniel Marjamäki
d3a848f2e6
Makefile: Added optional CFGDIR parameter that allows user to specify where Cppcheck will look for cfg files.
2013-12-26 18:41:51 +01:00
Daniel Marjamäki
742a6935ea
Calculation in sizeof: Fixed FP for sizeof(Fred**)
2013-12-26 13:52:58 +01:00
Daniel Marjamäki
29e74222fb
Sizeof calculation: Fixed FP for sizeof(int*[2])
2013-12-26 13:41:21 +01:00
Daniel Marjamäki
5d5e347418
AST: better handling of 'sizeof(void*)'
2013-12-25 22:08:53 +01:00
Daniel Marjamäki
915cb6c757
Fixed #5261 (AST: cast not handled well (a::b&)x)
2013-12-25 21:19:28 +01:00
Daniel Marjamäki
aa65799c19
pointerArithBool: Updated error message
2013-12-25 19:56:00 +01:00
Daniel Marjamäki
6182394966
Uninitialized variables: Fixed false positive taking value of pointer that is allocated but not initialized
2013-12-25 14:00:27 +01:00
Daniel Marjamäki
eb2ea1c28f
AST: refactored CheckSizeof::sizeofCalculation()
2013-12-25 12:35:41 +01:00
Daniel Marjamäki
26dfddac6b
UninitVar: Fixed false positive when checking if allocated pointer is null
2013-12-24 12:48:17 +01:00
Daniel Marjamäki
4c44e62159
AST: Refactored CheckOther::clarifyCalculation
2013-12-24 10:07:20 +01:00
Daniel Marjamäki
753559fff3
Uninitialized variables: Don't warn about try/catch exception variables
2013-12-24 07:39:15 +01:00
Daniel Marjamäki
042d3afb80
CheckOther::checkDuplicateExpression: Readded warnings when there is a expression between the duplicate expressions 'X || Y || X'
2013-12-24 07:21:46 +01:00
Daniel Marjamäki
ac30a84c3a
Refactoring: Replaced CheckOther::checkCCTypeFunctions with configuration
2013-12-23 19:58:33 +01:00
Daniel Marjamäki
a3dd65caee
Fixed #5126 (new check: missing pointer dereference or pointer overflow 'if (p+1)')
2013-12-23 18:39:05 +01:00
Daniel Marjamäki
661784a170
Fixed #5255 (False positive (error) Uninitialized variable: ptr2 - calling a static member function)
2013-12-23 16:50:27 +01:00
Daniel Marjamäki
e2fa6a291c
Uninitialized variables: Fixed false negatives for loop variables / pointer dereference
2013-12-23 12:27:00 +01:00
Daniel Marjamäki
596b4bd405
astyle formatting
2013-12-23 12:26:12 +01:00
Daniel Marjamäki
e747b6c49b
Merge pull request #202 from simartin/ticket_5214
...
Ticket #5214 : Added test case (ticket already fixed in mainline).
2013-12-23 02:49:25 -08:00
Daniel Marjamäki
76b907fe65
Fixed #5252 (Improve check: use Library to validate function arguments in invalidFunctionUsage)
2013-12-23 10:06:45 +01:00
Daniel Marjamäki
be03d4718a
Library: Added <valid> element that is used to define valid input values for functions
2013-12-22 19:10:14 +01:00
Daniel Marjamäki
85c62f98d7
Library: added <markup> element
2013-12-22 18:44:31 +01:00
Simon Martin
02dc49624d
Ticket #5214 : Don't read out of bounds upon invalid ternary operator.
2013-12-22 18:13:52 +01:00
Daniel Marjamäki
4769838b80
Library: Refactoring of markup code
2013-12-22 17:03:46 +01:00
Daniel Marjamäki
e2bc99aa24
Fixed #5154 (Tokenizer: wrong handling of msvc 'for each')
2013-12-17 06:34:27 +01:00
Daniel Marjamäki
762806499f
Fixed #5182 (Tokenizer::simplifyEnum: template function call as enum value)
2013-12-16 07:07:00 +01:00
Daniel Marjamäki
92305ed1f9
Fixed #5170 (False positive: warning (uninitMemberVar): Member variable 'ToDoubleArray::mfNaN' is not initialized in the constructor.)
2013-12-15 14:07:29 +01:00
Daniel Marjamäki
a948b4f4b0
Revert "Preprocessor:removeParentheses: fixed potential buffer access out of bounds, if find returns std::string::npos."
...
This reverts commit 4fbe15c866
.
As far as I see there can't be buffer access out of bounds. line always contain a '('.
2013-12-15 13:41:07 +01:00
Daniel Marjamäki
7938692b01
Fixed #5212 (Tokenizer::simplifyEnum bad simplification of enum value (1<<0)|(1<<1))
2013-12-15 07:47:04 +01:00
Daniel Marjamäki
f599e3184c
Fixed #5174 (Tokenizer: member function 'abort' returns)
2013-12-14 11:12:48 +01:00
Daniel Marjamäki
fdcb6634df
Fixed #5190 (FP Use const reference to avoid data copying)
2013-12-14 08:46:18 +01:00
Daniel Marjamäki
98b6fa2eaf
SymbolDatabase: Use std::size_t for Function::getArgument() argument since Function::argCount() returns a std::size_t
2013-12-14 08:35:46 +01:00
Daniel Marjamäki
57ecdd693c
Fixed #5149 (false positive: (error) Dereferencing 'memory' after it is deallocated / released)
2013-12-14 07:37:24 +01:00
Daniel Marjamäki
80dec5a976
Uninitialized variables: Fixed FP when taking address of uninitialized variable
2013-12-13 20:10:22 +01:00
Daniel Marjamäki
7fe923bfc5
Uninitialized variables: Fixed FP when the variable is initialized in do-while condition
2013-12-13 13:27:01 +01:00
Daniel Marjamäki
abdd29fce3
fixed FP when passing uninitialized buffer as 2nd argument to itoa
2013-12-13 07:51:33 +01:00
Daniel Marjamäki
3e6fbc6517
Fixed uninitialized variable FP after realloc if it fails. Related with ticket: #5240
2013-12-13 07:15:59 +01:00
Daniel Marjamäki
08cd0cd0f7
CheckOther::checkDuplicateExpression: Added TODO comment to readd checking for duplicate separated expressions
2013-12-13 06:40:35 +01:00
Daniel Marjamäki
d2493fa3cb
CheckMemoryLeak: Report OtherRes leaks as resource leak
2013-12-12 18:23:42 +01:00
Daniel Marjamäki
35189e80f2
Uninitialized variables: Fixed false positive for '*p=..'
2013-12-12 15:33:31 +01:00
Daniel Marjamäki
7321f92eff
CheckUninitVar: Fix Coverity warning about possible null pointer.
2013-12-12 12:36:49 +01:00
Daniel Marjamäki
1b86615a69
Uninitialized variables: Fixed false positive for 'p=malloc; if (p) {}'
2013-12-12 11:44:07 +01:00
orbitcowboy
4fbe15c866
Preprocessor:removeParentheses: fixed potential buffer access out of bounds, if find returns std::string::npos.
2013-12-09 01:40:51 -08:00
Daniel Marjamäki
4e7594748d
Uninitialized variables: Fixed false positive for 'p=malloc; if (python tools/daca2.py b)'
2013-12-12 09:17:41 +01:00
Daniel Marjamäki
9f62740e1d
Fixed #5236 (varid 0: vlc: src/misc/objects.c:126)
2013-12-12 08:44:00 +01:00
Daniel Marjamäki
a4f9cb78d5
Uninitialized variables: Fixed false positives when passing allocated pointer to function
2013-12-11 05:54:42 +01:00
Daniel Marjamäki
ef15e40de5
Uninitialized variables: error when passing uninit pointer to function
2013-12-10 18:36:16 +01:00
Daniel Marjamäki
83066edec0
Code cleanup
2013-12-10 06:29:06 +01:00
Daniel Marjamäki
5ba02d2fdd
AST: Always use AST
2013-12-09 18:06:19 +01:00
Daniel Marjamäki
be5c00d215
Uninitialized variables: check function arguments
2013-12-09 15:58:42 +01:00
Daniel Marjamäki
14a00046a3
Fixed #5207 (Struct uninitialized members useage is not giving error (malloc).)
2013-12-04 20:32:20 +01:00
Simon Martin
fe75686595
Ticket #5203 : Don't crash when checking buffer overrun for invalid code.
2013-11-30 07:40:32 +01:00
Daniel Marjamäki
0c5282b1af
Fixed #5081 (False positive: (error) Uninitialized variable: f (handling of C-cast not correct))
2013-11-28 16:04:47 +01:00
Daniel Marjamäki
771dc2e1ad
AST: Improved handling when calling function through function pointer hidden within parantheses '(a.f)(1,2)'
2013-11-27 06:17:00 +01:00
Daniel Marjamäki
3b11ee9e0e
AST: Improved handling of brackets
2013-11-25 20:58:40 +01:00
Daniel Marjamäki
d8b25da73c
Fixed #4740 (False Positive: Uninitialised variable 'int *a[2][19]; int **b = a[0];')
2013-11-25 06:38:23 +01:00
Daniel Marjamäki
da540a3bb3
AST: Improved astIsFloat handling of expressions
2013-11-25 04:26:15 +01:00
Daniel Marjamäki
abdf2bb9d4
AST: fixed isSameExpressions handling of ({..})
2013-11-25 04:08:28 +01:00
Daniel Marjamäki
94e2bf7a11
AST: Handle ({..})
2013-11-25 04:07:44 +01:00
Robert Reif
43f00942dd
Fixed #5197 (SymbolDatabase: bad handling of unknown macros in function declaration)
2013-11-25 03:43:39 +01:00
Daniel Marjamäki
13cd0f41f6
AST: Fixed FP in isSameExpression when there are different casts
2013-11-24 15:17:08 +01:00
Alexander Mai
38b2f6b9b0
Fixed #5168 (segmentation fault (invalid code) in Tokenizer::simplifyVarDecl)
2013-11-24 11:07:11 +01:00
Daniel Marjamäki
8b77b7711c
Merge pull request #199 from simartin/ticket_5168
...
Ticket #5168 : Don't crash when simplifying bit-fields for invalid code.
2013-11-24 01:55:02 -08:00
Simon Martin
9817da00ec
Ticket #5168 : Don't crash when simplifying bit-fields for invalid code.
2013-11-23 20:33:03 +01:00