Commit Graph

707 Commits

Author SHA1 Message Date
PKEuS 068c695bd1 Fixed false positive when ternary operator is used: case A&&B?B:A: 2012-12-07 12:44:30 -08:00
PKEuS 0ac4c3baf4 New check: Find suspicious case labels like 'case A||B:' 2012-12-07 12:27:32 -08:00
PKEuS 65db8b8b9f Fixed #4229 2012-12-07 11:45:20 -08:00
Edoardo Prezioso 5101f3c029 Use the new pattern: '%comp%' where possible.
Change also the description comment of the Token::Match by adding the new pattern and the forgotten '%op%'.
2012-12-01 01:31:35 +01:00
Robert Reif 6b8e83a181 speed up checks by caching commonly looked up stuff in the symbol database (checkother, checkstl, checkunusedvar). Ticket: #4266 2012-11-16 06:50:49 +01:00
Daniel Marjamäki 79cd601ae7 Fixed #4356 (False positive at variable initialization) 2012-11-15 07:48:45 +01:00
Robert Reif 09eed80938 speed up checks by caching commonly looked up stuff in the symbol database (CheckOther). Ticket: #4266 2012-11-15 07:11:45 +01:00
Robert Reif 04d04c33c2 speed up checks by caching commonly looked up stuff in the symbol database (CheckOther). Ticket #4266 2012-11-14 18:12:33 +01:00
Robert Reif 6578b78077 speed up checks by caching commonly looked up stuff in the symbol database (checkIncorrectLogicOperator). Ticket: #4266. 2012-11-13 18:30:33 +01:00
PKEuS 3e03838025 Fixed verbose messages in CheckOther::incorrectLogicOperatorError which didn't contain all information of the short message. 2012-11-10 11:31:36 +01:00
PKEuS ce961578c2 New checks (inconclusive): Suspicious calculation with sizeof()
- Check for sizeof(ptr)/something: This indicates that programmer was trying to calculate array size, but sizeof(ptr) doesn't return the length of the memory area, but size of a pointer.
- Check for sizeof()*sizeof(): This indicates that programmer misunderstood what sizeof() does: It does return the length in bytes of the given variable, not e.g. the number of elements in an array.
2012-11-09 18:08:20 +01:00
PKEuS aa2ad41629 Print message "Found calculation inside sizeof()" also for increment/decrement operator. 2012-11-06 11:39:47 -08:00
PKEuS bbe06c65c0 Added support for wide-strings (wcs* functions, std::wstring, std::*wstringstream) at many places. 2012-11-06 10:54:52 -08:00
Zachary Blair 51d128c918 Fixed #2029 (free invalid address) by reporting previously-unreported errors as "inconclusive" 2012-11-05 21:02:51 -08:00
PKEuS 1c399c86ca Improved fix for #4311; Added back support for "this." (fixes again #4291)
Added TODO unit test for missing varid.
2012-11-03 21:16:05 +01:00
Daniel Marjamäki 6c2563c467 Fixed #4311 (False positive: warning (selfAssignment): Redundant assignment of 'm_bar' to itself. 2012-11-03 13:18:43 +01:00
PKEuS a36e008967 Fixed #4314: Using CheckNullPointer::isPointerDeRef() here is overkill and doesn't work as intended, since this function is designed to return 'false' if it isn't sure. 2012-11-03 10:25:32 +01:00
Daniel Marjamäki e7483af028 Opposite inner conditions - made check 'experimental' because there are unsolved false positives. 2012-10-21 18:18:29 +02:00
Baris Demiray d84d360afc Fixed #4291 (Variable ID is not set when variable is accessed through 'this') 2012-10-19 06:18:13 +02:00
Robert Reif c7961b147d speed up checks by caching commonly looked up stuff in the symbol database 2012-10-11 06:12:24 +02:00
Robert Reif bbfd676b4e speed up checks by caching commonly looked up stuff in the symbol database 2012-10-10 20:42:07 +02:00
Robert Reif 8ccbde117a Fixed #4261 (CheckOther::checkComparisonOfFuncReturningBool using wrong function scope test) 2012-10-08 16:15:07 +02:00
Alexander Mai 3656366c7e Fixed #4257 (False Positive: String literal compared with variable - for non-pointer variable) 2012-10-07 16:26:03 +02:00
Daniel Marjamäki 2f069f550f Removed Java/C# handling 2012-10-02 18:44:36 +02:00
Edoardo Prezioso 72666e10d1 Related to previous commit: reduce scope level, remove the now redundant check. 2012-10-02 15:19:29 +02:00
Edoardo Prezioso 60de3e75af CheckOther::checkComparisonOfBoolWithBool,checkComparisonOfFuncReturningBool: use symbolDatabase to check only tokens in executable code. 2012-10-01 15:38:31 +02:00
PKEuS 7a1e64fdd4 Replaced unsafe local isFunction() function by symboldatabase. 2012-09-29 11:32:11 +02:00
PKEuS c17853949d Fixed scope handling problems with CheckOther::checkComparisonOfFuncReturningBool(), removed its experimental status. 2012-09-29 11:23:30 +02:00
Daniel Marjamäki 52be4a5925 Disabled checkComparisonOfBoolWithBool since there are false positives. Ticket #2617 2012-09-28 19:11:36 +02:00
Daniel Marjamäki ff4f8b58f3 Disable checkComparisonOfFuncReturningBool check because of false warnings. Ticket #2617 2012-09-28 18:51:10 +02:00
Edoardo Prezioso 7362ca9e8f Fixed #4242 (segmentation fault of cppcheck (invalid code: '<')) 2012-09-28 11:24:35 +02:00
Mohit Mate 9e297c95f2 Fixed #2617 (improve check: comparing boolean with '<') 2012-09-26 18:18:36 +02:00
PKEuS 508e9394d3 Added some nullpointer-checks and removed some redundant ones based on VS2012 code analysis results. 2012-09-17 15:22:51 +02:00
PKEuS 5237ed2de9 Message refactorization: checkother.cpp 2012-09-16 19:44:02 +02:00
PKEuS 9a624576f4 Revert "CheckOther::clarifyStatement: improved message to show what's the 'bad' and the 'good' expression."
This reverts commit f8591f9004.
2012-09-15 20:19:02 +02:00
Daniel Marjamäki 7ec825cd5d Cppcheck: Fixed Cppcheck warning about variable scope 2012-09-15 15:54:52 +02:00
PKEuS 22a8e3f4e6 Replaced Tokenizer::getFunctionTokenByName() by SymbolDatabase::findFunctionByName(), which handles scopes slightly better. 2012-09-11 18:03:47 +02:00
PKEuS 5940d77a62 Disabled C++ specific checks and simplifications when checking a C or non-C++ file. 2012-09-10 19:02:32 +02:00
PKEuS a4b5824dec New internal check: checkRedundantNextPrevious().
Fixed findings by new internal check
2012-09-07 12:36:40 +02:00
PKEuS e4a693eaab Refactorizations:
- Fixed several findings of CheckInternal.
- Removed some debug code from CheckOther::checkRedundantAssignment().
2012-09-07 11:59:20 +02:00
Edoardo Prezioso 097d0816d0 Fixed #4150 (new ineffective statement check warning wrong). 2012-09-06 17:48:30 +02:00
Arpit Chaudhary 67e40a85e5 Improved check for shifting by negative values and removed false positives 2012-09-05 16:09:40 +02:00
Nilesh Kumar c7633fc73c Fixed #3645 2012-09-05 13:48:00 +02:00
Zachary Blair 8546bcc94e Fixed #2029 (new check: free invalid address) 2012-09-04 23:31:23 -07:00
Daniel Marjamäki 2197b84d78 astyle formatting 2012-09-04 16:29:23 +02:00
Edoardo Prezioso f8591f9004 CheckOther::clarifyStatement: improved message to show what's the 'bad' and the 'good' expression. 2012-09-04 02:07:55 +02:00
anuraggarg011 b156c727b0 Fixed #3939: Support ****foo++; 2012-09-03 17:10:27 +02:00
Ankita Gupta c3a65dca40 Fixed #3793 (improve check: calculation in sizeof) 2012-09-03 15:56:10 +02:00
PKEuS 27cafd495a Don't bailout for noreturn functions in checkRedundantAssignments outside switch. 2012-09-03 12:03:30 +02:00
PKEuS d98ee357d4 Fixed crash #4135 when using Q_DECLARE_METATYPE 2012-09-03 11:30:36 +02:00