Commit Graph

7153 Commits

Author SHA1 Message Date
PKEuS a9f52aec04 ValueType: Support unary arithmetical/bit operators 2016-02-04 21:03:54 +01:00
PKEuS cae19cadd3 ValueType: Added support for static member variables and simplified code 2016-02-04 20:49:13 +01:00
PKEuS b801386ac8 Fixed bug in Token::findClosingBracket() and broken unit test (#7277) 2016-02-04 10:00:54 +01:00
PKEuS cc8c498ebb Moved a few tests to testgarbage.cpp 2016-02-04 09:10:20 +01:00
Alexander Mai d3546ea410 #7321 segmentation fault in valueFlowSwitchVariableScope::isVariableDeclaration 2016-02-03 22:49:57 +01:00
Alexander Mai cfe9c01bf8 #7257 segmentation fault in valueFlowSwitchVariable (invalid code). Correct SymbolDatabase::validateVariables() so it does not complain about function arguments for function without body 2016-02-03 21:52:02 +01:00
Alexander Mai ca2e3b9abb #7370 False positive uselessCallsCompare on unknown type. Ensure related warnings are only issued on STL types 2016-02-02 20:26:02 +01:00
PKEuS 841f17776b Set ValueType for assignment operators, detect division by zero for %= and /= again (#7322) 2016-02-02 17:17:55 +01:00
PKEuS 4b9241f643 Removed support for patterns like |a|b and a||b (equal to a|b|)
-> Improved performance by 1,3% (non-matchcompiled build)
2016-02-02 11:46:42 +01:00
Alexander Mai 468a130447 Fix compiler warnings introduced by refactoring 2016-02-02 09:18:58 +01:00
Alexander Mai a288d5eb16 #7027 TokenList::validateAst() did not detect broken AST with endless recursion 2016-01-31 22:16:58 +01:00
Daniel Marjamäki 988918c9bc ValueType: Use signed as default sign for short/int/long/longlong 2016-01-31 14:34:26 +01:00
Daniel Marjamäki e660c55d39 TestIO: Refactoring macros 2016-01-31 13:49:17 +01:00
Daniel Marjamäki b54613a942 Fixed #7046 (constexpr value used as template parameter reported as not used) 2016-01-31 12:39:43 +01:00
PKEuS 9d2258677d Improved CheckOther::checkUnusedLabel(): Write a warning instead of a style message if it happens inside a switch() 2016-01-31 12:07:24 +01:00
Dmitry-Me cdf68353ae Merge pull request #769 from Dmitry-Me/testNoWarningWhenCharIndexInRange
Test for signed char index in positive values range
2016-01-31 13:43:18 +03:00
Daniel Marjamäki c7f5ca74bd VarId: Set varid for template parameters (#7046) 2016-01-31 11:07:30 +01:00
PKEuS 6d0c2f7253 Fixed false positive useClosedFile when noreturn function is called (#7359) 2016-01-31 10:39:35 +01:00
PKEuS 0e8777ec99 Fixed crash on garbage code (#7356) 2016-01-31 10:25:09 +01:00
PKEuS 4d01af3fe1 Fixed false positive in CheckMemoryLeakStructMember when returning a member that has been allocated (#7302). 2016-01-31 10:10:48 +01:00
Daniel Marjamäki d5884692df Fixed #7363 (valueflowOppositeCondition - if (size1 > size2) ... else if (size1 < size2) ...) 2016-01-30 22:13:03 +01:00
PKEuS 3b046b42a6 Support function pointers in CheckUnusedVar::checkFunctionVariableUsage_iterateScopes() (#7194) 2016-01-30 20:59:55 +01:00
Daniel Marjamäki b908bb18a9 Fixed #5503 (FP: Uninitialized variable - initialize in in if and else branch) 2016-01-30 20:48:28 +01:00
PKEuS 923f7f843d Better distinguishing between possible and known null pointer dereferenciations (#7157) 2016-01-30 20:43:40 +01:00
PKEuS 5d9f275ff8 Fixed false positive uninitMemberVar with member function of template (#7205) 2016-01-30 20:18:13 +01:00
PKEuS 23ad881c64 Fixed false positive returnLocalVariable (#7180) 2016-01-30 20:18:12 +01:00
Daniel Marjamäki 30f2bb7796 ValueFlow: set known value for opposite condition in else if (#5503) 2016-01-30 20:03:55 +01:00
Matthias Krüger 112b35a49e testrunner: add testcode for #6781 (TemplateSimplifier::simplifyTemplateInstantiations causes heap corruption on invalid code) 2016-01-30 18:20:45 +01:00
Daniel Marjamäki fd67ca146d Fixed #4955 (false positive: Variable 'i' is assigned a value that is never used (only used in template instantiation)) 2016-01-30 16:49:39 +01:00
Daniel Marjamäki 0e89620212 Fixed #4698 (False positive: Uninitialized member variable warning with confusing namespaces) 2016-01-30 14:04:48 +01:00
Daniel Marjamäki f3f9ea2d09 TemplateSimplifier: One more fix for #3130. Restored max recursion count to 100 and improve pattern for reference template instantiations instead. 2016-01-30 11:22:44 +01:00
Daniel Marjamäki f116de678e Fixed #3130 (Tokenizer: Doesn't instantiate recursive template correctly) 2016-01-30 10:33:25 +01:00
Dmitry-Me c74282c258 Test for signed char index in positive values range 2016-01-29 11:09:25 +03:00
Daniel Marjamäki fa31ebf88e Fixed #7349 (checker 'inefficient find()' unintentionally used for find_first_of()) 2016-01-29 08:55:46 +01:00
Daniel Marjamäki b5986f6ad2 Fixed #7358 (valueflow: value is not known after conditional assignment) 2016-01-27 19:20:00 +01:00
Alexander Mai 1dac1664be 7357 segmentation fault in TokenList::insertTokens 2016-01-26 19:12:57 +01:00
Daniel Marjamäki 462b98afbc Fixed #7310 (ValueFlow: Value of NULL in function call) 2016-01-26 16:53:01 +01:00
Daniel Marjamäki 5c9be4a0df Fixed #7216 (ValueFlow: known value in condition) 2016-01-26 16:10:15 +01:00
Daniel Marjamäki c0056d2455 Fixed #7347 (AST: wrong ast when template variable is declared and initiailized in if 'if (A::B<C> abc = 123)') 2016-01-26 10:40:44 +01:00
Daniel Marjamäki 40e14f401f CheckCondition::alwaysTrueFalse: Move to normal checking to catch more problems 2016-01-26 10:08:21 +01:00
Daniel Marjamäki a391bca060 Fixed #7350 (ValueFlow: Result of 'x & 0' is always 0) 2016-01-26 10:07:42 +01:00
Daniel Marjamäki 0fb9ab7b4a Refactoring CheckMemoryLeakNoVar::checkForUnusedReturnValue(). use continue 2016-01-25 10:33:11 +01:00
Daniel Marjamäki 7663b6ee75 Fixed #7348 (AST: wrong ast for cast that starts with :: '(::X*)x;') 2016-01-25 10:29:24 +01:00
Daniel Marjamäki 659cd96b03 Fixed #7209 (False positive: Array index used before limits check reported in sizeof) 2016-01-24 14:06:02 +01:00
Daniel Marjamäki 6faa637fc7 Fixed #6537 (False positive badBitmaskCheck - error in valueflow) 2016-01-24 13:45:44 +01:00
Daniel Marjamäki a8416bfb16 Fixed #6000 (ValueFlow: conditional code in for loops) 2016-01-24 13:11:51 +01:00
Daniel Marjamäki 76cdfbf487 Fixed #6330 (valueflow: condition is always false first iteration in dowhile loop) 2016-01-24 08:57:57 +01:00
Daniel Marjamäki 26612ab846 Fixed #5332 (Tokenizer: if braces not added properly 'if (x==123) label: {}') 2016-01-23 11:43:48 +01:00
Daniel Marjamäki 3d0338e9f9 Fixed #7212 (incorrectly adding function argument with no name) 2016-01-23 09:48:21 +01:00
Daniel Marjamäki 2627aada07 Fixed #7346 (Tokenizer::setVarId: No varId for member in initialization list) 2016-01-23 08:28:04 +01:00
Daniel Marjamäki f64930b7f5 Fixed #7343 (SymbolDatabase: handling of override) 2016-01-22 19:22:24 +01:00
Daniel Marjamäki 8568a80208 Fixed #6883 (Template parsing error) 2016-01-20 16:10:58 +01:00
Daniel Marjamäki 642cc57428 CheckMemoryLeak: Fix FP when overloaded new is used 2016-01-20 10:34:03 +01:00
Daniel Marjamäki 4a3ece5847 CheckNullPointer: Fix FP for 'buf[p]' when p is NULL 2016-01-20 08:42:58 +01:00
Daniel Marjamäki ab441f3fb1 Tokenizer:vardecl: split up reference variables declared in class better 2016-01-19 15:27:11 +01:00
Daniel Marjamäki a434e0fb1a Fixed #7272 (Tokenizer:setVarId: handle namespaces better) 2016-01-19 14:32:27 +01:00
Daniel Marjamäki 79aec559d5 Fixed #7243 (False positive unknownEvaluationOrder - comma operator inside while-clause) 2016-01-18 16:10:51 +01:00
Daniel Marjamäki b9a4a950a2 Fixed #7144 (Tokenizer::isScopeNoReturn: handling '{ { throw new string(..); } }') 2016-01-18 15:39:20 +01:00
Daniel Marjamäki d656e3a056 Fixed #7103 (isReturnScope: handling 'return (bstr){0};') 2016-01-17 12:38:49 +01:00
Daniel Marjamäki d54f4f9c65 Fix TestAstUtils 2016-01-16 19:08:51 +01:00
Daniel Marjamäki 522de81cc7 Refactoring: Move isReturn() to astutils and rename it to isReturnScope() 2016-01-16 18:52:34 +01:00
Daniel Marjamäki ca7ec25b92 Merge pull request #708 from siemens/preprocessor-directives-for-addons-v2
Add preprocessor directives dump and Y2038 addon
2016-01-16 12:28:14 +01:00
Matthias Krüger 7b1710a44f redundantAssignment: change from severity 'performance' to 'style' since avoiding unneccessary stores is a basic optimization done by compilers. 2016-01-15 22:01:40 +01:00
Albert ARIBAUD (3ADEV) 38e70dfb74 Preprocessor directives for addons
This patch augments the XML dumps with a 'directivelist'
subnode which lists all raw preprocessor directives met
while reading the source code in each configuration.

Also, the addons/cppcheckdata.py file has been extended
to give easy access to the list of directives and to
provide Python support for the --template (or short -t)
option.

Finally, an new addon, addons/y2038/y2038.py, is created
to detect when a glibc symbol might be Y2038-sensitive,
based on whether and how _TIME_BITS and _USE_TIME_BITS64
are defined when meeting the symbol.
2016-01-15 12:36:35 +01:00
Robert Reif 966d078dcc CheckIO: Fix FN when using '%x' as format specifier for a 'signed int' variable 2016-01-15 09:29:29 +01:00
Alexander Mai 161412dc31 Correct posix.cfg to avoid false positives. Fix runtests.sh 2016-01-15 00:11:48 +01:00
Daniel Marjamäki 5214406771 Try to readd refactorings in testio. 2016-01-14 09:00:03 +01:00
Daniel Marjamäki 8e2f7812fd CheckString: Fix FP when macros are used. 2016-01-13 20:32:40 +01:00
Daniel Marjamäki 9c8ff5b89c TestIO: Use std::strcmp() to compare strings instead of std::string() 2016-01-13 19:04:30 +01:00
Daniel Marjamäki dd3dd397b5 try to fix travis and appveyor by reverting my changes 2016-01-13 18:31:57 +01:00
Daniel Marjamäki a6ac22f735 Attempt to fix travis and appveyor 2016-01-13 16:39:09 +01:00
Daniel Marjamäki 075c479bff TestIO: Refactoring, split up test cases 2016-01-13 11:34:37 +01:00
Daniel Marjamäki 647f3fc619 Refactoring TestIO 2016-01-13 10:13:24 +01:00
Alexander Mai 7802517a69 #7285 wrong var name: memset() called to fill 0 bytes of '&' memset with pointer: remove var name from message. Correct some entries in posix.cfg. 2016-01-12 23:20:48 +01:00
Daniel Marjamäki 610326e37f Refactoring TestIO macros 2016-01-12 20:03:42 +01:00
Daniel Marjamäki 4f958bd2ca Refactor TestIO, split test case 2016-01-12 19:23:37 +01:00
Daniel Marjamäki 14670f743e Refactor TestIO, split test cases 2016-01-12 16:43:27 +01:00
Daniel Marjamäki 89b23bb698 Refactor TestIO, split test case 2016-01-12 15:06:42 +01:00
Daniel Marjamäki 5079b6d95e TestIO refactoring, split test case 2016-01-12 15:01:32 +01:00
Daniel Marjamäki dbf620aa8c TestIO refactoring, split test case 2016-01-12 14:41:03 +01:00
Daniel Marjamäki 0226ee5ef3 TestIO: Splitting up test case 2016-01-12 13:06:42 +01:00
Daniel Marjamäki 8e79e5c1d3 Fixed #7147 (TemplateSimplifier: specialized template class with inheritance) 2016-01-11 18:45:12 +01:00
Daniel Marjamäki 414bdc30a9 Fixed #7276 (VarId: Missing varId in template class constructor initialization lists) 2016-01-10 22:10:49 +01:00
Daniel Marjamäki 4269702755 Fixed #7266 (False positive shiftTooManyBits with macros) 2016-01-10 20:44:52 +01:00
Daniel Marjamäki b3208fb4b3 Fixed #7211 (False positive: Finding the same expression on both sides of an operator (enumconstant == 0)) 2016-01-10 11:21:43 +01:00
Daniel Marjamäki 7191733981 Fixed #7192 (False positive: uninitMemberVar when base class is in another namespace) 2016-01-09 12:18:36 +01:00
Daniel Marjamäki 0b9d8ae0f1 astyle formatting
[ci skip]
2016-01-08 15:24:05 +01:00
amai2012 bd2892fde4 Ticket #7270 segmentation fault (invalid code) in Tokenizer::simplifyLabelsCaseDefault. include fix for cygwin 2016-01-08 11:59:02 +01:00
Daniel Marjamäki a014920280 Fixed #7260 (ValueType: in C++ the result of 'sint >> unknowntype' has unknown type) 2016-01-07 10:46:19 +01:00
Daniel Marjamäki 88a525aca7 Fixed #7267 (Tokenizer::setVarId: wrongly sets varId in cast with unknown type) 2016-01-06 17:47:59 +01:00
Daniel Marjamäki 58e28cb00e ValueType: Better handling of unsigned unknown types 2016-01-05 19:47:11 +01:00
Daniel Marjamäki a0971355b7 Tweaked Tokenizer::simplifyAsm2() 2016-01-04 19:18:10 +01:00
Daniel Marjamäki f1d3d5b47d TestTokenizer::simplifyAsm2: replace invalid example code with valid code 2016-01-04 10:50:52 +01:00
Daniel Marjamäki b748453b30 Tokenizer: Improve handling of block declarations (C extension) 2016-01-04 09:59:53 +01:00
Daniel Marjamäki 036306d7c2 Refactoring Tokenizer::startOfExecutableScope(). Improve and reuse Tokenizer::isFunctionHead(). 2016-01-03 22:52:24 +01:00
Alexander Mai d6fd4705cf #7255 segmentation fault (invalid code) in CheckMemoryLeakInFunction::getcode 2016-01-03 20:53:03 +01:00
Daniel Marjamäki 79e663dd6f Settings: Remove '_' prefix for public member variables 2016-01-03 16:18:17 +01:00
Daniel Marjamäki 8dccbfefcf ValueType: handle lowercase number suffix, for instance '0ll' 2016-01-03 13:34:47 +01:00
Daniel Marjamäki cd89e68f60 Fixed #6931 (noexcept and override qualifiers plus less than operator results in a syntax error) 2016-01-03 12:22:07 +01:00
Daniel Marjamäki 91d0f0fee0 astyle formatting
[ci skip]
2016-01-03 09:38:03 +01:00