Commit Graph

6777 Commits

Author SHA1 Message Date
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