Commit Graph

6241 Commits

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