Frank Zingsheim
1c12378ce9
Simplified pattern in Tokenizer::simplifyExternC() ( #5544 )
2015-07-23 13:04:25 +02:00
Daniel Marjamäki
eda3fdc96a
CheckCondition: Refactoring function parameter lookup
2015-07-23 12:06:33 +02:00
Frank Zingsheim
907dea92b1
Fixed #6844 (CMake with matchcompiler)
2015-07-23 10:49:53 +02:00
Frank Zingsheim
6485339d66
Support lambdas in "else if" simplification ( #6860 )
2015-07-23 09:41:35 +02:00
Daniel Marjamäki
8d8c03dad8
uninitvar: removed returns from new checking to fix 'more' tests. these returns should be readded when the executionpath checking is removed.
2015-07-23 09:21:53 +02:00
Daniel Marjamäki
79067ac031
uninitvar: use new checking instead of executionpath in more tests. small improvements in new checking to fix testcases.
2015-07-23 08:46:59 +02:00
Daniel Marjamäki
1de1aaa2f4
CheckUninitVar: Fix crash when AST is not created properly
2015-07-22 22:17:12 +02:00
Daniel Marjamäki
1f5eea98b5
CheckUninitVar: Fix a FP reported for invalid code
2015-07-22 21:58:06 +02:00
Daniel Marjamäki
42ed436e9d
Tweaks in uninitvar, small steps to make it possible to remove the ExecutionPath
2015-07-22 20:31:58 +02:00
Daniel Marjamäki
75f922e799
cleanup checkother
2015-07-22 18:48:43 +02:00
Daniel Marjamäki
b38062743d
Refactoring handling of if conditions in CheckMemoryLeak
2015-07-22 16:45:14 +02:00
PKEuS
258e3b9dc3
Refactorization: Renamed Token::isOperator() to Token::isOperatorKeyword() to avoid confusion with Token::isOp(), use Token::isOperatorKeyword() in setVarId().
2015-07-22 13:57:51 +02:00
Robert Reif
4e693f1620
Fixed #6827
2015-07-22 13:57:51 +02:00
PKEuS
ab1113fb16
Fixed crash on garbage code #6859
2015-07-22 13:33:24 +02:00
Daniel Marjamäki
b2b4bb49fa
Refactoring handling of comparisons
2015-07-22 12:31:18 +02:00
Daniel Marjamäki
c67776c04d
Testing: extract testcases, edit comparisons, run cppcheck, compare results
2015-07-22 09:52:24 +02:00
Daniel Marjamäki
6313304f77
Fix Travis build
2015-07-22 01:52:24 +02:00
Daniel Marjamäki
c6cadf5252
Fix Travis build
2015-07-22 01:41:01 +02:00
Daniel Marjamäki
350cba1c59
CheckLeakAutoVar: updated handling of comparisons after Tokenizer::simplifyIfNot was removed
2015-07-22 01:24:07 +02:00
Daniel Marjamäki
f711520892
Fixed #6852 (false negative: logical conjunction 'x == 0')
2015-07-21 22:26:22 +02:00
Daniel Marjamäki
f9d22f70db
Removed simplifyIfNot simplification ( #6072 )
2015-07-21 20:56:47 +02:00
Daniel Marjamäki
24269b1061
Refactoring CheckMemoryLeak::notvar, use AST instead of token parsing
2015-07-21 20:27:59 +02:00
Daniel Marjamäki
1b8252181d
Tokenizer: Removed Tokenizer::simplifyIfNotNull ( #6072 )
2015-07-21 17:58:44 +02:00
Daniel Marjamäki
ffc707246b
ValueFlow: Better handling of Known/Possible values after conditional unknown function call
2015-07-21 17:56:40 +02:00
PKEuS
7f6b6e43b1
Support strings in CheckStl::mismatchingContainers() ( #6839 )
2015-07-21 14:13:26 +02:00
PKEuS
a3eb725c3f
Support C++03-style of declaring a copy ctor as deleted ( #6585 )
2015-07-21 13:46:50 +02:00
amai2012
e8ac4d8e87
#6847 segmentation fault (invalid code) in Token::multiCompare. Fix and simple refactoring in Tokenizer
2015-07-21 13:40:50 +02:00
PKEuS
bdd53b4142
Fixed false positive #6717
2015-07-21 12:13:59 +02:00
PKEuS
dd9cb929bf
Refactorization in Preprocessor: Support beginning/end of file in removeSpaceNearNL(), avoid string copying when calling replaceIfDefined()
2015-07-21 12:13:58 +02:00
Daniel Marjamäki
2e2735518e
AST: Updated printAst
2015-07-21 11:54:11 +02:00
Daniel Marjamäki
8a72bb8aa8
AST: Fixed AST for struct initialisation
2015-07-21 11:40:42 +02:00
PKEuS
149d11d9ad
Improved handling of inline assembly ( #6813 ):
...
- Add ; after asm {} block if required
- Fixed inline suppressions
2015-07-20 23:09:54 +02:00
PKEuS
a0890ecd2c
Fixed false positive: Do not print useClosedFile on arrays ( #6823 )
2015-07-20 22:40:19 +02:00
PKEuS
c987a99ac8
Fixed hang on garbage code ( #6824 )
2015-07-20 22:33:32 +02:00
Daniel Marjamäki
749bb34deb
Fixed #6830 (ValueFlow: value of switch-variable inside switch)
2015-07-20 19:45:38 +02:00
Alexander Mai
defee734f5
#6846 segmentation fault (invalid code) in CheckClass::hasAssignSelf
2015-07-20 19:04:34 +02:00
Daniel Marjamäki
c0880c8d79
ValueFlow: Values that are assigned in switch are possible after switch
2015-07-20 09:36:56 +02:00
Frank Zingsheim
8416be4d9d
#6345 Tokenizer::simplifyTypedef() adds redundant 'typename' to declaration
2015-07-20 07:55:22 +02:00
amai2012
af9b67562b
Merge pull request #626 from simartin/ticket_6648
...
Ticket #6648 : Properly handle variables that have been deallocated and whose _address_ is taken after
2015-07-19 18:04:47 +02:00
Simon Martin
fa94f2e0f4
Ticket #6648 : Properly handle variables that have been deallocated and whose _address_ is taken after in CheckLeakAutoVar.
2015-07-19 17:37:50 +02:00
Alexander Mai
8b97f04de4
Try to address some Coverity issues. Add TODO testcase for #5783 . Introduce TODO_ASSERT macro.
2015-07-19 15:03:35 +02:00
Daniel Marjamäki
ce7e879460
ValueFlow: isVariableChanged() should return true when variable is changed by passing its address to subfunction
2015-07-18 15:35:39 +02:00
Daniel Marjamäki
5aa0b284dc
ValueFlow: Evaluate more calculations when operands have known values
2015-07-18 15:03:57 +02:00
Simon Martin
1f73d71542
Ticket #5776 : Simplify (&a)->b into a.b
2015-07-17 23:27:35 +02:00
Simon Martin
af1b0cfddf
Ticket #6835 : Don't get confused by parentheses while detecting template parameter default values.
2015-07-17 21:30:34 +02:00
Daniel Marjamäki
25d9ebedd8
ValueFlow: fixed known/possible value of static variable
2015-07-17 20:48:37 +02:00
Daniel Marjamäki
f1e410a878
ValueFlow: value that is changed in do while loop must be possible instead of known.
2015-07-17 20:30:34 +02:00
Daniel Marjamäki
69c1a7ecb1
ValueFlow: default argument values are not known, they are possible
2015-07-17 16:05:07 +02:00
Daniel Marjamäki
cb04dfbd37
Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))
2015-07-17 15:30:23 +02:00
Daniel Marjamäki
577ab1c2ac
ValueFlow: result of ? is not 'known'
2015-07-17 15:22:24 +02:00
Daniel Marjamäki
61cf224f32
ValueFlow: Make known loop value possible
2015-07-17 10:24:24 +02:00
Daniel Marjamäki
9bdee7fce9
ValueFlow: Refactoring setTokenValue()
2015-07-17 09:46:31 +02:00
Daniel Marjamäki
3d5781743c
ValueFlow: Restore handling of not
2015-07-16 21:17:44 +02:00
Daniel Marjamäki
15a8e4d2df
Temporarily revert "Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))"
...
This reverts commit a3fbad50cb
.
The ValueFlow must be updated before this can be re-added.
2015-07-16 21:10:46 +02:00
Daniel Marjamäki
09efe140fe
ValueFlow: Change value to 'Possible' after conditional assignment in inner loop
2015-07-16 21:08:32 +02:00
Daniel Marjamäki
38214b6907
ValueFlow: function arguments only has 'possible' values
2015-07-16 20:49:14 +02:00
Daniel Marjamäki
fa13179c68
Fixed Cppcheck warning, condition is always true
2015-07-16 20:23:25 +02:00
Daniel Marjamäki
a3fbad50cb
Fixed #4842 (condition is always true (variable is assigned constant value and then used in condition))
2015-07-16 20:17:57 +02:00
Daniel Marjamäki
88491267d6
ValueFlow: Added Value::valueKind that says if value is known or possible
2015-07-16 17:33:16 +02:00
Alexander Mai
d45aa6170b
Minor refactoring in Tokenizer: Optimize for C code and use nullptr instead of 0
2015-07-16 00:29:48 +02:00
Simon Martin
2d8993319c
Ticket #6810 : Avoid infinite loop upon invalid typed enum declaration.
2015-07-15 21:39:15 +02:00
Daniel Marjamäki
b821e996e1
MathLib: Add TEST_MATHLIB_VALUE that is used to test MathLib::value
2015-07-15 17:36:41 +02:00
Alexander Mai
b604d63dd8
#6726 cppcheck hangs with 100% CPU load (invalidcode) inside Token::astOperand2(). #6840 egmentation fault (invalid code) in Token::astOperand2. Improve stability on invalid code
2015-07-15 15:19:48 +02:00
Alexander Mai
b30d9ffe98
#6838 cppcheck hangs on some strange input code. Token::astOperand1/2 throw internal error on garbage code instead of creating endless recursion in AST
2015-07-14 21:07:10 +02:00
Daniel Marjamäki
177fd9c79d
MathLib: make isinf and isnan more portable
2015-07-14 20:48:08 +02:00
Antti Tuppurainen
a75872a15e
Fix uniform init in out-of-class ctor-initer
2015-07-14 18:09:07 +02:00
Daniel Marjamäki
405a1fba11
ValueFlow: set values for false/true
2015-07-14 18:02:26 +02:00
Daniel Marjamäki
1a872a2c9f
Fixed #6019 (false negative: Expression is always true/false '!(v!=10) && !(v!=20)')
2015-07-13 20:53:49 +02:00
Daniel Marjamäki
7ccd30362c
Fixed #6826 (False positive: ValueFlow conditional value used in condition)
2015-07-12 19:35:47 +02:00
Daniel Marjamäki
a4a866ab07
Fix Cppcheck warning about non-explicit constructor for MathLib::value
2015-07-10 21:17:17 +02:00
Daniel Marjamäki
ac04541d56
MathLib: Add value class. this will allow more type-independant value handling.
2015-07-10 20:36:38 +02:00
Daniel Marjamäki
f36f1e8952
MathLib: Minor tweaks. Use toDoubleNumber instead of std::atof. Only use clang workaround with clang.
2015-07-10 18:34:28 +02:00
Daniel Marjamäki
81d9c90890
Fixed Cppcheck warning caused by a redundant null pointer test.
2015-07-08 21:04:38 +02:00
Daniel Marjamäki
0dd008e068
Fixed Cppcheck warning about possible null pointer dereference
2015-07-08 16:06:35 +02:00
Daniel Marjamäki
5a9328f26a
Fixed Cppcheck warning about possible null pointer dereference
2015-07-08 13:41:27 +02:00
Simon Martin
7bfb1fb545
Simplify the code handling C++0x typed enumerations.
2015-07-06 23:37:16 +02:00
Boris Egorov
f7c6140e1a
checkautovariables: Simplify some conditions
2015-07-05 17:15:13 +02:00
Daniel Marjamäki
f3b4c1d0db
Remove some useless casts, probably added to avoid false positives.
2015-07-04 13:19:21 +02:00
Daniel Marjamäki
b8e77c8005
valueflow: fix for ?:. the condition result is not a result of the ?.
2015-07-04 11:17:38 +02:00
Daniel Marjamäki
fef251ac76
negative array size: fixed noise when array is not vla
2015-07-04 09:42:42 +02:00
Daniel Marjamäki
7e1ddea653
One more fix for #6811 (ValueFlow: result of ?:)
2015-07-02 20:52:04 +02:00
Daniel Marjamäki
c751039612
Fixed #6811 (ValueFlow: result of ?:)
2015-07-02 20:11:27 +02:00
amai2012
4a1695c879
#6807 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. #6808 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Throw InternalError on garbage code
2015-07-01 16:31:49 +02:00
Alexander Mai
6e03e7dca2
Remove some code checking for invalid class hierarchy which got obsolete since 480a5672b0
. Run astyle
2015-07-01 07:50:13 +02:00
amai2012
480a5672b0
#6298 stack overflow in Scope::findFunctionInBase (endless recursion). Fix handling of circular class hierarchy
2015-07-01 00:04:01 +02:00
amai2012
1604e751e5
Fix some compiler warnings which got introduced recently
2015-06-30 20:11:51 +02:00
amai2012
99dfd55d0c
#6804 segmentation fault (invalid code) in Token::getValueTokenDeadPointer. Fix null pointer access
...
TestGarbage: Increase coverage by running all code snippets as C as well as C++ code. (inspired by #6800 )
2015-06-30 19:40:22 +02:00
amai2012
c0b91662ba
#6803 segmentation fault (invalid code) in Token::findClosingBracket.
2015-06-30 12:16:55 +02:00
amai2012
0849deed01
#6801 C: FN variable scope, FP unused value?. Fix typo from d7aa65c1fc
2015-06-30 08:46:30 +02:00
amai2012
11538c84f6
Refactoring: Distinguish between C and C++ code
...
Refactoring: Replace CheckNonReentrantFunctions::initNonReentrantFunctions by static initialization
2015-06-29 21:17:15 +02:00
Alexander Mai
d7aa65c1fc
#6800 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase. Fix null pointer access for invalid C code
2015-06-29 19:56:02 +02:00
Martin Ettl
b8e08ca5d8
Code cleanup.
2015-06-28 19:27:23 +02:00
Martin Ettl
7ff4d10c43
Astyle formatting, no functional changes.
2015-06-28 19:25:13 +02:00
amai2012
5814c3b84c
Fix some compiler warnings with VS
...
Minor refactoring on Windows SEH code.
2015-06-28 19:20:16 +02:00
Alexander Mai
0b225fa02f
2nd attempt to fix crash in CheckUnusedFunctions::check. CheckBufferOverrun::checkBufferAllocatedWithStrlen: Don't check for 'new' in C code.
2015-06-28 18:34:09 +02:00
Alexander Mai
02a3a01eca
Fix compiler warnings
2015-06-28 18:07:31 +02:00
Alexander Mai
2c73518e29
Fix platform-dependent test result, formatting and crash in whole program analysis
2015-06-28 17:54:48 +02:00
amai2012
4a47b8b3ae
Refactoring: Better distinguish between C and C++ in a few checks.
2015-06-28 16:49:16 +02:00
Alexander Mai
56e90f95d9
Corrections for non-Microsoft compilers
2015-06-28 12:34:08 +02:00
amai2012
649a89d308
Refactoring: Expose some previously local functions to public and add Tokenizer as argument to distinguish between C and C++ code (e.g. in isSameExpression).
...
Refactoring: Improve type-safety for TestFixture::assertEquals to allow tests with types which were not handled correctly (e.g. unsigned long long)
2015-06-28 12:08:36 +02:00
Alexander Mai
e75662aaf1
#6792 segmentation fault (invalid code) in TemplateSimplifier::templateParameters. Avoid null pointer access
2015-06-25 20:48:05 +02:00
amai2012
ac1f0301c0
#6791 segmentation fault (invalid code) in TokenList::createAst. Fix null pointer access
2015-06-25 08:57:09 +02:00
Alexander Mai
c047fae53b
#6790 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix null pointer access
2015-06-25 07:47:40 +02:00
Alexander Mai
8946fcd960
#6772 segmentation fault (invalid code) in Tokenizer::setVarId. Add another validate() call to Tokenizer::simplifyTokenList1. Small refactoring to Tokenizer: mark many methods as private.
2015-06-24 20:47:04 +02:00
Alexander Mai
6ba9c21fb9
#6786 segmentation fault (invalid code) in Tokenizer::simplifyRedundantParentheses. Small refactoring for Tokenizer::simplifyTokenList2() including additional calls to validate() - which prevents heap corruption on invalid code
2015-06-24 20:22:28 +02:00
amai2012
9fedc9bd74
#6788 segmentation fault (invalid code) in Tokenizer::simplifyVarDecl. Fix null pointer access
2015-06-24 16:54:23 +02:00
Alexander Mai
f806d945a1
Refactoring: Allow TemplateSimplifier to throw InternalErrors by itself.
2015-06-23 20:53:57 +02:00
amai2012
69f91ac187
#6785 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Avoid null pointer access
2015-06-23 17:59:01 +02:00
Alexander Mai
07bcc7157b
#6784 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Avoid null pointer access
2015-06-22 20:43:26 +02:00
amai2012
99524b1f59
#6780 segmentation fault (invalid code) in Token::multiCompare. Simple fix in CheckOther
2015-06-22 11:12:46 +02:00
Alexander Mai
b6858622eb
#6779 internal error: division overflow. Previous error handling (see #4520 ) was too restrictive.
2015-06-20 23:15:35 +02:00
Alexander Mai
4172011e78
Missing update for Makefile. CheckMemoryLeakInFunction::getcode(): skip some C++ token matching in C mode. Minor refactoring
2015-06-20 22:49:28 +02:00
Alexander Mai
b3c7a3f798
Fix more (potential) multi-threading issues
2015-06-20 22:26:51 +02:00
Simon Martin
7481fbb028
Fixed #6506 (Properly detect calls to the deallocating free() function)
2015-06-20 21:00:54 +02:00
Daniel Marjamäki
1d49334398
Fixed #6662 (False positive assignIfError (assignment in while condition))
2015-06-20 16:23:16 +02:00
Martin Ettl
272cf27ec3
Improved constness of local variable, no functional changes.
2015-06-20 11:33:27 +02:00
Daniel Marjamäki
63f39ea48f
Change unusedScopedObject severity from error to style. The checker does not determine that there is ub or wrong behaviour.
2015-06-20 11:22:15 +02:00
Simon Martin
cba0583045
Ticket #6536 : Properly handle variables whose name is that of an allocation function.
2015-06-19 23:48:40 +02:00
Daniel Marjamäki
af4a4663e2
Fixed #6764 (False positive redundantCondition - !(i>1) is not i<1)
2015-06-19 19:49:05 +02:00
Daniel Marjamäki
02df692b0b
Fixed #4760 (false negative: (error) usage of uninitialized variable (struct member))
2015-06-19 18:21:46 +02:00
Alexander Mai
712919a691
#6431 Invalid XML created - Invalid encoding of string literal. Partial fix: ensure the short message string is also processed to avoid problems with non-terminated string.
2015-06-18 21:16:25 +02:00
Alexander Mai
60f5bd97df
Refactoring: missing include added, (potential) multi-threading issue fixed, expose static method to allow unit testing
2015-06-18 19:07:51 +02:00
PKEuS
189a652c2e
Fixed garbage code in checkinternal.cpp
2015-06-18 17:13:46 +02:00
Matthias Krüger
baaf3213e4
checkcondition: only print style message "A && (!A || B)' is equivalent to 'A || B'" if --enable=style is given.
2015-06-18 13:23:48 +02:00
Alexander Mai
13c1c2c035
Refactoring (use const std::set for strings). Omit some matching for C++ stuff within C code.
2015-06-17 22:28:15 +02:00
Alexander Mai
eebb5b8c77
Fix some compiler warnings in checkio.cpp. Fix some (potential) multi-threading issues in checkinternal.cpp
2015-06-17 21:25:15 +02:00
Daniel Marjamäki
a884362817
Fixed #6752 (wrong AST when there is lambda function)
2015-06-17 19:32:44 +02:00
orbitcowboy
06e818f89d
Running astyle, no functional change.
2015-06-17 09:09:23 +02:00
amai2012
33d7631ee3
Fix another Borlad-specific test by setting Windows platform type
...
Refactoring: make CheckIO::ArgumentInfo aware of language (C vs. C++) to perform some optimizations
2015-06-16 23:11:34 +02:00
amai2012
a8db00b4bf
Repair test which had to be adjusted after previous changeset.
...
Refactoring: Add some const
2015-06-16 22:45:33 +02:00
amai2012
919fcb38f5
Refactoring Tokenizer
...
Create Tokenizer::simplifyAsm2(), skip simplifyExternC() in C code and
simplifyBorland() on non-Microsoft or C code
2015-06-16 20:53:11 +02:00
Martin Ettl
9b14ab15eb
MathLib::intsuffix: Added support for LLU and LU suffixes.
2015-06-16 19:12:18 +02:00
amai2012
227b48212e
Skip some C++-specific simplifications in Tokenizer
2015-06-15 19:42:20 +02:00
Daniel Marjamäki
2cc23b4bb3
MathLib: Try to keep type suffix in constant calculations
2015-06-15 19:01:56 +02:00
XhmikosR
8fc4456fb4
Fix compilation error with MSVC 2013 after a7b82b5
.
2015-06-15 16:06:18 +03:00
Alexander Mai
a5a835b1e0
#6771 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase
2015-06-14 22:18:28 +02:00
Daniel Marjamäki
d571d5db6f
Fixed compiler warning -Wfloat-equal in template when type is double and there is equality comparison
2015-06-14 20:25:52 +02:00
Daniel Marjamäki
1e1ba6b4a9
Fixed #6574 (False positive oppositeInnerCondition - unknown variable)
2015-06-14 20:06:05 +02:00
Alexander Mai
70ba6c4340
#6767 False positive: memory leak when variable name is 'new'. Fix handling of new in C code. Move some tests for TokenList to new testtokenlist.cpp
2015-06-14 15:49:49 +02:00
Alexander Mai
a7b82b5c28
Refactoring to address some issues from #5895 (handling of unsigned numbers). Also adding a TODO testcase since the real issue (FP) is still not fixed
2015-06-13 18:08:13 +02:00
Alexander Mai
40d7baa6bb
Fix more (potential) multi-threading issues by moving static local vars (non-POD-type) to file scope
2015-06-13 16:22:43 +02:00
Alexander Mai
d704e97203
Fix (potential) multi-threading issues by moving static local vars (non-POD-type) to file scope
2015-06-10 21:14:17 +02:00
Daniel Marjamäki
3986c0dc64
fixed cppcheck warnings
2015-06-10 19:07:04 +02:00
Dmitry-Me
cae605b1ec
New warning: warn about redundant code in condition.
2015-06-10 18:53:55 +02:00
Frank Zingsheim
0e354a03bd
Fixed #6716 (Performance: Alternative String Representation in Match Compiler)
2015-06-07 16:21:06 +02:00
Daniel Marjamäki
0ca410a4d7
Fixed #6668 (False positive bufferAccessOutOfBounds on sprintf() - regression)
2015-06-07 14:01:20 +02:00
Alexander Mai
c18461b173
#6761 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crash.
2015-06-07 13:35:51 +02:00
Daniel Marjamäki
75b0430ba5
Token::strValue: fixed handling of backslash
2015-06-07 11:25:33 +02:00
Alexander Mai
b6264e4a00
#6759 segmentation fault (invalid code) in Tokenizer::simplifyTokenList2. #6760 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crashes
2015-06-06 13:11:32 +02:00
Daniel Marjamäki
d208e763df
astyle formatting
2015-06-05 14:34:53 +02:00
Daniel Marjamäki
e36cc9f6d9
stringLiteralWrite: Updated error message
2015-06-05 14:34:13 +02:00
amai
5fd9dd04fa
#6757 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix crash
2015-06-04 19:00:35 +02:00
Alexander Mai
5f4902c613
6755 segmentation fault (invalid code) in Token::isAssignmentOp. #6756 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix two crashes.
2015-06-04 17:46:52 +02:00
amai2012
f2d397882f
#6753 segmentation fault (invalid code) in CheckMemoryLeakStructMember::checkStructVariable. #6754 segmentation fault (invalid code) in CheckUnusedVar::checkFunctionVariableUsage_iterateScopes. Trivial fixes to avoid null pointer access
2015-06-03 17:17:53 +02:00
amai2012
87bf09c0ae
#6751 segmentation fault (invalid code) in Tokenizer::simplifyTypedef.
2015-06-03 11:39:30 +02:00
amai2012
ed5a4127e8
#6749 segmentation fault (invalid code) in Tokenizer::copyTokens. #6750 segmentation fault (invalid code) in Tokenizer::simplifyTypedef.
2015-06-03 10:39:19 +02:00
amai2012
d36c84553f
#6748 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Throw error from now (member-function) Tokenizer::processFunc
2015-06-03 08:59:38 +02:00
Alexander Mai
d86ac9e3ed
#6747 segmentation fault (invalid code) in Token::isAttributeConstructor
2015-06-02 22:26:17 +02:00
Alexander Mai
09f2cff519
#6746 segmentation fault (invalid code) in Tokenizer::simplifyTypedef
2015-06-02 21:52:08 +02:00
Alexander Mai
6e1b5a0a53
#6744 segmentation fault (invalid code) in Tokenizer::simplifyPointerToStandardType. #6745 segmentation fault (invalid code) in Tokenizer::simplifyTypedef
2015-06-02 21:20:41 +02:00
Alexander Mai
454d4573b4
#6742 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase. Fix in Type::initBaseInfo()
2015-06-02 20:15:21 +02:00
Alexander Mai
f348c8eebe
#6741 segmentation fault (invalid code) in Tokenizer::simplifyTypedef.
2015-06-02 20:09:12 +02:00
Alexander Mai
7fc9930b38
#6740 segmentation fault (invalid code) in Tokenizer::simplifyFunctionPointers. Throw syntaxError instead
2015-06-02 19:48:20 +02:00
Alexander Mai
a3bdd90df5
#6739 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. Fix segfault in the specified method
2015-06-02 19:40:20 +02:00
Alexander Mai
be3690920a
#6738 Avoid segfault on garbage code in Tokenizer::simplifyTypedef()
2015-06-02 19:07:26 +02:00
amai2012
7895f1c2bb
#6737 Avoid segfault on garbage code inside Type::initBaseInfo. Disable test TestGarbage::garbageCode58() for #6732 since it triggers memory corruption still
2015-06-02 18:28:43 +02:00
Martin Ettl
0a148a9433
Running astyle, no functional changes.
2015-06-01 22:09:56 +02:00
amai2012
4b2fb4b76c
#6735 , #6735 Fix segfault on garbage code
...
Throw syntax error instead
2015-06-01 21:47:06 +02:00
Daniel Marjamäki
4bde4d5a4a
updated style messages
2015-06-01 21:22:47 +02:00
Alexander Mai
fb2bd978ad
#6732 segmentation fault (invalid code) in Tokenizer::simplifyEmptyNamespaces. Add testcase, segfault seems to have been fixed by previous commit. Run astyle
2015-06-01 13:46:13 +02:00
amai2012
b81e82d462
#6733 segmentation fault (invalid code) in Tokenizer::simplifyAddBracesPair
...
Avoid access to NULL-token by throwing an InternalError
2015-06-01 13:27:32 +02:00
Frank Zingsheim
6857dbe864
#6729 Simplification reference to constants.
2015-06-01 10:00:03 +02:00
Simon Martin
519bd7007a
Ticket #6588 : Properly detect whether the condition in a ternary operator is constant on C input.
2015-05-31 22:40:13 +02:00
Simon Martin
85b47636dc
Simplify known variableswhen they are at the end of a statement.
2015-05-30 23:34:50 +02:00
orbitcowboy
9c6ce2b06b
Merge pull request #605 from simartin/no_space_in_decl
...
Removed useless space in the declaration for Tokenizer::Simplifyfunctionpointers
2015-05-30 21:22:14 +02:00
Simon Martin
c73876b3a8
Removed useless space in the declaration for Tokenizer::Simplifyfunctionpointers.
2015-05-30 21:00:41 +02:00
Simon Martin
98e6dca4f2
Ticket #6713 : Properly detect ternary operator in valueFlowForward.
2015-05-30 20:55:36 +02:00
Alexander Mai
ddc80246c2
#6724 segmentation fault (invalid code) Token::isAttributeConstructor. Local fix to avoid access to NULL-token
2015-05-30 19:15:53 +02:00
Alexander Mai
4050d56169
#6722 segmentation fault (invalid code) in Tokenizer::simplifyTypedef
2015-05-29 21:44:00 +02:00
Martin Ettl
d5d6d7fbb8
Running astyle, no functional changes.
2015-05-29 20:20:05 +02:00
amai2012
5b347c537b
Fix #6720 and #6721 (Crashes on garbage code)
...
Local fixes to avoid access to NULL-token
2015-05-29 19:30:55 +02:00
Martin Ettl
9236ea4a20
Running astyle, no functional changes.
2015-05-29 19:15:41 +02:00
amai2012
e41beb4f8d
Fix #6718 and #6719 (crashes on garbage code).
...
Local fixes avoiding access to NULL-token. Also minor correction to
TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates()
2015-05-29 18:34:00 +02:00
Alexander Mai
098391ee32
#6715 segmentation fault (invalid code) in TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates. Harden TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates()
2015-05-28 21:38:20 +02:00
Alexander Mai
8adff0a31b
#6712 segmentation fault (invalid code) in CheckExceptionSafety::checkRethrowCopy. Local fix to avoid accessing NULL-token
2015-05-28 21:12:02 +02:00
Alexander Mai
133d8f9a91
#6706 segmentation fault (invalid code) in tokenlist::compilePrecedence3. Local fix to prevent acess to NULL-token
2015-05-27 21:39:31 +02:00
Alexander Mai
94d376e228
Merge branch 'master' of https://github.com/danmar/cppcheck
2015-05-27 21:13:18 +02:00
Alexander Mai
e498f8493e
#6705 segmentation fault (invalid code) in CheckVaarg::va_list_usage. Local fix i nchecker preventing SIGSEGV on NULL-token
2015-05-27 21:12:33 +02:00
Daniel Marjamäki
22c608dd2c
Reverted fix for #6710 . It didnt work as I wanted.
2015-05-27 20:50:03 +02:00
Daniel Marjamäki
0836bf3d33
astyle formatting
2015-05-27 20:26:26 +02:00
Daniel Marjamäki
152ea116fa
Fixed #6710 (valueFlowBeforeCondition: function call in loop seems to cause FN)
2015-05-27 20:25:58 +02:00
Simon Martin
50e5595845
Ticket #6708 : Check that a function name is not a reserved keyword in SymbolDatabase::isFunction instead of later.
2015-05-26 00:28:08 +02:00
amai2012
729b240d9c
Refactoring (compiler warnings and a typo)
2015-05-25 23:15:59 +02:00
Alexander Mai
d4550c763d
Exit code shall indicate that an internal error (syntax error) has been found. Add some const. Run astyle
2015-05-25 21:15:55 +02:00
amai2012
f1c4cc6d55
Merge pull request #598 from simartin/useless_str_check
...
Removed unnecessary string comparison in Tokenizer::simplifyKnownVariablesSimplify
2015-05-25 19:13:33 +02:00
Daniel Marjamäki
a8d7897471
Fixed travis failure
2015-05-25 18:19:40 +02:00
Daniel Marjamäki
a9db06c641
longCast: Only warn when original name is 'long'. avoids some FPs when typedef types are used.
2015-05-25 18:06:20 +02:00
Daniel Marjamäki
c0b33d2fef
Fixed #6707 (new check: possible truncation when assigning int result to long)
2015-05-25 10:02:17 +02:00
Alexander Mai
e28e9be82f
Add TODO testcase for #5738 . Refactoring: add some const
2015-05-25 08:20:14 +02:00
Daniel Marjamäki
eb0db322eb
Fixed #6560 (ValueFlow: handling ternary operator better in valueFlowSubFunction)
2015-05-24 17:02:00 +02:00
Simon Martin
c58fab07d6
Removed unnecessary string comparison in Tokenizer::simplifyKnownVariablesSimplify.
2015-05-24 13:13:46 +02:00
Alexander Mai
7f15873759
Refactoring in tokenize.cpp: Fix cppcheck warning, add some const, fix typo from previous refactoring
2015-05-24 11:43:46 +02:00
Alexander Mai
7002f9df35
Merge branch 'master' of https://github.com/danmar/cppcheck
2015-05-24 09:43:52 +02:00
Alexander Mai
394160184a
Refactoring: Replace complex if/else cascade by search in a container. Remove redundant plain arrays (in favour of container)
2015-05-24 09:43:17 +02:00
Simon Martin
26f244e638
Ticket #6704 : Tighten pattern skipping base class declarations and fix crash upon garbage code.
2015-05-24 08:16:34 +02:00
Simon Martin
898ba783bf
Ticket #6703 : Rewrite pattern in SymbolDatabase to avoid crash upon garbage code.
2015-05-23 23:18:59 +02:00
Alexander Mai
7416d6add9
Another fix for handling of final/override specifiers in Tokenizer::simplifyKeyword() including a testcase. Ran astyle
2015-05-23 20:51:15 +02:00
amai2012
7c23f4e611
Merge pull request #596 from simartin/ticket_6620-6685
...
Ticket #6620 , #6685 : Reserved keywords cannot be function names.
2015-05-23 13:47:07 +02:00
Alexander Mai
e8d84bc6b4
#6700 const vs non-const inside assert() statement. Function matching in symboldatabase did not honor const'ness of a class instance variable
2015-05-23 11:56:11 +02:00
Simon Martin
67eab0cd7c
Ticket #6620 , #6685 : Reserved keywords cannot be function names.
2015-05-23 11:29:58 +02:00
Alexander Mai
f0bc300198
#6510 False positive performance warning for std::list::size(). Fix this and other similar false positives. Refactoring of Variable::isStlType(), use fail-safe std::set instead of plain array. Run astyle
2015-05-17 20:02:41 +02:00
amai2012
20842fb1fc
#6690 override and final qualifiers plus less than operator results in a syntax error
...
Tokenizer::simplifyKeyword() is now able to handle all combinations out
of const|final|override
2015-05-17 13:02:13 +02:00
PKEuS
3ce4e68ca6
Refactorization: Make use of do-loops to avoid redundant Token::Match() calls
2015-05-13 13:40:40 +02:00
PKEuS
b946b74e09
Fixed crash #6686
2015-05-13 13:02:33 +02:00
PKEuS
4f00189ee1
Fixed crash #6684
2015-05-12 14:00:43 +02:00
PKEuS
1b6e4589da
Implemented array size calculation for n-dimensional arrays with arbitrary dereferencing ( #6657 )
2015-05-11 17:30:11 +02:00
PKEuS
33277c6110
Fixed false positive #6679 , fixed unit test for #6663 .
2015-05-11 13:10:11 +02:00
PKEuS
d5302953c7
Merge pull request #594 from simartin/ticket_6680
...
Ticket #6680 : Members can be initialized by operator>>.
2015-05-10 22:53:26 +02:00
PKEuS
8bbf8f1b50
Merge pull request #593 from simartin/ticket_6675
...
Ticket #6675 : Fixed pattern detecting C++ 11 delegated constructors.
2015-05-10 22:50:49 +02:00
PKEuS
f8d8856d09
Merge pull request #592 from simartin/ticket_6666
...
Ticket #6666 : Don't crash upon garbage code in CheckLeakAutoVar::checkScope
2015-05-10 22:49:25 +02:00
Simon Martin
da302b3912
Ticket #6680 : Members can be initialized by operator>>.
2015-05-10 14:27:15 +02:00
PKEuS
77c5381612
Support C++14 [[deprecated]]
2015-05-10 12:36:28 +02:00
Simon Martin
27e88fdc47
Ticket #6666 : Don't crash upon garbage code in CheckLeakAutoVar::checkScope.
2015-05-10 11:35:33 +02:00
Simon Martin
25aff001e0
Ticket #6675 : Fixed pattern detecting C++ 11 delegated constructors.
2015-05-10 11:27:47 +02:00
Daniel Marjamäki
075b07fb6c
stringLiteralWrite: only check in function scopes
2015-05-10 10:34:13 +02:00
Alexander Mai
96891dface
#6276 clang: -fsanitize=integer warnings. Fix remaining issues in preprocessor.cpp.
2015-05-09 19:26:31 +02:00
PKEuS
22fbc18fb7
Fixed false positive for *a++ in for-loop condition
...
Moved unit test to testgarbage.cpp
2015-05-07 20:34:57 +02:00
Alexander Mai
1c5e9e47c5
#6671 false positive: incorrect sizeofwithsilentarraypointer with reference to array.
2015-05-06 07:38:26 +02:00
Alexander Mai
6f96634759
#6276 clang: -fsanitize=integer warnings. Fix unwanted integer overflow in TemplateSimplifier::useDefaultArgumentValues() and Tokenizer::simplifyQtSignalsSlots()
2015-05-03 15:21:58 +02:00
Daniel Marjamäki
71cb8e9f64
Fixed --errorlist output for new checker stringLiteralWrite
2015-05-03 15:02:34 +02:00
Daniel Marjamäki
baa1ae079d
New check: negative size in array declaration. Ticket #1760
2015-05-03 15:00:47 +02:00
Daniel Marjamäki
e837bad01d
Fixed false positive in new stringLiteralWrite checker
2015-05-03 12:34:27 +02:00
Matthias Krüger
6b80e61934
fix internal warning; was
...
[lib/checkstring.cpp:43]: (warning) Found simple pattern inside Token::Match() call: "] ="
2015-05-03 10:59:58 +02:00
Daniel Marjamäki
666377da1c
Updated error message for stringLiteralWrite
2015-05-03 10:48:28 +02:00
Daniel Marjamäki
9d31afb663
Fixed #1748 (Undefined Behavior: Modification of string literal)
2015-05-03 10:44:40 +02:00
PKEuS
70a1e11ada
Set version to 1.69.99/1.70 dev
2015-05-03 08:15:13 +02:00
Daniel Marjamäki
ca1f19b6d4
Fixed #6378 (valueFlowForward: decrement not handled)
2015-05-02 17:30:09 +02:00
Daniel Marjamäki
aab1d83075
Updated error message. write variable name.
2015-05-02 16:55:17 +02:00
PKEuS
4cbbd44d49
Fixed false positive #6663 : Better support for loops in CheckStl::readingEmptyStlContainer()
2015-05-02 14:09:48 +02:00
Daniel Marjamäki
dc54676289
Reverted my changes I made by mistake in previous commit
2015-05-02 14:01:31 +02:00
Daniel Marjamäki
28985d1baa
manual: Document the cwe attribute
2015-05-02 11:43:42 +02:00
Daniel Marjamäki
a79791cb81
1.69: Set versions
2015-05-01 18:51:33 +02:00
Frank Zingsheim
9bea7bec92
Fixed #6659 (heap user after free: kernel: sm750_accel.c)
2015-05-01 18:28:00 +02:00
Frank Zingsheim
4ceed51bfb
Fixed #6607 (Crash triggered by TemplateSimplifier::useDefaultArgumentValues)
2015-05-01 17:13:02 +02:00
Alexander Mai
fa42f554a8
cppcheck compilation fails with g++4.6.3 ( #5929 ). Patch supplied by mavik1
2015-05-01 16:25:27 +02:00
orbitcowboy
785df82513
#6660 : Fixed crash in Tokenize::SetVarid().
2015-04-29 09:18:54 +02:00
Daniel Marjamäki
88f59ad7e8
Partial fix for #6656 (Allow that CWE is mapped for error message)
2015-04-25 17:48:11 +02:00
Daniel Marjamäki
ad6db2ba81
Reverted 105de8e917
, new checker had FPs that need to be fixed.
2015-04-25 15:35:31 +02:00
Daniel Marjamäki
bdc024bd7c
Fixed 6634 (false positive: dereferencing null pointer in a sizeof operation)
2015-04-20 13:46:02 +02:00
amai2012
8d8fffb20f
#6651 Don't call member function on NULL pointer - even if call is "safe"
2015-04-17 08:47:59 +02:00
PKEuS
ac867b4220
Handle pointers to const member functions in Tokenizer::simplifyFunctionPointers() ( #6603 )
2015-04-13 21:21:57 +02:00
PKEuS
c4ceb97cea
Fixed #6629 : Don't simplify sinf(0) if sinf is a variable
2015-04-13 20:37:07 +02:00
PKEuS
708a379fd2
Refactorized simplification of sizeof without parantheses:
...
- Moved sizeofAddParentheses() behind combineOperators()
- Improved sizeofAddParentheses() to handle all code from unit tests at simplifyTokenList1()
- Removed simplification from simplifyTokenList2()
2015-04-13 20:18:21 +02:00
PKEuS
4c40664861
Fixed #6639 : Calculate sizeof() of multidimensional arrays
2015-04-13 20:18:21 +02:00
PKEuS
19bba94282
Merge pull request #589 from simartin/restore_libcpp_build
...
Restore build with libc++ and revert PR#228 and PR#562.
2015-04-13 17:12:00 +02:00
PKEuS
b6709294a8
Fixed ...... in template instantiations (similar to constconst from #6604 )
2015-04-13 17:03:06 +02:00
Simon Martin
e5745d7d4a
Restore build with libc++ and revert PR#228 and PR#562.
2015-04-12 20:29:49 +02:00
PKEuS
c2ccd7d9e4
Simplify _declspec like __declspec
2015-04-11 11:02:52 +02:00
Matthias Krüger
42f0955e3f
Move more setting checks out of loops and use const bools instead. Reorder a few related checks.
...
Follow up to eedcb6abcb
.
2015-04-10 14:31:19 +02:00
Frank Zingsheim
84830638a2
Improved fix #6636 : (False positive unreadVariable - scope analysis seems to fail to False positive unreadVariable)
2015-04-09 21:09:31 +02:00
Robert Reif
4ceb24630d
Fixed #6568 : Scope for template class member function missing in symboldatabase
2015-04-09 21:01:47 +02:00
PKEuS
d5ad1def40
Removed two unused functions
2015-04-09 20:54:07 +02:00
PKEuS
4e5c5eb238
Fixed #5665 : Recognize free() with more than one parameter
2015-04-09 20:50:19 +02:00
Frank Zingsheim
d52b031301
Fixed #6638 : (varid for loop in for statement)
2015-04-09 19:58:12 +02:00
Frank Zingsheim
648ee95f31
Fixed #6636 : (False positive unreadVariable - scope analysis seems to fail to False positive unreadVariable)
...
Bug was introduced by 1f5265c1bd
2015-04-08 20:30:41 +02:00
Daniel Marjamäki
d563bd73f4
Fixed #6583 (False positive uninitvar - exit() ignored?!)
2015-04-08 15:35:04 +02:00
Gustav Palmqvist
105de8e917
#220 uninitialized variable: using variable in ctor before it has been initialized. Implement new check usageBeforeInitialization
2015-04-07 22:01:13 +02:00
orbitcowboy
8596794ce7
MathLib:mod: Declared local variable as const. No functional change.
2015-04-07 17:21:28 +02:00
Matthias Krüger
eedcb6abcb
move setting flags checks out of for loops, make them const.
2015-04-07 07:23:28 +02:00
Frank Zingsheim
1f5265c1bd
Fixed #6253 ([False Positive] Variable not initialized in the constructor)
2015-04-06 19:47:21 +02:00
Alexander Mai
9876cf2312
#6626 crash: Token::astOperand2() const ( do while ). Fix two segmentation faults on invalid code.
2015-04-06 17:23:48 +02:00
Matthias Krüger
7fdbb91694
don't print warning message if --enable=warning is not specified.
...
message was of type:
(warning) Possible null pointer dereference: previous - otherwise it is redundant to check it against null.
2015-04-06 15:05:34 +02:00
Matthias Krüger
22d97fdbd6
don't print style message if --enable=style is not specified.
...
message was of type:
(style) Redundant checking of STL container element existence before removing it.
2015-04-06 14:26:15 +02:00
Matthias Krüger
988acf11b4
don't print warning message if --enable=warning is not given.
...
message was of type:
(warning) Passing value 0 to foo() leads to implementation-defined result.
2015-04-06 13:37:27 +02:00
Matthias Krüger
592177200a
don't print warning message if --enable=warning is not given.
...
message was of type:
(warning) Call of pure virtual function 'foo' in constructor.
2015-04-06 13:34:44 +02:00
Matthias Krüger
6ff9a52d8b
don't print style message if --enable=style is not given ( #6627 )
...
message was of type:
(style) Class 'foo' is unsafe, 'foo::bar' can leak by wrong usage.
2015-04-06 12:02:21 +02:00
Simon Martin
0f7f08644c
Show template instantiation and not definition location in template instantiation debug message.
2015-04-05 14:54:24 +02:00
Robert Reif
c02acea5bf
Fixed #6614 (false positive: (style) The class 'A' does not have a constructor.)
2015-04-04 11:33:25 +02:00
Daniel Marjamäki
aacd9b9f6b
Fixed #6586 (Tokenizer: '>>' is wrongly tokenized as '> >' - if (n1 < len>>1))
2015-04-03 20:25:49 +02:00
Dmitry-Me
ba423185b8
Omit uneeded checks
2015-04-02 10:26:19 +03:00
amai2012
788da37e05
Merge pull request #584 from Dmitry-Me/betterVariableName3
...
Formatting cleanup, better variable name
2015-04-02 09:20:31 +02:00
Dmitry-Me
7b69396223
Formatting cleanup, better variable name
2015-04-01 18:23:51 +03:00
Dmitry-Me
aa7d665e7a
Better variable name
2015-04-01 16:39:45 +03:00
PKEuS
72b4809da0
Moved simplification of operator names before template and parentheses simplifications ( #6576 )
2015-04-01 13:47:36 +02:00
PKEuS
0d37c4df04
Fixed three unique crashs on garbage code ( #6613 ).
...
Removed redundant copy of string in templatesimplifier.cpp
2015-04-01 12:43:24 +02:00
PKEuS
4c3a7661c3
Merge pull request #565 from Dmitry-Me/cacheAndReuse
...
Cache and reuse value
2015-04-01 11:30:13 +02:00
PKEuS
04a3196a32
Merge pull request #576 from Dmitry-Me/anyParameterType
...
Constructor parameter type need not be a number
2015-04-01 11:29:44 +02:00
Daniel Marjamäki
e3bff8ff07
astyle formatting
2015-03-29 21:05:18 +02:00
Dmitry-Me
7c402afeb7
Preprocessor: Reduce overhead from searching for fallthrough comments when not needed
2015-03-29 09:28:17 +02:00
Dmitry-Me
e36ff852cd
Don't call abort() in the middle of C++ code
2015-03-26 15:26:08 +03:00
Dmitry-Me
e8f0abf259
Proper simplify delete a,b
2015-03-25 16:54:23 +03:00
Dmitry-Me
d735918a8a
Constructor parameter type need not be a number
2015-03-25 14:56:45 +03:00
Dmitry-Me
9398fa810b
Avoid value truncation
2015-03-25 10:39:09 +03:00
PKEuS
be4e51f00b
Merge pull request #571 from Dmitry-Me/omitUnneededActions3
...
Omit unneeded actions
2015-03-24 19:25:22 +01:00
PKEuS
b9ff2fd922
Merge pull request #573 from Dmitry-Me/removeDuplicateCheck
...
Remove duplicate check
2015-03-24 19:24:14 +01:00
amai2012
035faa4b6b
Merge pull request #572 from Dmitry-Me/mergeOverlappingPatterns4
...
Merge overlapping patterns
2015-03-24 16:55:37 +01:00
Dmitry-Me
8a4033e13a
Omit unneeded actions
2015-03-24 16:01:59 +03:00
Dmitry-Me
c9cdba5865
Remove duplicate check
2015-03-24 15:58:03 +03:00
Dmitry-Me
4201279954
Merge overlapping patterns
2015-03-24 10:22:26 +03:00
Daniel Marjamäki
a3a5c74bbf
Revert "Remove bitwise-or abuse"
...
This reverts commit 7017b051fe
.
2015-03-24 08:07:15 +01:00
PKEuS
ab97d8dd6f
Merge pull request #569 from Dmitry-Me/removeBitwiseOpAbuse
...
Remove bitwise-or abuse
2015-03-23 20:23:07 +01:00
Dmitry-Me
7017b051fe
Remove bitwise-or abuse
2015-03-23 13:30:05 +03:00
Dmitry-Me
0383998aea
Better variable name
2015-03-23 11:58:56 +03:00
PKEuS
19f770e41b
Fixed #6604 - don't create template instanciations with "const const const const..." patterns.
2015-03-22 11:20:47 +01:00
amai2012
a9b7299dc3
Merge pull request #566 from simartin/ticket_6587
...
Ticket #6587 : Do not consider template expressions in decltype as instantiations
2015-03-21 18:13:46 +01:00
Simon Martin
ec1eebf585
Ticket #6587 : Never consider a template parameter's default value as an instantiation.
2015-03-21 16:30:00 +01:00
amai2012
bb9848d24a
Merge pull request #563 from Dmitry-Me/deconvoluteCheck
...
Make the check slightly less convoluted
2015-03-21 12:27:37 +01:00
Dmitry-Me
8f21aba606
Cache and reuse value
2015-03-20 12:39:51 +03:00
Dmitry-Me
4a75ac58cf
Merge overlapping patterns
2015-03-20 11:06:18 +03:00
Dmitry-Me
5f6aaa4573
Make the check slightly less convoluted
2015-03-20 11:03:11 +03:00
Simon Martin
2587ebf189
Restore build on Mac OS X on which we're force to use GNU's STL, that does not have cend()...
2015-03-19 20:25:57 +01:00
amai2012
4086127144
Merge pull request #559 from Dmitry-Me/omitUnneededActions2
...
Omit unnecessary operations
2015-03-19 19:03:47 +01:00
Dmitry-Me
20d4c6fad3
Eliminate duplication in TCHAR functions substitution
2015-03-19 18:41:36 +03:00
Dmitry-Me
4fcbe00913
Omit unnecessary operations
2015-03-19 15:14:07 +03:00
Dmitry-Me
9703e6b72b
Unicode names set for ANSI
2015-03-19 13:26:08 +03:00
Dmitry-Me
7afe4ba5e0
Mismatching TCHAR function names
2015-03-19 10:41:02 +03:00
Daniel Marjamäki
dbfbddb178
Merge pull request #555 from Dmitry-Me/eliminateRepeatedFind
...
Eliminate repeated lookup
2015-03-19 06:45:26 +01:00
Jakub Melka
a49efb13f6
Added auto_ptr checking for malloc
2015-03-19 06:41:54 +01:00
Dmitry-Me
8f8ba65a29
Eliminate repeated lookup
2015-03-18 11:52:09 +03:00
Dmitry-Me
15a847cc0d
Move declaration to where it's first needed
2015-03-18 10:07:13 +03:00
Dmitry-Me
3ab3715a88
Merge overlapping patterns
2015-03-17 16:23:19 +03:00
PKEuS
e8161aeda6
Refactorized Scope::getVariableList(): Removed scope depth counter, simplified patterns
2015-03-15 12:37:50 +01:00
PKEuS
e978a681a3
Removed unused variable
2015-03-15 10:19:35 +01:00
PKEuS
0d127f15a5
Fixed grammar mistake; fixed two VS2013 code analysis messages; removed redundant Token::Match call
2015-03-15 10:06:56 +01:00
PKEuS
713d993f71
Some refactorizations in Tokenizer:
...
- Refactorized simplifyTypedef
- Perform some template specific code only on non-C code
2015-03-15 10:04:44 +01:00
PKEuS
d6751a7987
Merge pull request #537 from Dmitry-Me/decouplePatternMatchingFromOtherChecks
...
Decouple pattern matching from other checks
2015-03-15 08:50:59 +01:00
Daniel Marjamäki
a200e5b32f
Merge pull request #551 from simartin/ticket_4335
...
Ticket #4335 : Properly detect and handle template class specialisations
2015-03-15 07:59:11 +01:00
Simon Martin
520314f9a0
Ticket #4335 : Properly detect and handle template class specializations.
2015-03-15 00:28:33 +01:00
Simon Martin
32a7a178e8
Code simplification now that ">>" is turned into "> >" when it closes template argument lists.
2015-03-14 23:02:10 +01:00
amai2012
40769c9a59
Merge pull request #549 from simartin/ticket_6437
...
Ticket #6347 : Fix use after delete when simplifying template instantiations
2015-03-14 22:30:58 +01:00
PKEuS
430d8ca760
Refactorized code in simplifyEnum()
2015-03-14 20:43:14 +01:00
Daniel Marjamäki
fd6bd97972
Fixed #6495 (Improve check: uninitialized variable, 3rd function argument)
2015-03-14 19:23:33 +01:00
Simon Martin
4c916641cc
Ticket #6347 : Fix use after delete when simplifying template instantiations.
2015-03-14 18:46:17 +01:00
Daniel Marjamäki
42c4aa1c49
Fixed #4880 (false negative: uninitialized variable, handling of conditional noreturn scopes)
2015-03-14 17:59:11 +01:00
amai2012
53e2d425d1
Merge pull request #546 from Dmitry-Me/properChainConditions
...
Proper if-else-if chain for mutually exclusive conditions
2015-03-14 17:38:06 +01:00
Dmitry-Me
2b50e73aa9
Misleading comment
2015-03-14 15:18:29 +03:00
Dmitry-Me
89ec9058a8
Proper if-else-if chain for mutually exclusive conditions
2015-03-14 15:09:46 +03:00
Dmitry-Me
43a19dee8b
Remove unneded deep copy, make reference const
2015-03-14 13:45:21 +03:00
PKEuS
6e0302fd56
Refactorized CheckBool::checkComparisonOfBoolWithInt(), CheckBool::checkComparisonOfBoolExpressionWithInt() and CheckBool::pointerArithBool():
...
- Support more patterns in CheckBool::pointerArithBool()
- Use AST and SymbolDatabase
- Removed redundant skipping over template arguments
2015-03-12 20:07:48 +01:00
PKEuS
7f2b6881b3
Refactorization: Avoid including path.h in (almost) every source file (via library.h)
2015-03-11 22:54:45 +01:00
PKEuS
3d2e26daeb
Small Refactorizations:
...
- Removed #include "symboldatabase.h" from library.h
- Moved variable to inner scope in tokenize.cpp
- Removed unnecessary variable in tokenize.cpp
2015-03-11 20:52:54 +01:00
PKEuS
cd84d78e92
Ran AStyle, fixed VS2015 warning in symboldatabase.h
2015-03-11 20:26:53 +01:00
PKEuS
9bafa3bf25
Fixed false positive #6575
2015-03-11 20:25:27 +01:00
amai2012
ed097d4c4f
Merge pull request #540 from JakubMelka/ticket_695
...
Ticket #695 : new style check : explicit declaration of ctor
2015-03-11 12:15:22 +01:00
Jakub Melka
e1e1dbfe97
Ticket #695 : Fixed VS 2010 issue, switched to "style" severity, changed error messages and updated unit tests
2015-03-10 19:35:12 +01:00
Jakub Melka
b7d92a4fc7
Fixed warnings of CppCheck's own code (caused by new check #695 )
2015-03-08 18:18:09 +01:00
Daniel Marjamäki
2d8a6c7b89
Fixed #6571 (Library::isNotLibraryFunction: Return true for methods)
2015-03-08 16:13:32 +01:00
Simon Martin
1d973b882d
Ticket #6567 : Handle member functions in TemplateSimplifier::getTemplateNamePosition.
2015-03-07 21:52:12 +01:00
Jakub Melka
2af9212b16
Ticket #695 : new style check : explicit declaration of ctor
2015-03-07 20:07:54 +01:00
Daniel Marjamäki
0131bda065
Merge pull request #539 from simartin/ticket_6181
...
Ticket #6181 : Normalize '>>' into '> >' when it's closing a C++11 template parameter list
2015-03-07 15:02:21 +01:00
Simon Martin
9c6a625f91
Ticket #6181 : Normalize '>>' into '> >' when it's closing a C++11 template parameter list.
2015-03-07 11:06:04 +01:00
Daniel Marjamäki
87ebeb3f65
Fixed #6533 (library: alloc/dealloc doesn't work when function declaration is seen)
2015-03-07 09:43:56 +01:00
Dmitry-Me
74417699db
Remove redundant break
2015-03-06 18:55:47 +01:00
Daniel Marjamäki
f705cdce72
Fixed #6556 (Tokenizer::simplifyVarDecl: doesn't simplify template variables properly)
2015-03-06 17:30:20 +01:00
Daniel Marjamäki
e38f15ecc0
--check-library: dont write <noreturn> messages now since they cant be fixed.
2015-03-05 07:19:03 +01:00
Daniel Marjamäki
6646a896f9
Fixed #6446 (FP zerodivcond on double arithmetics)
2015-03-03 15:50:31 +01:00
Daniel Marjamäki
925f077b8a
Fixed #6110 (TemplateSimplifier::simplifyCalculations: wrong simplification of 'if (VG_(strlen)(s)>=3)')
2015-03-02 16:27:00 +01:00
Daniel Marjamäki
86cdc8e7a6
Fixed #6540 (Tokenizer::simplifyKnownVariables: Missing varid for simplification in conditional code)
2015-03-02 06:18:00 +01:00
Daniel Marjamäki
830f656a25
Library: variables are not library functions (variable declarations can look like function calls)
2015-03-01 11:46:43 +01:00
Robert Reif
27388c3696
Fixed #6546 (False positive uselessAssignmentPtrArg - triggered by throw?)
2015-02-28 16:07:43 +01:00
Daniel Marjamäki
449b88aa0c
Fixed #6547 (Regression - unknown macro causes analysis error)
2015-02-28 11:09:39 +01:00
Daniel Marjamäki
3add466035
Add isFunctionHead() in Tokenizer
2015-02-27 18:29:34 +01:00
Dmitry-Me
10b762da98
Decouple pattern matching from other checks
2015-02-27 13:09:06 +03:00
Dmitry-Me
848f50b005
Get rid of Hungarian notation
2015-02-27 12:02:12 +03:00
Daniel Marjamäki
acbf48c7fa
Fixed #6548 (Tokenizer: Wrong varid set after function which is throw())
2015-02-26 16:31:42 +01:00
Dmitry-Me
22b0f37aaf
Cache and reuse value
2015-02-26 14:34:18 +03:00
Dmitry-Me
d7365519a5
Cache and reuse value
2015-02-26 11:48:15 +03:00
PKEuS
cb4bf73749
Merge pull request #530 from Dmitry-Me/doChecksEarlier
...
Don't run the checks which will be silenced later anyway
2015-02-25 19:22:00 +01:00
amai2012
b9316e8ce0
Merge pull request #531 from Dmitry-Me/removeRedundantCasts
...
Remove redundant casts
2015-02-25 07:57:52 +01:00
Daniel Marjamäki
d1892786b8
ValueFlow: Improved when using '[' on arrays and strings
2015-02-24 15:57:39 +01:00
Dmitry-Me
938b84903f
Remove redundant casts
2015-02-24 15:15:22 +03:00
Alexander Mai
8427398d9d
#6539 Segmentation fault in Tokenizer::duplicateTypedef. Avoid crash on garbage code
2015-02-24 11:15:23 +01:00
Dmitry-Me
24d2b0368f
Don't run the checks which will be silenced later anyway
2015-02-24 10:20:43 +03:00
Robert Reif
130ffc5752
Fixed #6538 (Symboldatabase: improve isFunction)
2015-02-24 06:11:31 +01:00
Alexander Mai
b9cc5b5c6b
#6543 crash: CheckCondition::checkBadBitmaskCheck ; wine dlls/gdi32/dibdrv/primitives.c. Run astyle.
2015-02-23 22:06:55 +01:00
Daniel Marjamäki
fb5cc6fded
Fixed #5905 (isSameExpression: comparisons 'a<b' and 'a>b' are same)
2015-02-23 16:38:55 +01:00
Daniel Marjamäki
830d1eb3fd
Revert "Fixed #6538 (Symboldatabase: improve isFunction)"
...
This reverts commit d7ef89bbe6
.
There was crashes in a Travis job.
2015-02-23 08:07:19 +01:00
Robert Reif
d7ef89bbe6
Fixed #6538 (Symboldatabase: improve isFunction)
2015-02-23 06:49:50 +01:00
Alexander Mai
26c2c4a824
Extend verbose message for memsetClassFloat
2015-02-22 15:41:02 +01:00
Daniel Marjamäki
d4fa656e58
Refactor and improve Tokenizer::sizeofAddParentheses
2015-02-22 13:38:06 +01:00
PKEuS
bedc935ab0
New check: Warn about constant expression if ( unknown | non_null_constant) ( #6519 )
2015-02-22 13:09:39 +01:00
PKEuS
5f31242ee8
CheckOther::checkRedundantAssignment(): Bail out on inline assembly ( #6525 )
2015-02-22 12:03:53 +01:00
PKEuS
f04070940e
Fixed setVarId on ternary operator in initialization list
2015-02-22 11:57:46 +01:00
PKEuS
bae95b4560
Fixed noise in CheckOther::checkLibraryMatchFunctions().
2015-02-21 12:39:02 +01:00
PKEuS
e02caea025
Fixed C&P-mistake in comment
2015-02-21 12:39:02 +01:00
Dmitry-Me
19d05979ee
Remove C4189 in release builds
2015-02-20 11:00:34 +03:00
Dmitry-Me
158a2acc41
Resolve CID 1037075
2015-02-19 17:16:38 +03:00
PKEuS
6227abac73
Fixed GCC (testsymboldatabase.cpp) and MSVC (checkother.cpp) warnings
2015-02-18 21:19:36 +01:00
Alexander Mai
6a7605271a
Fix compiler warning. Add interfaces of POSIX passwd.h and pwd.h to posix.cfg
2015-02-18 20:56:44 +01:00
Daniel Marjamäki
e251a99817
AST: fix handling of sizeof. ticket #6515
2015-02-18 19:56:13 +01:00
Daniel Marjamäki
b1e9d9b86f
Coverity CID 1270450: Removed redundant conditions
2015-02-17 19:32:59 +01:00
Alexander Mai
0a6babea74
#6181 Drop redundantGetAndSetUserId. Ensure (style-) warnings are issued if setuid()/getuid() and some related functions are ignored. Move strdupa()/strndupa() from posix.cfg to gnu.cfg
2015-02-16 22:19:51 +01:00
Daniel Marjamäki
42b40b0c85
Merge pull request #525 from Dmitry-Me/moreDoubleSlashCases
...
Handles double slashes close to end of path, more tests
2015-02-16 18:02:51 +01:00
Dmitry-Me
f0e0201c2d
Better handle double slashes, more tests
2015-02-16 13:11:13 +03:00
Dmitry-Me
56747e4af9
Reorder checks
2015-02-16 12:11:13 +03:00
Simon Martin
c4c46be972
Revert fix for #6181 , that caused #6354 and #6414 .
2015-02-14 12:29:05 +01:00
Luis Díaz Más
22424ba54a
Add CMake files
2015-02-13 19:00:14 +01:00
Daniel Marjamäki
6afe2e9fdc
astyle formatting
2015-02-13 16:36:47 +01:00
Dmitry-Me
5674b3c49d
early break in loop for readability
2015-02-13 16:36:20 +01:00
Dmitry-Me
7961bba0da
Path: better handling of UNC paths
2015-02-13 16:32:45 +01:00
Daniel Marjamäki
2d21eb07ba
Cleaned up snprintf hardcoding in CheckBufferOverrun
2015-02-13 06:44:38 +01:00
Daniel Marjamäki
9aad4fa8ca
CheckBufferOverrun: Remove hardcoding for sprintf and rely on cfg configuration instead
2015-02-12 17:29:36 +01:00
amai2012
baba720e58
Merge pull request #518 from Dmitry-Me/removeRedundantCode
...
Remove completely redundant code
2015-02-11 17:17:15 +01:00
Daniel Marjamäki
a24cbc448a
CheckBufferOverrun: loop through all arguments in checkFunctionCall
2015-02-11 16:24:25 +01:00
Daniel Marjamäki
d9deabe2ce
TestBufferOverrun: clean up
2015-02-10 17:29:36 +01:00
Dmitry-Me
77aa385384
Remove completely redundant code
2015-02-10 13:52:04 +03:00
Dmitry-Me
dfd19233e9
Simplify loop logic
2015-02-09 14:40:17 +03:00
Dmitry-Me
6eacb4957c
Simplify ternary operators, use else-if to avoid extra comparison
2015-02-09 11:46:27 +03:00
Dmitry-Me
fd0155cacf
Reuse already known values
2015-02-09 10:23:36 +03:00
Daniel Marjamäki
8a1b8df1ba
ValueFlow: Improved handling of alias values in valueFlowForward
2015-02-08 19:20:05 +01:00
Daniel Marjamäki
1d873de67f
Fix testrunner
2015-02-07 19:44:33 +01:00
Daniel Marjamäki
62a5d88eb0
ValueFlow: Improved handling of strings
2015-02-07 18:14:22 +01:00
Matthias Krüger
dd70b6e0cd
fix internal message: [lib/valueflow.cpp:239]: (warning) Found simple pattern inside Token::Match() call: "} ;"
2015-02-07 12:51:17 +01:00
Daniel Marjamäki
29db3eb848
Fixed #5980 (ValueFlow: pointer cant be 0 below throw in switch)
2015-02-07 10:45:30 +01:00
Dmitry-Me
6f6f9f7754
Reorder checks, move declaration
2015-02-06 16:30:39 +03:00
Daniel Marjamäki
eec938dbad
Fixed #6249 (False positive: Incorrect detection of (assignment + comparison) inside for-clause)
2015-02-05 20:17:30 +01:00
Dmitry-Me
cc18b8d1bb
Merge overlapping patterns
2015-02-05 17:30:49 +03:00
Dmitry-Me
1f31dd749b
Break loop early
2015-02-04 10:47:58 +03:00
Robert Reif
323475393b
Symboldatabase: improved debug output
2015-02-04 06:08:41 +01:00
PKEuS
f1714110d0
Fixed crash if double constants are passed as default arguments ( #6494 )
2015-02-03 22:12:05 +01:00
Daniel Marjamäki
5888b65bd4
fixed --check-library information message
2015-02-03 17:50:32 +01:00
Dmitry-Me
5517c22524
Omit redundant token match
2015-02-03 15:01:09 +03:00
Dmitry-Me
c05e632baf
Cache and reuse value
2015-02-03 11:00:40 +03:00
Dmitry-Me
21fbc30d59
Calling a function using Class::func() syntax should not be simplified
2015-02-02 10:37:10 +03:00
PKEuS
9dfb864522
Fixed two nullpointer messages in cppcheck
2015-02-01 15:21:09 +01:00
PKEuS
451a277b18
Refactorization: Support function default values in ValueFlow, removed now obsolete CheckNullPointer::nullPointerDefaultArgument().
...
-> Use valueFlowForward() to parse values passed to functions
-> valueFlowForward(): Set value in first occurrence of a variable in a condition
2015-02-01 15:15:00 +01:00
PKEuS
f78744ac30
Fixed AST generation if expression starts with ternary operator
2015-02-01 14:02:19 +01:00
Daniel Marjamäki
d6c94e3828
isOppositeCond: Fixed FN
2015-02-01 13:03:38 +01:00
Daniel Marjamäki
d091639080
Fixed #6482 (False positive multiCondition)
2015-02-01 12:58:06 +01:00
PKEuS
b74b94b1e6
Partially reverted previous commit - std::vetcor instance creation can't be avoided without generating lots of debug messages
2015-02-01 12:33:53 +01:00
PKEuS
58c3fdd063
Fixed crash on garbage code introduced recently, optimized code in valueFlowFunctionReturn.
2015-02-01 12:26:46 +01:00
PKEuS
a4cc4c3e3f
Refactorization: Use SymbolDatabase scope information in ValueFlow
2015-02-01 12:10:20 +01:00
PKEuS
54b6b8e571
Fixed false positive #6481
2015-01-31 20:34:06 +01:00
PKEuS
21cb0cfd60
Take simplifyIfNotNull and simplifyIfNot out of simplifyTokenList1 (first step for #6072 )
2015-01-31 20:12:02 +01:00
PKEuS
1f97e3001b
Fixed calculation of array size ( #6487 )
2015-01-31 19:06:44 +01:00
PKEuS
ae4b86c231
Several improvements to CheckMemoryLeakNoVar::checkForUnusedReturnValue():
...
- Support user defined functions (solves TODO tests)
- Print message if return value is not stored properly (adapted message text, #6458 )
2015-01-31 17:28:03 +01:00
Daniel Marjamäki
73113c67e7
Fixed #6480 (False positive unreachableCode - member function exit called instead of ::exit())
2015-01-31 16:55:55 +01:00
PKEuS
789665dadf
Fixed #6455 : Show uninitvar even for const variables
2015-01-31 13:21:22 +01:00
PKEuS
27924d4ae2
Improved detection of array dimensions ( #6430 )
2015-01-31 13:12:06 +01:00
PKEuS
f771a79738
Removed obsolete internal check. The underlying but in Token::Match should be fixed since b4f0869a71
2015-01-31 12:56:54 +01:00
PKEuS
18b0e14590
Refactorizations: Fixed a pattern in checkbufferoverrun.cpp, simplified one in checkclass.cpp
2015-01-31 12:32:05 +01:00
PKEuS
b2835051df
Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0.
2015-01-31 12:32:04 +01:00
PKEuS
33f5d27b53
Fixed varId0 message #6443 .
2015-01-31 10:33:32 +01:00
Daniel Marjamäki
57ec1aea91
Library: Don't rely on ast in isNotLibraryFunction since it's used in tokenizer
2015-01-31 10:24:10 +01:00
PKEuS
36841cfa41
Better support for stream operator in CheckAutoVariables::returnReference() ( #6423 )
2015-01-31 10:12:49 +01:00
PKEuS
3a1bd4a5ad
Fixed gcc shadowing warnings
2015-01-30 22:04:26 +01:00
PKEuS
dcc1362890
SymbolDatabase: Support std::array ( fixes #6401 )
2015-01-30 21:56:27 +01:00
PKEuS
03e44d4aa0
CheckMemoryLeakInFunction: Don't treat delete as delete operator for C code
...
Fixed GCC message in checkbufferoverrun.cpp
2015-01-30 20:55:53 +01:00
PKEuS
98e33a189f
Enhanced CheckBufferOverrun:
...
- Fixed bug in library: manual and existing libraries use "size", but library.cpp reads "sizeof" as podtype attribute
- Fixed a couple of bugs in handling unknown size in checkbufferoverrun.cpp, get size from library if available.
2015-01-30 20:27:48 +01:00
PKEuS
b69528eb80
Bailout in Token::getValueTokenDeadPointer() if reference is used ( #6399 )
2015-01-30 19:29:37 +01:00
PKEuS
0d151b45b5
Better support for funciton pointers in checkuninitvar.cpp ( #6404 )
2015-01-30 19:16:25 +01:00
PKEuS
80feb8697d
Fixed false positives #6473 and #6469
2015-01-29 21:26:06 +01:00
PKEuS
71379616e7
Fixed false positive #6467
2015-01-29 10:18:21 +01:00
PKEuS
9ada111045
Fixed false positive #6466
2015-01-29 09:50:48 +01:00
PKEuS
8225b12763
Fixed some cppcheck messages
2015-01-28 22:29:07 +01:00
PKEuS
3342ea4c54
CheckInternal: Complain about Token::Match pattern if %or% or %oror% is the only "complex" pattern
2015-01-28 19:48:36 +01:00
PKEuS
21bd1d080e
Refactorization: Rearranged some code in checkleakautovar.cpp
2015-01-28 19:44:59 +01:00
PKEuS
0488f45a5f
Removed standalone check CheckOther::checkDoubleFree(), integrated (most of) the functionality into CheckLeakAutoVar. Added support for new/delete to checkLeakAutoVar.
2015-01-28 17:38:43 +01:00
PKEuS
5c56e63996
Fixed false positive #6452 : Handle member functions in CheckIO::checkFileUsage()
2015-01-27 21:52:52 +01:00
PKEuS
e82d2b3c8d
Fixed false positive #6453 : Skip over inner class if checking outer function
2015-01-27 21:21:17 +01:00
Daniel Marjamäki
3285f85ebf
Fixed #6460 (Library: better function/type matching)
2015-01-27 17:55:18 +01:00
PKEuS
bfa16ec258
Set /LARGEADDRESSAWARE flag for Win32 builds
...
Idea from Kosta-Github (pull-request #501 )
2015-01-27 15:43:40 +01:00
Dmitry-Me
e7bb43fc6b
Cache and reuse token pointer
2015-01-27 10:23:58 +03:00
Dmitry-Me
c79bfdce2c
CheckClass: Better checking of what operator= returns
2015-01-24 11:18:33 +01:00
PKEuS
ee046af20c
Fixed false positives #6450 and #6451
2015-01-23 19:38:39 +01:00
PKEuS
da35a74589
Fixed false negative: Passing uninitialized variable to stream ( #4673 )
2015-01-22 22:56:41 +01:00
PKEuS
da5a04f071
Fixed recently introduced FP in checkuninitvar.cpp if address of variable is passed to a function
2015-01-22 21:22:02 +01:00
PKEuS
4c76f71499
Reactivated old uninitialized variable checker which I accidentially disabled in previous commit
2015-01-22 17:34:22 +01:00
PKEuS
f4d11a4209
Fixed false negatives on try and non-executable scopes in checkUninitVar, removed unnecessary function parameters
2015-01-22 13:55:19 +01:00
PKEuS
bdae9064ea
Support throw in checkleakautovar.cpp
2015-01-22 11:12:26 +01:00
PKEuS
331a6b66be
Fixed internal message
2015-01-22 10:53:53 +01:00
PKEuS
7c60fe4aef
Fixed crash introduced by last commit.
2015-01-22 10:51:06 +01:00
PKEuS
7364cc8040
Fixed false positive in fityk: operator new calling constructor
2015-01-22 10:37:31 +01:00
PKEuS
60b2b655df
Support new/delete in new uninitialized variable checking; realloc() requires an initialized first argument.
2015-01-21 23:46:52 +01:00
PKEuS
c3e47f7eaa
Fixed false positive in CheckUninitVar and internal message
2015-01-21 22:26:44 +01:00
PKEuS
94c3c45350
CheckUninitVar: Use function information from library, bailout for '?'
2015-01-21 22:02:25 +01:00
PKEuS
ecb9d87e42
Fixed false positive: Bailout in checkuninitvar.cpp if setjmp is found
2015-01-21 16:49:34 +01:00
PKEuS
5334aaa25f
Refactorization:
...
- Removed a few unit tests of old uninitialized variable checking expecting other results than same test for new checking
- A few tweaks to new uninitvar checking to improve results when run on tests for old check
- switched some (TODO) tests to new check if the TODO is fixed
2015-01-21 16:17:58 +01:00
PKEuS
d8e282fe76
Refactorization: Made checkUninitVar::isVariableUsage() non-static
2015-01-21 13:52:03 +01:00
PKEuS
346532d312
Fixed false positives in CheckUninitVar::checkStruct()
2015-01-21 13:11:48 +01:00
PKEuS
54de731cac
Refactorized CheckUninitVar::checkScope(), fixed false negative
2015-01-21 12:20:03 +01:00
PKEuS
5f36c7c914
Improved detection of Type::needInitialization:
...
- Implement shortcut for C code - all types need initialization there
- Break out of loop faster if we encounter a type that needs initialization (it is sufficient if one member needs initialization)
2015-01-21 10:34:58 +01:00
Samir Aguiar
141a071792
* Added Clang-related flag to gui.pro
...
* Updated external lib location with PWD variable
2015-01-20 19:20:00 +01:00
Thomas Jarosch
ec21134817
Fix false negatives for local suppressions
...
Introduce a new bool setting jointSuppressionReport
that will be set by the analyseWholeProgram() code path.
When the flag is enabled, unmatched suppressions are
collected after running the final whole program analysis
to prevent false positives for the unusedFunction check.
The check functions in the unit test
for single / multi file suppressions were unified.
2015-01-20 18:47:30 +01:00
orbitcowboy
5a8574cc05
tokenlist::createAst(); should not be const.
2015-01-20 11:22:22 +01:00
orbitcowboy
bf1565bd34
Fixed inconclusive warnings regarding const correctness.
2015-01-20 09:09:16 +01:00
Robert Reif
56dc0b02ef
Fixed #6432 (cppcheck fails to detect ctor - partial template specialization)
2015-01-19 16:15:11 +01:00
Robert Reif
3b8540fdc0
Fixed #6424 (false negative: Use of 'class Ns::C' silence Cppcheck)
2015-01-19 06:38:54 +01:00
Thomas Jarosch
a83fe0e268
Check "var" for null pointer before using it
...
Reported by covertey -> amai on IRC.
2015-01-18 13:02:58 +01:00
Thomas Jarosch
c0aceb893e
Replace custom code with Settings::isWindowsPlatform()
2015-01-18 12:43:43 +01:00
Thomas Jarosch
9a5260a43f
Only simplify Windows's DEBUG_NEW macro on Windows platform
2015-01-18 12:20:23 +01:00
Thomas Jarosch
cd4c297dce
Fix segfault in template simplifier
...
When something parsing the template syntax
went wrong, "tok2" was NULL and resulted
in deleting all remaining tokens. Whoops.
Triggered by gcc test suite:
gcc/testsuite/g++.dg/cpp0x/variadic87.C
Tracked down the source of the bug with
valgrind's "--track-origins=yes" switch.
2015-01-18 01:43:43 +01:00
Thomas Jarosch
58cb6cc116
Add new "style" check to catch redundant pointer operations
...
Doing "&*some_ptr_var" is redundant and might be the remainder
of a refactoring. Warnings for expanded macros are excluded though:
They are often used with and without pointers and
do something like this: "func(&(*macroarg))".
The new check is fully AST based and was given
strong false positive testing on a large code base.
2015-01-18 00:34:07 +01:00
Thomas Jarosch
2bcd675653
Verbose AST dump: Show if token is expanded from macro
...
I also added the token variable id, but that decreased
readability of the AST tree too much.
2015-01-17 23:20:52 +01:00
Thomas Jarosch
10fffbfce0
Use unsigned int for all flags
...
Frank Zingsheim reported: With the parameter 'flag_'
and the member variable '_flags' having the type 'int'
produces a lot of warings in clang:
"warning: implicit conversion changes signedness: 'int' to 'unsigned int'".
2015-01-17 16:46:05 +01:00
Thomas Jarosch
fd01cafb1b
Clean up redundant pointer operations
2015-01-17 16:29:50 +01:00
Thomas Jarosch
e6f042dadc
Multi process check: Sanitize error messages for illegal characters
...
before sending them across the pipe.
The deserializer died while deserializing
a string containing a binary zero.
2015-01-17 16:12:00 +01:00
Thomas Jarosch
36bcefc39d
Don't crash when the deserialization of an error message fails
...
Found while scanning the code of an
open source project related to onions.
2015-01-17 16:09:58 +01:00
Robert Reif
193645318b
Tokenizer: Remove macro in class declaration like 'class DLLEXPORT Fred {}' to be able to handle the class better later
2015-01-17 07:42:49 +01:00
Thomas Jarosch
08985bf68a
Throw exception in getVariableFromVarId() if called with out_of_range varId
...
That way we have a chance to catch code bugs at all.
2015-01-15 18:52:11 +01:00
Thomas Jarosch
1cc85bfce3
Add bounds check to getVariableFromVarId()
...
While poking around the memory leak check,
I managed to trigger an out-of-bounds access
in the symbol database.
Fix it by sanity checking the variable id
passed to getVariableFromVarId().
2015-01-14 23:00:38 +01:00
Thomas Jarosch
ef7f104335
Make sure we have a valid Variable pointer before dereferencing it
...
All other call sites check the pointer already.
2015-01-14 23:00:28 +01:00
Thomas Jarosch
c92d861b1e
Fix typo in "internal error" message
2015-01-12 23:09:17 +01:00
Robert Reif
68bb197bcb
Destructor detected as constructor resulting in false variable not initialized warnings
2015-01-12 06:11:22 +01:00
Thomas Jarosch
059f9d056c
Move to global variables to file scope
...
Putting them in the anonymous namespace
is the same effect as making them "static".
2015-01-11 12:37:11 +01:00
PKEuS
787cbcb02e
Accept unknown elements in Library files, but print a warning. This fixes backward compatibility of libraries with older cppcheck versions
2015-01-10 22:18:57 +01:00
PKEuS
fd2f93bb80
Two small refactorizations:
...
- Avoid leaving and entering again critical section without doing anything
- Use isPointer() in checkbufferoverrun.cpp instead of string comparison
2015-01-10 21:03:21 +01:00
PKEuS
d019b7f9a6
Fixed wrong condition in library.cpp
2015-01-10 20:51:14 +01:00
Aneesh Azhakesan S
fe5d2fc245
Fixed #5906 (false negative: 'else if' expression is always false (use library to determine if function is pure))
2015-01-10 12:21:55 +01:00
Thomas Jarosch
332254e0af
Make patterns compilable (mini refactoring)
2015-01-09 23:43:45 +01:00
PKEuS
d110d715ba
Refactorization: Use Token::link() when stringifying template argument list in symboldatabase.cpp
2015-01-09 22:03:43 +01:00
PKEuS
4da314b2e4
Declared recently added helper functions as static
2015-01-09 21:40:50 +01:00
PKEuS
25cd3794ac
Refactorization: Simplified and unified SymbolDatabase printing
2015-01-09 21:35:16 +01:00
PKEuS
7452613479
Refactorization:
...
- Merged messages exceptThrowInNoexecptFunction, exceptThrowInNoThrowFunction, exceptThrowInAttributeNoThrowFunction and exceptThrowInDeclspecNoThrowFunction into a single message.
- Merged Token::fIsDeclspecNothrow into Token::fIsAttributeNothrow
2015-01-09 20:18:09 +01:00
PKEuS
4d5bf28b33
Refactorization: Removed code for copying attributes from function declaration to implementation in symboldatabase as it is neither tested nor necessary
2015-01-09 19:46:04 +01:00
Robert Reif
6998c55680
Symboldatabase: function return token ( #6244 )
2015-01-09 16:08:34 +01:00
Thomas Jarosch
374af15bd4
Fix parsing linkage specifier from global function declaration
...
Our very own "tools/dmake.cpp" had a function declaration
featuring "static void foobar()" while the function implementation
did not have the 'static' keyword (which is perfectly legal code).
2015-01-09 00:38:25 +01:00
Daniel Marjamäki
2375f1c46d
CheckBufferOverrun: Fix FN when multifile checking is used.
2015-01-08 21:01:22 +01:00
Daniel Marjamäki
6a8293a8b7
Library: More strict matching of functions
2015-01-08 19:31:41 +01:00
Robert Reif
ba1c24ee65
Fixed #6422 (symbol database: put function flags into a single flag variable)
2015-01-08 05:45:31 +01:00
Thomas Jarosch
4248c94d87
Silence compiler warning about unused parameter
...
PKEuS should decide if we can drop the parameter altogether.
2015-01-07 16:30:30 +01:00
Thomas Jarosch
2cb2161c5d
Fix unmatched local suppression error message for "unusedFunction" ( #6228 )
...
This fixes a regression from commit
e35329aba3
(fix for #4946 )
2015-01-07 15:40:12 +01:00
orbitcowboy
cd98471398
Merge branch 'master' of https://github.com/danmar/cppcheck
2015-01-07 08:30:17 +01:00
Thomas Jarosch
4bec2b58fd
Unused function check: Fix detection of func.usedOtherFile
...
Check if function is called from another file or not.
2015-01-07 11:29:37 +01:00
orbitcowboy
c07b07b8fe
Fixed #6415 - FP stringCompare memcmp(ptr, ptr+offset, length).
2015-01-07 08:30:05 +01:00
orbitcowboy
ba837a6f2d
Added support for strpbrk to std.cfg. Running astyle.
2015-01-07 02:34:41 +01:00
Daniel Marjamäki
8a6bb46958
Tokenizer: only print AST in debug output if --verbose is used
2015-01-07 06:46:04 +01:00
Daniel Marjamäki
b0cc46e98b
reverted 840b2fb0
, it caused FN. tweaked the Tokenizer::simplifyAssignmentBlock to fix the FP it caused.
2015-01-07 06:38:42 +01:00
Daniel Marjamäki
840b2fb035
Tokenizer: Removed simplification Tokenizer::simplifyAssignmentBlock. This fixes a fp in linux.
2015-01-06 20:44:58 +01:00
Daniel Marjamäki
a87fb96eaf
Uninitialized variables: fix fp when 'a=((b)=c)' is used
2015-01-06 18:03:40 +01:00
Daniel Marjamäki
88e7b55a2d
CheckSizeof: only report warnings when --enable=warning has been used
2015-01-06 15:20:42 +01:00
Daniel Marjamäki
1068e095e7
Fixed cppcheck warning about iterator post increment
2015-01-06 15:16:29 +01:00
Daniel Marjamäki
6c3b7c1d0e
CheckBufferOverrun: only report warnings when --enable=warning has been used
2015-01-06 15:14:15 +01:00
Daniel Marjamäki
228f5960fc
CheckIO: only report warnings when --enable=warning has been used
2015-01-06 15:08:25 +01:00
Daniel Marjamäki
eee9183406
ValueFlow: improved handling of conditional noreturn scope in valueFlowForward
2015-01-06 14:12:35 +01:00
Daniel Marjamäki
f2e5fbd30d
Uninitialized variables: bailout when ({..}) are used to avoid fp. it can be handled better.
2015-01-06 07:44:04 +01:00
Daniel Marjamäki
1f698ca493
ValueFlow: Fixed valueFlowForward, when condition is false and else-block returns dont set values below the else-code
2015-01-05 16:39:47 +01:00
Daniel Marjamäki
fe8d04e840
CheckNullPointer: Fix FP when x is NULL and address is calculated with expression '&x->y.z[0]'
2015-01-05 14:54:24 +01:00
Daniel Marjamäki
c5467766e2
ValueFlow: Fix for valueflow analysis after for loop
2015-01-05 14:00:12 +01:00
Daniel Marjamäki
a80101f277
CheckMemoryLeak: Fix FP for allocation functions that register memory before returning it
2015-01-05 13:23:38 +01:00
Daniel Marjamäki
fb685f096a
CheckOther:checkNegativeBitwiseShift: Fix FP when shift is protected by ?:
2015-01-05 10:01:04 +01:00
Thomas Jarosch
1ef1143609
Make local functions static
2015-01-05 01:25:49 +01:00
Daniel Marjamäki
d1927e3492
Removed Tokenizer::simplifyStructInit simplification.
2015-01-04 16:48:52 +01:00
PKEuS
432ff8fa7b
Fixed GCC warnings in checkstl.cpp
2015-01-04 14:32:20 +01:00
Daniel Marjamäki
7bafbfbd6e
Tokenizer: cleanup simplification of '!= 0' to avoid FP in 'x[(y & 0x80) != 0]' (linux)
2015-01-04 13:50:54 +01:00
PKEuS
e06a4cdf00
Refactorized CheckStl::if_find():
...
- Added support for find()-like functions to Library::Container
- Use <container> information from library
- Fixed false positive #6402
2015-01-04 12:43:50 +01:00
Daniel Marjamäki
f94243f85e
CheckMemoryLeak: Fix fp for allocation function that returns success value
2015-01-04 11:46:26 +01:00
Daniel Marjamäki
b3c2ea2c4f
CheckUninitVar: Fix fp for 'int x=2+x();' when x() is an unseen preprocessor macro
2015-01-04 11:13:20 +01:00
Zachary Blair
22bd20c94a
New check: Use make_shared/make_unique ( #5673 )
2015-01-04 11:07:53 +01:00
PKEuS
016e89e422
Refactorizations:
...
- Disabled some parts of setVarId() for C code.
- Fixed mistake in <contaier> documentation
2015-01-04 10:52:11 +01:00
Daniel Marjamäki
8dd569b9e1
Refactoring: Use AST in CheckUninitVar::isVariableUsage() to determine if & operator is address-of. This fixes FP in linux.
2015-01-04 09:23:24 +01:00
PKEuS
11fa185cae
Fixed crash on range-based for-loop
2015-01-03 22:36:39 +01:00
PKEuS
7ece58c3a0
CheckStl::stlOutOfBounds() now uses <container> information from Libraries
2015-01-03 22:18:33 +01:00
PKEuS
e39729ffcc
Library: Add <container> tag to Libraries, provide configuration for std::vector, std::deque, std::array and STL strings
...
Token: Added function to jump to the next template argument
2015-01-03 22:18:33 +01:00
Daniel Marjamäki
eb1c048d2a
Tokenizer: Fix wrong simplification when checking linux kernel
2015-01-03 21:35:03 +01:00
Daniel Marjamäki
014f8e3c71
Fixed #6396 (There are false negatives when --include is used)
2015-01-03 18:22:52 +01:00
PKEuS
267552779d
Improved check ( #6391 ): Detect identical code in both branches of ternary operator
2015-01-03 18:01:49 +01:00
PKEuS
bb9ce68354
Refactorization: Reduced chaos in CheckOther::classInfo()
2015-01-03 18:00:16 +01:00
PKEuS
9e46aabc03
Set version to 1.68.99/1.69 dev
2015-01-03 17:44:47 +01:00
Daniel Marjamäki
6793e96458
1.68: Set versions
2015-01-03 13:20:01 +01:00
Daniel Marjamäki
ff11ba9847
Updated copyright year to 2015
2015-01-03 12:14:58 +01:00
PKEuS
1355f49af7
Fixed false positive: Support assignments in CheckStl::if_find()
2015-01-03 11:29:13 +01:00
PKEuS
8885ac3eba
Fixed #6217 , refactorized CheckStl::if_find(): allow all comparison operators, use AST, fixed wrong unit tests
2015-01-03 11:07:11 +01:00
Martin Ettl
c8bb19567b
CheckString::checkAlwaysTrueOrFalseStringCompare: Added support for Microsofts string compare functions.
2015-01-02 15:33:55 +01:00
Martin Ettl
8f4f3ca063
CheckString::checkAlwaysTrueOrFalseStringCompare: Added support for string compare more functions.
2015-01-02 13:12:42 +01:00
Martin Ettl
465f74b3bb
Fixed #6398 - false negative: (warning) Unnecessary comparison of static strings.
2015-01-02 12:58:04 +01:00
Robert Reif
1aa3adbb46
Refactorization: Speedup function lookup in symboldatabase ( #6277 ) (Part 2)
2015-01-02 21:41:01 +01:00
PKEuS
417f42f732
Fixed #6096 : bool is an integral type, but there is no portability issue if a pointer is assigned to a bool.
2015-01-02 21:07:02 +01:00
PKEuS
274e1a838a
Fixed #5871 : Properly parse initialization list in setVarId() if constructor is declared as noexcept
2015-01-02 20:03:06 +01:00
Robert Reif
9a679d1720
Refactorization: Speedup function lookup in symboldatabase ( #6277 )
2015-01-02 16:11:21 +01:00
orbitcowboy
d53f2f583c
Fixed #6388 : Support strncasecmp
2015-01-02 14:04:55 +01:00
PKEuS
c4fd8919a2
Fixed #6014 : Added plausibility check before issuing null pointer messages on function calls defined in library
2015-01-02 13:35:39 +01:00
PKEuS
88990bac59
Fixed #6386 : Improved behaviour on unknown language (header file)
2015-01-02 12:32:23 +01:00
PKEuS
a3fbc5aee5
Refactorization: Avoid stringification of second branch if first branch was empty in CheckOther::checkDuplicateBranch()
2015-01-02 11:24:28 +01:00
Daniel Marjamäki
2831bbd420
ValueFlow: better handling of goto to avoid false positives
2015-01-01 14:29:49 +01:00
Alexander Mai
d2caf89706
#6385 crash in Variable::getFlag(). Catch token without variable in fix for #6095 .
2014-12-31 18:19:10 +01:00
Daniel Marjamäki
5c2a2a5c22
Fixed #6095 (False positive oppositeInnerCondition - neglecting statements with side-effects)
2014-12-31 15:14:22 +01:00
PKEuS
58f4660c94
Fixed #5223 : Bailout in valueFlowForLoop1() for complex conditions
...
Refactorization: Reuse result instead of calling MathLib::toLongNumber() twice
2014-12-30 19:56:47 +01:00
PKEuS
5dc45bd4ac
Fixed #5497 : Support designated initializers in array size detection
2014-12-30 19:23:01 +01:00
PKEuS
ec826a0e0e
Fixed #6022 : Support ++%var% in valueFlowForLoop1
...
Fixed TODO unit test: properly handle loops that are never executed
2014-12-30 18:50:22 +01:00
PKEuS
9e8a66ee40
Fixed #6373 : Support bitops in clarifyCalculation check
2014-12-30 17:55:29 +01:00
Thomas Jarosch
69b31a0743
Fix up extra whitespaces in match patterns
...
Detected by new internal check.
2014-12-30 14:53:43 +01:00
Thomas Jarosch
17b47f1ce0
New internal check: Catch extra whitespace in match patterns
...
Inspired by a recent commit from PKEuS.
2014-12-30 14:21:18 +01:00
Daniel Marjamäki
208761f0c3
Fixed #6361 (crash: CheckBufferOverrun)
2014-12-28 10:05:08 +01:00
PKEuS
8b59c39c42
Refactorization: Removed whitespaces at the end of Token::Match patterns
2014-12-27 11:09:54 +01:00
PKEuS
990d14f3e2
Fixed #6328 : Use isAttributeNoreturn() whereever we also check Library::isnoreturn().
2014-12-27 11:07:36 +01:00
Robert Reif
9e60f584d9
Fixed #6321 : Implemented function Token::swapWithNext().
2014-12-27 10:53:26 +01:00
Dmitry-Me
14f13afa0a
Don't care which type protected operator= returns
2014-12-26 15:38:22 +01:00
Daniel Marjamäki
6194a4eefd
Fixed #6357 (Improve check: pointer arithmetic 'p+x' overrun, conditional x)
2014-12-26 09:12:00 +01:00
Daniel Marjamäki
7ab12cea63
Improved pointer arithmetic message
2014-12-25 14:31:46 +01:00
Daniel Marjamäki
bc594d52c8
Fixed #6349 (Pointer arithmetic: clarify message)
2014-12-25 10:05:55 +01:00
Thomas Jarosch
26aa049724
Fix C++11 compat wrapper for clang
...
clang identifies itself as gcc 4.2.
The preprocessor macros can be dumped with:
clang++ -dM -E -x c /dev/null
2014-12-25 01:28:02 +01:00
Daniel Marjamäki
0c086cf247
Incomplete statement: tweaked bailout for '0;' statement using isExpandedMacro()
2014-12-24 21:47:37 +01:00
Daniel Marjamäki
7cfa54f0e0
Fixed #6353 (False positive: CheckBufferOverrun checking reassigned array function parameter)
2014-12-24 14:03:52 +01:00
Daniel Marjamäki
06803ee333
Refactoring Tokenizer::simplifyAttribute
2014-12-24 13:03:38 +01:00
Daniel Marjamäki
fb3f5a159d
Token: Added flag for attribute noreturn ( #6328 )
2014-12-24 12:50:51 +01:00
Daniel Marjamäki
90bd38a972
Renamed isCasted to isCast
2014-12-24 10:35:40 +01:00
Daniel Marjamäki
de1a91f30d
Incomplete statement: tweaked bailout for '(void*)0' using isCasted()
2014-12-23 18:19:33 +01:00
Daniel Marjamäki
1b2a23b3fe
Fixed #6350 (Tokenizer::simplifyCast: set Token::isCasted when cast is removed)
2014-12-23 16:16:14 +01:00
Daniel Marjamäki
e16a934fb3
CheckBufferOverrun: Added comment in code to clarify why severity is portability for pointerOutOfBounds message.
2014-12-22 15:41:46 +01:00
Thomas Jarosch
d5e10c18d3
checkUnreachableCode(): fix FP for statements that just hide compiler warnings about unused function arguments
...
Seen throughout the rockbox codebase.
2014-12-22 11:18:23 +01:00
Daniel Marjamäki
10ae551fef
CheckBufferOverrun: Use portability warning for pointer arithmetic UB. It can be used by intention and usually works as intended.
2014-12-22 10:56:17 +01:00
Thomas Jarosch
dca65ce3da
Fix FP if sizeof is used without parentheses on struct members
...
Right now we only support checking basic pointer types.
Pointers inside structs are not supported yet.
Consider the tokens "foo@1 . bar@2",
Token::Match( "sizeof ( %varid% )" ) won't match it.
Token::Match( "sizeof %varid%" ) did match it -> FP.
2014-12-22 09:44:08 +01:00
Daniel Marjamäki
93ac5a41cd
Fixed #6346 (pointer calculation overflow)
2014-12-22 09:38:00 +01:00
Daniel Marjamäki
293dc1efc7
Fixed #6327 (Unwanted constStatement on (void)0)
2014-12-21 13:42:21 +01:00
PKEuS
e03f49360f
Merge pull request #484 from simartin/ticket_6181
...
Ticket #6181 : Properly handle >> terminating template parameter lists.
2014-12-21 12:21:17 +01:00
Lauri Nurmi
d543a85510
Fix compilation with GCC 4.4.
...
It was broken by fe468ac142
.
2014-12-21 02:15:53 +02:00
Daniel Marjamäki
a95e5bff2b
Fixed #6344 (false positive: out of bounds access when array size is unknown)
2014-12-20 18:50:08 +01:00
Daniel Marjamäki
f24e1b82cf
astyle formatting
2014-12-20 18:47:40 +01:00
Daniel Marjamäki
b8371ebd87
Revert 2e45df3b
. Because there are FP.
2014-12-18 06:37:15 +01:00
Matthias Krüger
cc7f69da54
fix two internal warnings:
...
[lib/checkuninitvar.cpp:1668]: (style) Call to 'Token::tokAt()' followed by 'Token::str()' can be simplified.
[lib/checkuninitvar.cpp:1669]: (style) Call to 'Token::tokAt()' followed by 'Token::str()' can be simplified.
2014-12-17 19:06:13 +01:00
orbitcowboy
2e45df3b72
Fixed #6341 : false negative uninitvar pattern "return foo ( %var%"
2014-12-17 17:43:31 +01:00
Daniel Marjamäki
a1537e1a6e
Fixed #6339 (false negative: array index out of bounds on allocated buffer using valueflow)
2014-12-17 16:23:48 +01:00
Simon Martin
4c7a8c5497
Ticket #6181 : Properly handle >> terminating template parameter lists.
2014-12-14 15:14:27 +01:00
PKEuS
010eb1c8cb
Merge pull request #483 from simartin/ticket_6172
...
Ticket #6172 : Properly grok %type%... template parameters.
2014-12-14 17:01:25 +01:00
Simon Martin
859c6381cc
Ticket #6172 : Properly grok %type%... template parameters.
2014-12-14 14:33:37 +01:00
Daniel Marjamäki
5490fad8c7
Fixed #5840 (False positive (inconclusive): Possible nullpointer dereference - use before for-loop over nested list)
2014-12-14 14:10:42 +01:00
Thomas Jarosch
2f1ba89567
Improve readability of Library::load()
...
by caching often used node names.
Also constify existing name caches.
2014-12-12 22:18:22 +01:00
PKEuS
ff5ede342b
Fixed #6266 : Support noexcept(false)
2014-12-09 23:53:50 +01:00
PKEuS
4d81945ac5
Fixed a couple of #6276 integer over/underflow issues
2014-12-09 23:28:22 +01:00
PKEuS
493ab541ab
Fixed #6291 and #6293 : Support :: in front of function name in checkUnusedFunctions
...
Simplified code in CheckUnusedFunctions
2014-12-09 22:04:51 +01:00
PKEuS
e9bc3b7acf
Fixed #6308 : Properly associate Function with Scope for destructors in SymbolDatabase
2014-12-09 21:36:09 +01:00
Alexander Mai
cef324435f
Remove dead code in CheckMemoryLeakInFunction::call_func() (Coverity CID 1257017)
2014-12-09 20:34:30 +01:00
Dmitry-Me
ff6604e289
Make expensive string manipulation depend on settings
2014-12-09 06:08:38 +01:00
Alexander Mai
ec2c4aa2e3
#6301 Unused shared lock variable. Add exception for std::shared_lock() to CheckUnusedVar::checkFunctionVariableUsage_iterateScopes()
2014-12-07 15:32:09 +01:00
Daniel Marjamäki
64e6b5186d
astyle formatting
2014-12-05 06:41:47 +01:00
Alexander Mai
c2584aa635
#6303 crash in CheckBufferOverrun. Add check on loop variable in CheckBufferOverrun::checkScope().
2014-12-04 20:49:58 +01:00
Matthias Krüger
7a6cd54059
Fix [lib/tokenize.cpp:6184]: (warning) Found simple pattern inside Token::Match() call: ") {"
2014-12-04 11:11:47 +01:00
Daniel Marjamäki
e3892a95b5
Fixed #6290 (Tokenizer: Because 'and' is not simplified to '&&' there are false positives)
2014-12-03 16:32:05 +01:00
Dmitry-Me
7d259c073a
Cache and reuse value
2014-12-02 16:19:52 +03:00
Daniel Marjamäki
0b9d80c95d
Refactoring CheckUnusedFunctions so it uses new infrastructure for multifile analysis
2014-12-02 06:41:18 +01:00
Dmitry-Me
cf3f8c2f38
Refactoring: Replace names with underscores with camelCase names
2014-12-01 16:22:56 +01:00
Dmitry-Me
c0d2933ec7
Reorder checks to avoid redundant actions
2014-11-30 16:14:53 +03:00
Dmitry-Me
6482fefe3e
Cache and reuse previously computed value
2014-11-30 13:00:27 +01:00
Dmitry-Me
5e37275b2a
Code cleanup. Use 'isDelete' instead of token match
2014-11-28 17:50:23 +01:00
Dmitry-Me
828fdb6c47
Code cleanup. Omit redundant check.
2014-11-28 17:48:23 +01:00
Robert Reif
418c2e51a0
Fixed #3314 (cppcheck incorrectly reporting Syntax error.)
2014-11-28 17:44:36 +01:00
Robert Reif
0dad8b64e8
Fixed #6268 (False positive functionStatic (inconclusive) - nested namespaces)
2014-11-27 06:29:33 +01:00
Daniel Marjamäki
139414bd5c
astyle formatting
2014-11-26 16:13:57 +01:00
Daniel Marjamäki
465555e39d
Fixed memory leaks for non-solaris compilers.
2014-11-26 16:13:40 +01:00
amai2012
0913a51ccd
Merge pull request #469 from lasergnu/SEGV
...
Fix SEGV on Solaris x86
2014-11-25 17:01:00 +01:00
Dmitry-Me
f926958acb
Fix false positive about return type when there's =delete in operator= declaration
2014-11-25 15:52:52 +01:00
Jay Sigbrandt
f7eeb82ca4
Fix SEGV on Solaris x86
...
On Solaris x86, with both GCC 4.8 and 4.9, running cppcheck causes a segmentation fault when process terminates.
The backtrace (dbx) where
=>[1] _ZNSt14_List_iteratorIP5CheckEppEv(0x804798c, 0x8047994, 0xc0d61d6, 0x291a), at 0x8291b7c
[2] std::list<Check*, std::allocator, <Check*>void>::remove(0x84ab328, 0x80479c8, 0x80479d4, 0x82d96fc), at 0x82da984
[3] Check::~Check(0x84a9fc4, 0x83d232c, 0xfef411fb, 0x83d135c), at 0x82d9709
[4] CheckExceptionSafety::~CheckExceptionSafety(0x84a9fc4, 0xfee82a40, 0xfee82a40, 0xfedcf000), at 0x8311e7d
[5] __static_initialization_and_destruction_0(0x0, 0xffff, 0xfedd4c80, 0xfedcf000), at 0x81b01f8
[6] _GLOBAL__sub_D__ZN20CheckExceptionSafety11destructorsEv(0x83d135c, 0xfedd4f18, 0x8047a50, 0x828a5f5, 0xfedcf000, 0x8047a68), at 0x81b023c
[7] __do_global_dtors_aux(0xfedcf000, 0x8047a68, 0xfece28cd, 0x8047b08, 0x8047a48, 0xfedcf000), at 0x8185b90
[8] _fini(0x8047b08, 0x8047a48, 0xfedcf000, 0xfedd4f00, 0x8047a80, 0xfecd4e72), at 0x828a5f5
[9] _exithandle(0xfeffb7d8, 0x8185a1a, 0x0, 0x0, 0x0, 0x0), at 0xfece28cd
[10] exit(0x1, 0x8047b70, 0x0, 0x8047ba3, 0x8047bba, 0x8047ce6), at 0xfecd4e72
The destructor order is somehow getting messed up on this platform.
This fix moves the code away from header file and ensures _instances remains valid during termination.
2014-11-25 14:03:46 +01:00
Daniel Marjamäki
a002654c47
Reverted refactoring 828417c
for now. It caused a major slowdown in the unused functions checking.
2014-11-24 06:37:08 +01:00
Dmitry-Me
298021af1f
Remove redundant variable and manipulation thereof
2014-11-22 12:17:49 +01:00
Frank Zingsheim
9497732ac8
Fixed #6238 (false positive with double fopen)
2014-11-20 22:19:39 +01:00
Alexander Mai
d4e59065df
Fix some (clang) compiler warnings
2014-11-20 20:49:05 +01:00
Daniel Marjamäki
051d42ae6b
astyle formatting
2014-11-20 14:20:09 +01:00
orbitcowboy
4a2a4474c9
Fixed #6281 : MathLib: Long integer suffix i64 is not supported.
2014-11-20 10:23:09 +01:00
orbitcowboy
f5d804f71a
running astyle
2014-11-20 10:13:03 +01:00
Robert Reif
d12f14844a
Fixed #6279 (False Positive: Member variable 'Fred::i' is not initialized in the constructor)
2014-11-20 06:18:29 +01:00
Robert Reif
b7c9187539
Fixed #6280 (MathLib: binary literals are integers)
2014-11-19 06:43:52 +01:00
PKEuS
4163f1e122
Fixed #6260 - C++11 style array initialization
2014-11-18 19:50:09 +01:00
PKEuS
428587f3d4
Fixed #6275 : Simplification of = (NULL); to = 0;
2014-11-18 19:39:38 +01:00
Alexander Mai
85c02df56c
Fix compiler warning. run astyle
2014-11-18 19:36:47 +01:00
PKEuS
ad8749c0bd
Fixed #6278 : Remove casts to references to pointers in Tokenizer::simplifyCasts()
2014-11-18 19:23:59 +01:00
Dmitry-Me
34bd612ea9
Omit unneeded operations
2014-11-18 16:35:36 +03:00
Dmitry-Me
e12d280e90
Code cleanup. Omit redundant actions.
2014-11-18 06:38:19 +01:00
Alexander Mai
8bcf833bb7
Cure null pointer access within Scope::findFunction introduced by recent cs
2014-11-17 23:10:00 +01:00
Robert Reif
c5e15950df
Fixed #6230 (SymbolDatabase: Wrong function() is set for token)
2014-11-17 16:04:44 +01:00
Robert Reif
7c4a137e14
Fixed #6274 (MathLib::isFloat doesn't recognize long double literal suffix L or l)
2014-11-17 06:53:32 +01:00
Alexander Mai
45ff012b2c
Small doxygen fixes
2014-11-16 19:40:04 +01:00
Daniel Marjamäki
828417c934
CheckUnusedFunction: Refactorings to use same infrastructure for whole program analysis as CheckUninitVar and CheckBufferOverrun
2014-11-15 18:44:23 +01:00
Daniel Marjamäki
de7e9223b8
Fixed #6272 (Improve check: multifile checking in checkbufferoverrun)
2014-11-15 10:43:49 +01:00
Dmitry-Me
353b885948
CheckOther::invalidPointerCast: Incorrect interpretation of settings
2014-11-14 20:22:17 +01:00
Dmitry-Me
fefb0ca912
Reuse previously computed values
2014-11-14 13:24:56 +03:00
orbitcowboy
b9a9f51fe0
MathLib: Added test for isDec() and removed not required state.
2014-11-14 04:29:35 +01:00
Alexander Mai
5300ba2074
Make single-argument constructors explicit
2014-11-13 21:39:14 +01:00
Alexander Mai
0f007fa24e
Increase CPPCHECK_DEVMINOR to 68
2014-11-13 21:36:57 +01:00
Dmitry-Me
cb9a6c1cb5
Don't show warning for same expressions alongside == in static_assert
2014-11-13 16:04:34 +01:00
Robert Reif
67385cfc4b
Symboldatabase: improved look up of delegate constructors
2014-11-13 06:29:51 +01:00
Daniel Marjamäki
189dfd64f7
Revert "Fixed #6230 (SymbolDatabase: Wrong function() is set for token)"
...
This reverts commit 685fce6b91
.
2014-11-11 07:29:16 +01:00
Daniel Marjamäki
ea765c24f2
Fixed #3262 (Tokenizer: wrong 'return a=1,b=2,...;' simplification;)
2014-11-10 17:31:19 +01:00
Simon Martin
cc6b51f2d9
Ticket #6059 : Properly handle class... in parameter lists.
2014-11-07 23:08:54 +01:00
Daniel Marjamäki
685fce6b91
Fixed #6230 (SymbolDatabase: Wrong function() is set for token)
2014-11-07 11:10:20 +01:00
Daniel Marjamäki
8012ac9562
Fixed #5993 (FP: memleak (linux list))
2014-11-07 07:44:12 +01:00
Frank Zingsheim
7e0fc3d481
Fixed #6252 (False positive "freed twice")
...
--HG--
extra : rebase_source : 24f801452fbefa3a59ab2cca62c3cf02aea513b6
2014-11-03 21:24:34 +01:00
PKEuS
e5d63195cb
Fixed #5983 : Support storing pointers/references to member variables in CheckClass::checkConst()
2014-11-02 13:38:03 +01:00
Robert Reif
df6855c216
SymbolDatabase: reintroduce test, move symboldatabase cleanup code to SymbolDatabase destructor
2014-11-02 10:36:52 +01:00
Frank Zingsheim
0e4c508d7b
Fixed #4272 and #6237 (Crash from running out of memory with many templates)
2014-11-01 22:07:24 +01:00
Alexander Mai
fe468ac142
cppcheck compilation fails with g++4.6.3. Patch from mavik1
2014-11-01 20:21:15 +01:00
Robert Reif
4eb33e7479
SymbolDatabase: Refactoring of findFunction
2014-11-01 14:36:17 +01:00
Daniel Marjamäki
b766071272
Fixed #4970 (false positive: conditionally initialized variable used in if-clause (git/notes.c))
2014-11-01 14:03:02 +01:00
PKEuS
c7d315fba3
Refactorization: Changed simplifyMathFunctions() to a single pass simplifier
2014-10-31 23:08:11 +01:00
PKEuS
f8371f65f0
Refactorization: Avoid string copying.
2014-10-31 22:36:44 +01:00
PKEuS
9b0b7a77b6
Removed unnecessary conditions and avoid string copying in Tokenizer::simplifyMathFunctions()
2014-10-31 13:59:39 +01:00
PKEuS
662283cab8
Refactorization: Avoid iterations over whole token list, limited several checks to function scopes.
2014-10-31 11:42:54 +01:00
PKEuS
5bc775e43e
Refactorization: avoid string copying in Path::getPathFromFilename()
2014-10-30 23:48:23 +01:00
PKEuS
d29117c4b2
Rearranged some code in simplifyTypedef
2014-10-30 23:48:23 +01:00
PKEuS
b5ea677180
Some fixes for CheckOther::checkIgnoredReturnValue():
...
- Fixed name of the function
- Fixed false positive for code like "class strcmp { strcmp() {} };"
- Fixed FP #6233 on checking side (no AST generated for function call)
2014-10-30 23:24:13 +01:00
PKEuS
b7996bd0b0
Handle overloads and custom implementations of functions checkReturnIgnoredReturnValue() to avoid false positives
2014-10-30 21:26:32 +01:00
Robert Reif
f75aca1921
SymbolDatabase: change symboldatabase::findFunction to only check function arguments for function calls
2014-10-30 13:47:20 +01:00
PKEuS
6fdaf65cea
Fixed createLinks2() when > is followed by ; ( #6242 )
2014-10-30 11:15:24 +01:00
Daniel Marjamäki
6088ba7951
Merge pull request #456 from simartin/ticket_6817_take2
...
Ticket #6187 : Avoid infinite loop if eraseDeadCode does not remove anything (this time without memory corruption).
2014-10-23 09:43:02 +02:00
Daniel Marjamäki
4483c3e820
Fixed #6234 (FP : shift by too many bits is undefined on a QT container)
2014-10-23 06:52:19 +02:00
Simon Martin
c6e2107d99
Ticket #6187 : Avoid infinite loop if eraseDeadCode does not remove anything (this time without memory corruption).
2014-10-22 20:25:36 +02:00
Frank Zingsheim
71c5d4bd60
Ticket #6232 (cppOut of bounds array access)
...
--HG--
extra : rebase_source : 79ed3533a12a486ea3ed3f09f9bc55b1a4771161
2014-10-21 22:56:53 +02:00
Daniel Marjamäki
dd6ade9831
Fixed #6231 (mingw compiler error: Path::getAbsoluteFilePath)
2014-10-21 18:46:09 +02:00
Daniel Marjamäki
a3efa1e180
Fixed #4776 (FP: Assignment of function parameter has no effect outside the function, with goto)
2014-10-21 16:21:33 +02:00
Daniel Marjamäki
e965d8de67
Merge pull request #455 from Dmitry-Me/refactorNumberIsX
...
Reuse code in isXNumber() to avoid duplication and unneeded computations
2014-10-21 15:30:19 +02:00
Dmitry-Me
c3fa85b282
Reuse code in isXNumber() to avoid duplication and unneeded computations
2014-10-21 16:02:35 +04:00
Robert Reif
42f709c09d
Fixed #6229 (Move Windows builtin types __intXX to library)
2014-10-21 06:11:19 +02:00
Daniel Marjamäki
d8b50e73df
Fixed #6002 (Defect: False positive due to pointer address not being associated with variable in for loop)
2014-10-20 15:54:02 +02:00
Robert Reif
d5908f03b7
Fixed #6226 (false negative: printf format check for user defined array type)
2014-10-20 06:33:36 +02:00
Robert Reif
e2f72b4cb1
Fixed #6215 (Move Windows platform types into library)
2014-10-19 07:34:40 +02:00
Daniel Marjamäki
0ed2b580b2
doc: updated wiki syntax for --doc output
2014-10-18 21:20:29 +02:00
Daniel Marjamäki
de88c10e6b
1.67: set version
2014-10-18 11:35:00 +02:00
Daniel Marjamäki
0a1a34b9b7
Fixed Cppcheck warning, possible null pointer dereference of tok.
2014-10-18 10:59:48 +02:00
Daniel Marjamäki
0fd6586fcc
Fixed #6219 (valueFlowForward: better multivariable analysis needed to avoid FP)
2014-10-17 06:50:33 +02:00
Frank Zingsheim
41a54fceba
Fixed false positives about uninitialized member variables if variable has a default value ( #5500 )
2014-10-16 21:57:43 +02:00
Frank Zingsheim
3923618b8d
Fixed #6222 (Missing varid for multiple braced initialized variables)
...
-> Fixed broken code in unit tests
2014-10-16 20:46:57 +02:00
PKEuS
079f495455
Added missing relational operators to pattern, as suggested in #6189
2014-10-16 20:37:21 +02:00
PKEuS
a99fd364ef
Restored functionality to detect std::string(0) calls as null pointer dereferences ( #6189 )
2014-10-16 19:12:02 +02:00
Daniel Marjamäki
7107286be6
Fixed #5891 (AST: wrong ast generated for 'x = (int)(double(123)*i);')
2014-10-16 15:57:05 +02:00
PKEuS
eefaddf980
Fixed bug in Tokenizer::simplifyReference() ( #6133 )
2014-10-16 11:43:42 +02:00
PKEuS
6955e719cf
Collected garbage code tests and moved them to testgarbage.cpp
2014-10-16 10:59:46 +02:00
Frank Zingsheim
9dd3bce98b
Fixed #6214 : non-static member initializer causes false positive
2014-10-16 09:11:09 +02:00
Samuel Degrande
96e8b83bf8
Fixed newline in verbose message
2014-10-16 09:08:39 +02:00
Daniel Marjamäki
ecd17d84fb
Reverted f088588c
fix for #6187 that fixes infinite loop, the fix cause a use-after-free regression.
2014-10-16 06:32:06 +02:00
Frank Zingsheim
eab0878b8a
Support {} initialization in initializer list ( #6216 )
2014-10-15 21:33:21 +02:00
Daniel Marjamäki
228206f556
Fixed #6067 (ValueFlow: subfunction, condition with && or ||)
2014-10-15 16:34:03 +02:00
Daniel Marjamäki
17cab08cba
Tokenizer::setVarId: Refactored fix to avoid varId for function name
2014-10-15 06:47:09 +02:00
Daniel Marjamäki
36297f1025
Tokenizer::varId: don't set varid for function name in code 'bool f(X x, int=3);'
2014-10-14 20:37:32 +02:00
Daniel Marjamäki
82972b7b0d
SymbolDatabase: fix debug output
2014-10-14 19:39:08 +02:00
Daniel Marjamäki
24ecaf8b0a
leakautovar: handling of unknown/non-pod types in c++
2014-10-14 16:40:30 +02:00
Daniel Marjamäki
94c677905b
ast: don't hang when invalid code with new is found 'new (var1,var2,var3);'
2014-10-13 19:12:20 +02:00
Daniel Marjamäki
77cffcde38
Fixed #6190 (SymbolDatabase: variable info not set properly when reinterpret_cast is used)
2014-10-12 16:06:50 +02:00
Frank Zingsheim
11867e3210
Fixed #6214 (non-static member initializer causes false positive (function call; initializer))
2014-10-12 15:06:07 +02:00
Daniel Marjamäki
aac9e66147
AST: fixed ast for 'new (char *)[10]'
2014-10-12 12:57:01 +02:00
Daniel Marjamäki
f72a8d3f15
AST: fixed ast for 'a(new A(1)), b(new B(2))'
2014-10-12 12:13:01 +02:00
Daniel Marjamäki
649e2dfa97
AST: fixed ast for 'a = new (b) ::X;'
2014-10-12 11:12:25 +02:00
Daniel Marjamäki
f96ea94048
AST: fixed ast for 'a(new (X), 5);'
2014-10-12 10:20:03 +02:00
Daniel Marjamäki
c537c98751
AST: fixed ast for 'a(new (X));'
2014-10-12 09:24:43 +02:00
Daniel Marjamäki
30353d4b61
Tokenizer::setVarId: better handling of c++ casts
2014-10-11 18:35:06 +02:00
Daniel Marjamäki
31d8cac8c9
Fixed #6138 (ValueFlow: entry can't be 0 in loop code 'while (entry = get()) entry->value;')
2014-10-11 17:48:51 +02:00
Simon Martin
70561682eb
Tokenizer::simplifyConstTernaryOp: Properly detect the end of the 'false' part of ternary operators when it contains '>'.
2014-10-11 17:01:55 +02:00
Daniel Marjamäki
8c8e85d2db
Tokenizer::setVarId: A variable declaration can't start with the typedef keyword
2014-10-11 16:30:51 +02:00
Daniel Marjamäki
489fc6cce7
AST: more fixes of new statements in clang test suite. some of it is not handled very well.
2014-10-11 13:20:48 +02:00
Daniel Marjamäki
4783a67042
AST: fixes for more new statements from clang test suite
2014-10-11 11:27:13 +02:00
Daniel Marjamäki
dd6ae3033f
Tokenizer::simplifyRedundantParentheses: dont remove parentheses in 'void * operator new(SIZE_TYPE, int);'
2014-10-11 09:18:43 +02:00
Daniel Marjamäki
e6708c1ae2
AST: fixed hang for 'new (int S::*[3][4][5])()' (clang test suite)
2014-10-11 08:32:49 +02:00
Daniel Marjamäki
5891bae59e
AST: generilized handling of auto usage in new statement
2014-10-10 19:05:31 +02:00
Daniel Marjamäki
b0b86f5607
Fixed internal error, use Token::simpleMatch for pattern 'const new' instead of Token::Match
2014-10-10 18:58:04 +02:00
Daniel Marjamäki
19a05b1f53
Tokenizer::setVarId: don't set varid for 'auto' keyword
2014-10-10 16:46:31 +02:00
Daniel Marjamäki
d0d2a0faf8
simplifyCalculations: Fix simplification of '( %num% )' when parentheses must be kept
2014-10-10 13:19:25 +02:00
Daniel Marjamäki
66d4614a87
AST: don't hang when using auto in new statement
2014-10-10 12:47:01 +02:00
Daniel Marjamäki
b5faf3a0cc
AST: improved handling of new
2014-10-10 10:37:54 +02:00
Daniel Marjamäki
cca003490b
Fixed #6203 (AST: fix problem with '; static_cast<...')
2014-10-10 08:18:24 +02:00
amai2012
85500dcdbd
Merge pull request #453 from simartin/ticket_5625
...
Ticket #5625 : Simplify constant ternary operator in template parameters.
2014-10-06 09:01:08 +02:00
amai2012
cddb4af10b
Merge pull request #450 from simartin/ticket_6187
...
Ticket #6187 : Avoid infinite loop if eraseDeadCode does not remove anything
2014-10-06 08:59:56 +02:00
Simon Martin
9ddf857dc7
Ticket #5625 : Simplify constant ternary operator in template parameters.
2014-10-04 20:49:57 +02:00
PKEuS
b48bf1dbad
Fixed GUI bug: file test.cpp is loaded from file if scratchpad is empty.
...
The underlying problem was in lib and is fixed by changing the behaviour of CppCheck::check(). Checking is performed on empty content without attempt to load from file.
2014-10-03 10:40:48 +02:00
PKEuS
a02712cb66
Some small refactorizations:
...
- Removed redundant calls to std::string constructor
- Use default parameters in some places
2014-10-03 10:02:46 +02:00
PKEuS
bb8c8d53cc
Support do-loops in CheckStl::stlOutOfBounds()
2014-10-02 20:38:55 +02:00
PKEuS
621644b17a
Added support for member variables in Check64BitPortability::pointerassignment()
2014-10-02 20:38:54 +02:00
PKEuS
542cb1cd8e
Reduce RAM usage: Avoid keeping a copy of the preprocessed source files content during checking.
2014-10-02 19:44:17 +02:00
orbitcowboy
5a4526e997
Fixed typos in comments, no functional changes.
2014-10-02 04:39:41 +02:00
Dmitry-Me
23bfd21bbc
Don't proceed to outer scope once match is found
2014-10-02 12:24:19 +04:00
PKEuS
7c7fcf36af
Support :: prefix in front of allocation function.
2014-10-01 15:33:03 +02:00
PKEuS
14f15d65e7
Support more patterns when replacing stuff like 'or' ( #6201 )
2014-10-01 08:41:55 +02:00
Simon Martin
f088588c88
Ticket #6187 : Avoid infinite loop if eraseDeadCode does not remove anything (invalid goto into a dead loop's body).
2014-09-30 19:43:22 +02:00
orbitcowboy
f36aaae732
Fixed a typo in a comment. No functional changes.
2014-09-30 14:54:59 +02:00
Daniel Marjamäki
fbc6323a9b
doc: changed --doc output to Markdown syntax
2014-09-30 14:56:12 +02:00
PKEuS
8788e58cbb
Fixed false positive #5327 : fclose as inner function call
2014-09-30 13:55:21 +02:00
PKEuS
c0e2adf723
Detect "var += fclose(f)" as deallocation (fixes false positive #6016 )
2014-09-30 13:19:53 +02:00
PKEuS
ccb5384645
Fixed false positive memoryLeak #6013
2014-09-30 13:02:02 +02:00
PKEuS
936043d47d
Fixed false positive 'unusedVar' with C++11 initialization ( #6160 )
2014-09-30 12:39:27 +02:00
PKEuS
374ea8f039
Fixed false positive ignoredReturnValue on unknown member function log() ( #6197 )
2014-09-29 19:55:32 +02:00
Martin Ettl
a7c870bdc8
Fixed crash on garbage code in CheckOther::checkVariableScope(). The corresponding backtrace is hosted at https://github.com/orbitcowboy/cppcheck_crash_files/blob/master/crash223.cpp
2014-09-29 19:44:25 +02:00
Martin Ettl
2ca47601cd
Running astyle
2014-09-28 22:05:05 +02:00
Martin Ettl
b677d3d17f
Fix crash on garbage code in tokenlist. The corresponding backtrace along with a testcase is hosted at: https://github.com/orbitcowboy/cppcheck_crash_files/blob/master/crash220.cpp
2014-09-28 22:04:25 +02:00
PKEuS
38af865560
Fixed false positive: Member variable not initialized in the constructor with array and (*this) ( #5754 )
2014-09-29 16:49:20 +02:00
PKEuS
cbb8360b30
Added version attribute to .cfg files ( #5928 )
2014-09-29 16:26:17 +02:00
PKEuS
68b26f8faa
Fixed subsequent false negatives in CheckBufferOverrun::checkInsecureCmdLineArgs() ( #5835 )
2014-09-29 15:38:33 +02:00
PKEuS
1df1b9c2bd
Fixed #5836 : Make showing $ in stringified tokens optional
2014-09-29 14:50:00 +02:00
PKEuS
448195f255
Added variable name to debug message about typeStartToken()
...
Fixed cppcheck message
2014-09-29 14:36:03 +02:00
PKEuS
0ae09c0029
SymbolDatabase: A token with a varId cannot be a function declaration
2014-09-29 13:05:51 +02:00
PKEuS
58fe668fc4
Fixed AST for operator:: after template ( #6195 )
2014-09-29 11:01:37 +02:00
PKEuS
55b14853d0
Fixed AST: Compile expression inside [] brackets of operator new. ( #6193 )
2014-09-29 10:26:15 +02:00
PKEuS
1495a411eb
Fixed false positive ignoredReturnValue for variables initialized with constructor syntax ( #6194 )
2014-09-29 10:15:29 +02:00
PKEuS
03b1afc28c
Loops over all varIds should start at 1.
2014-09-28 09:47:11 +02:00
Alexander Mai
ccd80e3407
#6141 FP: Unknown type is assumed to have size 0.
2014-09-27 21:51:11 +02:00
PKEuS
210294443e
New check: Check for unused return values ( #653 )
2014-09-27 21:31:04 +02:00
PKEuS
e1218cf846
Support allocation of array of pointers with operator new in checkmemoryleak.cpp
2014-09-27 11:25:08 +02:00
PKEuS
812bc6bdaf
CheckVaarg::va_list_usage(): Bailout when try{} block is encountered ( #6186 )
2014-09-27 11:03:58 +02:00
Alexander Mai
21c85118d6
#6189 assign with operator= a '\0' to a std::string is not an error
2014-09-26 20:40:44 +02:00
PKEuS
de13ad7eca
Improved simplifications of redundant loops:
...
- Execute simplifyWhile0 after simplifyKnownVariables (#394 )
- Support declaration of variable in loop header in removeRedundantFor
2014-09-26 10:47:05 +02:00
Robert Reif
1729ea6f0f
Fixed #6182 (Format specifier check confused by ternary operator)
2014-09-24 16:45:06 +02:00
PKEuS
0cc5b67bf6
Avoid copying std::list object in valueFlowAfterAssign
2014-09-24 13:22:22 +02:00
Robert Reif
194e4a71a4
Symbol database: handle anonymous namespace
2014-09-24 06:09:08 +02:00
PKEuS
1e8c7e102d
Revert "run dmake"
...
This reverts commit 8ccf9eed09
.
2014-09-23 21:04:31 +02:00
PKEuS
6dc5b1725e
Restored files removed in 1cc872f5b2
2014-09-23 21:02:46 +02:00
Matthias Krüger
8ccf9eed09
run dmake
2014-09-23 16:20:19 +02:00
Lauri Nurmi
1cc872f5b2
Change "obsolete" in all filenames into "obsolescent", and also update all references to such files.
...
Neither the C standard, the C++ standard, or POSIX talks about "obsolete". All of them use the word "obsolescent", which is a different word with a different meaning.
2014-09-23 16:18:04 +02:00
Daniel Marjamäki
ee93d30d94
ValueFlow: improved valueflow for loops that assign variable and then break
2014-09-23 16:06:02 +02:00
Dmitry-Me
b17f2eea16
Cache search result to avoid dual search
2014-09-22 15:54:17 +04:00
Dmitry-Me
ebf1764bcc
Move variable declarations, remove unneeded assignments, remove comparison duplication
2014-09-19 11:29:31 +04:00
amai2012
77f341be97
Merge pull request #440 from Dmitry-Me/renameVariablesReduceActions
...
Cleanup variable names, reduce unneeded operations
2014-09-17 18:39:17 +02:00
Jonathan Thackray
2b3ef83f26
Fixed #5747 (When socket() returns -1 on error, this shouldn't be marked as a resource leak)
2014-09-17 18:37:41 +02:00
Dmitry-Me
57c379d300
Cleanup variable names, reduce unneeded operations
2014-09-17 15:52:03 +04:00
Dmitry-Me
32f7a789df
Merge overlapping patterns, move declarations
2014-09-17 10:54:53 +04:00
amai2012
776e720d8f
Merge pull request #438 from Dmitry-Me/moveDeclarationReorderCheck
...
Move declaration, run check earlier
2014-09-16 20:50:04 +02:00
Daniel Marjamäki
f93cf9d1b7
Fixed #6170 (Tokenizer: sizeof on array in 2d-array is not handled properly)
2014-09-16 17:21:17 +02:00
Dmitry-Me
7c4b9bed9e
Move declaration, run check earlier
2014-09-16 13:34:16 +04:00
Dmitry-Me
6f9730b1d8
Reorder checks, unwrap code
2014-09-16 10:17:06 +04:00
Dmitry-Me
b479948f0f
Refactoring: Merge overlapping Token::Match function calls
2014-09-16 06:22:16 +02:00
Daniel Marjamäki
bbbe2c1b94
Fixed #6169 (False positive: passing uninitialized struct buffer member to strncpy)
2014-09-15 15:58:21 +02:00
PKEuS
cafddcb109
Fixed wrong function log10 being recommended instead of log1p
2014-09-14 13:36:12 +02:00
Daniel Marjamäki
29a49d0641
removed some redundant null pointer checks before calling Token::Match
2014-09-14 11:35:04 +02:00
Simon Martin
53b58f0ed9
Refactoring. Use Token::Match instead of hardcoded patterns to increase readability.
2014-09-14 11:26:16 +02:00
Daniel Marjamäki
d354cdc02c
Fixed #6168 (False positive: sign conversion for inner calculation)
2014-09-14 10:29:58 +02:00
Daniel Marjamäki
865a252c89
astyle formatting
...
[ci skip]
2014-09-14 10:29:12 +02:00
Simon Martin
4b750997cb
Ticket #6121 : Report a syntax error for invalid enum initializers.
2014-09-13 20:46:53 +02:00
Simon Martin
01cf008792
Ticket #6134 : Improve the mechanism differentiating template declarations from template definitions.
2014-09-13 16:44:05 +02:00
PKEuS
210d01c274
Merge pull request #430 from Dmitry-Me/mergeDuplicatePatterns
...
Merge partially duplicate patterns
2014-09-12 21:28:18 +02:00
Daniel Marjamäki
8cbd013d7f
checkSignConversion: dont warn for + and -
2014-09-12 18:58:31 +02:00
Dmitry-Me
961a1b65ae
Merge partially duplicate patterns
2014-09-12 19:10:41 +04:00
Daniel Marjamäki
0e55f12140
Fixed #6165 (Remove old checkUnsignedDivision checker that uses neither AST nor ValueFlow. The CheckType::checkSignConversion should be much more accurate)
2014-09-12 16:59:16 +02:00
Daniel Marjamäki
d60cf16eb8
Sign conversion: Improved check. When its not explicit that 'int' variable is signed but it can have negative values, assume its signed
2014-09-12 16:18:42 +02:00
PKEuS
0b7281803e
Merge pull request #428 from Dmitry-Me/detectArrowAccessesViaUninitPtrs
...
Detect -> accesses on uninitialized pointers
2014-09-12 09:19:59 +02:00
Dmitry-Me
a2b30c7801
Detect -> accesses on uninitialized pointers
2014-09-12 10:19:00 +04:00
Daniel Marjamäki
7119550dde
Too big shift: fix FP when cast is used
2014-09-12 06:45:45 +02:00
Daniel Marjamäki
0ab7abded1
AST: fixed cast for 'return (long long)c << 40;'
2014-09-12 06:43:52 +02:00
PKEuS
e2136adf5b
Merge pull request #427 from Dmitry-Me/reorderChecksMoveDeclaration
...
Reorder checks, move declaration closer to where it's needed
2014-09-11 21:46:13 +02:00
PKEuS
6f92557478
Use information about pure/leak-ignore from library to improve accuracy of several bailouts
2014-09-11 20:27:07 +02:00
PKEuS
c1b0bfe4ee
Simplified code
2014-09-11 20:27:01 +02:00
PKEuS
fb0d145b34
Don't show inconclusive message redundantCopyLocalConst if --inconclusive is not set.
...
Ran AStyle
2014-09-11 19:45:52 +02:00
PKEuS
87e6a3501a
Added checktype.cpp to VS solution; Fixed MSVC warning about signed/unsigned mismatch
2014-09-11 18:47:28 +02:00
Daniel Marjamäki
7847263451
Fixed #6158 (New check: dangerous sign conversion)
2014-09-11 18:10:19 +02:00
Dmitry-Me
f58a25bebd
Reorder checks, move declaration closer to where it's needed
2014-09-11 17:14:06 +04:00
Dmitry-Me
e050fba414
Move declaration closer to where it is used
2014-09-11 11:26:35 +04:00
PKEuS
865fc9aa67
Fixed #6154 : Don't suggest to reduce scope if inner scope is a lambda.
2014-09-10 20:56:34 +02:00
PKEuS
0a416910c4
Improved speed of testrunner: Avoid repeated loading of the same library
2014-09-10 20:29:44 +02:00
PKEuS
3fade4d28c
Improved performance of library loading (~5%):
...
- Use std::string for comparison, convert to string only once
- Avoid calling tinyxml functions multiple times
2014-09-10 20:29:44 +02:00
PKEuS
c3ac91eb42
Fixed ID of message about purged configurations.
2014-09-10 20:19:21 +02:00
Daniel Marjamäki
a46f5c00a8
Minor tweaks for new CheckOther::checkIntegerOverflow checker
2014-09-10 17:26:20 +02:00
Daniel Marjamäki
974c8688c3
Fixed #1751 (Undefined Behavior: Signed integer overflow)
2014-09-10 17:02:18 +02:00
Daniel Marjamäki
a36b0e55be
CheckOther::checkTooBigBitwiseShift: improving error messages
2014-09-09 17:06:45 +02:00
Dmitry-Me
0a1b8c22d6
Simplify null pointer handling
2014-09-09 13:11:41 +04:00
Daniel Marjamäki
f111a89639
Fixed #1757 (Undefined Behavior: Shift too many bits)
2014-09-09 07:24:59 +02:00
Dmitry-Me
f7824bfd00
CheckNullPointer::isPointerDeRef: Improve handling of static member variables and functions
2014-09-09 05:36:09 +02:00
Matthias Krüger
323fd1b3dc
tokenize.cpp: fix internal warning: Found simple pattern inside Token::Match() call: ") :"
2014-09-08 22:00:57 +02:00
Martin Ettl
0ced0c33e5
Fixed #6149 : (gcc) warning: comparing floating point with == or != is unsafe. Using Tokenizer::isOneNumber function to compare a floating point number being 1.0.
2014-09-08 20:02:04 +02:00
Frank Zingsheim
8c5013adda
Fixed #6073
2014-09-07 21:53:32 +02:00
Daniel Marjamäki
db929ffd19
Fixed CID 1037074. Useless null pointer check. Created ticket #6144 .
2014-09-07 13:50:55 +02:00
PKEuS
301b668eb5
Fixed internal warning of cppcheck
2014-09-07 11:47:40 +02:00
PKEuS
ff4fc6a234
New check: Recommend expm1, log1p, erfc ( #5392 )
2014-09-07 11:38:49 +02:00
Daniel Marjamäki
7142edf03e
Improved fix for Cppcheck warning. Remove useless conditions instead of adding a new one.
2014-09-07 09:56:07 +02:00
PKEuS
605fb9039a
Merge pull request #391 from Dmitry-Me/resolveIssue1037098
...
Resolve CID 1037098
2014-09-06 23:17:52 +02:00
PKEuS
117e45f8af
Merge pull request #395 from Dmitry-Me/fixBufferOverrun
...
Fix potential buffer overrun
2014-09-06 23:03:02 +02:00
PKEuS
4859b55ce6
Merge pull request #422 from simartin/ticket_6023
...
Ticket #6023 : Properly handle template'd default template parameter values
2014-09-06 22:55:45 +02:00
Alexander Mai
e4d0435976
Merge branch 'master' of https://github.com/danmar/cppcheck
2014-09-06 22:27:38 +02:00
Alexander Mai
6b26b6ed31
Fix read access to uninitialized variable
2014-09-06 22:27:13 +02:00
Simon Martin
6e10603227
Ticket #6023 : Properly handle template'd default template parameter values.
2014-09-06 20:39:04 +02:00
PKEuS
35b00a5e05
Support rValue references in typedef ( #1823 )
2014-09-06 19:00:26 +02:00
Alexander Mai
efab840b50
#5230 Explicit reinterpret_cast should not give a warning. Lower all invalidPointerCast messages to 'portability'
2014-09-06 13:09:02 +02:00
Alexander Mai
29b46cb505
#6132 crash: daca: kvirc CheckOther::checkRedundantAssignment()
2014-09-05 20:03:34 +02:00
Martin Ettl
8a15486370
Fixed CID-1234716: Dereference after null check in lib/checkio.cpp
2014-09-01 09:00:05 +02:00
PKEuS
e8f7279039
Refactorization: Moved detection of STL strings to SymbolDatabase
2014-09-05 12:03:08 +02:00
PKEuS
4940da06c0
Calculate checksum only if necessary ( #6129 )
2014-09-05 11:05:21 +02:00
Simon Martin
eeeb816db9
Ticket #6103 : Simplify "new (type)" constructs into "new type" to avoid confusion upon certain input.
2014-09-05 08:02:18 +02:00
PKEuS
8c24553229
Support inherited member variables in setVarId ( #4101 )
2014-09-04 22:22:09 +02:00
Alexander Mai
5a96413220
#6127 crash on patch(?)-".c" file. Avoid segfault.
2014-09-04 21:28:18 +02:00
Alexander Mai
65f599bd9e
Fix version number macros
2014-09-04 21:18:15 +02:00
Daniel Marjamäki
b3e4abd82a
Fixed Cppcheck warnings
2014-09-04 18:08:56 +02:00
Daniel Marjamäki
05617d7285
Fixed #6118 (False positive: divide by zero - if condition not evaluated properly)
2014-09-04 17:52:14 +02:00
PKEuS
800b57d87e
Merge pull request #415 from Dmitry-Me/reducePatternsDuplication
...
Reduce patterns duplication
2014-09-04 07:46:59 +02:00
PKEuS
5d0aa15002
Merge pull request #416 from Dmitry-Me/removeDuplicateChecks
...
Remove duplicate checks
2014-09-04 07:46:45 +02:00
PKEuS
e4a81f9666
Improved checksum algorithm to fix configurations being purged by coincidence ( #6126 ):
...
- Better distribution of values by rotating the bits of the checksum for each token
2014-09-03 23:10:38 +02:00
Alexander Mai
270f59e76a
Fix doxygen warning and astyle formatting
2014-09-03 20:38:41 +02:00
Dmitry-Me
68d650e9ac
Remove duplicate checks
2014-09-03 14:17:34 +04:00
PKEuS
6d27ca6c9a
Fixed SymbolDatabase if unnamed struct is casted and returned ( #6125 )
2014-09-03 11:15:05 +02:00
PKEuS
bf2f76e70c
Detect and purge duplicate configurations by calculating a checksum.
2014-09-02 22:35:52 +02:00
Alexander Mai
a632f68345
#6122 segmentation fault (invalid code) in in valueFlowForLoop2. Simple fix and testcase.
2014-09-02 19:41:50 +02:00
Alexander Mai
45dc4ca6be
Fix compiler warning. Re-order if-expression for performance reasons
2014-09-02 19:18:30 +02:00
Dmitry-Me
46d24c7bfb
Reduce patterns duplication
2014-09-02 19:51:22 +04:00
Dmitry-Me
7342a81ea7
Minor refactorings. rename token. cleanup if/else.
2014-09-02 16:10:51 +02:00
PKEuS
a52401cf1b
Fixed some compiler warning about signed/unsigned conversions.
2014-09-02 11:44:51 +02:00
PKEuS
3e65cb446e
Remove "auto" keyword (storage class specifier) from C++03 and C code ( #4990 ).
2014-09-02 11:21:47 +02:00
PKEuS
2d608890a5
Improved message 'mismatchSize' ( #4167 )
2014-09-02 09:38:40 +02:00
PKEuS
ddc19febb5
Merge pull request #413 from Dmitry-Me/improveCStyleCastsDetection
...
Improve C style casts detection
2014-09-02 08:07:53 +02:00
PKEuS
428f7a6f26
Attempt to fix crashs on clang test suite.
2014-09-01 23:29:15 +02:00
PKEuS
00044aabb0
Handle ternary operator in redundantAssignment check ( #5964 )
2014-09-01 23:16:52 +02:00
Alexander Mai
a4ff30301a
#5805 'Passing value -1.0 to sqrt() leads to undefined result' is incorrect. Degrade wrongmathcall from error to warning, since it deals with implementation-defined behaviour
2014-09-01 19:31:32 +02:00
PKEuS
80df3dc642
Disabled several checks and simplifications for C code, if they are C++-only. Do not match arguments for C code, since there can't be overloads.
2014-09-01 18:43:24 +02:00
amai2012
9bc0e3afd6
Merge pull request #412 from Dmitry-Me/moveChecksEarlier
...
Move cheap checks earlier to avoid more expensive ones
2014-09-01 17:49:45 +02:00
Dmitry-Me
f937dde1e0
Improve C style casts detection
2014-09-01 16:40:28 +04:00
PKEuS
0995b85c09
Attempt to fix crashs when self-checking cppcheck introduced by previous commit
2014-09-01 14:12:43 +02:00
PKEuS
40e5dab9dc
Refactorization in checkmemoryleak.cpp:
...
- Use Library to detect noreturn/notnoreturn functions
- Removed realloc from std.cfg as long as there is no proper way to configure such functions
2014-09-01 13:54:33 +02:00
PKEuS
c92230dfee
Fixed crash on garbage code introduced by recent commit.
2014-09-01 12:41:30 +02:00
PKEuS
20a066bb14
Run unreachableCode checking only on executable scopes ( #5789 )
2014-09-01 11:29:39 +02:00
PKEuS
b5e064e737
Fixed unreachableCode message if a lambda is returned ( #6008 ).
2014-09-01 11:10:42 +02:00
Dmitry-Me
a6219adc9b
Move cheap checks earlier to avoid more expensive ones
2014-09-01 12:52:27 +04:00
PKEuS
353a9e9a64
Bailout for duplicateBranch check if branches are empty ( #5354 )
2014-09-01 10:19:14 +02:00
PKEuS
e35329aba3
Fixed reporting of unmatched suppressions for unusedFunction ( #4946 )
2014-09-01 10:13:03 +02:00
PKEuS
47764321f2
Several fixes to invalidScanfFormatWidthError():
...
- Different IDs for different messages (#5809 )
- severity is warning, not style, so check _settings->isEnabled() properly
- Removed never shown message text
2014-09-01 09:33:58 +02:00
amai2012
d1d3c24f3e
Merge pull request #411 from Dmitry-Me/moveDeclarationsCloserToWhereTheyreNeeded
...
Move declarations closer to where they're first used
2014-09-01 08:48:46 +02:00
PKEuS
59cccb83ce
Reimplemented version.h:
...
- Use macros to form version number and string. CPPCHECK_MAJOR, CPPCHECK_MINOR and CPPCHECK_DEVMINOR now contain the parts of the version number.
- "dev" status is now detected by comparison of CPPCHECK_MINOR and CPPCHECK_DEVMINOR, version string created accordingly.
Fixed two comments.
2014-09-01 08:48:25 +02:00
Dmitry-Me
9199dde560
Move declarations closer to where they're first used
2014-09-01 10:05:59 +04:00
PKEuS
288c94a47f
Extended Message "fflushOnInputStream" to files opened for reading.
2014-08-31 21:03:33 +02:00
PKEuS
b07f61170d
Changed severity of fflushOnInputStream to portability: The behaviour of fflush(stdin) is defined on Linux.
2014-08-31 20:56:05 +02:00
PKEuS
e1bc5f5248
Fixed false positive #4788 (break; in BOOST_FOREACH)
2014-08-31 20:40:52 +02:00
PKEuS
8722bba52a
Fixed false positive #4648
2014-08-31 20:33:27 +02:00
PKEuS
3ccdae78ba
Support __declspec(property) ( #4700 )
2014-08-31 20:17:18 +02:00
PKEuS
b8918906e6
Fixed false positive #5466
2014-08-31 19:46:30 +02:00
PKEuS
8f4662de92
No unused variable messages about std::unique_ptr|shared_ptr|auto_ptr ( #4355 )
2014-08-31 19:18:02 +02:00
PKEuS
78932094c8
Fixed crash on garbage code #6106
2014-08-31 12:12:03 +02:00
PKEuS
9733a751ec
SymbolDatabase: Several small refactorizations
2014-08-31 11:27:32 +02:00
PKEuS
862b18e0e2
SymbolDatabase: New scope type eLambda
2014-08-31 10:21:27 +02:00
Daniel Marjamäki
97005d7d87
remove redundant declaration of isSameExpression. fixes gcc compiler warning.
2014-08-30 19:23:31 +02:00
Dmitry-Me
eace67ee1c
Use logical instead of bitwise operators to save cpu
2014-08-30 11:35:25 +02:00
PKEuS
e9fdfc6cd0
Fix on checking side for #6099
2014-08-30 11:18:48 +02:00
Daniel Marjamäki
3ac5f16668
Makefile: generate new Makefile with dmake
2014-08-29 18:32:50 +02:00
PKEuS
06a92e8981
Moved several condition checks from checkOther to checkCondition (former checkAssignIf)
2014-08-29 17:06:46 +02:00
Daniel Marjamäki
eeeb8aa0a7
ValueFlow: Fix crash for lambda function
2014-08-27 17:27:34 +02:00
Daniel Marjamäki
2dc3945017
astyle formatting
2014-08-27 17:27:14 +02:00
Daniel Marjamäki
ae8a20b197
Fixed #6086 (False positive: valueFlow, conditional code returns)
2014-08-27 16:59:18 +02:00
amai2012
c242faf45e
Merge pull request #408 from Dmitry-Me/continueEarlyToOmitUnneededActions2
...
Continue early to omit unneeded operations
2014-08-27 16:36:19 +02:00
Matthias Krüger
cd33d784d5
run dmake
2014-08-27 09:45:50 +02:00
PKEuS
eba8c6f6c5
Refactorization:
...
- Added missing separating comments between checks in checkother.cpp
- Moved checks related to strings into own file
2014-08-27 09:42:09 +02:00
Dmitry-Me
44ba0ca347
Continue early to omit unneeded operations
2014-08-27 11:32:14 +04:00
Daniel Marjamäki
23ec9fea8e
Fixed #6024 (False positive (nullPointer) using in 1.66)
2014-08-26 18:48:11 +02:00
PKEuS
6a4319f050
Improved simplifications:
...
- Rearranged their order to solve problems with typedefs. If we simplify chained declarations before typedef parsing, we have less complex expressions to deal with (#4777 ).
- Fixed detection of variables hiding enums
2014-08-26 15:21:19 +02:00
PKEuS
a8dc17c1d9
Fixed false positive #5566 .
2014-08-26 11:29:26 +02:00
PKEuS
5e2ea8b6cd
Fixed crash #6089 by using information stored in Variable instead of accessing Variable::nameToken
2014-08-26 11:08:21 +02:00
PKEuS
c15ead7855
Merge pull request #406 from Dmitry-Me/removeCodeDuplicationCleanupVariableNames
...
Reduce code duplication, cleanup variable names
2014-08-26 10:42:22 +02:00
PKEuS
2326e78381
Fixed #6058 : Don't detect class with unknown macro as variable.
...
Commented out crashing unit test tokenize33() in VS12
2014-08-26 10:40:00 +02:00
amai2012
e02741c82c
#5780 Crash on template code below Tokenizer::setVarId(). Fix several crashes with same location.
2014-08-26 09:12:10 +02:00
Daniel Marjamäki
cd75b2d83d
AST: fix hang for code 'MACRO({.x=1,.y=2})'
2014-08-25 19:10:16 +02:00
Dmitry-Me
d72b98bbaa
Reduce code duplication, cleanup variable names
2014-08-25 11:49:17 +04:00
Dmitry-Me
67ea470275
Break loop early, cleanup declarations
2014-08-24 20:17:41 +02:00
Daniel Marjamäki
789b01aad2
ValueFlow: fixed one more hang in valueFlowForward
2014-08-24 08:50:01 +02:00
Daniel Marjamäki
1060b30e52
AST: better AST for placement new expression 'new (a) MyClass;'
2014-08-23 13:21:36 +02:00
PKEuS
0dc4b75565
Fixed crash on invalid code #6080
2014-08-23 12:36:42 +02:00
PKEuS
7f2be2f57c
Fixed template bracket linkage in while loop simplification
...
Ran AStyle
2014-08-23 12:28:54 +02:00
amai2012
976966fe81
#5639 String literal compared with char buffer in a struct.
2014-08-23 09:41:40 +02:00
PKEuS
f01d7543f6
#6077 : Don't warn about memcpy/memmove on class containing floats.
2014-08-20 15:12:53 +02:00
PKEuS
c678937538
Fixed more false positives of #6056 :
...
- Implemented nextArgument() for usages before < and > are linked
- slightly optimized nextArgument()
2014-08-20 15:02:52 +02:00
PKEuS
8188578cf2
SymbolDatabase: Fixed handling of nested types for function arguments
...
Removed unnecessary loops between var->typeStartToken() and var->typeEndToken()
2014-08-19 11:55:00 +02:00
PKEuS
69b7f91034
Support :: in some more places
2014-08-19 11:36:32 +02:00
PKEuS
5d50e7e9ae
Changed heuristics to detect variable constructor initialization syntax ( #6071 )
2014-08-19 11:06:52 +02:00
PKEuS
96c5983409
Merge pull request #404 from Dmitry-Me/continueEarlyToOmitUnneededActions
...
Continue early to omit unneeded actions
2014-08-19 09:45:54 +02:00
Daniel Marjamäki
b6355b991f
Fixed #6070 (false positive: Array 'array[8192]' accessed at index 8192, which is out of bounds)
2014-08-19 07:03:00 +02:00
Dmitry-Me
93b5b28c3d
Continue early to omit unneeded actions
2014-08-19 07:58:45 +04:00
PKEuS
eac2d58c9e
Fixed fix for #6056
2014-08-18 20:40:43 +02:00
PKEuS
49bafa10a0
Merge pull request #402 from Dmitry-Me/emiminateDuplicateStatements
...
Remove duplicate return statements.
2014-08-18 18:39:46 +02:00
Daniel Marjamäki
b2288e5ada
Fixed #6022 (Defect: False positive due to bug in determining bounds of for loop 'for (i = 2; i < 1; ++i)')
2014-08-18 16:45:22 +02:00
Dmitry-Me
443e846b2e
Remove duplicate return statements.
2014-08-18 16:02:35 +04:00
Dmitry-Me
a386fbb665
Avoid mutually exclusive checks
2014-08-18 14:30:52 +04:00
Dmitry-Me
120e8c0674
Make loop termination more explicit.
2014-08-18 14:00:25 +04:00
PKEuS
5483c8ed5e
Removed obsolete function from checkNullPointer
2014-08-18 11:42:50 +02:00
PKEuS
e7754be316
Fixed #6056 - properly detect member functions in setVarId()
2014-08-18 11:07:56 +02:00
PKEuS
a69860eb70
Fixed false positive #6066 : va_list may be used after being copied.
2014-08-18 10:40:39 +02:00
PKEuS
5c54f8d0d8
Support namespaces and static member variables in setVarId (only one depth) ( #6061 )
2014-08-18 10:25:30 +02:00
PKEuS
0bf7b03f96
Refactorization: Support :: in some places in checkother.cpp
2014-08-18 10:25:30 +02:00
PKEuS
df080ab5c3
Refactorization in valueflow.cpp: Removed redundant loop, rearranged code.
2014-08-18 10:25:30 +02:00
Daniel Marjamäki
d44d6ad94a
incorrect logic operator: fixed crashes
2014-08-18 05:37:07 +02:00
Alexander Mai
66d767b4b5
#6050 arithmetic on void** - fix false positive
2014-08-17 19:14:55 +02:00
Daniel Marjamäki
a52c122229
Tokenizer::createLinks2: set no template-links in 'if (a < b || c > d)'
2014-08-17 19:03:06 +02:00
Daniel Marjamäki
ebc0b6cd44
astIsFloat: Fix crash when there is no second operand for '.'
2014-08-17 14:28:31 +02:00
Daniel Marjamäki
f7f44f24c7
Fixed #5132 (False negative: incorrectLogicOperator in simple if-clause)
2014-08-17 14:04:40 +02:00
Daniel Marjamäki
5cdbe0f42d
ValueFlow: Improved value flow after for loop
2014-08-17 10:40:22 +02:00
Daniel Marjamäki
75ec97ad23
Tokenizer::simplifyKnownVariables: Fixed bad simplification in for loop header
2014-08-17 07:39:42 +02:00
Daniel Marjamäki
7ca742c454
Fixed #5062 (ValueFlow: Handle comma operator in abstract interpretation)
2014-08-17 06:42:16 +02:00
Daniel Marjamäki
65f10edcb6
Fixed #5866 (False negative: useless condition or null pointer dereference (null object after while loop, method))
2014-08-16 18:32:25 +02:00
Daniel Marjamäki
76510e0006
null pointer: perform proper null pointer checking when no --enable=warning is given.
2014-08-16 12:48:20 +02:00
Dmitry-Me
e91a63c834
Resolve CID 1037101. break after loop if tok is null because tok is dereferenced below. Ticket: #6055
2014-08-15 18:39:15 +02:00
Daniel Marjamäki
364c975701
Fixed #5557 (astIsFloat: better handling of '.')
2014-08-15 16:48:53 +02:00
Dmitry-Me
7e442cf75d
Some safe coding. Check that pointer is not null.
2014-08-14 16:10:12 +02:00
Daniel Marjamäki
543589564d
Merge pull request #394 from Dmitry-Me/resolve1132030
...
Resolve CID 1132030
2014-08-14 13:28:59 +02:00
Daniel Marjamäki
6db3eabadb
Merge pull request #393 from Dmitry-Me/furtherResolve1222223
...
Further resolve CID 1222223
2014-08-14 09:54:13 +02:00
Daniel Marjamäki
b8e356462a
Dead pointer: Fixed FP for subfunction pointer argument
2014-08-14 06:47:19 +02:00
Daniel Marjamäki
e83f08a825
Fixed #6044 (hang: darkplaces / cl_particles.c)
2014-08-14 06:13:42 +02:00
Daniel Marjamäki
f0cb6ef33d
Change fix for hang so there won't be FP
2014-08-13 05:36:17 +02:00
Daniel Marjamäki
bdfe43d82c
Fix hang in libdmtx package. found through daca2.
2014-08-13 04:03:17 +02:00
Dmitry-Me
406239dfc7
Fix potential buffer overrun
2014-08-12 17:44:20 +04:00
Dmitry-Me
b022afae75
Resolve CID 1132030
2014-08-12 13:04:32 +04:00
Dmitry-Me
0991d42cb9
Further resolve CID 1222223
2014-08-12 11:14:28 +04:00
Dmitry-Me
fd9009c494
Resolve CID 1037098
2014-08-12 10:02:54 +04:00
Daniel Marjamäki
970fda9e79
ValueFlow: Fixed nullpointer FP warning in checksizeof
2014-08-11 16:21:20 +02:00
PKEuS
5d302716e7
Refactorized Variable::isIntegralType() and Variable::isFloatType():
...
- Cached property
- Make use of it in several checks
- float* is flagged as floating point type
2014-08-09 11:45:13 +02:00
PKEuS
2d06786c3f
Merge pull request #388 from Dmitry-Me/resolveIssue1037100
...
Resolve CID 1037100: possible dereference of _errorLogger nullpointer
2014-08-09 10:35:18 +02:00
PKEuS
728d0fb9dc
Merge pull request #390 from Dmitry-Me/suppressGccShadowingWarning
...
Avoid GCC name shadowing warning.
2014-08-09 10:34:36 +02:00
PKEuS
865df4e207
Fixed false negative #4306 : Detect loop access of empty STL container
2014-08-09 10:06:44 +02:00
PKEuS
5ddee75b5d
Removed newline from divideBySizeofError message
2014-08-08 09:59:55 +02:00
PKEuS
5c238692e6
New check: Division by sizeof() as parameter to memset/memcpy/memmove/etc. as they expect a size in bytes ( #5698 )
...
Refactorizations in sizeof checking:
- Changed severity of sizeofwithsilentarraypointer to warning
- Made pointerSize message conclusive - there seems to be no reason for inconclusive
2014-08-08 09:49:09 +02:00
PKEuS
c4635cf698
Improved check: portability message when calling memset on a class with floating point numbers ( #5421 )
2014-08-08 09:49:09 +02:00
PKEuS
a1b7ab277b
Changed handling of unhandled characters:
...
- Don't abort checking (reverts 42140b6488
)
- Modified error message: New Id unhandledCharacter, removed redundant line information, improved message text
2014-08-08 09:49:09 +02:00
PKEuS
56ba4b6a92
Fixed crash if va_start is passed less arguments than expected
2014-08-06 20:53:13 +02:00
PKEuS
076c1bd06c
Fixed crash in CheckVaarg::va_start_argument ( #6032 )
2014-08-06 19:35:09 +02:00
PKEuS
b708022e97
Fixed cppcheck message
2014-08-06 14:31:09 +02:00
PKEuS
639f1fa85a
Fixed another variable shadowing warning.
2014-08-06 14:27:03 +02:00
Matthias Krüger
b5cf56790c
dmake: update
2014-08-06 14:25:49 +02:00
PKEuS
5f7b4ad0ae
Added several new va_arg related checks:
...
- Wrong parameter passed to va_start() (#3850 )
- Reference passed to va_start() (#3849 )
- Missing va_end() (#3295 )
- Using va_list before it is opened (#3295 )
- Subsequent calls to va_start/va_copy()
2014-08-06 14:20:46 +02:00
PKEuS
e4b55cf843
Fixed a bug and two warnings introduced recently.
2014-08-06 13:35:39 +02:00
Dmitry-Me
3ec821df34
Avoid GCC name shadowing warning.
2014-08-06 15:35:04 +04:00
PKEuS
c3577bc8dd
Fixed crash, simplified code in testassert.cpp
2014-08-06 12:24:21 +02:00
PKEuS
d3a567bf96
Fixed false positive #5824 : Variables that might be used for va_start() must not be passed by reference.
2014-08-06 12:06:36 +02:00
PKEuS
adcc8b1634
Implement support for __attribute__((used)) ( #3408 )
2014-08-06 11:13:58 +02:00
PKEuS
8da61ab71a
Refactorized CheckAssert::assertWithSideEffects():
...
- Removed crap
- Error message on calling non-const member function in assert()
- Fixed false positive #5311 and TODO_ASSERT
2014-08-06 10:15:48 +02:00
Dmitry-Me
51fab1f9f1
Resolve CID 1037100
2014-08-06 11:20:04 +04:00
PKEuS
fd5ff1bb8b
Fixed false positive #6030 : inheriting classes is not a variable declaration.
2014-08-06 09:04:03 +02:00
PKEuS
e7605d6f77
Merge pull request #387 from Dmitry-Me/resolveIssue1037105
...
Resolve CID 1037105
2014-08-06 08:42:01 +02:00
PKEuS
83a80cebeb
Fixed order of simplifications ( #6029 )
2014-08-06 08:39:23 +02:00
Dmitry-Me
644d83e91b
Resolve CID 1037105
2014-08-06 10:05:32 +04:00
Daniel Marjamäki
8bbbb54f94
Refactoring valueFlowSubFunction
2014-08-06 06:33:06 +02:00
Moshe Kaplan
4894d3807d
Improved invalidScanf error message
2014-08-06 06:08:28 +02:00
Daniel Marjamäki
f2fdc4fb14
Merge pull request #385 from Dmitry-Me/resolveIssue1222223
...
Resolve CID 1222223.
2014-08-05 17:48:04 +02:00
PKEuS
8130fda4ae
Implemented support for C++11 uniform initialization in several checks.
2014-08-05 16:11:42 +02:00
PKEuS
f3e0df7501
Support C++11 style initialization with {}:
...
-> Support in setVarId and SymbolDatabase (#4344 )
-> Fixed false positives in unused variable checking (#5491 , #5494 )
Side-effect: Support global variables initialized with brackets (C++03 style) in SymbolDatabase
2014-08-05 15:33:57 +02:00
PKEuS
4207b3cb66
Fixed error message.
2014-08-05 11:59:53 +02:00
PKEuS
804e055eee
New check: initialization by itself in initializer list ( #3982 )
...
Refactorizations:
- Rearranged code in checkclass.cpp to increase readability
- Several fixes for testclass.cpp tests.
2014-08-05 11:50:08 +02:00
Daniel Marjamäki
9eb28cb8af
ValueFlow: Improved analysis of assignments
2014-08-05 08:28:46 +02:00
Daniel Marjamäki
a2f776b1b7
Dead pointer: Added checking for dead pointer usage when pointer alias local variable that has gone out of scope.
2014-08-05 06:24:23 +02:00
Daniel Marjamäki
eac337b955
Fixed Cppcheck warning about 'null pointer dereference or redundant condition'
2014-08-04 15:15:41 +02:00
Daniel Marjamäki
d35ce5f0db
ValueFlow: Better handling of calculated function arguments in valueFlowSubFunction
2014-08-04 12:31:04 +02:00
Daniel Marjamäki
344016f7ab
ValueFlow: Handle string values in valueFlowSubFunction
2014-08-04 12:13:15 +02:00
PKEuS
ac59485e7e
Refactorized CheckAutoVariables::assignFunctionArg():
...
- Splitted message into style message (assigning non-pointers) and warning message (assigning pointers)
- Support operator++/-- (#4793 )
2014-08-04 11:45:24 +02:00
PKEuS
4a3d719386
Fixed recently introduced FP when C-Style casting nullpointers
2014-08-04 11:42:14 +02:00
PKEuS
4c80ca4e8e
Improved cstyleCast check:
...
- Detect casting of literals
- Check initializer lists (#3630 )
2014-08-04 11:21:25 +02:00
Daniel Marjamäki
47a2b35e98
BufferOverrun: Use ValueFlow string values more
2014-08-04 08:25:10 +02:00
Dmitry-Me
8cd6e490d9
Resolve CID 1222223.
2014-08-04 10:00:53 +04:00
Daniel Marjamäki
ab958e7710
Fixed Cppcheck warning
2014-08-04 06:30:20 +02:00
Daniel Marjamäki
79fc549de0
ValueFlow: start adding valueflow handling of strings and pointer aliases
2014-08-03 20:11:22 +02:00
PKEuS
57c055fcc4
Fixed false negative #5985 : default argument values should not affect variable usage checking.
2014-08-03 19:13:37 +02:00
PKEuS
de66ed4071
Added missing message to --errorlist output, changed Id to avoid duplicate
2014-08-02 20:55:59 +02:00
PKEuS
6d5603af45
Increased version to 1.66.99/1.67 dev
2014-08-02 18:07:01 +02:00
Daniel Marjamäki
1c8c26a488
1.66: Set version
2014-08-02 11:58:30 +02:00
PKEuS
e486e8cc62
Updated WiX installer and VS solution to VS12 and Qt5
2014-08-02 11:52:37 +02:00
PKEuS
6d3cb86d2a
Merge pull request #382 from Dmitry-Me/bringDeclarationsCloserToWhereTheyAreNeeded
...
Bring variable declarations closer to where they're first used.
2014-08-02 11:12:34 +02:00
Daniel Marjamäki
f2e3700142
Merge pull request #383 from moshekaplan/patch-1
...
Updated message for strncat usage
2014-08-02 11:10:16 +02:00
Daniel Marjamäki
7237b01979
Fixed Cppcheck warning
2014-08-02 10:07:23 +02:00
Daniel Marjamäki
4dc73e3a5b
Use Token::simpleMatch for simple pattern
2014-08-01 17:47:02 +02:00
Daniel Marjamäki
3f5da22d2b
Tokenizer: Added FIXME for keywords handling
2014-08-01 17:27:35 +02:00
Daniel Marjamäki
a943a0739a
Tokenizer: Don't remove struct member in Tokenizer::simplifyKeyword()
2014-08-01 17:19:08 +02:00
Daniel Marjamäki
f908959196
ValueFlow: improved analysis in for loops to avoid fp
2014-08-01 16:12:57 +02:00
Daniel Marjamäki
544a5957e1
Token: Added utility function getStrSize as a complement to getStrLength
2014-08-01 13:12:18 +02:00
Daniel Marjamäki
404c13ef4b
Fixed ValueFlow --debug output
2014-08-01 09:50:30 +02:00
Daniel Marjamäki
688b798b88
ValueFlow: Cleanup variable
2014-08-01 08:59:07 +02:00
Daniel Marjamäki
57c2e928d1
ValueFlow: Simple multivariable control flow analysis to avoid FP when 'control variable' is used
2014-08-01 07:35:15 +02:00
PKEuS
95afa51b24
Fixed crash #5991 : Don't crash when lambda is incomplete
...
Fixed crash #6004 : Support struct initializations in AST
2014-07-31 23:15:36 +02:00
Moshe Kaplan
e881495eaf
Updated message for strncat usage
2014-07-31 13:51:29 -04:00
Daniel Marjamäki
5de1e35350
CheckBufferOverrun: Fixed minsize checking of string literals. Check sizeof string instead of strlen.
2014-07-30 20:35:21 +02:00
Daniel Marjamäki
25846cf223
ValueFlow: Fix for if/else valueflow analysis
2014-07-30 18:12:33 +02:00
Daniel Marjamäki
473b1bdb2b
Multicondition: Fixed FP when using dynamic_cast
2014-07-30 11:23:09 +02:00
Dmitry-Me
ee180787eb
Bring variable declarations closer to where they're first used.
2014-07-29 13:59:45 +04:00
Daniel Marjamäki
905a383ac2
Merge pull request #381 from Dmitry-Me/checkBooleanFlagFirst
...
Run cheaper check first, don't check the same condition twice.
2014-07-28 18:02:49 +02:00
Daniel Marjamäki
8a1c5d6fce
Fixed #6011 (crash: libreoffice/binfilter svt_enhwmf.cxx)
2014-07-28 16:33:42 +02:00
Daniel Marjamäki
fdfea717c6
Suspicious string comparison: Refactoring using AST. Fixed FP in Lac.
2014-07-28 14:27:35 +02:00
Dmitry-Me
dc03b98e60
Run cheaper check first, don't check the same condition twice.
2014-07-28 14:58:19 +04:00
Robert Reif
90bc59e0fa
Fixed #6009 (Detect type mismatch in printf-like function when type is returned)
2014-07-28 09:16:35 +02:00
Daniel Marjamäki
76020d2ad0
astIsFloat: expression 'floatvar ? 0x40 : 0' is not float
2014-07-26 09:09:58 +02:00
Dmitry-Me
431453f53e
Reuse previously computed values, use more const.
2014-07-25 15:05:13 +04:00
Daniel Marjamäki
216ecd06e1
Fix Cppcheck warning. Make function Preprocessor::readpreprocessor static instead of const.
2014-07-25 12:43:55 +02:00
Dmitry-Me
f104aa237f
Bring declarations closer to where they're needed.
2014-07-24 18:34:13 +04:00
Dmitry-Me
a4d597451b
Resolve CID 1214637.
2014-07-24 16:54:20 +04:00
Dmitry-Me
615eb32fdc
Use temp variables to avoid repeated actions in code.
2014-07-23 18:51:23 +04:00
Dmitry-Me
07c120f1af
Cache option flags and check them first.
2014-07-23 17:06:27 +04:00
Daniel Marjamäki
2e60f30bfc
Merge pull request #372 from Dmitry-Me/dontUseArrayAtWhenItWouldntThrow
...
Use [], not at() when the index is guaranteed to be valid.
2014-07-23 14:15:42 +02:00
Daniel Marjamäki
c5e9da2984
xml dump: add more token attributes
2014-07-21 12:44:53 +02:00
Dmitry-Me
cd13232062
Use [], not at() when the index is guaranteed to be valid.
2014-07-21 10:37:08 +04:00
Daniel Marjamäki
5ae6234729
Fixed #5978 (false positive: Array 'm_pool_vector[-1]' accessed at index 0, which is out of bounds.)
2014-07-20 11:44:25 +02:00
Daniel Marjamäki
1e5eab8f17
xml dump: Added function attribute in scope
2014-07-20 11:44:01 +02:00
Daniel Marjamäki
328cc7b8f5
Fixed #5996 (false positive: Clarify calculation precedence for '+' and '?'.)
2014-07-19 18:29:53 +02:00
Daniel Marjamäki
af2b94e322
Fixed #5826 (Change error message for 'throw in destructor' check)
2014-07-19 03:29:50 +02:00
Daniel Marjamäki
c252885bf8
Merge pull request #369 from Dmitry-Me/useBoolFlagToAvoidComparisonDuplication
...
Use boolean flag to avoid comparison duplication
2014-07-18 18:11:53 +02:00
Daniel Marjamäki
2cc31acabb
Fixed #5922 (FP: passedByValue for std::string::value_type)
2014-07-18 15:51:59 +02:00
Dmitry-Me
fae9d975cf
Use boolean flag to avoid comparison duplication
2014-07-18 13:31:31 +04:00
Daniel Marjamäki
946c139043
Merge pull request #367 from Dmitry-Me/fixVariableCapitalization
...
Fix variable capitalization.
2014-07-18 11:15:17 +02:00
Alexander Mai
55e45add4a
Fix compiler warnings
2014-07-17 20:04:56 +02:00
Dmitry-Me
f995f67a11
Fix variable capitalization.
2014-07-17 12:38:09 +04:00
Daniel Marjamäki
425e7527bb
Merge pull request #366 from Dmitry-Me/useTempVariableToOmitRecomputation
...
Use temp variable to omit recomputing the same value.
2014-07-17 10:27:47 +02:00
PKEuS
8c96cc59c9
Fixed false positive #5976 : Properly handle shift from stream.
2014-07-17 10:03:58 +02:00
Daniel Marjamäki
15bb447fdc
Fixed #5965 (False positive zerodiv - loop iterating over double variable)
2014-07-17 08:44:55 +02:00
Dmitry-Me
c829dff2b9
Use temp variable to omit recomputing the same value.
2014-07-17 10:44:19 +04:00
Daniel Marjamäki
b1e5b015df
xml dump: output some more info in the dump
2014-07-16 15:27:13 +02:00
Daniel Marjamäki
51c2245a07
Merge pull request #364 from Dmitry-Me/tempVariablesAndBetterNames
...
Shorten code by using temp variables, cleanup variable names.
2014-07-16 15:22:11 +02:00
Dmitry-Me
13234a7366
Shorten code by using temp variables, cleanup variable names.
2014-07-14 12:20:00 +04:00
Dmitry-Me
2989f70898
Get rid of tokAt() and strAt() in trivial cases.
2014-07-14 11:44:58 +04:00
Daniel Marjamäki
954400a382
Add simple xml debug output. When both --xml and --debug is used there will be xml debug output.
2014-07-13 17:21:45 +02:00
orbitcowboy
af6f21308f
Tokenizer: Added missing comma in string array initialization (This fixes Coverity-ID: 1226263 Missing comma in a string array initialization).
2014-07-12 12:52:49 +02:00
orbitcowboy
6e5a05104b
Fixed copy and paste error (Coverity-ID: 1226262 Copy-paste error).
2014-07-12 12:48:05 +02:00
Daniel Marjamäki
5bdd197b01
Fixed #5981 (FP: nullPointer on repeated switch)
2014-07-16 09:12:56 +02:00
Daniel Marjamäki
d41ef3a6d0
TemplateSimplifier: Fixed crash caused by null pointer dereference. I don't have a testcase. But the code is suspicious, in the loop we check if tok3 is null and then in the loop head we call tok3->next().
2014-07-15 21:28:52 +02:00
Daniel Marjamäki
c531749d7a
ValueFlow: Small cleanups
2014-07-15 10:36:13 +02:00
Daniel Marjamäki
b6a9c53826
xml dump: fixed some bad xml output in the token list dump
2014-07-14 19:49:31 +02:00
Daniel Marjamäki
2f7b8fe4b2
xml dump: fixed some minor issues in symboldatabase dump
2014-07-14 19:25:30 +02:00
Daniel Marjamäki
84ec573d0a
xml dump: Fixed segfault when dumping symboldatabase variables
2014-07-14 19:17:39 +02:00
Daniel Marjamäki
6732556eb8
xml dump: output a <variables> with all variables
2014-07-14 18:35:15 +02:00
Daniel Marjamäki
2e7a72856a
xml dump: remove duplicate attribute
2014-07-14 18:13:27 +02:00
Daniel Marjamäki
8db5836e3f
Fixed #5982 (Add xml dump)
2014-07-14 15:51:45 +02:00
Daniel Marjamäki
bf5b4d9ece
astyle formatting
...
[ci skip]
2014-07-14 14:38:40 +02:00
Dmitry-Me
9829e0b48a
Clearer variable names, fix typo in comment.
2014-07-11 11:33:09 +04:00
Dmitry-Me
ba3757dfd3
Bring variables decalaration to where they are really needed.
2014-07-10 11:23:14 +04:00
Daniel Marjamäki
bc6a320f91
Merge pull request #359 from Dmitry-Me/useReferencesToAvoidDeepCopy
...
Use references instead of deep copying the strings
2014-07-10 08:31:09 +02:00
Daniel Marjamäki
cb9d67b9ec
Fixed #5901 (False positive: (error) Using 'memcpy' with vector of uint8_t items)
2014-07-09 15:00:06 +02:00
Dmitry-Me
d0cbfeb186
Use references instead of deep copying the strings
2014-07-09 11:21:38 +04:00
Daniel Marjamäki
7b0616786c
Merge pull request #358 from Dmitry-Me/reuseDataFromPreviousCodeAndOmitChecks2
...
Omit unnecessary checks
2014-07-09 06:45:52 +02:00
Alexander Mai
df95cd09f0
Fix compiler warnings about type mismatch
2014-07-08 21:47:22 +02:00
Daniel Marjamäki
14def42c99
Fixed #5972 (FP: Buffer is accessed out of bounds)
2014-07-08 16:31:08 +02:00
Daniel Marjamäki
254b6438b9
CheckBufferOverrun::checkStringArgument: sizeof string is strlen+1
2014-07-08 16:04:09 +02:00
Dmitry-Me
7da6ce8704
Omit unnecessary checks
2014-07-08 12:28:57 +04:00
Daniel Marjamäki
4d0189c672
CheckBufferOverrun: Fixed crash. The crash occured in ThreadHandler in the deserialize() function. Probably because " was used in error message.
2014-07-08 07:08:51 +02:00
Daniel Marjamäki
6afe9a4fbe
astyle formatting
...
[ci skip]
2014-07-08 06:44:57 +02:00
amai2012
9b38ae73c1
Attempt to fix 2 Coverity messages.
...
Replace a few unsigned int by std::size_t
2014-07-07 21:25:30 +02:00
Daniel Marjamäki
987ce5a408
Fixed #5968 (False positive: 'Possible null pointer dereference' when checking null in negated conjuction)
2014-07-07 17:48:58 +02:00
Daniel Marjamäki
26a3bdfe00
ValueFlow: Cleanup code by using SymbolDatabase provided scope info
2014-07-07 16:34:21 +02:00
Daniel Marjamäki
3169a2d215
astyle formatting
...
[ci skip]
2014-07-06 17:50:21 +02:00
amai2012
0ddd7752b5
Avoid crash reported in #5943 (using the example from duplicate ticket #5971 )
...
Replace a few size_t/unsigned int by std::size_t
2014-07-06 14:48:24 +02:00
amai2012
f1bf38004b
Fix MSVC compiler warnings
2014-07-06 13:08:22 +02:00
Daniel Marjamäki
0fd334911a
Fixed #5257 (Check memcpy size for string literals)
2014-07-06 08:41:39 +02:00
amai2012
77095e2b05
Add some more functions to posix.cfg which allow to enable TestBufferOverrun::buffer_overrun_1_posix_functions
...
Fix some compiler warnings on MSVC
2014-07-05 22:47:10 +02:00
Daniel Marjamäki
a3acc3241e
Library: Added <minsize> element used for buffer overrun checking
2014-07-05 20:31:43 +02:00
Alexander Mai
88890a851c
Fix compiler warning (and minor cleanup).
2014-07-05 12:10:23 +02:00
Dmitry-Me
4f21b31004
Use temp variables to simplify code.
2014-07-04 10:56:43 +04:00
Daniel Marjamäki
51396e52aa
Merge pull request #353 from Dmitry-Me/breakLoopEarlyInsteadOfContinuingBitwiseAnd
...
Break the loop once the result can no longer change.
2014-07-03 06:54:00 +02:00
Daniel Marjamäki
d40b77dce2
Removed special 'else if' handling. this is redundant since these are simplified.
2014-07-02 16:16:19 +02:00
PKEuS
719304a8fc
Added internal check for || and | inside Token::Match patterns.
2014-07-02 15:51:18 +02:00
PKEuS
b4f0869a71
Reduced Token::Match complexity, better support for complex patterns
2014-07-02 15:25:41 +02:00
PKEuS
817d32f791
Fixed and cleaned up Token::Match engine
2014-07-02 15:25:19 +02:00
Dmitry-Me
b38e43ebae
Negation not needed anymore.
2014-07-02 11:12:39 +04:00
Zachary D. Blair
f6523e384b
Fixed 4979 (Doesn't allow any ordering of int modifiers)
2014-07-01 23:59:04 -07:00
PKEuS
3d0ebe196b
Several improvements to CheckUnusedVar::checkFunctionVariableUsage_iterateScopes():
...
- Use AST in some places
- Fixed misusage of Token::isStandardType (fixes false negative)
- Removed some redundant conditions
2014-07-02 00:18:40 +02:00
Daniel Marjamäki
5e9e90b1c1
Fixed Token::Match pattern. In x|y|.. patterns, all %cmd% should be placed before plain-text operands.
2014-07-01 15:55:29 +02:00
Dmitry-Me
454dd0a736
Break the loop once the result can no longer change.
2014-07-01 17:16:45 +04:00
Daniel Marjamäki
b7d7633b97
ValueFlow: Improved analysis after switch
2014-06-30 17:56:42 +02:00
Daniel Marjamäki
f1762f9ed6
Fixed #5939 (fp: Possible null pointer dereference, after check against NULL in for loop)
2014-06-30 07:26:48 +02:00
Daniel Marjamäki
df799f97c5
valueFlowBefore: better analysis of conditional assignment
2014-06-30 00:02:49 +02:00
Daniel Marjamäki
4f43e4f9aa
Fixed #5959 (ValueFlow: return value from subfunction)
2014-06-29 18:04:38 +02:00
Daniel Marjamäki
893996d182
Fixed #5937 (ValueFlow: wrong analysis of calculations with different variable operands)
2014-06-29 10:57:39 +02:00
Daniel Marjamäki
41baffdda1
Fixed #5850 (Wrong Message on self assignment)
2014-06-28 15:26:22 +02:00
Daniel Marjamäki
ab08883332
Merge pull request #351 from simartin/ticket_5952
...
Ticket #5952 : Simplify redundant parentheses in pointer variable declarations
2014-06-28 12:20:27 +02:00
Daniel Marjamäki
9eaadc81e2
Fixed #5861 (valueFlowSubFunction: fp for float value)
2014-06-28 12:04:20 +02:00
Daniel Marjamäki
46479ced7e
Library: Handle FIlE_NOT_FOUND better
2014-06-28 10:22:35 +02:00
Daniel Marjamäki
6f2c8a8236
Fixed #5931 (arrayIndexOutOfBoundsCond id reported instead of arrayIndexOutOfBounds)
2014-06-28 10:09:53 +02:00
Simon Martin
7b942650c2
Ticket #5952 : Simplify redundant parentheses in pointer variable declarations.
2014-06-28 09:36:51 +02:00
Daniel Marjamäki
6c8558c112
CheckBufferOverrun: Removed old for-loop handling. This is handled through ValueFlow from now on.
2014-06-27 06:46:42 +02:00
Alexander Mai
b6a40fceb7
Fix some compiler warnings
2014-06-26 20:34:07 +02:00
Daniel Marjamäki
036b2f8ccf
CheckBufferOverrun: Added bufferOverrun2 that is based on ValueFlow/SymbolDatabase/Ast from the start. Replaced some old checking.
2014-06-26 17:36:20 +02:00
Daniel Marjamäki
72992c7973
AST: fixed ast for '++i;'
2014-06-26 17:31:57 +02:00
PKEuS
7ea7ee0005
Store Token::_originalName on heap, since it is only used for a small amount of Tokens (reduce memory usage of TokenList by ~12% (x64))
2014-06-26 11:51:02 +02:00
PKEuS
ec1bd420a7
Refactorizations optimizing std::string usage:
...
1) Added global static const std::string emptyString; object:
-> Replaces some static variables in functions which might be not threadsafe
-> Avoids constructor call (std::string::string(""))
-> Even functions that return an empty string in some branches can return by reference now.
Added to config.h to ensure that it is available everywhere
2) Added overloads for TestFixture::assertEquals for the most common use cases:
-> Moves conversion from const char[] to std::string into a function, reducing code duplication in binary.
2014-06-26 11:51:02 +02:00
PKEuS
feefa4c626
Speedup checking large amounts of arrays ( #5615 ) by avoiding Token::Match calls in CheckBufferOverrun::checkScope(2).
...
-> Decreased entire checking time on a subset of the attached file by 66% (MSVC12, x64, non-matchcompiled)
2014-06-26 11:51:02 +02:00
PKEuS
e13de2681e
SymbolDatabase: 'const' can't be the name of a variable - fix use after free #5882
2014-06-26 09:19:57 +02:00
PKEuS
e80104327a
AST: Fixed detection of operator new/delete - don't hang when C code is checked as C++ ( #5910 )
2014-06-26 09:19:57 +02:00
PKEuS
b20f87faf2
Optimized Tokenizer::simplifyPlatformTypes() once more: Another 3% improvement on Windows.
...
-> All Token::Match strings are uppercase, so check Token::isUpperCaseName() to avoid comparisons with very slow long Token::Match strings (idea from amai)
Removed duplicate Token::Match call in symboldatabase.cpp
2014-06-25 20:42:59 +02:00
PKEuS
360fd4a565
Speedup Tokenizer::simplifyMathFunctions() and Tokenizer::simplifyPlatformTypes()
...
-> Speedup on entire checking time (TortoiseSVN code) by 3% (MSVC12, x64, not matchcompiled). Probably only measurable when checking code with Windows platform.
2014-06-25 17:00:59 +02:00
Daniel Marjamäki
5af96c2dd8
Fixed #5947 (valueFlowForward: forward conditions not handled properly)
2014-06-25 16:00:56 +02:00
Daniel Marjamäki
c77786a745
valueFlowAfterCondition: wrong analysis for floats
2014-06-25 06:17:44 +02:00
PKEuS
ac4e727da7
Removed redundant code (replaced by libaries, should fix #5934 ).
2014-06-24 21:57:19 +02:00
PKEuS
3a89e5d65f
Fixed cppcheck warnings introduced by previous commit
2014-06-24 19:51:47 +02:00
Daniel Marjamäki
54aede9086
Fixed #5941 (ValueFlow: Wrong value in subfunction under ?)
2014-06-24 19:30:46 +02:00
PKEuS
1b5d127373
Cache results for TokenList::isC() and TokenList::isCPP() to avoid redundant calls to Path::isCPP()/isC(), which perform slow string operations (conversion to lowercase, substring, comparisons)
...
-> Speedup of 2% on self-checking cppcheck-core (MSVC12, x64, not matchcompiled)
2014-06-24 17:42:39 +02:00
PKEuS
2d54bace1b
Improved performance of CheckBufferOverrun::checkScope() ( #5944 ):
...
-> Speedup by 40% (MSVC12, x64, not matchcompiled) on the file attached to the ticket
2014-06-23 19:06:59 +02:00
Daniel Marjamäki
1ae6531c4c
Fixed #5923 (false positive: (error) Resource leak: fp (static file pointer))
2014-06-23 16:05:28 +02:00
Daniel Marjamäki
ae81b09b58
Refactoring: Move isScopeNoReturn implementation to library and reuse it both in ValueFlow and Tokenizer
2014-06-22 19:13:15 +02:00
Daniel Marjamäki
f78cbda2db
Refactoring: Removed CheckNullPointer::nullPointerByCheckAndDeRef and implemented needed analysis in ValueFlow instead.
2014-06-22 10:02:14 +02:00
Daniel Marjamäki
ef81bc363a
ValueFlow: analysis in condition.
2014-06-19 17:29:41 +02:00
Daniel Marjamäki
dec251ac44
ValueFlow: Refactoring. Use utility function isVariableChanged.
2014-06-19 05:41:19 +02:00
Daniel Marjamäki
84581817f6
ValueFlow: Improved valueFlowForward. RHS in assignment.
2014-06-18 21:07:01 +02:00
PKEuS
188f9b4509
Fixed #error handling:
...
- Reporting them once is enough
- Don't report them if --force is used - since we silently drop these configurations when we check multiple configurations. Without the fix, -f combined with -D resulted in #error being shown erroneously.
- No redundant preprocessor instance to report them
2014-06-18 17:57:31 +02:00
PKEuS
dcc646735d
Made static local variable non-static (thread-safety, #5934 )
2014-06-18 17:57:31 +02:00
Daniel Marjamäki
13761927ff
ValueFlow: better analysis in valueFlowAfterCondition of 'if|while ( %var% )' etc
2014-06-18 06:57:48 +02:00
Daniel Marjamäki
9999ce9468
ValueFlow: extend aftercondition analysis below conditional code
2014-06-18 05:51:23 +02:00
Alexander Mai
2e3f26ba58
Patch from Dmitry-Me: reorder checks so that cheaper ones go first, reuse previously computed values, return early on edge condition
2014-06-16 21:36:31 +02:00
amai2012
c61d2b9f41
#5926 Dangerous iterator comparison using operator< on 'std::deque'.
...
std::deque features a random access iterator, so warning stlBoundaries
is a false positive
2014-06-16 20:50:47 +02:00
Daniel Marjamäki
847bb44bdd
ValueFlow: Improved analysis after condition when ! operator is used
2014-06-16 16:39:41 +02:00
orbitcowboy
be49185471
Fixed #5925 : The first include in path.cpp is not path.h and astyle run.
2014-06-16 15:11:44 +02:00
orbitcowboy
76f3f67bcf
Fixed fsanitize=undefined: left shift of negative value -10000 in lib/templatesimplifier.cpp.
2014-06-16 10:58:41 +02:00
Daniel Marjamäki
0e971f2979
Merge pull request #341 from simartin/ticket_5268
...
Ticket #5268 : Properly detect function heads when in Tokenizer::simplifyEnum
2014-06-15 18:14:20 +02:00
Daniel Marjamäki
a27ca11b85
Fixed #5916 (ValueFlow: Add a valueFlowAfterCondition() function)
2014-06-15 16:47:01 +02:00
Simon Martin
efb12f0409
Ticket #5268 : Properly detect function heads when in Tokenizer::simplifyEnum.
2014-06-15 15:52:58 +02:00
Robert Reif
1f09cb0c30
Fixed #5807 (non virtual dtor in virtual class)
2014-06-14 12:55:20 +02:00
Daniel Marjamäki
17f1841fba
Merge pull request #339 from simartin/ticket_5868
...
Ticket #5868 : Ignore variables called like a typedef when substituting typedefs
2014-06-14 12:38:02 +02:00
PKEuS
8b9daadd25
Replaced static variable isCPP in Token (was not threadsafe):
...
- Encapsulate parameters passed through AST compiler functions in a struct
-> Reduces maintenance overhead when changing them
-> Contains parameter indicating if the file is C or C++
- Added eKeyword Token type (at the moment, only true for C++ keyword "delete", but should be set for other keywords as well)
2014-06-14 10:28:12 +02:00
Simon Martin
d588ed49b3
Ticket #5868 : Ignore variables called like a typedef when substituing typedefs.
2014-06-14 00:50:14 +02:00
Daniel Marjamäki
ad879320e5
ValueFlow: Fixed 'function call => calculation' value flow
2014-06-13 16:34:57 +02:00
orbitcowboy
5c2ed8450e
Revert my previous fix 28763fa020
and suppress gcc false positive warnings.
2014-06-13 15:46:43 +02:00
orbitcowboy
28763fa020
Libary: Fixed gcc warning -Wmissing-field-initializers
2014-06-13 13:17:08 +02:00
Alexander Mai
0f7071a000
Fix clang and coverity warnings
2014-06-12 20:03:11 +02:00
Daniel Marjamäki
86ef5f8ae7
CheckIO: Handle library types
2014-06-12 07:01:44 +02:00
Daniel Marjamäki
a4a6f3e1be
Tokenizer: Removed Tokenizer::simplifyConditionOperator(). Using the AST and ValueFlow, it should be much easier to parse ?: than before.
2014-06-10 19:30:13 +02:00
Dmitry-Me
6e1568a6db
Simplify code - bail out early, vreak loops early, reorder checks and declarations.
2014-06-09 13:35:30 +04:00
Daniel Marjamäki
42c3b3c89d
Library: Change range operator in validation pattern to ':'
2014-06-08 18:12:11 +02:00
Simon Martin
dc12a73987
Ticket #5907 : Properly handle extern declarations in Tokenizer::simplifyVarDecl.
2014-06-08 14:59:58 +02:00
Daniel Marjamäki
a41f6077e1
Tokenizer: Use 'podtype' info from library. Partial fix for #5623
2014-06-08 13:28:15 +02:00
Daniel Marjamäki
9e81fa04b2
Library: Added 'podtype' element. Partial fix for #5623
2014-06-08 12:09:00 +02:00
Alexander Mai
e1513090e2
#5909 crash: clang: test/Preprocessor/ifdef-recover.c. Avoid segfault in Preprocessor::getcfgs() on invalid code.
2014-06-08 10:02:16 +02:00
Daniel Marjamäki
56e3e150c2
Merge pull request #334 from Dmitry-Me/ReorderChecksAndCleanupDeclarations
...
Cleanup code - reorder checks and make variable declaration scope narrower
2014-06-07 18:35:03 +02:00
Daniel Marjamäki
4c7b0806aa
Library: handle validation expression '-1000-0'. Ticket #5847
2014-06-07 16:28:29 +02:00
Alexander Mai
4d5b463613
Fix clang compiler warning in mathlib.cpp and repair test case for #5895
2014-06-07 13:16:02 +02:00
Dmitry-Me
7692a306cd
Cleanup code - reorder checks and make variable declaration scope narrower.
2014-06-06 18:58:20 +04:00
orbitcowboy
16352ca674
Reverted fix 6d0f490138
, but keeping the testcase in the testsuite.
2014-06-06 14:44:22 +02:00
PKEuS
f1a57cbfcc
Refactorization in timer.cpp ( #5902 ), Removed misleading comment in symboldatabase
2014-06-05 17:39:14 +02:00
orbitcowboy
6d0f490138
#5895 - Fixed potential signed integer overflow in Checkother:getvalue. Added regression test.
2014-06-05 16:41:10 +02:00
PKEuS
f6c9320aee
Fixed incorrect usage of startOfExecutableScope() (Checking time reduced by ~60% (nonlinear) for #5876 )
2014-06-05 10:45:26 +02:00
PKEuS
0a0f1072c0
Attempt to fix travis and some more VS warnings
2014-06-04 19:18:27 +02:00
PKEuS
51f381edf3
Fixed VS warnings
2014-06-04 18:55:29 +02:00
PKEuS
2455b76abd
Fixed lots of bugs in the AST:
...
- Support new and delete
- Properly handle "..."
- References and rValue references as function parameters
- Destructor definitions
2014-06-04 18:47:56 +02:00
PKEuS
39b64ea5fb
Simplify rValue reference arguments without name (&& -> & &)
2014-06-04 18:45:56 +02:00
PKEuS
8db0790407
Tokenizer::tokenize() can now be called without AST being created
2014-06-04 18:45:28 +02:00
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