Commit Graph

7457 Commits

Author SHA1 Message Date
PKEuS 35317695d4 ValueType: Fixed handling of constness 2016-02-05 13:31:31 +01:00
PKEuS 792835cd9a ValueType: Support ++/--. 2016-02-05 12:06:44 +01:00
PKEuS 2b179dc836 ValueType: Properly support ternary operator with pointers (#7378) 2016-02-05 09:59:48 +01:00
PKEuS 3b7948fb4e ValueType: Support ternary operator 2016-02-04 21:20:05 +01:00
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
Daniel Marjamäki ed12b4dc44 Fixed #7253 (AST wrong on nested reinterpret_cast) 2016-01-03 09:37:38 +01:00
Alexander Mai 1d3e39df7e Adjust message text for signConversion for constant negative epxressions 2016-01-02 22:56:15 +01:00
Alexander Mai ce12e1cea6 Remove unnecessaryForwardDeclaration check. It had false positives (e.g. #3663), was implemented in the Tokenizer and of little value. 2016-01-02 19:14:03 +01:00
Robert Reif db6dfa2d22 Fixed #7195 (crash: valueFlowSwitchVariable()) 2016-01-02 18:53:51 +01:00
Alexander Mai 37c3d5da7b #6731 Tokenizer::eraseDeadCode causes heap corruption on invalid code. Better detection of invalid code inside Tokenizer::simplifyFlowControl() 2016-01-01 23:32:10 +01:00
Daniel Marjamäki 95009a4630 Merge pull request #745 from lanurmi/2016_ad
Update copyright year to 2007-2016.
2016-01-01 22:57:19 +01:00
Daniel Marjamäki b457ceef0e Settings: Added defaultSign 2016-01-01 17:33:59 +01:00
Daniel Marjamäki f5715c1496 Rename Unspecified platform type to Native 2016-01-01 16:39:41 +01:00
Daniel Marjamäki 3bd5a4d10e CheckUnusedVar: Fix FP when there is class initialization 2016-01-01 16:04:13 +01:00
Daniel Marjamäki 2f26195b23 Fixed #7248 (crash in ValueType::str()) 2016-01-01 15:13:50 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki dea41e2390 CheckUnusedVar: Fix FP for assignment in while 2016-01-01 12:14:18 +01:00
Daniel Marjamäki e69e952c46 Fixed #7245 (ValueType: Wrong result type for 'sint << uint') 2015-12-31 20:18:35 +01:00
Daniel Marjamäki 98756ea7f5 Fixed #7247 (False positive CastAddressToIntegerAtReturn - returning std::string) 2015-12-31 18:53:07 +01:00
Daniel Marjamäki 350908d0e9 Fix FP in CheckUnusedVar. Caused by #7230 fix. 2015-12-31 15:30:33 +01:00
Matthias Krüger 7c1a4da6a4 testrunner: add testcase for #7246. 2015-12-31 14:17:52 +01:00
Daniel Marjamäki 9f6890512c Refactoring CheckType checkers. Use ValueType. 2015-12-31 12:05:23 +01:00
Daniel Marjamäki 8171154e12 Fixed #7230 (Confusing code snippet in error message) 2015-12-31 01:15:49 +01:00
Daniel Marjamäki 5216f904e7 Refactoring Check64BitPortability. Use ValueType. 2015-12-30 19:59:23 +01:00
Daniel Marjamäki c0e8654649 Refactor void* checking. Use ValueType. 2015-12-30 11:48:20 +01:00
Daniel Marjamäki fdcab8f1bb ValueType: better handling of struct member 2015-12-30 11:36:46 +01:00
Daniel Marjamäki c5c386ceb8 ValueType: Handle void pointers 2015-12-29 19:58:51 +01:00
Daniel Marjamäki bd1037e95b Fixed #7242 (False positive unknownEvaluationOrder - comma expression in function argument) 2015-12-29 12:06:42 +01:00
Daniel Marjamäki 83cb028963 Preprocessor: insert space between ++ or -- in macro expansion 2015-12-29 06:54:44 +01:00
Daniel Marjamäki 25a5ac1846 Split up TestOther::testEvaluationOrder() 2015-12-28 14:04:14 +01:00
Daniel Marjamäki 15ecb26a6c Tokenizer: Moved simplifyAssignmentInFunctionCall from simplifyTokenList1 to simplifyTokenList2 2015-12-28 13:58:41 +01:00
Daniel Marjamäki 0ddb5c12ce Fixed #7238 (False positive unknownEvaluationOrder for comma operator on C code) 2015-12-28 13:45:55 +01:00
Daniel Marjamäki f09dded7b1 TokenList: Better handling of '1++a' and 'a++1' 2015-12-27 14:57:22 +01:00
Daniel Marjamäki 908bc664a4 Evaluation order: ignore usage in sizeof 2015-12-27 14:08:16 +01:00
Alexander Mai e9635fd393 #7236 segmentation fault (invalid code) in ValueFlow::setValues. #7237 segmentation fault (invalid code) in Tokenizer::setVarIdClassDeclaration 2015-12-26 23:51:10 +01:00
amai2012 081f443b2a #7235 segmentation fault (invalid code) in TokenList::createAst 2015-12-26 20:26:07 +01:00
amai2012 36a6599386 #7324 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1 2015-12-26 20:16:01 +01:00
Daniel Marjamäki c672210e06 Evaluation order: don't warn for 'dostuff(expr++, &expr)' 2015-12-26 15:48:43 +01:00
Daniel Marjamäki 32455e8441 Fixed #7214 (ValueType: does not handle static_cast) 2015-12-26 15:20:17 +01:00
Daniel Marjamäki 293bd2eead Fixed #6990 (false negative: Invalid abs() argument nr 1. A non-boolean value is required.) 2015-12-26 01:38:41 +01:00
Daniel Marjamäki 64494ca226 astyle formatting
[ci skip]
2015-12-26 01:37:21 +01:00
Alexander Mai 87767fb666 #7228 segmentation fault (invalid code) in Tokenizer::isFunctionHead 2015-12-26 00:21:56 +01:00
Daniel Marjamäki ab6809f3fa Fixed testrunner 2015-12-25 19:01:32 +01:00
Daniel Marjamäki 24438c326e Fixed #7233 (Fasle negative 'unknownEvaluationOrder in case of macro) 2015-12-25 18:31:21 +01:00
Daniel Marjamäki 27af1bcfd8 Fixed #7229 (Improve check; unknown evaluation order, write different message for self assignment) 2015-12-25 18:00:19 +01:00
Daniel Marjamäki 07b929e13f Added TODO test case for unknown evaluation order 2015-12-25 17:48:15 +01:00
Daniel Marjamäki 90a54b1fae Fixed #7232 (False positive unknownEvaluationOrder on id = Remap( id += 42 );) 2015-12-25 16:45:11 +01:00
Daniel Marjamäki 81f0597316 Fixed #3206 and #7226 (New check: Undefined execution order) 2015-12-24 09:13:20 +01:00
PKEuS 8f641aaa76 Added gets_s() to std.cfg (C11), added <use-retval/> to min/max(). 2015-12-18 18:09:07 +01:00
PKEuS 8f22e4924c Updated AStyle to version 2.05.1
Tweaked runastyle.bat a little bit.
2015-12-17 15:53:13 +01:00
Matthias Krüger 158238ad4b add testcase for #7179 (see bebf8cc ) 2015-12-17 14:08:24 +01:00
Daniel Marjamäki bebf8ccdd5 Revert da15efb3 and 6304a4dd to fix FPs. See #7148, #7179, etc 2015-12-16 14:51:50 +01:00
orbitcowboy ad17a0d721 testsymboldatabase: Improved constness of local variable. 2015-12-15 13:29:58 +01:00
orbitcowboy d93f2994d4 testsymboldatabase: Removed useless call of GetSymbolDatabase. 2015-12-15 13:11:20 +01:00
Daniel Marjamäki 0baad496f2 Fixed #6383 (FP shiftNegative - value converted to unsigned in function argument) 2015-12-14 10:55:23 +01:00
Pavel Bibergal e4dc97c81c faster recursive file collection on huge codebases (posix systems), was 47sec to collect all files, now its only 3 2015-12-13 15:21:01 +02:00
Alexander Mai 96531d6ffe TokenList::createAst() doesn't validate itself anymore. Remove some duplicated code and fix glitch in TestGarbage::garbageCode162 2015-12-12 20:01:03 +01:00
Daniel Marjamäki 9cb8e9a07e Revert "Fixed #3923 (valueFlowForward: assignment in if should not cause bailout for code in else)"
This reverts commit 04f9b71281.
2015-12-12 16:50:02 +01:00
Daniel Marjamäki 04f9b71281 Fixed #3923 (valueFlowForward: assignment in if should not cause bailout for code in else) 2015-12-12 15:50:33 +01:00
Alexander Mai 9a847d7b14 #7208 Cppcheck hangs with 100% CPU load in CheckOther::checkNegativeBitwiseShift (invalidcode). TokenList::validateAst() is running consistency checks on AST 2015-12-12 15:39:38 +01:00
Daniel Marjamäki 392cda8bce Remove qmake pro files. qmake is just for cppcheck-gui nowadays. 2015-12-11 15:20:57 +01:00
Akhilesh Nema 932f6ea81b Cppcheck hangs with 100% CPU load in TemplateSimplifier::checkComplicatedSyntaxErrorsInTemplates (invalidcode) 2015-12-09 14:00:40 +01:00
Alexander Mai 26b699fd30 Fix compiler warnings about incomplete handling of library error codes 2015-12-06 12:52:49 +01:00
Alexander Mai 9d8dffbd79 #6269 false positives in case of overloaded standard library functions. Detect memset() with proper argument cound, using new function numberOfArguments() 2015-12-06 12:50:05 +01:00
PKEuS eb27d3b877 Refactorization: Moved condition out of loop and ran AStyle 2015-12-06 10:40:22 +01:00
Alexander Mai 98f2cd021e #7199 SymbolDatabase::validate() should be run in debug mode and print debug messages. In turn correct some test examples with invalid code. 2015-12-06 08:14:04 +01:00
Alexander Mai ba0859e838 #6981 crash in checkvaarg.cpp (with possible fix). Avoid segfault. Add SymbolDatabase::validate() to allow validating smyboldatabase 2015-12-05 20:55:26 +01:00
Alexander Mai 5ddc5c0798 #7187 internal error; unhandled char constant \e. Support \e char literal support by clang,gcc,tcc 2015-12-05 18:53:03 +01:00
Alexander Mai 86c9387987 #7182 crash: CheckMemoryLeak::functionReturnType() 2015-12-05 18:43:29 +01:00
Matthias Krüger 246147c6e6 TestClass::memsetOnClass(): remove duplicate ASSERT_EQUALS() call. 2015-12-05 18:31:33 +01:00
Alexander Mai e69377d5a8 #7183 CheckClass::checkMemset() uint overflow. Plus some minor refactoring 2015-12-05 18:22:01 +01:00
Alexander Mai 6ae1533cb4 #7190 Cppcheck hangs with 100% CPU load in Tokenizer::simplifyAttribute (invalidcode). Call validate() once more in Tokenizer::simplifyTokenList1 to trigger invalid code exception 2015-12-05 13:55:33 +01:00
PKEuS 308fd1ba50 Fixed false positive 'noCopyConstructor' for static member variable (#7198) 2015-12-04 18:26:49 +01:00
Dmitry-Me 8f8a0097fe Detect more non-interlocked accesses 2015-12-02 10:58:57 +03:00
Daniel Marjamäki 508b06abaa Fixed #6973 (ValueFlow: dont set possible tokvalues in unreachable code) 2015-12-01 07:49:19 +01:00
Matthias Krüger 9a42f52915 testpath: add another explicit test for './././././test.cpp' being the same as 'test.cpp' 2015-11-30 22:04:24 +01:00
Matthias Krüger c7bbc27130 Preprocessor: run paths of some error messages through Path::simplifyPath()
teach Path::simplifyPath() to recursively remove "./././" from beginning of paths.
2015-11-30 19:30:37 +01:00
Daniel Marjamäki 9c3f25603e CheckBufferOverrun: Remove old checking of strings and use new ValueFlow-based checking instead (#6973) 2015-11-30 16:36:52 +01:00
Daniel Marjamäki 8fb6f33aca ValueFlow: dont set dynamic values in unreachable code (#6973) 2015-11-30 16:15:58 +01:00
Daniel Marjamäki 1b0bb02f1d invalidTestForOverflow: Fixed some false negatives (#7184) 2015-11-30 11:12:51 +01:00
Daniel Marjamäki fb8cce647c invalidTestForOverflow: Refactor; move from checkother to checkcondition 2015-11-30 08:51:15 +01:00
Daniel Marjamäki 26a07265a8 Fixed #7184 (Invalid test for overflow 'p + x < p') 2015-11-29 20:59:50 +01:00
Daniel Marjamäki 4fa888ec44 Warn when shifting a negative value, it is UB. (#4931) 2015-11-29 16:28:55 +01:00
Daniel Marjamäki 8a9e068129 Fixed #7119 (Cppcheck hangs with 100% CPU load in Tokenizer::copyTokens (invalidcode)) 2015-11-29 14:56:15 +01:00
PKEuS e8522c7883 Small refactorizations:
- #include cleanup
- Use std::array instead of std::vector
- Do not create a stringstream to concatenate 4 strings
- Use std::cout instead of printf
2015-11-29 10:56:44 +01:00
Alexander Mai f4aaa76639 Fix compile error with clang 2015-11-28 16:50:12 +01:00
Alexander Mai 78489f4293 MathLib::characterLiteralToLongNumber can encode unicode char literals, though it's incompatible to gcc/clang 2015-11-28 16:37:26 +01:00
Daniel Marjamäki 5fabe66ff7 simplifyCalculations: better handling of && and || in conditions (#4931) 2015-11-28 15:00:41 +01:00
Alexander Mai 174317429f Reduce number of threads TestThreadExecutor::many_threads a bit. Especially runs with dynamic analysis tools (asan/ubsan/etc.) cause very high system load. 2015-11-28 12:04:03 +01:00
PKEuS 93c02ce826 Fixed compiler error introduced in previous commit and several MSVC warnings 2015-11-28 10:49:08 +01:00
Daniel Marjamäki c0da6c1541 simplifyCalculations: handle '(4%1<<1&4!=1)' better. must combine '!' '=' before constant folding. fixed the operator precedence for comparison operators. (#4931) 2015-11-28 09:04:22 +01:00
Daniel Marjamäki 1bf547c716 Fixed #4931 (Wrong calculation for '2|0*0&2>>1+0%2*1') 2015-11-27 15:02:49 +01:00
Daniel Marjamäki 1977a18a1e simplifyNumericCalculations: Don't fold negative constants in shift/bitmask calculation. Behaviour is not well defined. 2015-11-27 14:16:49 +01:00
PKEuS 3b4160600d Fixed crash in CheckMemoryLeak::functionReturnType() for unary operator:: (#7172) 2015-11-27 11:18:40 +01:00
PKEuS 0ba3d25917 CheckMemoryLeak: Correctly detect new char[...]() as array allocation (#7164) 2015-11-27 11:04:18 +01:00
Frank Zingsheim 1d7fac3ca9 Added testrunner test to cmake. #7098 2015-11-26 21:01:07 +01:00
Frank Zingsheim 70c20515a9 Cmake object linkage. Fix #7128: (cppcheck 1.70 doesn't report any warnings) 2015-11-26 20:25:09 +01:00
Daniel Marjamäki 2737f63f71 Wrong calculation of constants (simplifying: +,<<,% operations) 2015-11-25 16:46:39 +01:00
orbitcowboy f84af529af Extended windows.cfg and posix.cfg about missing functions, found by using --check-library on some projects. 2015-11-25 11:02:32 +01:00
Alexander Mai a7ab5ecf08 Fix some compiler in MathLib::characterLiteralToLongNumber + some small refactoring 2015-11-23 20:41:21 +01:00
Daniel Marjamäki e8182395f7 Fix 'make checkcfg' by adding inline suppressions when obsolete functions are used. 2015-11-22 17:52:47 +01:00
Alexander Mai b7030fcfa1 Fix compiler error (VS2010) and warning 2015-11-22 16:56:44 +01:00
Daniel Marjamäki d93cf96a29 Fixed #6769 (false positive: Uninitialized struct member: epoch.integer) 2015-11-22 16:20:46 +01:00
Alexander Mai 63b7700660 Use clang/gcc-conforming encoding of multicharacter literals 2015-11-22 14:20:36 +01:00
PKEuS f516de8633 Moved a few checks from CheckOther to CheckFunctions 2015-11-22 13:49:10 +01:00
Alexander Mai 9ca6704c81 #7162 Support multicharacter char literals. 2015-11-22 13:31:31 +01:00
Matthias Krüger 8db72994fb make checkcfg / runtests.sh: be verbose (set -x) 2015-11-22 11:03:10 +01:00
Alexander Mai b1385dd951 Run dmake to update Makefile etc. 2015-11-22 10:40:48 +01:00
PKEuS 57d1196386 Replaced CheckNonReentrantFunctions and CheckObsoleteFunctions by generic CheckFunctions which is based on Library (#6529) 2015-11-22 09:18:07 +01:00
Alexander Mai 517922feb6 MathLib::characterLiteralToLongNumber now reports more specific error messages for unsupported unicode literals (see #7162) 2015-11-22 07:38:38 +01:00
Alexander Mai 714579401f #7160 Internal error: Unhandled char constant '\1'. Correct MathLib::toLongNumber. Create new utility function MathLib::characterLiteralToLongNumber 2015-11-21 22:35:58 +01:00
Daniel Marjamäki 5f68f3ddf6 Fixed #6264 (FP: gimp: struct initialized via pointers to member variables) 2015-11-21 19:31:18 +01:00
Daniel Marjamäki fb0477affd CheckUninitVar: Fixed false negatives when there are conditions 2015-11-21 10:00:21 +01:00
PKEuS 12af125fd3 Fixed false positive stlIfStrFind for function call inside condition.
Removed unnecessary suppressions in .travis_suppressions
2015-11-20 20:08:53 +01:00
Daniel Marjamäki 8fd62e0cf9 Fixed #4931 (Wrong calculation of constants (simplifying: +,<<,% operations)) 2015-11-20 19:43:11 +01:00
Daniel Marjamäki 79a70c1277 MathLib::toLongNumber: Better handling of '\x12' and '\000' char constants 2015-11-20 18:57:48 +01:00
Daniel Marjamäki 4abc0b7c1f Partial fix for #4931 (Wrong calculation of constants (simplifying: +,<<,% operations)) 2015-11-20 16:09:47 +01:00
PKEuS c0e33e20b4 Reimplemented CheckStl::readingEmptyStlContainer() based on Libraries 2015-11-20 15:53:14 +01:00
PKEuS 53b2eca983 Reimplemented CheckStl::stlBoundaries() based on Libraries; Added support for iterators to libraries 2015-11-20 15:53:14 +01:00
Daniel Marjamäki 0022ce8075 Refactor handling of char constants 2015-11-20 10:10:38 +01:00
PKEuS c5b21d12cf Removed lots of redundant tests from testmemleak.cpp, added some missing types to gtk.cfg 2015-11-19 18:51:32 +01:00
PKEuS 2e7c5d37df Refactorizations in checkmemoryleak.cpp:
- Rely more on <alloc> declarations in Libraries
- Removed unreachable debug message
- Simplified code
2015-11-19 17:34:17 +01:00
PKEuS 0d25a43a5d checkmemoryleak.cpp: Refactorized CheckMemoryLeakNoVar::check() and replaced a redundant whitelist by CheckMemoryLeakInFunction::test_white_list() 2015-11-19 17:34:17 +01:00
Daniel Marjamäki 40851a12ef Fixed #4627 (Tokenizer::setVarId: function declaration in function body) 2015-11-19 16:27:16 +01:00
PKEuS ab171fc027 Fixed false negatives in CheckMemoryLeakStructMember::checkStructVariable():
- Use generic detection of allocation/deallocation (#4770)
- Make the checker usable for C++ by checking for destructors
- Reduced unit test duplication
2015-11-19 16:10:26 +01:00
PKEuS db6174bb60 Refactorization: Support Types that consist of more than a single token in CheckMemoryLeakNoVar::checkForUnsafeArgAlloc
Removed obsolete comments
2015-11-19 16:10:26 +01:00
Daniel Marjamäki 4d3e231bd0 Fixed #3948 (False positive: variable not initialised - used in multi-condition if-clause) 2015-11-19 13:09:45 +01:00
PKEuS 87d3ed91ab Refactorization:
- Improved and cleaned up CheckMemoryLeak::functionReturnType()
- Cleaned up whitelist from functions declared as <leak-ignore/> in std.cfg
2015-11-18 22:09:27 +01:00
PKEuS 1566b72c5b Fixed broken AST for simple expressions with delete operator.
Fixed cppcheck internal warning
2015-11-18 21:37:37 +01:00
PKEuS e990cfb76b Fixed setVarId() for destructors 2015-11-18 21:13:58 +01:00
PKEuS 6ee4cf80dc Improved detection of new operator in checkmemoryleak.cpp, fixed TODO unit test 2015-11-18 20:33:39 +01:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Daniel Marjamäki 04ecbba361 Fixed #7135 (ValueFlow: Wrong pointer alias set for 'p = &p[x];') 2015-11-15 23:38:23 +01:00
Alexander Mai 435a980ce2 Convert wrong test result for #7133 to TODO_ASSERT_EQUALS and add more test cases 2015-11-15 20:14:20 +01:00
Daniel Marjamäki 71bf0f076f CheckAutoVariables: Handle 'x-y' better in isAutoVarArray 2015-11-15 19:34:36 +01:00
Alexander Mai 65666a1ba4 Makefile: explicit list directories which should be used with ctags. Run astyle. 2015-11-15 19:03:18 +01:00
amai2012 f0bf749621 #7133 crash: Variable::declarationId(). 2015-11-15 19:01:29 +01:00
Daniel Marjamäki ca8b15cd6b Fixed #7124 (int32_t etc are recognised as fundamental types, but std::int32_t etc are not) 2015-11-15 17:51:27 +01:00
PKEuS 25749ab19f Fixed another crash in clang test suite and let two times two functions in std.cfg share same configuration 2015-11-15 14:55:30 +01:00
Daniel Marjamäki 4e578af603 CheckAutoVar: Improved usage of AST and ValueFlow 2015-11-15 14:48:13 +01:00
PKEuS 481d800d5a Fixed crash in clang test suite. 2015-11-15 14:40:31 +01:00
PKEuS 3f255e7685 Use Library information in Tokenizer::sizeOfType() 2015-11-15 14:37:02 +01:00
Daniel Marjamäki c10a10c26f CheckAutoVariables: use ValueFlow to detect more errors when pointer aliases are used 2015-11-15 12:10:35 +01:00
Alexander Mai 835c234e18 #7131 crash: Tokenizer::setVarId() 2015-11-14 21:22:53 +01:00
Alexander Mai af2ada9258 #6692 False positive: Hidden member variable - parent class with same name in different namespace. Add regression test for FP which got fixed in 1.70 already 2015-11-14 14:44:27 +01:00
Daniel Marjamäki b10110b5ac CheckClass: Removed noExplicitCopyMoveConstructorError after discussion in http://sourceforge.net/p/cppcheck/discussion/general/thread/b2ce9d3d/. 2015-11-13 12:48:26 +01:00
PKEuS f9bc229d4b Support varids in nested classes that are declared outside of outer class (#7127) 2015-11-13 10:07:57 +01:00
Daniel Marjamäki 595f1e1a27 ValueFlow: set value for char literals 2015-11-12 16:38:58 +01:00
Daniel Marjamäki 34dbc3c00c ValueFlow: Improved handling of a[i] 2015-11-12 16:14:27 +01:00
Daniel Marjamäki 4ec333dbb6 Fixed #7007 (ValueFlow: value is not known, modified by subfunction) 2015-11-12 14:59:35 +01:00
PKEuS 1589841cb6 Fixed crash in clang test suite with member variable pointers 2015-11-11 18:26:59 +01:00
PKEuS 36c5815ddb Fixed false positive about redundant variable assignment in try-scopes if the variable is read in catch block (#6555) 2015-11-11 17:21:55 +01:00
PKEuS a8cf63239a Fixed false positive autovarInvalidDeallocation if deallocting result of member function (#6551) 2015-11-11 16:59:31 +01:00
Daniel Marjamäki b9b0964dab Fixed #7006 (False positive Mismatching assignment and comparison (variable is changed in loop)) 2015-11-11 13:45:28 +01:00
PKEuS ee00925dc5 setVarId: Support throw() in constructor implementations (#7123) 2015-11-11 11:01:49 +01:00
Alexander Mai 869334acf5 #6554 False positive eraseDereference - erase in while() loop. Add regression test for bug fixed in 1.70 2015-11-10 19:03:35 +01:00
PKEuS 03d52de74b Treat "class" keyword similar to "struct" or "union" on C++ code (#6696) 2015-11-10 17:03:27 +01:00
PKEuS cc9a1f4375 Fixed setVarId() for template in initializer list (#7122) 2015-11-10 16:14:53 +01:00
PKEuS feae241fc0 Fixed simplification of pointers (#6829) 2015-11-10 14:45:24 +01:00
PKEuS 6336372fb4 Apply same heuristics in CheckMemoryLeakNoVar::checkForUnusedReturnValue() as in CheckOther::checkIgnoredReturnValue(): Ensure that a defined function has non-void return value. (#6693) 2015-11-10 14:19:45 +01:00
Daniel Marjamäki 459a4e0cbe Fixed #7121 (False positive 'Uninitialized variable' converting pointer to reference) 2015-11-10 10:18:24 +01:00
PKEuS 5cd36d6f8a Refactorization: Use varid instead of variable name in CheckClass::initializeVarList() and fixed issue in setVarId().
Fixed internal warning.
2015-11-09 23:00:14 +01:00
PKEuS 49a9b011eb Fixed handling of this-> and (*this). in setVarId() 2015-11-09 21:43:40 +01:00
PKEuS db342ea910 Handle alias variables in CheckClass::initializeVarList() (#6921) 2015-11-09 21:02:06 +01:00
PKEuS aca8a69f5e Skip over lambdas in CheckClass::checkPureVirtualFunctionCall() (#4992) 2015-11-09 20:15:26 +01:00
PKEuS f15f8514f6 Fixed crash on garbage code (#7120) 2015-11-09 17:25:20 +01:00
PKEuS 389d30fe44 Fixed crash on garbage code (#7118) 2015-11-09 11:21:07 +01:00
Daniel Marjamäki 5074c11b53 CheckBufferOverrun: Fixed FP when accessing string that contains '\0'. Refactoring address-of. 2015-11-09 10:30:39 +01:00
Daniel Marjamäki ef5be435c7 Fixed #7113 (False positive arrayIndexOutOfBounds - using pointer alias with cast) 2015-11-08 17:21:32 +01:00
Daniel Marjamäki fc564d779e Fixed #7112 (crash: CheckBufferOverrun::checkGlobalAndLocalVariable (invalid code)) 2015-11-08 14:21:12 +01:00
Daniel Marjamäki 37dbebb093 Fixed #7049 (valueflow: value is not known after case) 2015-11-08 14:08:47 +01:00
Alexander Mai ab296fa93f 7111 segmentation fault (invalid code) in Tokenizer::simplifyRedundantParentheses 2015-11-08 13:45:55 +01:00
PKEuS 32f0cbb6ad Fixed false positive eraseDereference with range-based for-loops (#7106) 2015-11-08 09:42:55 +01:00
Daniel Marjamäki 7d6e1974eb Fixed #7104 (False positive arrayIndexOutOfBounds) 2015-11-08 09:30:23 +01:00
PKEuS fdb596fa05 Do not set "pure" flag if function is declared as "= default" (#7101) 2015-11-07 22:21:50 +01:00
Matthias Krüger dc823c65fa testrunner: add testcase for crash which was fixed in previous 2 commits. 2015-11-07 20:48:52 +01:00
Daniel Marjamäki 9c7271a5e9 CheckBufferOverrun: The simplifyKnownVariables() has been reduced, use ValueFlow instead 2015-11-07 18:12:01 +01:00
Daniel Marjamäki f7a7a8a95c Fixed #6934 (False positive returnLocalVariable - assigning local array to function argument) 2015-11-07 15:07:26 +01:00
PKEuS 9a879fc828 Fixed false positives with pointerSize being shown even if no sizeof() is used (#7100). 2015-11-07 13:19:06 +01:00
Alexander Mai 2554674f4b Add regression test for previously fixed #6064, and TODO test for #6081 2015-11-07 11:17:44 +01:00
PKEuS 49f6231756 Fixed two issues in CheckSizeof::checkSizeofForPointerSize() 2015-11-07 09:35:30 +01:00
PKEuS b20a7e3192 Refactorization: Moved two tests to testgarbage.cpp
Fixed wrong comment in testcppcheck.cpp (forgotten in previous commit)
2015-11-06 21:58:49 +01:00
PKEuS 61b16909bd Fixed false negative pointerSize with member variables.
Fixed wrong comment in testcppcheck.cpp
2015-11-06 21:48:56 +01:00
PKEuS 7a90b763f6 Tokenizer::simplifyLabelsCaseDefault(): Do not insert ; between two cases. 2015-11-06 19:59:23 +01:00
PKEuS 95a0c0f14c Limit the number of cases created by Tokenizer::simplifyCaseRange(). 2015-11-06 19:21:56 +01:00
PKEuS 1fe1d7ea4a Extended Tokenizer::simplifyCaseRange() to support also ranges of chars. 2015-11-06 18:46:43 +01:00
PKEuS 41b1b9d850 Support case ranges (gcc extension, #6490) 2015-11-06 18:39:03 +01:00
PKEuS 2ac8da0497 Fixed #6548 also for noexcept 2015-11-06 18:00:59 +01:00
PKEuS be36539ad7 Fixed AST generation for C++11-style initialization (#6528) 2015-11-06 17:34:26 +01:00
PKEuS 62bc827eb0 Fixed createLinks2() when inheriting from a template (#6601) 2015-11-06 10:44:37 +01:00
PKEuS eb2b0fa0d0 Fixed wrongly detected unconditional scope with C++11-style initialization in SymbolDatabase (#6581) 2015-11-06 10:16:44 +01:00
PKEuS eefea507b9 Use ValueFlow in CheckIO::checkWrongPrintfScanfArguments() (#6563) 2015-11-06 09:52:22 +01:00
Alexander Mai 3177d73fb0 #7089 segmentation fault (invalid code) in Tokenizer::simplifyTokenList1. Refactor some functions to accept argument as refernce instead of pointer 2015-11-05 19:00:08 +01:00
PKEuS 83a816b109 Fixed crash on garbage code (#7085) 2015-11-04 10:26:55 +01:00
PKEuS 6c20f4b2a2 Fixed crash on garbage code (#7090) 2015-11-04 10:10:20 +01:00
PKEuS 8374e8414b Fixed use-after-free in clang test suite introduced recently (#7087) 2015-11-03 19:24:19 +01:00
PKEuS b97f9e576d Fixed crash in clang test suite introduced by previous commit. 2015-11-02 22:53:05 +01:00
PKEuS b049050792 Fixed wrong parsing of ^{} 2015-11-02 22:14:41 +01:00
PKEuS 4f565ba90f Fixed crashs on garbage code (#7082) 2015-11-02 21:30:28 +01:00
PKEuS 23e6e5a568 Fixed crash on garbage code (#7081) 2015-10-31 18:11:56 +01:00
Miika-Petteri Matikainen acd8a092f8 Make syntaxError suppressable (fixes #5917 and #7076)
syntaxErrors were not suppressable, because they were treated as
InternalErrors which were thrown and catched during the checking,
and normal suppression rules were not applied for those.

We fix this by calling the normal reportErr() function that does
suppression matching.
2015-10-28 20:53:35 +02:00
PKEuS 963008089d Fixed false positive with range-based for-loop (#7078) 2015-10-28 16:37:46 +01:00
PKEuS 4ee56d2306 Fixed simplifyAssignmentInFunctionCall for complex expressions (#6927) 2015-10-27 20:01:40 +01:00
PKEuS 7866990d04 Fixed false positive with range-based for-loop (#7075) 2015-10-27 14:47:18 +01:00
Daniel Marjamäki bfd8a69e74 Fixed #6243 (False positive: uninitialized variable, looping with goto) 2015-10-27 12:40:52 +01:00
Daniel Marjamäki 4b0625c570 Fixed #6239 (Possible null pointer dereference after pointer is modified by a function template) 2015-10-27 12:33:46 +01:00
PKEuS 24882fb53a Fixed VarId accidentially assigned to case labels. 2015-10-26 21:24:53 +01:00
PKEuS dfdc0f6b99 Support range-based for-loop in SymbolDatabase 2015-10-26 19:20:42 +01:00
PKEuS 5add1d8901 Set VarId in range-based for-loops 2015-10-26 19:03:23 +01:00
PKEuS a5f577d179 Support range-based for-loop in CheckClass::checkConst() (#5514) 2015-10-26 18:48:01 +01:00
Alexander Mai 7d8b62e615 Add regression test for #6669 Return value of malloc is reported not stored, while it is. 2015-10-26 18:24:49 +01:00
PKEuS 636bf75799 Fixed crash on garbage code (#7074) 2015-10-26 13:29:47 +01:00
PKEuS 0370c66e41 Fixed broken function Token::getCharAt() (#7073) 2015-10-26 11:51:05 +01:00
PKEuS 297f2c78bd Fixed false positives variableHidingTypedef (#5624, #6507) 2015-10-26 10:06:52 +01:00
PKEuS ee58587706 Fixed false positive unreachableCode when ternary operator is used (#6664) 2015-10-26 08:29:43 +01:00
amai2012 116c10c7d6 Merge pull request #700 from simartin/ticket_6998
Ticket #6998: Properly handle "typedef unsigned T;" constructs.
2015-10-24 15:24:27 +02:00
Simon Martin 5d40a3ab66 Ticket #6998: Properly handle "typedef unsigned T;" constructs. 2015-10-24 12:27:26 +02:00
PKEuS e989d4b11b Support C++11 array initialization in CheckUninitVar (#7010) 2015-10-24 12:06:40 +02:00
Daniel Marjamäki fc2bf2ef08 Fixed #7065 (AST: More explicit handling of lambda functions, generate ast for ';new Fred;') 2015-10-20 23:55:29 +02:00
Alexander Mai 3b1d849476 Correct template syntax check which got introduced by an attempt fix #6865. Disable test for #6865, adjust some modified tests and add new regression tests 2015-10-19 20:03:33 +02:00
Daniel Marjamäki b856ac51dd Fixed #7064 (Tokenizer: Wrong simplification of 'a.public:') 2015-10-19 10:01:57 +02:00
Philipp Kloke 06c20252fa Added dot at end of stringLiteralWrite message 2015-10-19 09:01:21 +02:00
Philipp Kloke 7060c7c87d Refactorization: Reduced code duplication in testlibrary.cpp 2015-10-19 09:01:20 +02:00
Philipp Kloke a837cc48e0 Refactorization: Simplified code in tokenlist.cpp, token.cpp and testthreadexecutor.cpp 2015-10-19 09:01:20 +02:00
Alexander Mai 8667184f12 #7062 Remove unnecessaryQualification check 2015-10-18 17:00:09 +02:00
Daniel Marjamäki 9be284e80f AST: proper operator precedence for c++11 initializer {} and :: 2015-10-18 16:58:15 +02:00
PKEuS 52be380ef0 Fixed fix for #7042 - support hexadecimal digits 2015-10-18 16:37:33 +02:00
Alexander Mai 21efa992e3 #6865 TemplateSimplifier::expandTemplate doesn't terminate on invalid code. Add some another syntax check on templates to avoid problems later on. 2015-10-18 15:47:37 +02:00
Daniel Marjamäki 9bb2af1893 Fixed #7059 (AST: handle C++ initialization with {} better) 2015-10-18 13:43:39 +02:00
Alexander Mai 8f07b2e440 #6922 valueFlowForward does not terminate: xorg/driver/xf86-video-neomagic : src/neo_driver.c (invalid code). Add regression test for previously fixed bug. 2015-10-18 11:52:25 +02:00
Daniel Marjamäki fe4fac7eb2 Fixed #7058 (Tokenizer::simplifyTypedef: wrong simplification of enum constant 'AB::A' if AB is a struct typedef) 2015-10-18 04:55:04 +02:00
Daniel Marjamäki ec87b09d89 Fixed #7056 (iscast does not handle '(ulong)~0' properly, Tokenizer::simplifyCalculations wrongly simplifies '(ulong)~0' to 'ulong~0') 2015-10-17 18:58:13 +02:00
Daniel Marjamäki 30af2fcd73 iscast: handle '(ulong)~0' better 2015-10-17 18:25:27 +02:00
Daniel Marjamäki c88297c971 Fixed #7054 (AST: handle C++ initialization with {} better) 2015-10-17 17:03:24 +02:00
Alexander Mai 8e3e981323 #7050 segmentation fault (invalid code) in isVariableChanged 2015-10-15 21:27:55 +02:00
Daniel Marjamäki 6cf25825de Fixed #7030 (Tokenizer::simplifyTypedef: Label) 2015-10-15 16:56:22 +02:00
PKEuS 46bfa62aad Execute prepareTernaryOpForAST earlier (#7048) 2015-10-15 10:31:54 +02:00
Alexander Mai 600641c4c5 #7043 segmentation fault (invalid code) in Tokenizer::simplifyVarDecl 2015-10-14 20:34:55 +02:00
PKEuS d0cc97a4cf Fixed wrong syntax error (#7045) 2015-10-14 16:01:48 +02:00
PKEuS a97f6f973f Support C++14 digit separators (#7042) 2015-10-14 12:00:54 +02:00
Daniel Marjamäki 60f8982999 Fixed #7039 (ValueFlow: bitand calculation '16&15') 2015-10-14 10:44:04 +02:00
Daniel Marjamäki a04e072976 Fixed #7040 (False positive syntaxError False positive syntaxError) 2015-10-13 20:31:17 +02:00
PKEuS 3971f8625f Fixed false positive seekOnAppendedFile if FILE* is reused (#6566) 2015-10-13 15:32:13 +02:00
PKEuS 05b5275110 Improved AST:
- Fixed TODO for ternary operator. Add parantheses between ? and : where necessary as a preparation for createAst()
- Improved AST validation:
-- Better message for binary operator with only one operand
-- Ensure ? has : as second operand (#7035)
2015-10-12 19:21:48 +02:00
Daniel Marjamäki 97326fce13 Fixed #6992 (argument name of function typedef conflicts with local variable name) 2015-10-12 10:15:02 +02:00
Daniel Marjamäki ac9cb87e04 ValueType: Handle bit operations, sizeof better. Use ValueType in astIsFloat(). 2015-10-11 12:20:40 +02:00
Daniel Marjamäki 5b082aa799 ValueType: struct member 2015-10-11 10:48:08 +02:00
Daniel Marjamäki 9738cc66eb ValueType: function return type 2015-10-11 08:42:31 +02:00
Daniel Marjamäki cf179f82b6 ValueType: Better handling of wide strings 2015-10-11 08:13:30 +02:00
Daniel Marjamäki 0849ad4707 ValueType: Better handling of const 2015-10-10 08:32:45 +02:00
PKEuS 2eb8492993 Fixed crash on garbage code #7034 2015-10-09 13:49:17 +02:00
PKEuS 7d624f2e21 Fixed crash on garbage code #7033 2015-10-09 13:06:52 +02:00
PKEuS 70dce7701a Refactorization: Reduced code duplication in testpreprocessor.cpp 2015-10-09 12:27:39 +02:00
Daniel Marjamäki a500f6f703 Improved handling of 'long double' and address-of in ValueType. Removed Tokenizer::simplifyFloatCasts() to handle float casts better. 2015-10-08 19:50:10 +02:00
PKEuS 856e4c414d Refactorization: Reduced code duplication in testsymboldatabase.cpp 2015-10-08 12:53:56 +02:00
PKEuS 3645e3c16b Fixed two TODO unit tests by delaying arraySize simpification until createLink2 is executed 2015-10-08 12:52:28 +02:00
PKEuS 0a34b206e8 Refactorization: Reduced code duplication in test suite 2015-10-08 11:35:51 +02:00
Philipp Kloke 4ac6623875 Moved a few tests out of testtokenize.cpp; refactorized them 2015-10-07 22:45:38 +02:00
Daniel Marjamäki 2fd27ff729 ValueType: Test promotions 2015-10-07 19:50:33 +02:00
PKEuS 0fa3b8806c Refactorization: Use '\x..' syntax to avoid cast and "#pragma warning". 2015-10-07 19:41:54 +02:00
Daniel Marjamäki 604a9acb48 ValueType: Handling constness 2015-10-07 19:08:26 +02:00
PKEuS b7f2f826a4 Refactorization: Removed some redundant code 2015-10-07 18:40:04 +02:00
PKEuS 3a5cef8a7e Refactorization: Improved usage of Settings instances in test suite 2015-10-07 18:40:03 +02:00
Daniel Marjamäki db31e22316 ValueType: Improved signedness 2015-10-07 18:10:48 +02:00
PKEuS f1bbcfe32d Refactorization: Avoid loading std.cfg multiple times in testautovariables.cpp 2015-10-07 14:40:09 +02:00
PKEuS 93dbfb72d1 Improved REGISTER_TEST() macro to support several occurrences within a single file 2015-10-07 14:30:01 +02:00
PKEuS 07b661ef62 Refactorization: Improved handling of preprocessor in test suite
- Set Preprocessor::macroChar to '$' once in the beginning to avoid problems when changing the order of tests
- Removed Preprocessor usage from where it is not required
- Fixed a TODO in testuninitvar.cpp
2015-10-07 14:18:57 +02:00
PKEuS 50ed47c725 Fixed crash on garbage code (#7022) 2015-10-07 13:52:06 +02:00
Daniel Marjamäki f5d9ba9cf3 Rewrote the charvar checker. It now uses valueflow also to limit false negatives. 2015-10-06 17:30:51 +02:00
amai2012 88b3d90505 #7023 segmentation fault (invalid code) in astIsIntegral. Avoid crash, unfortunately there is no syntax error yet detected. 2015-10-06 11:21:31 +02:00
Daniel Marjamäki b77203a277 CheckIO: Handle AST pointer type better 2015-10-05 19:59:15 +02:00
Daniel Marjamäki b9036c2ca8 AST types: Fix for 'long long' handling 2015-10-05 19:20:42 +02:00
Daniel Marjamäki 8f6bd7fd0d Fixed #7014 (False positive for printf("%c", "hello"[0])) 2015-10-05 10:12:30 +02:00
Daniel Marjamäki f35c24d4af SymbolDatabase: Better handling of valuetypes in AST 2015-10-04 23:27:58 +02:00
Daniel Marjamäki 9b253612ca SymbolDatabase: Add type information in AST 2015-10-04 19:42:58 +02:00
Frank Zingsheim 3bc21b8138 Fixed #6996 (ValueFlow: known and possible values) 2015-10-04 10:33:43 +02:00
Daniel Marjamäki f5bd00f153 Library: return true from Library::isnullargbad() for format string arguments. Related with #7012. 2015-10-03 20:51:45 +02:00
Daniel Marjamäki a574fda8a9 Fixed #6935 (Wrong duplicate expression) 2015-10-03 14:56:24 +02:00
Alexander Mai 27f72d7ae0 #7020 segmentation fault (invalid code) in Tokenizer::simplifyTypedef. #7021 segmentation fault (invalid code) in Tokenizer::simplifyEnum 2015-10-03 10:47:23 +02:00
Simon Martin 0f7e20c11d Ticket #7017: Properly interpret operator= return type for template classes in CheckClass::operatorEq. 2015-10-02 23:23:44 +02:00
amai2012 fde59242bb #7018 segmentation fault (invalid code) in Tokenizer::simplifyEnum 2015-10-02 15:33:23 +02:00
Martin Ettl 2fbb25e9bc test/std.cfg: Added more test cases and comments. 2015-10-01 20:18:06 +02:00
Martin Ettl dc051f077d #6667: Added a regression test to testgarbage. 2015-09-30 21:55:32 +02:00
Martin Ettl 12b4bf75e0 std.cfg: Fixed false negatives regarding uninitialized variable usage and added test cases. 2015-09-30 13:10:31 +02:00
Martin Ettl 0b782853fe Imroved std.cfg and added more test cases. 2015-09-30 12:45:40 +02:00
Martin Ettl 4fcd324ccd Improved testing of std.cfg regarding <arg nr=any> configured functions and added more test cases. 2015-09-30 12:18:56 +02:00
Martin Ettl c64f9cf9b1 #7012: Fixed FP in std.cfg by explicitly definining the first parameter of snprintf. 2015-09-29 21:33:39 +02:00
Martin Ettl 69b1e21560 Improved testing of std.cfg and added more test cases for snprintf(). There is a FP (according to #7012). 2015-09-29 21:14:22 +02:00
PKEuS e6467703b2 Support cast to ** in Tokenizer::simplifyCasts() (#7005) 2015-09-28 16:08:14 +02:00
PKEuS 590f1f1d66 Fixed handling of __asm...__endasm (#6970) 2015-09-28 15:43:48 +02:00
Thomas Otto 7ba69cfd0a sizeofCalculation: skip if void-casted inside a macro (#6888) 2015-09-28 14:33:29 +02:00
Daniel Marjamäki bd243a4748 Fixed #6903 (ValueFlow: Fix FP in ?:) 2015-09-27 13:29:28 +02:00
Dmitry-Me 6304a4dddb Fix FP for members of temporaries 2015-09-25 13:57:11 +03:00
Dmitry-Me da15efb3f6 Fix FN for distinct structs with identical members 2015-09-24 18:29:08 +02:00
Martin Ettl 7476f0d1c2 std.cfg: Added support for wmemcmp() and corresponding test cases. 2015-09-23 22:46:36 +02:00
Alexander Mai c27fc31fcf #6997 segmentation fault (invalid code) in CheckUninitVar::checkIfForWhileHead. Detect invalid syntax. 2015-09-23 10:33:55 +02:00
orbitcowboy 3bc4ea4e51 Merge pull request #687 from Dmitry-Me/tellIfItsStructOrUnion
Tell if it's struct or union
2015-09-22 21:14:30 +02:00
Martin Ettl 34dcf1182c test/cfg: Deactivated a test case in std.cpp, which tests std::string::find (three parameter version). It cases the travis build to be failing. 2015-09-22 20:54:25 +02:00
Dmitry-Me 0b991f5560 Tell if it's struct or union 2015-09-22 17:38:23 +03:00
Martin Ettl 10da5d6d2f std.cfg: Added configuration for std::string:find. 2015-09-21 23:01:51 +02:00
Martin Ettl f2fae9836b test/cfg: Another attempt to fix travis build. 2015-09-21 21:51:19 +02:00