Commit Graph

4708 Commits

Author SHA1 Message Date
Daniel Marjamäki a861817a01 Fixed #4751 (CheckBufferOverrun: better handling when struct member instance doesn't have same varid as struct member declaration) 2013-05-28 16:52:23 +02:00
Daniel Marjamäki ae7363fe54 Fixed #4599 (False positive with fopen/fclose test) 2013-05-23 06:34:22 +02:00
Daniel Marjamäki 1936eb8676 astyle formatting 2013-05-21 16:59:58 +02:00
Robert Reif 2c8360c607 Fixed #4789 (uninitMemberVar not found when constructor contains default parameters) 2013-05-18 18:33:24 +02:00
Frank Zingsheim 0943fecf03 Fixed #4799 (Segmentation fault in K&R simplification inside lambda expression) 2013-05-14 20:56:31 +02:00
PKEuS b58e1241dc Distinguish between different swprintf overloads. (#4790)
Fixed MSVC warning recently introduced
2013-05-14 02:06:16 -07:00
PKEuS 1903585ea3 Fixed bug in handling rvalue references: Scope has to be set everywhere. (#4732) 2013-05-14 01:43:32 -07:00
Frank Zingsheim 511f8a4c1f More general fix to #4187 (False positive: Variable inside a lambda is reported as uninitialized) 2013-05-12 10:19:43 +02:00
Frank Zingsheim d387e8b770 Fixed #4711: (false positive: Consecutive return...) 2013-05-11 17:50:59 +02:00
Daniel Marjamäki b6bcdf2936 Fixed #4520 (segmentation fault of cppcheck (preprocessing)) 2013-05-09 18:50:24 +02:00
PKEuS fb480ebb0a Now really fixed #4604. 2013-05-09 15:39:33 +02:00
PKEuS 881b47e79d Revert "Improved handling of 0 initializations (#4604)"
This reverts commit 1201e417ec.
2013-05-09 15:32:02 +02:00
PKEuS 0a104c40b7 Fixed "Improved handling of 0 initializations (#4604)"
This fixes commit 1201e417ec.
2013-05-09 15:25:36 +02:00
PKEuS 982b9491d4 Improved handling of 0 initializations (#4604) 2013-05-09 06:23:25 -07:00
PKEuS c42b89fb88 Revert "Improved handling of 0 initializations (#4604)"
This reverts commit 1201e417ec.
2013-05-09 15:19:23 +02:00
PKEuS 1201e417ec Improved handling of 0 initializations (#4604) 2013-05-09 06:17:10 -07:00
Daniel Marjamäki cbe0a0825c Fixed #4725 (Tokenizer: Replace block declaration (^{}) with asm()) 2013-05-09 14:47:18 +02:00
XhmikosR f32aa89da3 run tabspace 2013-05-08 18:36:47 +02:00
Lena Herscheid e23038c4de Fixed #4775 (Check for assert() with side effects) 2013-05-07 21:35:16 +02:00
Frank Zingsheim bca751b9f4 Fixed #4773 (Regression: wrong detection of unitialized variable) 2013-05-06 18:45:00 +02:00
Daniel Marjamäki 4659745106 Fixed #4786 (segfault with one LibreOffice file) 2013-05-06 16:56:34 +02:00
Daniel Marjamäki 3f5a858800 dmake: update Makefile 2013-05-05 09:22:04 +02:00
Daniel Marjamäki ea60c5b14b CheckBufferOverrun: Code cleanup 2013-05-05 08:14:19 +02:00
Daniel Marjamäki 079d22fbee Fixed #4734 (False 'Possible null pointer dereference') 2013-05-03 16:18:44 +02:00
Zachary Blair de8ee5b042 Fixed #4554 (false negative: buffer access out of bounds) 2013-05-02 21:50:48 -07:00
Daniel Marjamäki bfb1bc50e3 Fixed #4760 (false negative: (error) usage of uninitialized variable (struct member)) 2013-05-02 20:34:15 +02:00
Alexander Mai 957e0790c6 Tokenizer::setVarId: assert that strange code with same type names and variable names work. Ticket: #3990 2013-05-01 18:50:35 +02:00
Daniel Marjamäki 44cb070e13 Fixed #4737 (False positive: Uninitialized variable 'do_something(&((char*)&var)[0],1);') 2013-05-01 13:52:28 +02:00
Frank Zingsheim 42068a3d60 Fixed #4767 (segmentation fault in expand template) 2013-05-01 13:28:01 +02:00
Daniel Marjamäki 287782a679 Fixed #4390 (False alarm 'Object pointed by an auto_ptr is destroyed using operator delete. You should not use auto_ptr for pointers obtained with operator new[].') 2013-05-01 11:11:57 +02:00
Daniel Marjamäki b2798e929d Improved fix for #4455, no false negatives if variable is used before first memset 2013-04-30 16:56:44 +02:00
Daniel Marjamäki cf75e2bb28 astyle formatting 2013-04-30 06:44:50 +02:00
Daniel Marjamäki 47ef8cf455 Fixed #4455 (redundantCopy when precleaning with memset) 2013-04-30 06:43:16 +02:00
Baris Demiray 548dd42aaf Fixed #933 (Leaks with struct members not detected) 2013-04-26 16:11:57 +02:00
Zachary Blair 35668380cf Fixed #4510 (False positive: "Possible null pointer dereference if the default parameter value is used" after init) 2013-04-25 00:25:56 -07:00
Daniel Marjamäki c3d1274db3 Reverted 'simplify NOT' since there are problems related to signedness of numeric values. 2013-04-24 06:32:34 +02:00
Daniel Marjamäki e1dd14626c Fixed #4735 (FP: Mismatching assignment and comparison) 2013-04-23 06:47:15 +02:00
Daniel Marjamäki a5b044a6e2 Fixed #4754 (False positive: Map literals trigger redundant code warning) 2013-04-20 07:51:44 +02:00
Daniel Marjamäki 9f8ce6f77f Fixed #4729 (Tokenizer::setVarId: Varid not tracked properly after function declaration with 'shadow' parameter name) 2013-04-19 18:36:16 +02:00
Daniel Marjamäki 8d9ad2ae0d TestTokenizer: Renamed test functions so they match the function names used in the Tokenizer (simplifyRoundCurlyParentheses) 2013-04-19 06:42:09 +02:00
Daniel Marjamäki e3be600479 TestTokenizer: Renamed test functions so they match the function names used in the Tokenizer 2013-04-18 16:13:58 +02:00
Daniel Marjamäki 80cb2a9b20 Updated TestUninitVar test cases. They should not have unsimplified code. 2013-04-17 21:06:19 +02:00
Daniel Marjamäki 4e65800adf TestRunner: Updated warning message when there is unsimplified code 2013-04-16 16:54:19 +02:00
Daniel Marjamäki fdac502c39 Simplified TestNullPointer test cases 2013-04-15 19:00:15 +02:00
Daniel Marjamki 9007345221 Simplified TestOther test cases 2013-04-13 20:17:53 +02:00
Daniel Marjamäki 37a87d2f9d Simplified TestClass test cases 2013-04-13 19:11:07 +02:00
Daniel Marjamäki dd6a806ada TestBoost: Warn if test case is not simplified properly 2013-04-13 18:42:56 +02:00
Daniel Marjamäki 8c6637c79c TestBool: Warn if test case is not simplified properly 2013-04-13 18:41:06 +02:00
Daniel Marjamäki 25582dbde7 Simplify TestAutoVariables test cases 2013-04-13 18:38:15 +02:00
Daniel Marjamäki b42ec0fe8b Simplify TestAssignIf test cases (else if) 2013-04-13 18:23:53 +02:00
Daniel Marjamäki 393c75af70 Simplified remaining TestBufferOverrun test cases 2013-04-13 15:49:15 +02:00
Daniel Marjamäki cbe2cdafcf Simplify TestBufferOverrun test cases (casts, pointer addition, calculation) 2013-04-13 13:58:21 +02:00
Daniel Marjamäki fe911f92e1 Simplify TestBufferOverrun test cases (known variable value) 2013-04-13 13:13:13 +02:00
PKEuS 6f9886a1b9 Removed more duplicate unit tests 2013-04-13 02:07:18 -07:00
Daniel Marjamäki 78d3aef40e Simplified TestBufferOverrun test cases (sizeof, known variable value) 2013-04-13 11:01:19 +02:00
PKEuS 693c6e84cb Removed more duplicate unit tests 2013-04-13 01:49:17 -07:00
PKEuS 8e4f99884b Removed more duplicate unit tests 2013-04-13 00:49:00 -07:00
Daniel Marjamäki 3b880f9e2e Simplified TestBufferOverrun test cases (sizeof, known variables, casts, etc) 2013-04-13 08:19:14 +02:00
Daniel Marjamäki 7871f16e9d Simplified TestBufferOverrun::readlink test cases (sizeof) 2013-04-13 07:31:15 +02:00
Daniel Marjamäki 6afdd1b7c0 Simplified TestBufferOverrun::readlinkat test cases (sizeof, known variables) 2013-04-13 07:22:01 +02:00
PKEuS cdce755471 Removed duplicate unit tests in testbufferoverrun.cpp 2013-04-12 12:17:08 -07:00
Daniel Marjamäki 9ad39ca4c0 Fixed #4544 (Crash with this line : class CD : public CC< class CB< CA > >) 2013-04-12 16:38:12 +02:00
Daniel Marjamäki e8fbd39efd Templates: better handling of 'X<class Y>' template instantiations. Ticket: #4544 2013-04-11 18:58:39 +02:00
Ettl Martin e03a3946d0 avoid crash in checkother:wrongPipeParameterSize when a pointer with unknown size is provided. 2013-04-11 14:22:22 +02:00
Ettl Martin 33cfc1a52e fixed #4726: simplify bitwise Not (~ %num%) 2013-04-11 09:16:40 +02:00
Daniel Marjamäki a49fc57e00 Tokenizer: don't simplify 'a!=(b!=0)' to 'a!=b'. Ticket: #4697 2013-04-11 07:19:32 +02:00
Frank Zingsheim 54e7c8f6a2 Implemented support for move constructors:
Adapt code to Function::eMoveConstructor
introduced in commit eb2962792f
2013-04-10 21:57:22 +02:00
Daniel Marjamäki 7fdaba43ed Uninitialized variables: Fixed fp when initializing struct with function in loop body 2013-04-10 20:46:44 +02:00
Daniel Marjamäki 96a5429cee Uninitialized variables: Assume that function initializes struct if it is unknown if it does 2013-04-10 20:04:32 +02:00
PKEuS 994c429b7d Moved checks related to sizeof usage from checkother into new file 2013-04-10 09:49:38 -07:00
PKEuS 42fcb04d0c Moved checks related to boolean type (not condition checking!) from checkother into new file 2013-04-10 09:25:50 -07:00
PKEuS 4e6d105cbd Added support for complex patterns to CheckOther::checkIncorrectStringCompare() 2013-04-09 09:16:35 -07:00
XhmikosR 8ac9b8e7a9 remove duplicate ";" and fours dots 2013-04-09 17:49:09 +02:00
XhmikosR 700512a53f use spaces in strings 2013-04-09 17:49:09 +02:00
PKEuS c487ea843d Better fix for #4706: Use Token::nextArgument() properly. Removed redundant ' in message 2013-04-09 08:30:53 -07:00
Daniel Marjamäki 4c8b17c040 Fixed #4717 (False positive: Uninitialized variable inside ({..})) 2013-04-09 17:02:11 +02:00
Daniel Marjamäki 894a2435ae Fixed #4718 (False positive: unititialized variable (value flow)) 2013-04-08 19:34:39 +02:00
Alexander Mai 14fc140592 Fixed memory leaks in teststl 2013-04-07 18:43:18 +02:00
Daniel Marjamki cd770fb106 Fixed #4310 (False positive 'boolean result in bitwise' message in template class (was #3818)) 2013-04-07 16:48:42 +02:00
Daniel Marjamäki f43d732f33 Fixed #4691 (False positive: Mismatching bitmasks in switch()) 2013-04-07 04:25:10 +02:00
Daniel Marjamäki 38680e3440 Fixed #4677 (Message for 'possible null pointer dereference, otherwise it is redundant to check..' is warning but says error) 2013-04-07 03:41:02 +02:00
zblair ecfe4eb5be Fixed #3372 (New check: dereference iterator and then checking it) 2013-04-04 21:14:59 -07:00
PKEuS eb2962792f Implemented support for move constructors:
- Changed behaviour of Token::function - is now also set for declarations
- Resolved TODO in testclass.cpp
- removed redundant code in Scope::findFunction - it is safe to call nextArgument() on functions without arguments
- Use Token::function in checkother.cpp
2013-04-04 10:53:55 -07:00
PKEuS 188096665c Implemented support for rvalue references (C++11):
- Split up && when it is part of an rvalue reference declaration
- Added support into symbol database
- Current implementation sets Variable::isReference() to true also for rvalue references - they can probably be treated like normal references in many checks.

Changed behaviour of symbol database: Insert argument Variable of functions that are not implemented into SymbolDatabase::_variableList
2013-04-04 09:47:44 -07:00
Ettl Martin ba8cca8fa9 #4706 fix crash when a struct member is used as first argument. Replaced Token::nexArgument with %any% in Token::Match call. Added unittests in testing Token::nexArgument. 2013-04-04 15:12:18 +02:00
PKEuS 51685f24c5 Improved expression parsing in CheckNullPointer::isPointerDeRef() - fixed #4692 2013-04-03 01:27:08 -07:00
Ettl Martin 3e8eddc69e cleanup testcases: moved testcases from #3888 into allocfunc13 which contains similar testcases already. 2013-04-03 10:12:36 +02:00
Ettl Martin 08ac48199e #3103 added testcases. 2013-04-03 09:33:33 +02:00
Ettl Martin 9f25b618dc #3888 added a testcase 2013-04-03 08:57:26 +02:00
PKEuS 7596282cba Improved test coverage: Ensure that passing multiple <id> to --enable works. Check settings.isEnabled("warning"). 2013-04-01 04:15:05 -07:00
PKEuS fbe997ca80 Use global Settings instance in TestCmdlineParser, since most tests just need it to pass something to CmdlineParser class.
This change implies that we do not rely on any default state of the Settings class - as it should be, since CmdlineParser is tested, not Settings.
2013-04-01 04:12:56 -07:00
Frank Zingsheim 395a474ec2 Fixed #4695: Infinite recursion inside isRecordTypeWithoutSideEffects() 2013-04-01 12:41:14 +02:00
PKEuS 12f5ccfb4e Refactorized postfix operator check:
- Support class members
- Support references (removed wrong bailout)
- Removed wrong unit tests and wrong messages for std::cout << k-- << std::endl;
2013-03-31 04:17:23 -07:00
XhmikosR a9955cce8e run astyle 2013-03-30 19:06:13 +01:00
Frank Zingsheim 5d55d40361 Fixed #4656 (New check: Detect pure virtual function calls) 2013-03-30 15:09:22 +01:00
Robert Reif a3f9b5c07d Fixed #4686 (Prefer prefix ++/-- operators for non-primitive types with template iterator) 2013-03-30 13:49:56 +01:00
Alexander Mai b9c27699b3 Fixed #4684 (cppcheck crash in template function call.) 2013-03-29 19:29:23 +01:00
Daniel Marjamäki 3301728c50 astyle formatting 2013-03-29 17:55:09 +01:00
Alexander Mai 7902cd0123 Fixed #4447 (false positive: (style) Variable 'X' is assigned a value that is never used (goto)) 2013-03-28 06:44:37 +01:00
Robert Reif 3f57b5a6ca Fixed #4682 (using 'struct' disables checking) 2013-03-28 06:36:49 +01:00