Commit Graph

9101 Commits

Author SHA1 Message Date
Daniel Marjamäki 3d587d2704 Revert "Fix CID 1368511"
This reverts commit 41a79152a9.
2017-09-19 23:13:40 +02:00
Daniel Marjamäki 1a057bc23a Revert "Remove redundant safety logic (CID 1368511)"
This reverts commit d892031f28.
2017-09-19 23:13:31 +02:00
Daniel Marjamäki d892031f28 Remove redundant safety logic (CID 1368511) 2017-09-19 23:07:02 +02:00
Dmitry-Me 41a79152a9 Fix CID 1368511 2017-09-19 22:35:00 +03:00
Dmitry-Me 05d58f5c51 Unify classEnd check for scope 2017-09-19 22:13:50 +03:00
Daniel Marjamäki 840c7eb258 checkFloatToIntegerOverflow: check all calculations, not only in function bodies 2017-09-19 19:30:24 +02:00
Daniel Marjamäki 9268c2034a checkSignConversion: check all calculations, not only in function bodies 2017-09-19 19:25:33 +02:00
Daniel Marjamäki f6e30eee19 checkIntegerOverflow: handle long and long long also 2017-09-19 19:14:29 +02:00
Daniel Marjamäki cac7146cac checkIntegerOverflow: check all calculations, not only in function bodies 2017-09-19 14:43:48 +02:00
Daniel Marjamäki 6bc0df2908 checkTooBigBitwiseShift: Separate id for signed shift overflow 2017-09-19 09:21:20 +02:00
Daniel Marjamäki be0ad20a04 checkTooBigBitwiseShift: bitshift overflow when lhs is signed 2017-09-19 09:08:44 +02:00
Daniel Marjamäki 0cf551351b tooBigBitwiseShift: check all calculations, not only in function bodies 2017-09-19 08:50:19 +02:00
Dmitry-Me 696c5b8100 Reduce duplication, omit building unneeded string 2017-09-18 03:06:35 +03:00
Dmitry-Me 7d6ef71c4d More selective match pattern 2017-09-18 02:45:02 +03:00
Daniel Marjamäki 2e6d78bd08 Fixed #8184 (Syntax error: case outside switch) 2017-09-15 22:37:31 +02:00
Daniel Marjamäki 1dbcba4dd6 Fixed #8221 (ValueFlow: value for static variable that is not written) 2017-09-15 15:58:19 +02:00
Daniel Marjamäki d79762cfc3 Fixed #7449 (reademptycontainer (inconclusive) when variable changed in function ) 2017-09-15 10:49:58 +02:00
Dmitry-Me 349a28705a Clarify code with assertions 2017-09-15 01:11:27 +03:00
Dmitry-Me 0fe82335ac Remove duplicated method call 2017-09-15 00:53:44 +03:00
Dmitry-Me f28524fefa Unify variable names 2017-09-15 00:44:59 +03:00
Daniel Marjamäki ef1f3fbee6 Fixed #8173 (ValueFlow: use AST when setting values in assignment RHS ((n=42) && n=='A')) 2017-09-14 22:49:47 +02:00
Daniel Marjamäki 927b14b60f Fixed #8217 (Crash in isVariableChanged()) 2017-09-14 15:45:15 +02:00
Daniel Marjamäki bb20c0504e CheckCondition: Fix FP in daca (iqtree) 'in >> ch' 2017-09-13 22:46:36 +02:00
Daniel Marjamäki 5c7cf584ef bump simplecpp 2017-09-12 22:42:10 +02:00
Dmitry-Me 37dea8a5cf Only check the value if it wasn't surely set by previous code 2017-09-12 23:20:07 +03:00
Dmitry-Me a4c20b3606 Break loop early 2017-09-12 07:48:06 +03:00
Dmitry-Me 4126fab1d5 Simplify code with temporary 2017-09-12 07:46:38 +03:00
Dmitry-Me caebf137bc Cache and reuse value 2017-09-12 00:21:36 +03:00
Dmitry-Me 9ff04b4df1 Resolve CID 1368512
Wrong pointer was being checked
2017-09-11 23:50:42 +03:00
Dmitry-Me 988de6422e Omit repeated computations 2017-09-11 18:36:44 +03:00
Daniel Marjamäki 56544ac936 Fixed #8211 (Crash on incomplete code in isVariableChanged ()) 2017-09-11 13:45:36 +02:00
Daniel Marjamäki db321c2617 CheckCondition: Fix FP when there is increment/decrement in condition (daca icu) 2017-09-10 22:58:05 +02:00
Daniel Marjamäki c34fdd1905 CheckCondition: Fix FP for undeclared variables (daca) 2017-09-10 22:30:41 +02:00
Daniel Marjamäki b9b47809f9 Fixed #8197 (iscast: '(b)&1' is not a cast) 2017-09-08 22:52:16 +02:00
Daniel Marjamäki b81b4fcb78 Fixed #8208 (CheckCondition: Use Library to determine if function is const) 2017-09-08 18:08:32 +02:00
Daniel Marjamäki 899ad8479d CheckCondition: Fixed FP when condition contains global static variable 2017-09-08 15:44:56 +02:00
Daniel Marjamäki d9adb5432a astyle formatting
[ci skip]
2017-09-08 15:41:14 +02:00
Nekto89 9cbfa0e383 Fix #7803: false negative: condition is always true 'if (flags & A)' (#938) 2017-09-08 14:30:42 +02:00
Daniel Marjamäki 58db814d72 Rephraze /Same/Identical/ 2017-09-08 12:41:33 +02:00
Daniel Marjamäki 97125acabd Fixed #7365 (False positive: Use of erased iterator) 2017-09-08 09:45:30 +02:00
Daniel Marjamäki 57004ed533 Fixed #7663 (False positive: uninitialized variable (multi variables in inner scopes)) 2017-09-07 23:08:55 +02:00
Daniel Marjamäki 120d0f86d0 CheckCondition: Fix FP about same condition when switch case is used (daca) 2017-09-07 22:05:01 +02:00
Ayaz Salikhov 1d2b58e828 Correctify explicit usage (#951) 2017-09-07 13:03:45 +02:00
Ayaz Salikhov 64eccd780c Don't use static where not needed (#952) 2017-09-07 13:01:07 +02:00
Ayaz Salikhov f0b5327450 Fix codestyle (#953) 2017-09-07 13:00:46 +02:00
Ayaz Salikhov 0fc35c1350 Name all params (#956) 2017-09-07 12:59:53 +02:00
Daniel Marjamäki 4c30a5af25 CheckCondition: Break out code to check if function call is non-const 2017-09-06 22:51:21 +02:00
Daniel Marjamäki e0c7f7f8f2 CheckCondition: Fix FP when there are method calls in condition 2017-09-06 22:26:00 +02:00
Dmitry-Me 68f6cad2aa Omit repeated search when no insertion occurs 2017-09-06 18:02:27 +03:00
Dmitry-Me 66524ef645 Clarify code using temporary 2017-09-06 18:00:23 +03:00
Dmitry-Me 35f5515931 Fix CID 1360383 2017-09-06 00:12:09 +03:00
Matthias Krüger 58a64702b7 add "internalAstError" id so we can easily track ast errors on daca. 2017-09-05 22:49:16 +02:00
Daniel Marjamäki 35736364f8 Fixed #8199 (false negative: (warning) Same condition '...', second condition is always false) 2017-09-05 22:45:28 +02:00
Daniel Marjamäki e5e6f37e41 Fixed #7405 (false positive: (warning) Opposite conditions in nested 'if' blocks lead to a dead code block.) 2017-09-05 22:03:29 +02:00
Dmitry-Me 3127fcf429 Omit repeated computations 2017-09-05 17:56:57 +03:00
Dmitry-Me 0e444aa133 Cache and reuse values 2017-09-05 17:50:36 +03:00
Daniel Marjamäki c1000998f0 CheckCondition: Fix FP found in daca results (ace) 2017-09-05 09:33:35 +02:00
Dmitry-Me d7b91a9e92 Fix CID 1378763
Defensive check recovered from earlier version of this code
2017-09-05 00:17:51 +03:00
Dmitry-Me 7e823e6d8e Extract repeating checks, break loop early 2017-09-05 00:04:48 +03:00
Dmitry-Me 79f74fc4d3 Break loop early 2017-09-05 00:00:02 +03:00
Dmitry-Me 7c8cb29d14 Extract repeating checks 2017-09-04 23:58:14 +03:00
Daniel Marjamäki d02d235e5e Refactoring oppositeInnerCondition checking 2017-09-04 22:54:06 +02:00
Daniel Marjamäki d82805b7fe CheckCondition: Improved checking for same conditions 2017-09-04 22:40:34 +02:00
Dmitry-Me 5885988b1f Cache and reuse value 2017-09-04 23:33:52 +03:00
Dmitry-Me aece2254d7 Put faster checks first 2017-09-04 23:33:14 +03:00
Daniel Marjamäki abae5e0156 Fixed #8198 (false positive: (warning) Same condition, second condition is always false) 2017-09-04 22:25:20 +02:00
Dmitry-Me f7ab8c5ebb Drop unneeded parentheses
Those are a misleading leftover from old code
2017-09-04 22:49:05 +03:00
Dmitry-Me c29f16a306 Cache and reuse values 2017-09-04 17:55:45 +03:00
Dmitry-Me 5dba8268e7 Better variable name 2017-09-04 17:53:56 +03:00
Daniel Marjamäki d838dc2129 CheckCondition::multiCondition2: Fix FN for pointers 2017-09-04 15:58:22 +02:00
orbitcowboy 095e435031 wxwidgets.cfg: Added support for some wxTextFile functions. 2017-09-04 14:52:10 +02:00
Daniel Marjamäki 9465dca583 CheckCondition: Fix FPs for aliased variables (daca) 2017-09-04 09:34:03 +02:00
Daniel Marjamäki a02fd54a69 ValueFlow: Avoid FPs for aliased variables 2017-09-03 23:24:55 +02:00
Daniel Marjamäki ef4a7ba7f2 Fix FP in CheckCondition::multiCondition2 2017-09-03 14:46:37 +02:00
Daniel Marjamäki e5c6379d01 CheckCondition: Fix FP in Cppcheck 2017-09-03 11:35:37 +02:00
Daniel Marjamäki b9849d9e4e CheckCondition::multiCondition2: Handle loops better 2017-09-03 11:03:01 +02:00
Daniel Marjamäki 01e65d3e00 Improved CheckCondition::multiCondition2 so deeper bugs are found 2017-09-03 10:44:22 +02:00
Daniel Marjamäki f2ec5f24ce Fixed #5845 (new check: same condition after noreturn conditional code => second condition is always false) 2017-09-03 10:34:34 +02:00
Hinterwaeldlers 8aa568f085 Corrected noexcept constructor delegating handling (#948) 2017-09-02 22:54:23 +02:00
Daniel Marjamäki 1ecefa045a Fixed #8194 (False positive reademptycontainer - range based loop) 2017-09-02 22:22:32 +02:00
Daniel Marjamäki 30f04a5a96 Fixed #8195 (False positive uninitvar (regression) - valueflow misses variable initialization via istringstream >>) 2017-09-02 21:53:51 +02:00
Daniel Marjamäki 9eed9adf3c Fixed CID 1361393, logically dead code in return statement 2017-09-02 10:49:29 +02:00
Daniel Marjamäki 0b751dcc1b Opposite conditions: Better matching when outer condition uses && 2017-09-01 23:24:15 +02:00
Daniel Marjamäki 3bbcede43b Fixed #8193 (crash: A = -(-0.2) / (1.0 + B * B) ( daca, lammps)) 2017-09-01 22:15:09 +02:00
Dmitry-Me beba46987d Remove redundant variable 2017-09-01 18:19:25 +03:00
Dmitry-Me 2133350bf0 More useful default value 2017-09-01 18:17:40 +03:00
Dmitry-Me 4663dc205a Cache and reuse value 2017-09-01 18:16:08 +03:00
Daniel Marjamäki 3b4f60fd21 Updated error message 2017-09-01 13:33:47 +02:00
Daniel Marjamäki 7fad1b9a36 Improved checking for opposite conditions 2017-08-31 22:53:21 +02:00
Daniel Marjamäki dce942197c Fixed #8186 (Inner condition always false inside for loop) 2017-08-31 16:00:12 +02:00
Dmitry-Me d598a1c278 Fix typo causing two expressions being identical 2017-08-30 22:43:54 +03:00
Daniel Marjamäki 82527422a8 Fixed #5614 (Incorrect syntax error with function pointer typedef and dependent template types) 2017-08-30 19:18:05 +02:00
Daniel Marjamäki 59034e17f1 Refactoring, reuse code to skip lambda functions 2017-08-29 22:35:55 +02:00
Daniel Marjamäki 9c99bc43c2 ValueFlow: Skip wrong handling of lambda functions. TODO: handle lambda functions properly. 2017-08-28 22:39:12 +02:00
Dmitry-Me 017e72d145 Read attribute once, better variable name 2017-08-28 19:11:04 +03:00
Dmitry-Me 7bd3dc5da6 Simplify array access with references 2017-08-28 18:19:03 +03:00
Dmitry-Me 7d19d1ea2e Better use of temporary 2017-08-28 18:15:15 +03:00
Dmitry-Me cf6d3ba398 Omit unneeded computations 2017-08-28 18:10:49 +03:00
Daniel Marjamäki 02a1b7cd2d Fixed #7965 (valueFlowForward: Improved handling of correlated variables) 2017-08-27 19:50:44 +02:00
Daniel Marjamäki 713f607168 Fixed #8156 (wrong ast for 'z = (x & (unsigned)1) | (y & (unsigned)2);') 2017-08-26 23:25:45 +02:00
Daniel Marjamäki e74e4c6934 Fixed #8030 (False positive 'constStatement' when indexing with {}) 2017-08-26 11:59:09 +02:00
Dmitry-Me cc97834e88 Revert "Combine overlapping patterns"
This reverts commit 123f9b67e0.
2017-08-26 08:18:24 +03:00
Dmitry-Me 123f9b67e0 Combine overlapping patterns 2017-08-26 07:32:02 +03:00
Dmitry-Me b9c2a996bf Break loop early 2017-08-26 07:26:28 +03:00
Daniel Marjamäki 46c6620691 Token::takeData: dont keep old values or valuetype 2017-08-25 23:32:26 +02:00
Daniel Marjamäki ea0db18e0c Refactor Token::deleteThis() 2017-08-25 23:30:04 +02:00
Daniel Marjamäki 529b255e99 ValueFlow: Better errorpath for increment/decrement 2017-08-25 23:07:26 +02:00
Daniel Marjamäki b1b8e5270a ValueFlow: Better errorpath for increment/decrement 2017-08-25 22:15:52 +02:00
Heiko Eißfeldt bab2b26d10 Fixed #8154 (heap use after free in tokenlist) 2017-08-25 17:17:19 +02:00
Daniel Marjamäki 50636f75ba ValueFlow: Improved error path for compound assignments 2017-08-24 22:02:49 +02:00
Dmitry-Me 61e290750e Read attribute once, better variable name 2017-08-24 18:28:52 +03:00
Dmitry-Me 3bcfc33014 Break loop early 2017-08-24 18:26:53 +03:00
Dmitry-Me 45996b1404 Simplify code, read attribute once 2017-08-24 18:23:44 +03:00
Dmitry-Me eba9ea0ed0 Remove redundant check 2017-08-24 18:11:54 +03:00
Dmitry-Me 2582bbd0f6 Break loop early 2017-08-24 18:10:33 +03:00
Daniel Marjamäki d160d27417 Fixed #8172 (False positive uninitvar on sizeof *ptr) 2017-08-23 22:17:49 +02:00
Daniel Marjamäki f10634c021 ValueFlow: Dont try to evaluate '/=0;' 2017-08-23 17:53:05 +02:00
Dmitry-Me 7fba6ecef1 Remove and disallow unused copy constructor 2017-08-23 17:54:20 +03:00
Daniel Marjamäki 167cfb1ac5 valueFlowForward: improve handling of compound assignments 2017-08-23 11:13:47 +02:00
Daniel Marjamäki 71b0370389 Fixed #1793 (CheckType::checkFloatToIntegerOverflow: assignments) 2017-08-23 05:34:47 +02:00
Daniel Marjamäki b7f9e7ed1d negativeContainerIndex: avoid crash when AST is wrong 2017-08-22 12:30:43 +02:00
Daniel Marjamäki 2679b576c2 Fixed #1693 (false negative: std::vector, negative index) 2017-08-22 11:04:02 +02:00
Alexander Mai 0cae823c5d Fix doxygen comments 2017-08-21 21:13:01 +02:00
Daniel Marjamäki e087156e30 CheckUninitVar: Try to activate the valueflow based checking again 2017-08-20 19:54:06 +02:00
Daniel Marjamäki 3abb62a6d1 Fixed #8036 (valueFlowUninit: strcpy(buf, e = str), free(e);) 2017-08-20 19:47:26 +02:00
Daniel Marjamäki 92e9744020 Fixed #8148 (Tokenizer: Braces are not added properly in do while) 2017-08-16 18:55:34 +02:00
Dmitry-Me 2a4f68ccf8 Resolve CID 1365361
* work around possible null pointer dereference in case of missing attributes
2017-08-16 17:53:04 +03:00
Martin Güthle 1d491bd332 Treat noexcept correctly
Converts the noexcept to the already correctly handled noexcept(true)
2017-08-16 11:31:19 +02:00
Daniel Marjamäki 5c733c8f22 Fixed #8152 (Garbage code cause crash '0|\0|0>;') 2017-08-15 23:19:42 +02:00
Hinterwaeldlers 705e5e3468 Fix for http://trac.cppcheck.net/ticket/8151 (#942)
* Taking care of incorrect template syntax (missing close)

Forward the incorrectness via throw, as there is no direct access to the
syntaxError method, without converting the function to a member function
2017-08-15 22:40:55 +02:00
Dmitry-Me 6303437163 Resolve C4800 2017-08-15 17:42:56 +03:00
Dmitry-Me d3d9c76f01 Fix off by one, resolve C4334 2017-08-14 18:07:36 +03:00
Dmitry-Me b995e59ff2 No need for counting here 2017-08-14 18:06:23 +03:00
Daniel Marjamäki ca6109b40c threadsafety: Fix static data in Token::values() 2017-08-13 14:15:24 +02:00
Daniel Marjamäki fb37f3503a Fix GCC compiler warning about missing enum constant PlatformFile in switch 2017-08-12 00:17:55 +02:00
Dmitry-Me 45032f7d3b Use std mechanism to detect signedness 2017-08-11 18:44:14 +03:00
Gennady Feldman 1c71c789d6 Stop parsing a define with value at the '='. (#937) 2017-08-09 20:02:25 +02:00
Ayaz Salikhov b8cd7dbb5c Use nullptr instead of 0 or NULL (#936) 2017-08-09 20:00:26 +02:00
orbitcowboy 61e47208eb Removed hard coded avr8 platform and moved it into a platform file (avr8.xml). 2017-08-09 11:58:27 +02:00
Daniel Marjamäki 7a9d4b820f Fixed #8158 (Custom platform configuration seems to be not used) 2017-08-09 11:06:31 +02:00
Daniel Marjamäki c0890b5255 ImportProject: Improve cppcheckDefines() 2017-08-08 22:57:11 +02:00
Daniel Marjamäki 9861240e79 ImportProject: Only expose Cppcheck Visual Studio defines for Cppcheck 2017-08-08 22:27:08 +02:00
Nekto89 729af993fe Fix absolute pathes import from vcxproj (#934)
Fixed importing vcxproj that contains files with absolute pathes.
2017-08-07 23:51:12 +02:00
Daniel Marjamäki 5fa7a4edc4 GUI: save dumpfiles in buildDir if possible 2017-08-03 22:54:38 +02:00
Daniel Marjamäki 53002e40f6 Fix ImportProject 2017-08-03 20:38:24 +02:00
Daniel Marjamäki ccea0b17b3 ImportProject: Read system includes and standard from compile database 2017-08-03 20:33:56 +02:00
Daniel Marjamäki 61eccd7070 Fix dump 2017-08-03 18:03:59 +02:00
Daniel Marjamäki 4eb43a5557 Fixed some recent regression in ImportProject for vcxproj projects 2017-08-02 22:51:22 +02:00
Veli-Matti Visuri da3846f752 Add Timer copy constructor (#932)
- Satisfy the rule of three
2017-08-02 22:34:28 +02:00
amai2012 39955973e9 Merge pull request #931 from IOBYTE/master
Fixed #8142 (false positive: The class 'B' has 'copy constructor' but lack of 'operator='
2017-08-02 21:16:29 +02:00