Commit Graph

6675 Commits

Author SHA1 Message Date
orbitcowboy f1f46611d6 Merge pull request #624 from simartin/ticket_6601_template_parameters
Added unit test involving function reference for TemplateSimplifier::templateParameters
2015-07-19 09:02:43 +02:00
Simon Martin d218b95349 Ticket #5776: Since the fix is in Tokenizer, it makes more sense to have a Tokenizer unit test. 2015-07-19 00:10:47 +02:00
Simon Martin d1d51c5bb7 Added unit test involving function reference for TemplateSimplifier::templateParameters. 2015-07-18 23:56:55 +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 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 61cf224f32 ValueFlow: Make known loop value possible 2015-07-17 10:24:24 +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 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
orbitcowboy 48fed95942 Fixed wrong test case in testother: mathfunctionCall_atan2(). 2015-07-16 10:55:58 +02:00
orbitcowboy 1d910bc3bc #6313: Added test case for oppositeInnerCondition. 2015-07-16 08:44:38 +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
orbitcowboy dda5e46d1d Fixed typo in comment. No functional changes. 2015-07-15 15:29:35 +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 cf53074fd9 astyle formatting 2015-07-14 18:09:28 +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
Martin Ettl 027bdd3370 Reverted cebc105856. 2015-07-13 21:31:24 +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
orbitcowboy 08d6c244ee Running astyle. 2015-07-13 16:50:48 +02:00
orbitcowboy cebc105856 Changed test case from recent commit into a TODO test case. Since it is a FP. 2015-07-13 16:50:23 +02:00
orbitcowboy d042151b62 Checkother:selfAssignment: Improved test coverage. 2015-07-13 16:39:21 +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 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
Daniel Marjamäki 14044bf60b testrunner: revert changes to avoid compiler warnings 2015-07-01 19:15: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 108b035af2 Adjust two checks which have different results on Windows/Visual Studio than on Linux: one succeeds already, another fails. Analysis/fix is under development. Temporary repair allows to detect further regressions. 2015-06-30 21:21:26 +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
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
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 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 56b826e3bf #6732, #6762. Enable tests for garbage code. Related bug has been fixed before 2015-06-24 21:03:02 +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
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
Alexander Mai 272cc55ab8 #5309 False positive: redundantCondition - comparing large integer values (unsigned long long). Testcase added, issue got fixed before. 2015-06-20 12:18:24 +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 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
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 e32257db0a Add new test file: testtokenlist.cpp to testrunner 2015-06-16 20:30:09 +02:00
Martin Ettl 9b14ab15eb MathLib::intsuffix: Added support for LLU and LU suffixes. 2015-06-16 19:12:18 +02:00
Daniel Marjamäki 2cc23b4bb3 MathLib: Try to keep type suffix in constant calculations 2015-06-15 19:01:56 +02:00
Alexander Mai a5a835b1e0 #6771 segmentation fault (invalid code) in SymbolDatabase::SymbolDatabase 2015-06-14 22:18:28 +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 fff3db48a7 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:14:55 +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
Dmitry-Me cae605b1ec New warning: warn about redundant code in condition. 2015-06-10 18:53:55 +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
orbitcowboy eed0c0df14 Merge pull request #610 from simartin/ticket_6665_test
Ticket #6665 (dupe of #6588): Added test case.
2015-06-06 03:28:51 +02:00
Simon Martin 0ebaa9b8c4 Ticket #6463 (dupe of #6680): Added test case. 2015-06-05 23:57:42 +02:00
Simon Martin 311db970c5 Ticket #6665 (dupe of #6588): Added test case. 2015-06-05 23:44:03 +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
orbitcowboy ffcf45ab34 Running astyle, no functional changes. 2015-06-01 14:08:03 +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
Simon Martin 764df4dd56 Ticket #6588: Added test cases since the initial issue is fixed by some past commit. 2015-05-30 22:57:54 +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 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
amai2012 0bd7cbfbeb Merge pull request #603 from simartin/ticket_6708
Ticket #6708: Check that a function name is not a reserved keyword in SymbolDatabase::isFunction instead of later.
2015-05-26 16:48:17 +02:00
amai2012 2bd49dcbde Merge pull request #602 from simartin/templateParameters_tests
Added unit tests for TemplateSimplifier::templateParameters involving variadic templates
2015-05-26 07:10:10 +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
Simon Martin dc293ff483 Added unit tests for TemplateSimplifier::templateParameters involving variadic templates. 2015-05-25 23:13:01 +02:00
Daniel Marjamäki a8d7897471 Fixed travis failure 2015-05-25 18:19:40 +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
Martin Ettl 047d19220a #6608: Added a test case. 2015-05-24 10:03:50 +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
amai2012 1eba077c24 Merge pull request #597 from simartin/ticket_5760
Ticket #5760: Added test case since the issue has been fixed with PR#596
2015-05-23 20:52:34 +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
Simon Martin 4ff2f8b3e2 Ticket #5760: Added test case since the issue has been fixed with PR#596. 2015-05-23 20:29:44 +02:00
amai2012 01ce910a02 Merge pull request #595 from HeisSpiter/master
Handle HeapCreate()/HeapDestroy() API for Windows
2015-05-23 14:10:53 +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
Pierre Schweitzer 5a68e352df Add various tests targeting Windows platform to show the current troubles cppcheck has to distinguish two different source of allocation used together. 2015-05-19 21:23:09 +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 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
Alexander Mai 8fa7b13a18 #6659 heap user after free: kernel: sm750_accel.c. Add testcase. 2015-05-10 11:37:23 +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
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
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
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
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
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
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
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
Robert Reif 4ceb24630d Fixed #6568: Scope for template class member function missing in symboldatabase 2015-04-09 21:01:47 +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
Frank Zingsheim 1f5265c1bd Fixed #6253 ([False Positive] Variable not initialized in the constructor) 2015-04-06 19:47:21 +02:00
Alexander Mai bacc5ac1cc Fix false positives ignoredReturnValue about some posix interfaces. Remove redundant strsignal() output from signal handler 2015-04-06 18:16:37 +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 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
Robert Reif c02acea5bf Fixed #6614 (false positive: (style) The class 'A' does not have a constructor.) 2015-04-04 11:33:25 +02:00
Matthias Krüger 77e22da7fe testrunner: fix -Wshadow warning.
warning was:

test/testsimplifytemplate.cpp: In member function ‘int TestSimplifyTemplate::templateNamePositionHelper(const char*, unsigned int)’:
test/testsimplifytemplate.cpp:1170:22: warning: declaration of ‘tok’ shadows a member of 'this' [-Wshadow]
         const Token *tok = tokenizer.tokens();
                      ^
2015-04-04 01:15:56 +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
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 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
orbitcowboy dde34bb88c #6135: Added test case to testgarbage in order to ensure that this issue does not appear again. 2015-03-30 15:33:24 +02:00
Dmitry-Me 712b101862 Test simplification of "delete a, b, c" 2015-03-27 17:49:35 +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 9a1b543c07 Tokenizer: Add testcase for 'delete a, a=0;' 2015-03-24 07:59:17 +01: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
Alexander Mai 42d9afe7de posix.cfg add more interfaces from stdlib.h. run astyle 2015-03-21 12:26:07 +01:00
Dmitry-Me 818346622c More tests for checking negative pointers 2015-03-19 16:46:00 +03:00
Jakub Melka a49efb13f6 Added auto_ptr checking for malloc 2015-03-19 06:41:54 +01:00
Alexander Mai cb6ed95ed3 posix.cfg: add more interfaces. Remove include from test which is missing on travis 2015-03-15 13:28:16 +01:00
Alexander Mai 3a690fd18e posix.cfg: fix false positive and add more interfaces 2015-03-15 12:56:24 +01:00
PKEuS 42673255ed Refactorized testrunner: Create std::string only where necessary 2015-03-15 12:36:40 +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
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
Alexander Mai 5b8d93efda posix.cfg: Fix false positives and add poll() 2015-03-14 23:31:56 +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 4ec2df92b7 Refactorized testsimplifytypedef.cpp, fixed broken unit test simplifyTypedef99 2015-03-14 20:43:15 +01:00
Daniel Marjamäki 0efa113b6e fixed test/cfg/posix.c code 2015-03-14 19:40:13 +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
Alexander Mai d52e3c8eb7 Fix missing suppression in test/cfg/posix.c 2015-03-13 18:29:46 +01: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 bc5132e0ac Refactorization: Moved declaration of errout, ... to testsuite.h, uniformized style 2015-03-11 22:54:43 +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
Alexander Mai c8bee3e1a6 Merge branch 'master' of https://github.com/danmar/cppcheck 2015-03-11 18:59:56 +01:00
Alexander Mai 6bd7dd771d Add some functions from <time.h> to posix.cfg (see #6577) 2015-03-11 18:59:34 +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
Martin Ettl 0839ce5a96 posix.cfg: Removed duplicate utime() function introduced by 841a27c19d. Added more test cases for uninitvar for utime() and utimes(). 2015-03-08 21:38:43 +01:00
amai2012 3d9c2b4d97 Merge pull request #542 from MegaManSec/master
Add utime function to posix.cfg
2015-03-08 19:55:41 +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 780a530e0e test/cfg/windows.cpp: Added test for #6571, Library::isNotLibraryFunction() should return true for methods. 2015-03-08 16:23:54 +01:00
Alexander Mai 34a61e0883 Additions to windows.cfg. Fix compiler warning in test/cfg/posix.c 2015-03-08 15:21:50 +01:00
Joshua Rogers 841a27c19d Add utime function to posix.cfg 2015-03-09 00:43:25 +11:00
Alexander Mai 95411414c4 #6569 Add strcasestr function to gnu.cfg 2015-03-08 14:04:09 +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
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