Commit Graph

9533 Commits

Author SHA1 Message Date
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
Daniel Marjamäki f7514fcd2c Fix issue detected by Coverity, dereference tok3 and then check if its null. 2017-08-02 08:38:36 +02:00
Daniel Marjamäki e977cea04c Fix issue detected by Coverity, either null pointer check is useless or there is null pointer dereference 2017-08-02 08:24:16 +02:00
Daniel Marjamäki 32422c815b Fix issue found by Coverity, scope cant be null since scope is dereferenced on all paths before the while and also unconditionally inside while 2017-08-02 08:17:29 +02:00
Daniel Marjamäki 462ae455c8 Fix issue detected by Coverity, missing check if _settings is null 2017-08-02 08:04:35 +02:00
Daniel Marjamäki 60f819dbe7 Refactoring, use continue in loop 2017-08-02 08:00:52 +02:00
Daniel Marjamäki 5abf39503a Fix issue detected by Coverity, in case solution does not specify platform configuration the platform will be uninitialized 2017-08-02 07:59:25 +02:00
Daniel Marjamäki 05cdda3f4c Fix issue detected by Coverity, XMLElement::Attribute might return null 2017-08-02 07:56:22 +02:00
Daniel Marjamäki 55aec0ef1b Fix issue detected by Coverity, vt2 is null checked and then dereferenced 2017-08-02 07:48:11 +02:00
Robert Reif f5044bb65f Fixed #8142 (false positive: The class 'B' has 'copy constructor' but lack of 'operator='.)
Do not count static member variables when trying to figure out if
'operator =' is needed.
2017-08-01 19:52:41 -04:00
Matthias Krüger 9b6d371762 checkbufferoverrun: remove dead store
the variable was declared inside a loop and the dead store also took place inside the loop (guarded by a condition) without further access of the value after that store.
Found by clang analyzer.

Was:

lib/checkbufferoverrun.cpp:1223:17: warning: Value stored to 'tok' is never read
                tok = tok->next();
                ^     ~~~~~~~~~~~
2017-08-01 16:53:00 +02:00
Daniel Marjamäki 9ef9d0e4a8 Fixed #8128 (False negative: variable is assigned value that is not read) 2017-08-01 14:56:53 +02:00
Daniel Marjamäki 1758c3b4e7 Fix suspicious code found by Coverity, dont check if scope->function is null and then dereference it 2017-08-01 13:26:35 +02:00
Daniel Marjamäki 058c439b2a Coverity detected useless function call, cleanup code 2017-08-01 12:45:37 +02:00
Daniel Marjamäki 0c8a899f59 Fix issue detected by Coverity, there was dead code because the wrong variable was used in condition 2017-08-01 11:45:51 +02:00
Daniel Marjamäki be998773ee Minor refactoring, fixes FP from Coverity 2017-08-01 11:33:24 +02:00
Daniel Marjamäki 6cc7f46696 Fix issue detected by Coverity, ternary condition is always true 2017-08-01 11:25:28 +02:00
Daniel Marjamäki 267a2e154d Fixed #8127 (cppcheck 1.80 compilation by MINGW32 gcc 6.3 failed) 2017-07-31 18:30:20 +02:00
Daniel Marjamäki cdeae918a8 Fix issue detected by Coverity (ternary operator false expression is unreachable) 2017-07-31 17:58:07 +02:00
Daniel Marjamäki a024f339dd Fix issue detected by Coverity (ternary operator false expression is unreachable) 2017-07-31 17:55:15 +02:00
Daniel Marjamäki fec0c46af0 Refactoring, use continue in loop 2017-07-30 14:53:58 +02:00
Daniel Marjamäki 29265cdd49 Refactoring, use continue 2017-07-30 12:46:04 +02:00
PKEuS 9558877458 Set version to 1.80.99/1.81 dev 2017-07-30 08:48:47 +02:00
Daniel Marjamäki f76ff9e7bf Tokenizer: Put struct in anonymous namespace 2017-07-29 19:46:18 +02:00
Daniel Marjamäki 91eb0f1fad Removed XML version 1 2017-07-29 18:56:22 +02:00
Daniel Marjamäki baedfa6718 1.80: Set versions 2017-07-29 12:55:53 +02:00
Daniel Marjamäki a78fd23732 Refactoring, skipEnumBody 2017-07-29 12:13:32 +02:00
Daniel Marjamäki abf525e46d Fix Cppcheck warning 2017-07-29 11:58:00 +02:00
Simon Martin aa35462add Ticket #8091: Don't replace std types within enum definitions. (#922) 2017-07-29 11:56:09 +02:00
Daniel Marjamäki 01f023dc0a CheckClass: Refactor hasAssignSelf to use AST 2017-07-28 23:49:11 +02:00
orbitcowboy 0e575ce12c Modernize: make use of 'nullptr' and added a rule-file for finding non-nullptr (zero) initializations. 2017-07-28 15:20:43 +02:00
Daniel Marjamäki c4bd70210c GUI: Rename methods in FileList and PathMatch 2017-07-28 10:55:51 +02:00
Daniel Marjamäki a4dd8f0aa4 modernize, use nullptr 2017-07-27 18:36:33 +02:00
Daniel Marjamäki 5ae962194d revert mode change for lib/checkstl.cpp 2017-07-26 23:51:30 +02:00
Daniel Marjamäki 27af3edc5b CheckStl: Safer use of AST 2017-07-26 23:43:39 +02:00
Daniel Marjamäki eb288ec2a1 CheckStl: Use AST to handle iterator comparisons better 2017-07-26 23:13:01 +02:00
Daniel Marjamäki a3916c501c Refactor loop, use continue 2017-07-26 22:03:55 +02:00
Daniel Marjamäki da26ef0650 Refactoring: Use continue in loop 2017-07-26 21:13:49 +02:00
Daniel Marjamäki 32940c023a Refactoring: Use continue in loop 2017-07-26 20:32:14 +02:00
Daniel Marjamäki 2d4f64027a Refactoring: Use continue in loop 2017-07-26 20:29:13 +02:00
Daniel Marjamäki 2f38d3d80e CheckStl: Use ValueType 2017-07-26 20:19:36 +02:00
Andreas Pokorny b802b98136 Do not warn when unique pointers are passed by value
A unique pointer should only be passed by value or by const reference.
Passing by value means transferring ownership it makes no sense to have a pass by value Warning for unique_ptr

Signed-off-by: Andreas Pokorny <andreas.pokorny@siemens.com>
2017-07-25 11:17:56 +02:00
Daniel Marjamäki 0a03bbb320 Fixed #6315 (false positive - unreadVariable - variable is used via pointer) 2017-07-23 23:32:14 +02:00
Daniel Marjamäki b41350e8d8 Token::expressionString(): Fixed output of library types 2017-07-22 16:42:42 +02:00
Daniel Marjamäki bf5040e3d6 Fixed #7701 (ValueFlow: handle 64-bit unsigned values ) 2017-07-22 12:19:46 +02:00
Daniel Marjamäki 12b7843937 astyle formatting
[ci skip]
2017-07-21 09:17:25 +02:00
Daniel Marjamäki 255d0410a4 Fixed #8085 (Token::expressionString: unsigned long long) 2017-07-21 09:16:42 +02:00
Daniel Marjamäki 76a50e60b9 Merge pull request #926 from mathbunnyru/asalikhov/fix_warnings_macro
Fix warnings
2017-07-17 22:46:40 +02:00
Ayaz Salikhov 4bbc830a85 Fix warnings 2017-07-17 10:13:11 +03:00
Robert Reif 354a773bfe Fix #8020 (ValueType: no value type for iterator + constant) 2017-07-16 11:27:32 -04:00
Daniel Marjamäki fabe07ffd6 Merge pull request #924 from IOBYTE/master
Fixed #6985 (SymbolDatabase: Function pointer not set when calling bas…
2017-07-16 14:04:25 +02:00
Robert Reif b0aec042a6 Fixed #6985(SymbolDatabase: Function pointer not set when calling base class function)
Use using namespace when looking up types.
2017-07-15 19:14:15 -04:00
Daniel Marjamäki 814d2ae2a4 Fixed #7028 (False positive: opposite conditions (const method modifies variable)) 2017-07-10 23:12:45 +02:00
rsBNT fb7230ce05 importSln: Handle absolute paths for vcxproj 2017-07-10 11:12:48 +02:00
Daniel Marjamäki f85e43d21f Fixed #8059 (Tokenizer::simplifyWhile0: for loop that modifies local variable) 2017-07-09 22:44:10 +02:00
Daniel Marjamäki dff9d13758 Fixed #8115 (Tokenizer: links not properly set in r-value template 'Foo<int> && foo') 2017-07-09 13:26:59 +02:00
Daniel Marjamäki ea598d5284 refactoring, use early return 2017-07-09 13:09:36 +02:00
Daniel Marjamäki 32fe0aba41 Fixed #8037 (ValueFlow: global variable might be modified by function call) 2017-07-09 12:50:17 +02:00
Daniel Marjamäki 0a91ced941 refactoring, use continue in loop instead of nesting 2017-07-09 12:36:33 +02:00
Daniel Marjamäki ac85b78e2a Fixed #5619 (false positive: unusedVariable - array accessed by pointer variable only) 2017-07-09 11:19:00 +02:00
Daniel Marjamäki 7161daefbd Fixed #8040 (False positive resourceLeak - handle assigned to class instead of scalar) 2017-07-08 22:28:31 +02:00
Daniel Marjamäki 6417be4a71 Fixed #8054 (Tokenizer::simplifyKnownVariables(): Wrong simplification for global variables) 2017-07-08 22:12:01 +02:00
Daniel Marjamäki 6c2002a150 minor constness fix 2017-07-08 21:41:57 +02:00
Daniel Marjamäki 6b48781fdc Fixed #7105 (False positive resourceLeak - socket handle wiped after close) 2017-07-07 21:51:48 +02:00
Daniel Marjamäki 211d8c6020 Refactoring checking for unused variables (avoid FN when not taking address) 2017-07-01 22:45:51 +02:00
Daniel Marjamäki d6f066482e Fixed #6542 (FP: Variable 'lcount' is not assigned a value - using address of integer array) 2017-07-01 11:31:51 +02:00
Daniel Marjamäki db01ea1408 Fixed #6261 (false positive: Variable used in ternary expression within function argument list) 2017-07-01 11:03:49 +02:00
Daniel Marjamäki 4827751b04 improve constness 2017-07-01 09:10:23 +02:00
Daniel Marjamäki f847631cdb Fixed #5273 (FP memleak: Unknown if() condition should make error inconclusive) 2017-06-30 23:05:09 +02:00
Daniel Marjamäki b97f5d909e Fixed #6570 (False positive unusedFunction - function called from within template function) 2017-06-30 14:34:28 +02:00
Daniel Marjamäki 22919da9a8 Fixed #6246 (Defect: False positive due to ignoring struct initialisation when nested in a loop and assigned to a member) 2017-06-30 13:41:19 +02:00
Daniel Marjamäki 3ab8466415 refactoring, use early continue in for loop 2017-06-30 12:45:48 +02:00
x29a 15b0eb42bd import solution: Support system environment variables 2017-06-27 12:41:25 +02:00
Daniel Marjamäki dc37034687 Merge pull request #917 from x29a/unique_includes
Unique includes
2017-06-23 20:21:38 +02:00
neheb ef86ac04b4 Add OpenCL support
OpenCL is basically C99.
2017-06-22 17:34:07 -07:00
x29a b3a747d606 fix brainfart 2017-06-22 16:53:13 +02:00
x29a cde17935ea only use each include path once 2017-06-22 16:49:36 +02:00
Daniel Marjamäki 1e12ec241c reuse simplecpp::simplifyPath 2017-06-21 14:27:46 +02:00
Daniel Marjamäki f86d8244fa Fixed #8022 (DacaWrongData: checkIgnoredReturnValue, hana) 2017-06-10 08:23:26 +02:00
Daniel Marjamäki 453058c059 AST: Better handling of C++11 initializer lists 2017-06-09 22:35:46 +02:00
Daniel Marjamäki fd74d455ce AST: Better handling of case 2017-06-08 15:32:35 +02:00
Daniel Marjamäki da87fdbb90 Refactoring TemplateSimplifier::simplifyCalculations, Token::Match patterns 2017-06-08 08:18:40 +02:00
Daniel Marjamäki c1ea873e1c TemplateSimplifier::simplifyCalculations: Add some more tests and make sure they pass 2017-06-08 08:15:05 +02:00
Daniel Marjamäki cb48e63f92 TemplateSimplifier: Fixed bug in simplifyCalculations. Now template58 test case does not throw InternalError 2017-06-08 00:49:46 +02:00
Daniel Marjamäki d2e7df2c04 TemplateSimplifier: Broke out code into separate function 2017-06-08 00:16:43 +02:00
Daniel Marjamäki 2740736136 Avoid 'deleteThis' in TemplateSimplifier::simplifyCalculations as it can cause 'use after free' see #6021 2017-06-07 20:09:06 +02:00
Daniel Marjamäki d335412858 Avoid 'deleteThis' in TemplateSimplifier::simplifyCalculations as it can cause 'use after free' see #6021 2017-06-07 19:46:02 +02:00
Daniel Marjamäki 18abe4a142 Fixed #6021 (TemplateSimplifier::simplifyCalculations causes heap corruption on invalid code) 2017-06-07 19:32:56 +02:00
Daniel Marjamäki 60e36492e2 Refactoring, renamed local variable 2017-06-07 12:37:44 +02:00
Alexander Mai ce13b75967 Add missing types to Platform::platformString(). Add another pattern to Tokenizer::findGarbageCode() to avoid potential crash in Valueflow 2017-06-06 22:15:11 +02:00
Stas Cymbalov ff38cc5c13 Set struct size cutoff in passedByValue check to 2*sizeof_pointer
Struct arguments are either pushed to the stack or passed in the
registers. Since both methods operate on machine words it is logical to
tie the maximum size of a struct argument that doesn't trigger
passedByValue diagnostic to the size of the machine word.

Also guessed size of STL classes is set to 3*sizeof_pointer, this better
represents reality and ensures that structs containing them will still
trigger passedByValue.
2017-06-06 08:48:11 +02:00
Daniel Marjamäki 3b805e7001 fix testrunner (WRONG_DATA usage) 2017-06-05 18:49:20 +02:00
Daniel Marjamäki 150d2aa902 Refactor and rename CHECK_WRONG_DATA 2017-06-05 18:41:15 +02:00
Daniel Marjamäki 62c22a8e06 daca2: change output for DacaWrongData. Show location. And use severity 'debug' 2017-06-04 19:46:20 +02:00
Daniel Marjamäki 66a488586e Temporarily readd the UNSTABLE configuration 2017-06-04 18:30:49 +02:00
Daniel Marjamäki 20b27cfd51 avoid some WrongData warnings 2017-06-04 18:27:42 +02:00
Daniel Marjamäki 0c6a551039 Try to limit Daca2WrongData output a little 2017-06-04 16:41:30 +02:00
Daniel Marjamäki 9715164d0a Fixed DACA2 CHECK_WRONG_DATA macro 2017-06-04 15:50:27 +02:00
Daniel Marjamäki 35348fcf98 Try to fix Travis 2017-06-04 14:46:57 +02:00
Daniel Marjamäki 1439b08fbd Fixed -DDACA2 compiler errors 2017-06-04 14:14:42 +02:00
Daniel Marjamäki 2106099029 daca2: print error message (DacaWrongData) instead of crashing when wrong data is seen 2017-06-04 14:05:34 +02:00
Daniel Marjamäki 26bd863d0a Fixed #7724 (hang: long expression => wrong AST) 2017-06-04 12:16:49 +02:00
Daniel Marjamäki b8ee500d45 Fixed #7092 (Invalid style error: Variable not assigned a value) 2017-06-03 15:31:29 +02:00
Daniel Marjamäki ccb2f2ce6a astyle formatting
[ci skip]
2017-06-03 15:30:36 +02:00
Daniel Marjamäki bbde3cc23a Merge pull request #910 from mathbunnyru/asalikhov/improve_readability
improve readability
2017-06-03 14:33:21 +02:00
Daniel Marjamäki aeef7117fe astyle formatting
[ci skip]
2017-06-03 11:34:30 +02:00
Daniel Marjamäki 7ec3715c57 check.h: Cppcheck will be stable by default. Use -DUNSTABLE to make it unstable. 2017-06-03 11:18:00 +02:00
uburuntu f4ce49d883 ENH: perfomance: using clear() and empty() more faster for stl containers 2017-06-02 22:38:00 +04:00
Ayaz Salikhov f5646183cd Move comment to the right place 2017-06-02 17:15:24 +03:00
Alexander Mai b4a58be113 #define HIDE_WRONG_DATA to get release mode build (hiding crashes on invalid AST/symboldatabase). Fix doxygen syntax. 2017-06-01 23:38:02 +02:00
Daniel Marjamäki b68c8d91ab Fixed #8039 (Tokenizer: wrong simplification of string) 2017-06-01 22:21:02 +02:00
Daniel Marjamäki bce0776417 Fixed #7795 (ValueFlow: Value is not known after conditional increment ) 2017-06-01 15:16:07 +02:00
Daniel Marjamäki 5efb2e3be0 Visual Studio: Skip unknown platforms (ARM, ARM64) 2017-06-01 13:13:23 +02:00
Ayaz Salikhov 132c0af22a Simplify some statements 2017-06-01 02:02:12 +03:00
Ayaz Salikhov 3cd2f2d092 Don't cast bool to bool 2017-06-01 01:49:40 +03:00
Ayaz Salikhov cb58cf8163 .length() > 0 == !.emepty() 2017-06-01 01:42:29 +03:00
Daniel Marjamäki 1f48b082d1 CLI: Add --output-file flag so results can be written to file directly. 2017-05-30 15:04:28 +02:00
Ville Skyttä 5ab158fec2 Spelling fixes 2017-05-30 08:03:15 +03:00
Daniel Marjamäki 1961d6d0f7 CppCheck: make sure preprocessor syntax errors are reported 2017-05-28 20:34:58 +02:00
Sam Truscott 956b5812e7 Fixed #7866 (Crash while scanning QML files) 2017-05-28 16:39:18 +02:00
Steve Browne b58562fc7d Added test cases for catching when assignment comes after an operator, compound assignment, or comparison for ticket #7429 and fixed the tests. 2017-05-28 16:00:06 +02:00
Daniel Marjamäki 18adb97873 astyle formatting
[ci skip]
2017-05-28 15:56:26 +02:00
Frank Zingsheim aa937e426d Fixed #7849 (Tokenizer: Wrong simplification of floating point equality comparison) 2017-05-28 10:53:50 +02:00
amai 624ceb5027 Fix includes for cygwin 2017-05-27 10:23:06 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
uburuntu d41d091c07 ENH: perfomance: seeking of one char is more efficiently 2017-05-27 04:15:54 +02:00
amai 45ba1ff1e3 #8079 SymbolDatabase::createSymbolDatabaseEnums() crashes on invalid enum declaration 2017-05-25 09:50:14 +02:00
Daniel Marjamäki 1dd42d9a9e arrayIndexOutOfBounds: Make sure error message is clarified for daca2 --template format 2017-05-25 08:18:37 +02:00
Daniel Marjamäki 0262020707 --template: Removed 'clang' and renamed 'cppcheck2' to 'daca2' 2017-05-25 05:24:42 +02:00
Daniel Marjamäki dda5556ded Fixed #8034 (AST: better handling for c++ type initialization) 2017-05-24 20:24:56 +02:00
Daniel Marjamäki 5444875f89 Fixed #8034 (AST: better handling for c++ type initialization) 2017-05-24 20:18:31 +02:00
Daniel Marjamäki 099b4435c3 Fixed #8074 (Preprocessor::getConfigs: wrong configuration extracted 'A;B;;') 2017-05-24 11:16:41 +02:00
Daniel Marjamäki 93e0516291 Fixed #8009 (Tokenizer: fix handling of template rvalue references) 2017-05-23 18:55:17 +02:00
Daniel Marjamäki 70c2de62b7 arrayIndexOutOfBounds: better note 2017-05-23 16:06:32 +02:00
Daniel Marjamäki 6e1544bd49 ValueFlow: Use getOrdinalText() 2017-05-23 15:01:56 +02:00
Daniel Marjamäki e73657b198 Clarify arrayIndexOutOfBounds 2017-05-23 14:58:43 +02:00
Daniel Marjamäki a3c0eecccf Added --template=cppcheck2 output format 2017-05-23 12:19:11 +02:00
Daniel Marjamäki 6cb563b3fe ErrorLogger: Adjust the severity in the 'clang' output format. as far as I know, clang severities are 'fatal error', 'error' and 'warning'. 2017-05-23 12:02:57 +02:00
Daniel Marjamäki d3d3d31613 Clarify 'invalidFunctionArg' messages 2017-05-23 11:57:25 +02:00
Daniel Marjamäki f7cda81c0c Refactoring: ValueFlow::Value::errorSeverity() will have the logic if value is 'error' or 'warning' 2017-05-23 11:43:56 +02:00
orbitcowboy ba2b235e24 Fixed: warning: ‘tokvalue’ may be used uninitialized in this function [-Wuninitialized]. 2017-05-22 15:22:38 +02:00
orbitcowboy ffe6582e6b Added platform support for Atmel AVR 8 bit microcontrollers. 2017-05-22 14:46:19 +02:00
Daniel Marjamäki b59bd96c6d ErrorLogger: Fix crash when error message does not have a FileLocation 2017-05-22 11:25:58 +02:00
Daniel Marjamäki 8ef9ab26b1 Clarify floatConversionOverflow 2017-05-22 11:04:24 +02:00
Daniel Marjamäki 0cb1c4f221 Clarify integerOverflow messages 2017-05-22 10:10:56 +02:00
Daniel Marjamäki 9374055238 ErrorPath: clarify the 'shiftTooManyBits' error message 2017-05-22 07:58:56 +02:00
Daniel Marjamäki 7af58cf31a show full error path in xml files 2017-05-22 07:42:54 +02:00
Daniel Marjamäki 58da0df2f6 astyle formatting
[ci skip]
2017-05-20 18:52:48 +02:00
Daniel Marjamäki 82a372a380 Try to clarify ErrorPath texts 2017-05-20 08:47:35 +02:00
Daniel Marjamäki 55ae206ecc ErrorPath: better output 2017-05-19 17:29:16 +02:00
Daniel Marjamäki b53a2ff9eb Command line: Added --template=clang formatting 2017-05-19 17:09:49 +02:00
Daniel Marjamäki f92b16706c ValueFlow: Add ErrorPath info after for loop 2017-05-19 16:32:58 +02:00
Daniel Marjamäki 2bb54fef69 ValueFlow: Test ErrorPath handling 2017-05-19 14:34:59 +02:00
Matthias Krüger a2c716fa3b CheckOther::checkDuplicateExpression(): be lazier if style-reports are not enabled. NFCI. 2017-05-19 00:54:55 +02:00
Daniel Marjamäki 899615c1e4 update simplecpp includes
[ci skip]
2017-05-18 22:26:07 +02:00
Matthias Krüger aa3f1db33c Add internal check that checks for redundant non-nullness checks in Token::(simple)Match checks.
In code like
if (tok && Token::simpleMatch(tok, "bla")) {}
or
if (tok->previous() && Token::Match(tok->previous(), "foo")) {},
the first check is redundant because Token::(simple)Match already checks if the argument token is null.
2017-05-18 22:12:33 +02:00
Daniel Marjamäki 9d08cbf4d2 Fix 'make checkcfg' 2017-05-18 22:10:08 +02:00
Daniel Marjamäki 340c687cbf Revert "Use 'Stringification => Tokenizer' until some issues have been fixed"
This reverts commit c2727691a4.
2017-05-18 21:53:25 +02:00
Daniel Marjamäki 040d2f0012 Use simplecpp lexer in test cases 2017-05-18 21:52:31 +02:00
Daniel Marjamäki c2727691a4 Use 'Stringification => Tokenizer' until some issues have been fixed 2017-05-18 09:33:41 +02:00
Daniel Marjamäki 7bd0bc7534 Tokenizer: Simplify '->' to '.' 2017-05-17 22:50:54 +02:00
Daniel Marjamäki bc12a0b21f Handle empty token list better (for instance when Preprocessor::validateCfg() see problem) 2017-05-17 22:30:20 +02:00
Daniel Marjamäki 1f4b84379d Fix for #pragma asm 2017-05-17 21:58:46 +02:00
Daniel Marjamäki 59335f80d2 Try to fix windows build. Reduce header dependencies 2017-05-17 15:38:31 +02:00
Daniel Marjamäki 90a952d8c2 Add col and info in plist 2017-05-17 15:22:51 +02:00
Daniel Marjamäki 6230919976 Skip 'Stringification => Tokenize' step 2017-05-17 14:57:54 +02:00
Daniel Marjamäki 67e3187653 Preprocessor: Refactor handling of #pragma asm 2017-05-17 10:25:37 +02:00
Daniel Marjamäki cd53d10970 ErrorPath: More information about assignments 2017-05-16 23:12:35 +02:00
Daniel Marjamäki ecb3f0a934 ErrorLogger: Write ErrorPath info in the xml report 2017-05-16 22:58:02 +02:00
Daniel Marjamäki c617851567 ErrorLogger: Added ErrorPath where each item has token and info 2017-05-16 22:38:13 +02:00
Daniel Marjamäki e65d6d3c67 ValueFlow: inherit Value::callstack in calculations 2017-05-16 19:43:55 +02:00
Daniel Marjamäki f92e7b3bfc Emit better errorpath in CheckBufferOverrun::negativeIndexError 2017-05-16 19:08:47 +02:00
Daniel Marjamäki 970ff181de Show 'Possible' errors without --enable=warning 2017-05-16 17:51:45 +02:00
Daniel Marjamäki 6967d68137 Add --plist-output argument 2017-05-16 14:07:23 +02:00
Daniel Marjamäki 3ef2f825c7 Fixed Cppcheck warnings about null pointer dereference 2017-05-15 20:36:28 +02:00
Daniel Marjamäki 8d75d1b920 Partial fix for #8028 (ValueFlow: Origin/callstack of value) 2017-05-15 20:05:11 +02:00
PKEuS 3432257390 Removed deprecated command --append 2017-05-14 11:57:04 +02:00
PKEuS fda1f67da6 Set version to 1.79.99/1.80 dev 2017-05-14 10:07:38 +02:00
PKEuS fb94ad21fa Updated Visual Studio solution to VS2017. 2017-05-14 10:04:25 +02:00
Daniel Marjamäki 45d998979c CHECK_WRONG_DATA: switch to debug macro 2017-05-13 19:10:05 +02:00
Daniel Marjamäki 55cd69e290 alwaysTrueFalse: Dont warn when checking sizeof for some type. such condition might be platform dependent. 2017-05-13 19:07:24 +02:00
Daniel Marjamäki e5e5a5e4b8 1.79: Set version 2017-05-13 11:25:16 +02:00
Daniel Marjamäki 95db173e77 Fixed Cppcheck warning 2017-05-13 11:06:33 +02:00
orbitcowboy b9bac79a8c Improved const correctness, there are no functional changes. 2017-05-12 16:20:47 +02:00
PKEuS 68d77b73da SymbolDatabase: Fixed parsing of unnamed arguments, properly detect pointers (#8052) 2017-05-07 09:03:58 +02:00
PKEuS 28b8bc57a8 CheckVaarg::va_list_usage(): Bailout on "goto" (#8043) 2017-05-07 08:32:48 +02:00
PKEuS b345c430fe CheckStl::readingEmptyStlContainer(): Skip over lambdas (#8055) 2017-05-07 08:15:58 +02:00
Alexander Mai c1cdcc158f Run astyle. Fix some Doxygen issues 2017-05-06 11:57:02 +02:00
amai2012 3e11eb9dca #8050 cppcheckError: 0xFFFFFFul -> 16777215ULU. Don't add a suffix 'U' if there is already a suffix present. 2017-05-05 14:47:58 +02:00
Daniel Marjamäki a8a54bbfa8 Fixed #6028 (Improvement: False positive caused by C keywords in assembly comments) 2017-05-05 08:57:24 +02:00
Daniel Marjamäki 65297ce285 Fixed #7191 (false positive memleak on in-place new) 2017-05-04 19:39:57 +02:00
Alexander Mai f54a6f085b #7883 hang: CheckOther::checkFuncArgNamesDifferent() template code in .h. Activate language check for header files + Small refactoring 2017-05-03 20:36:26 +02:00
Daniel Marjamäki 1ec9b8c5b4 Fixed #8047 (false positive uninitialized variable - sizeof **A) 2017-05-03 19:27:55 +02:00
Alexander Mai e88b4dcf06 Add another check to Tokenizer::validateC(): C++ casts 2017-05-03 16:57:42 +02:00
Matthias Krüger a28f57344c templatesimplifier: mark getTemplateNamePositionTemplateMember() static.
Fixes gcc 7-dev warning:

lib/templatesimplifier.cpp: In function ‘bool getTemplateNamePositionTemplateMember(const Token*, int&)’:
lib/templatesimplifier.cpp:715:6: warning: no previous declaration for ‘bool getTemplateNamePositionTemplateMember(const Token*, int&)’ [-Wmissing-declarations]
 bool getTemplateNamePositionTemplateMember(const Token *tok, int &namepos)
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2017-05-03 08:45:48 +02:00
Daniel Marjamäki 295e4fdfc2 Fixed #8049 (Preprocessor: Comment in system include not removed properly) 2017-05-02 22:18:24 +02:00
Alexander Mai 1bc7a89b3c Improve search patterns within Tokenizer::validateC() 2017-05-02 17:57:06 +02:00
Robert Reif e2bfe1c0ec Fixed #8044: Crash below SymbolDatabase::setValueType 2017-05-01 14:12:50 -04:00
Matthias Krüger cee0f724ff Fixed #8018: Tokenize::findGarbageCode: detect heads of for-loops with 1 or more than 2 semicolons as garbage code. 2017-05-01 18:28:26 +02:00
Daniel Marjamäki bc7799dccd Fixed #7888 (false positive from knownConditionTrueFalse with sizeof(int) == sizeof(long)) 2017-05-01 12:23:28 +02:00
Daniel Marjamäki f51a709f80 add fixme comment 2017-05-01 11:25:58 +02:00
Daniel Marjamäki ce6cc5416a uninitvar: made ValueFlow check experimental 2017-05-01 11:13:30 +02:00
Daniel Marjamäki 9cdda53fb9 CheckFunctions::memsetZeroBytes: Add CHECK_WRONG_DATA to avoid crashes 2017-04-30 18:58:51 +02:00
Daniel Marjamäki 8a08cc0796 Fixed #8029 (Tokenizer::simplifyCAlternativeTokens: dont simplify 'eb.and + 1') 2017-04-30 14:40:41 +02:00
Daniel Marjamäki 7fd04cd8d0 Updated Token::expressionString(), write '->' instead of '.' 2017-04-30 14:22:18 +02:00
Simon Martin 28960a8bba Remove bailout and fix varid for template class member initialized in out-of-line constructor (#8031) 2017-04-30 08:59:47 +02:00
IOBYTE 8a668aa860 Add missing else that could cause an extra try scope to be added to the scope list (#8025)
Add an optional extended description…
2017-04-30 08:58:41 +02:00
Daniel Marjamäki 980ca39fe2 valueFlowForward: better handling of sizeof() in rhs in assignments 2017-04-29 08:25:55 +02:00
Garrett Bodily ddfd4c6348 Write access type of functions and variables to xml dump 2017-04-29 07:18:16 +02:00
Robert Reif 964b744c96 Fixed #7990 (crash: SymbolDatabase::printOut()) 2017-04-29 07:02:49 +02:00
Daniel Marjamäki 06102cb3d7 UninitVar: Don't warn for inconclusive values 2017-04-28 21:09:56 +02:00
Daniel Marjamäki a0a8f8ddd6 ValueFlowUninit: make it more strict 2017-04-28 13:29:09 +02:00
Daniel Marjamäki 5fd77d2518 Switch CHECK_WRONG_DATA macro so crashes/hangs are avoided 2017-04-28 10:48:41 +02:00
Daniel Marjamäki 589fabd0b1 Fixed #8027 (hang after AST_MAX_DEPTH is exceeded in array initialization) 2017-04-27 20:53:27 +02:00
Daniel Marjamäki d9f72d5f8c AST: Handle 'x = { [ID] = 1, .. }' when ID is unexpanded macro 2017-04-26 22:35:04 +02:00
Daniel Marjamäki bdf16b1157 Tokenizer::simplifyComma: dont simplify comma in '=(struct s){...}' 2017-04-26 20:48:08 +02:00
Daniel Marjamäki 89532cf8b9 Fixed #7968 (valueFlowBeforeCondition: better handling of compound assignments) 2017-04-25 20:45:02 +02:00
orbitcowboy 537045b176 Improved const correctness. There are no functional changes. 2017-04-25 14:57:48 +02:00
Daniel Marjamäki 140e086206 Fixed #7738 (False positive deallocret - delete and return NULL pointer) 2017-04-24 22:05:16 +02:00
Daniel Marjamäki 37fd60e879 Fixed #7293 (Use of uninitialized pointer not detected (worked in 1.71)) 2017-04-24 18:27:16 +02:00
Daniel Marjamäki 9a294496c1 ValueFlow::setTokenValue: Fix typo 2017-04-23 21:59:58 +02:00
Daniel Marjamäki a688402617 ValueFlow::setTokenValue: Don't calculate parent value for uninitialized values 2017-04-23 21:58:01 +02:00
Daniel Marjamäki 2f51b975ed valueFlowUninit: only check variables 2017-04-23 21:50:51 +02:00
Daniel Marjamäki 25a1ea3d18 use simpleMatch for simple pattern 2017-04-23 19:25:35 +02:00
Daniel Marjamäki 8a738eefab fixed #7998 (uninitialized variable is not found when used with switch/case) 2017-04-23 18:05:14 +02:00
Daniel Marjamäki 3f069d9e44 Write two FIXME comments, create library configuration to replace hardcoded checks 2017-04-23 15:34:45 +02:00
Daniel Marjamäki 198c8878ee Use Token::simpleMatch() for simple pattern 2017-04-23 12:14:14 +02:00
Daniel Marjamäki f2719ec6ca Refactoring CheckString::sprintfOverlappingData. Use AST, isSameExpression(), getArguments(), .. 2017-04-23 10:51:31 +02:00
Daniel Marjamäki f92ef7d8e2 Refactoring. Use 'endsWith()' 2017-04-23 10:17:35 +02:00
Daniel Marjamäki 101dc28afa Refactoring: Moved checkMemset.. from CheckOther to CheckFunctions 2017-04-23 07:53:41 +02:00
Daniel Marjamäki f6ab204dc6 Refactorings in CheckOther 2017-04-23 07:19:44 +02:00
Daniel Marjamäki f601a6903f Updated comment 2017-04-23 06:44:38 +02:00
Matthias Krüger 2744a9456f fix [lib/checkfunctions.cpp:300]: (warning) Found simple pattern inside Token::Match() call: "new" 2017-04-22 21:53:31 +02:00
Daniel Marjamäki e5b9e2a898 --check-library: less warnings 2017-04-22 21:23:46 +02:00
Daniel Marjamäki e72ec4282d Fixed #7842 (Preprocessor::getConfigs: #error in #ifndef not handled well) 2017-04-22 12:44:57 +02:00
Daniel Marjamäki 1039c710e4 Fixed #8017 (AST: wrong ast for extra comma 's={1,}') 2017-04-22 11:23:11 +02:00
Daniel Marjamäki 7140bae226 Merge pull request #894 from simartin/ticket_7964
Ticket #7964: Don't crash on valid code using function pointers named strcpy or strcat in main()
2017-04-22 01:24:03 +02:00
Simon Martin b526fd7c49 Ticket #7964: Don't crash on valid code using function pointers named strcpy or strcat in main(). 2017-04-21 23:36:10 +02:00
Daniel Marjamäki 43454936e7 Fixed #8014 (FP: Uninitialized variable 'f(1,{..});') 2017-04-21 22:33:27 +02:00
Robert Reif 78ad9825af Add support for auto variables in regular for loop. 2017-04-21 15:25:02 -04:00
Daniel Marjamäki e827119856 Fix testrunner InternalError 2017-04-21 21:02:46 +02:00
Daniel Marjamäki 902eb87a8a Fixed #8016 (AST: wrong ast for 'x=(s){...};') 2017-04-21 17:44:11 +02:00
Daniel Marjamäki eec8c77774 Merge pull request #892 from IOBYTE/master
Add support for auto variable initialized from function return type.
2017-04-20 22:17:23 +02:00
Daniel Marjamäki f8e9071de1 CheckFunction: In the <valid> check handle possible/conditional/inconclusive values better 2017-04-20 22:14:54 +02:00
Robert Reif 0ff8e49b69 Add support for auto variable initialized from function return type. 2017-04-20 15:22:57 -04:00
Daniel Marjamäki 95dd16892b Merge pull request #891 from IOBYTE/master
Fix #7963: crash; Variable::setFlag ; gecko-dev , dom/canvas/WebGLTra…
2017-04-20 20:51:40 +02:00
Daniel Marjamäki 3fbcc0cd3b Refactor CheckFunctions::invalidFunctionUsage 2017-04-20 19:57:39 +02:00
Daniel Marjamäki e43c078c5e checkfunctions: code cleanup 2017-04-20 17:42:25 +02:00
Robert Reif 69d18d9c29 Fix #7963: crash; Variable::setFlag ; gecko-dev , dom/canvas/WebGLTransformFeedback.cpp 2017-04-20 10:03:29 -04:00
Daniel Marjamäki 7a26e046a8 Fixed #8001 (AST: Wrong AST for lambda function with 'std::string const&' result type) 2017-04-18 21:21:30 +02:00
Daniel Marjamäki 0edb0dbf3c Fix redundant assignment found by Cppcheck 2017-04-17 22:33:15 +02:00
Daniel Marjamäki d911eeba75 astyle formatting
[ci skip]
2017-04-17 22:16:02 +02:00
Daniel Marjamäki 1a95dc9bd6 Fixed #7979 (Tokenizer: Detect and reject c++ code in .c file) 2017-04-17 22:15:29 +02:00
Daniel Marjamäki bb015c6a2b Fixed #8006 (AST: Wrong tree with complex for loops and casts) 2017-04-17 21:11:53 +02:00
Simon Martin 5fd686c878 Ticket #4544: Also handle Foo<struct Bar> constructs. 2017-04-17 11:24:28 +02:00
Daniel Marjamäki 4f64e67298 Misra: Add rule 8.11 2017-04-17 07:45:27 +02:00
Daniel Marjamäki 1045ece946 dump: refactor valueType dump 2017-04-16 09:11:20 +02:00
Daniel Marjamäki f90d8c9987 dump: fix xml format 2017-04-15 14:03:49 +02:00
Daniel Marjamäki b3b0a796b9 dump: fix xml format 2017-04-15 12:38:00 +02:00
Daniel Marjamäki e71b428740 dump: Add platform info and valueType info 2017-04-15 12:25:44 +02:00
Daniel Marjamäki 174bcc8d34 Misra: Add rule 16.3 2017-04-14 10:46:35 +02:00
Daniel Marjamäki d252a64ec8 Cleanup CheckFunctions::checkIgnoredReturnValue 2017-04-12 10:44:08 +02:00
Daniel Marjamäki 41a64f6d1f Fix crash 2017-04-11 20:16:33 +02:00
PKEuS b1f4bd7504 Refactorization: Reimplemented Settings::_enabled as a bitfeld instead of std::set (#7995) 2017-04-11 11:49:26 +02:00
Daniel Marjamäki 4d1a64301c AST: Fixed Match pattern '|*' => '*|' 2017-04-10 23:44:30 +02:00
Daniel Marjamäki 632a6b664c AST: Harden handling of C++11 2017-04-10 23:29:15 +02:00
Daniel Marjamäki 2c43075ece AST: weird clang syntax 2017-04-10 23:05:41 +02:00
Daniel Marjamäki df90ff9f5e Merge pull request #888 from simartin/ticket_7942
Don't generate invalid syntax for out of line template class constructors during instantiation
2017-04-10 22:18:20 +02:00
Daniel Marjamäki 5e1b6aee8c AST: Fix hang for weird VLA code 2017-04-10 22:17:34 +02:00
Daniel Marjamäki ffeadbdde4 AST: improved handling for struct initialization 's = { [0] = 123 }' 2017-04-10 07:25:18 +02:00
Daniel Marjamäki d92c529aa6 AST: Fix wrong handling of struct initialization, caused hang 2017-04-09 22:06:13 +02:00
Daniel Marjamäki 45d2d66df3 Remove redundant space in Token::Match pattern 2017-04-09 19:27:11 +02:00
Daniel Marjamäki e6005dfa3c AST: Fix AST for lambda '[&]{..}' 2017-04-09 17:49:55 +02:00
Matthias Krüger 7d12e1f3a6 valueFlowGetArrayIndexes: convert Token::Match to Token::simpleMatch.
The pattern is a sole "[", but since "[" is also used for complexe patterns, the internal check that finds potential simple match patterns bailed out here.
2017-04-09 17:27:46 +02:00
Simon Martin ee05fe7d77 Ticket #7942: Don't generate invalid syntax for out of line template class constructors during instantiation. 2017-04-09 16:12:59 +02:00
Daniel Marjamäki 6e0af5d01f MISRA 19 and 28 2017-04-09 10:11:54 +02:00
Robert Reif bcf0c5f010 Add ValueType and auto type information to debug output.
Print out ValueType for variables and function return type.
Print out complete type for variables and function return type.
Print out ValueType for variable auto token.
2017-04-07 19:57:10 -04:00
Daniel Marjamäki f5f141ff42 astyle formatting
[ci skip]
2017-04-07 19:19:41 +02:00
Daniel Marjamäki 8ffed6862d Tokenizer: Add --check-config warning for macro with semicolon in argument 2017-04-07 19:19:10 +02:00
Daniel Marjamäki 7d8af7bdca Fixed #7979 (crash (nr 2): CheckFunctions::checkIgnoredReturnValue()) 2017-04-07 13:18:53 +02:00
Daniel Marjamäki 392a06a44b AST: better handling of '(struct X){...}' 2017-04-06 21:28:13 +02:00
Daniel Marjamäki 70a7915173 CppCheck: Improve output when first configuration is not empty. 2017-04-06 19:52:21 +02:00
Daniel Marjamäki 50da7d4919 Tokenizer: Write syntax error if there is C++ code in C file. 2017-04-06 08:50:35 +02:00
Daniel Marjamäki fd2651909c Fixed #7978 (ValueType: container type not set properly) 2017-04-06 07:07:20 +02:00
Daniel Marjamäki fee86b9684 ValueType: Better handling of 'new Container' 2017-04-05 22:05:29 +02:00
PKEuS 47570f5791 Set version to 1.78.99/1.79 dev 2017-04-05 11:24:26 +02:00
Daniel Marjamäki e6ed08c4d8 Fixed #7976 (Internal error. Token::astOperand1() cyclic dependency. (ticket nr 2, new regression)) 2017-04-05 11:00:02 +02:00
Daniel Marjamäki 9c5a136f04 Fixed #7975 (crash: Tokenizer::createLinks2 problem with enable_if<x&&y,C*>) 2017-04-03 21:48:22 +02:00
Matthias Krüger 79010eecea lib: fix a bunch of warnings about differing function arguments in definition and declaration.
[lib/token.h:72] -> [lib/token.cpp:36]: (style, inconclusive) Function 'Token' argument 1 names different: declaration 'tokensBack' definition 't'.
    [lib/token.h:445] -> [lib/token.cpp:497]: (style, inconclusive) Function 'multiCompare' argument 1 names different: declaration 'needle' definition 'tok'.
    [lib/checkio.h:73] -> [lib/checkio.cpp:1385]: (style, inconclusive) Function 'ArgumentInfo' argument 3 names different: declaration 'isCPP' definition '_isCPP'.
    [lib/checkother.h:216] -> [lib/checkother.cpp:2136]: (style, inconclusive) Function 'checkComparisonFunctionIsAlwaysTrueOrFalseError' argument 2 names different: declaration 'strFunctionName' definition 'functionName'.
    [lib/errorlogger.h:214] -> [lib/errorlogger.cpp:51]: (style, inconclusive) Function 'ErrorMessage' argument 2 names different: declaration 'file0' definition 'file0_'.
    [lib/errorlogger.h:215] -> [lib/errorlogger.cpp:65]: (style, inconclusive) Function 'ErrorMessage' argument 2 names different: declaration 'file0' definition 'file0_'.
    [lib/library.h:327] -> [lib/library.cpp:1043]: (style, inconclusive) Function 'ignorefunction' argument 1 names different: declaration 'function' definition 'functionName'.
    [lib/mathlib.h:112] -> [lib/mathlib.cpp:1275]: (style, inconclusive) Function 'isNullValue' argument 1 names different: declaration 'tok' definition 'str'.
    [lib/preprocessor.h:91] -> [lib/preprocessor.cpp:122]: (style, inconclusive) Function 'setDirectives' argument 1 names different: declaration 'tokens' definition 'tokens1'.
    [lib/symboldatabase.h:860] -> [lib/symboldatabase.cpp:1801]: (style, inconclusive) Function 'argsMatch' argument 1 names different: declaration 'info' definition 'scope'.
    [lib/symboldatabase.h:1171] -> [lib/symboldatabase.cpp:2048]: (style, inconclusive) Function 'addClassFunction' argument 1 names different: declaration 'info' definition 'scope'.
    [lib/symboldatabase.h:1174] -> [lib/symboldatabase.cpp:2208]: (style, inconclusive) Function 'addNewFunction' argument 1 names different: declaration 'info' definition 'scope'.
    [lib/symboldatabase.h:1090] -> [lib/symboldatabase.cpp:3648]: (style, inconclusive) Function 'findVariableType' argument 2 names different: declaration 'type' definition 'typeTok'.
    [lib/symboldatabase.h:1101] -> [lib/symboldatabase.cpp:4308]: (style, inconclusive) Function 'findType' argument 1 names different: declaration 'tok' definition 'startTok'.
    [lib/symboldatabase.h:1176] -> [lib/symboldatabase.cpp:4349]: (style, inconclusive) Function 'findTypeInNested' argument 1 names different: declaration 'tok' definition 'startTok'.
    [lib/symboldatabase.h:1193] -> [lib/symboldatabase.cpp:4501]: (style, inconclusive) Function 'setValueType' argument 2 names different: declaration 'enumerators' definition 'enumerator'.
    [lib/path.h:159] -> [lib/path.cpp:247]: (style, inconclusive) Function 'isCPP' argument 1 names different: declaration 'extensionInLowerCase' definition 'path'.
    [lib/path.h:145] -> [lib/path.cpp:266]: (style, inconclusive) Function 'acceptFile' argument 1 names different: declaration 'filename' definition 'path'.
2017-04-03 00:06:46 +02:00
Daniel Marjamäki abb43b6a81 Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))') 2017-04-02 19:44:33 +02:00
Daniel Marjamäki de80d41ef4 CheckFunctions::checkIgnoredReturnValue: Dont warn in C++11 initializer lists in function arguments 2017-04-02 19:44:27 +02:00
Daniel Marjamäki 6f2db1a312 CHECK_WRONG_DATA: restore debug macro so crashes are seen. 2017-04-02 17:23:30 +02:00
Daniel Marjamäki d403a6a883 Preprocessor::getConfigs: Remove bad configurations when #error is seen 2017-04-02 12:15:53 +02:00
Daniel Marjamäki 7eb95aac2a Preprocessor::getConfigs: Handle #error in '#if !A' better 2017-04-02 10:06:39 +02:00
Daniel Marjamäki 87bc667289 astyle formatting
[ci skip]
2017-04-02 09:26:14 +02:00
Daniel Marjamäki edd1c32e5b Preprocessor::getConfigs: Better handling of ! in #if 2017-04-02 09:03:43 +02:00
Daniel Marjamäki b7dcdc00d0 Fixed #7970 (ValueType: no types set below 'new std::string') 2017-04-01 22:22:37 +02:00
Daniel Marjamäki 1faca91c1d Added 'endsWith' utility function. This will make compiling the democlient easier. 2017-04-01 18:14:18 +02:00
Daniel Marjamäki 2eda59eb72 Update version 2017-04-01 11:03:45 +02:00
Daniel Marjamäki 1dbf485e02 Fix Cppcheck warnings. Remove redundant null pointer check. 2017-04-01 10:51:45 +02:00
Daniel Marjamäki 279b66003b Fix Cppcheck warnings about mismatching argument names 2017-04-01 10:34:53 +02:00
PKEuS ea215c3b7b Fixed false positives in CheckClass::checkConst() due to unmatched function overloads
Fixed function matching if constness mismatches
2017-04-01 10:19:32 +02:00
Daniel Marjamäki 633ed23c0d Fix Cppcheck warnings about mismatching function argument names 2017-04-01 09:31:27 +02:00
Roberto Martelloni 35d1479d05 CWE mapping of funcArgOrderDifferent, funcArgNamesDifferent (#885)
Add an optional extended description…
2017-04-01 08:36:46 +02:00
Daniel Marjamäki 164df2aa7b Fixed #7966 (ValueType: wrong type for gcc initialization {[1]=..}) 2017-03-31 09:41:38 +02:00
Daniel Marjamäki 8fe7ee1012 Fixed #7886 (ValueFlow: endless forloop 'for (i = 0, j = 0; i < sz && j < 9; i++)') 2017-03-30 22:02:36 +02:00
Daniel Marjamäki a8788d7fc7 Fix Cppcheck warning 2017-03-30 11:20:04 +02:00
Daniel Marjamäki 2da3123db2 Fix ValueType. The '[' in variable declaration is not a dereference. 2017-03-30 11:01:29 +02:00
Daniel Marjamäki cc3ef7bbe8 Fix so array access out of bounds for external arrays are detected again 2017-03-30 10:14:17 +02:00
IOBYTE 7cae057615 Add missing varid or variable for member variables.
Add an optional extended description…
2017-03-30 10:07:58 +02:00
Daniel Marjamäki c9eb7f4556 minor update of 64-bit checker 2017-03-30 10:07:25 +02:00
PKEuS 3c8f5b85ae Refactorization: Allocate Token::_values (ValueFlow information) dynamically, reducing size of each token by around 10% 2017-03-27 18:48:34 +02:00
PKEuS 2938278f00 Refactorization: Store minsizes in vector instead of list which has less overhead 2017-03-27 17:53:43 +02:00
PKEuS 63d39390b4 checkbufferoverrun.cpp: refactorizations 2017-03-27 16:09:51 +02:00
PKEuS 83b1e1c329 CheckBufferOverrun: Refactorizations
- Improved/Optimized conditions in checkBufferAllocatedWithStrlen()
- Avoid copying strings for checkScope()
2017-03-27 11:48:34 +02:00
PKEuS 680828788b Fixed false negative in CheckBufferOverrun::checkInsecureCmdLineArgs(), removed redundant tests 2017-03-27 11:30:07 +02:00
PKEuS 171e1b8244 Fixed false negatives in CheckBufferOverrun::arrayIndexThenCheck() 2017-03-27 11:07:49 +02:00
Daniel Marjamäki 62d4077dd0 Fix Cppcheck warning 2017-03-26 11:40:53 +02:00
Daniel Marjamäki 6874f27e73 Added CHECK_WRONG_DATA() that can be used to avoid crashes/hangs in release binaries 2017-03-26 11:23:39 +02:00
Daniel Marjamäki 4a1c04cb33 Preprocessor: Removed redundant initialization 2017-03-26 11:10:48 +02:00
Robert Reif c96e8daebc Don't change varid of member variables. 2017-03-25 10:59:35 -04:00
Daniel Marjamäki f5d56fd303 Fixed #7961 (Hang in CheckOther::checkFuncArgNamesDifferent) 2017-03-24 22:01:05 +01:00
Daniel Marjamäki 5fb0f46a3a ValueType: Hide assignment operator 2017-03-24 13:38:45 +01:00
PKEuS f4c0ab5dd5 SymbolDatabase: Match function overloads by using ValueType information by running a second pass of the function pointer assignment routine. 2017-03-24 12:19:29 +01:00
Alexander Alekseev abba762d42 New check: checking for copy ctor and eq operator co-existence 2017-03-24 12:00:20 +01:00
Robert Reif bc87e874e9 Add variable and type information for auto and auto variables in range based for loops of containers. 2017-03-23 20:14:49 -04:00
Robert Reif 7adfb6e0e4 Add variable and type information to tokens for C array range based for loops. 2017-03-23 19:48:20 -04:00
PKEuS 97fa9e9d1b ValueFlow: Stop on inline assembly 2017-03-23 20:01:16 +01:00
PKEuS 9225bff31d Added (back) support for enums to CheckCondition::checkIncorrectLogicOperator() (#7794) 2017-03-23 18:57:48 +01:00
PKEuS 996501a449 Fixed false positive #7953: Support type conversion operators returning pointers 2017-03-23 18:12:46 +01:00
Daniel Marjamäki c280bcedb4 Merge pull request #880 from IOBYTE/master
Update symbol database with new auto type and variable information for assignment to auto.
2017-03-23 08:51:06 +01:00
Robert Reif 662bc6f846 Add variable or type information to auto and auto variable tokens. Changing the auto variable type requires rerunning the variable pointer pass to correct the symbol database for the new type. 2017-03-22 22:09:40 -04:00
Robert Reif fda1f02dab long double is a floating point type. 2017-03-22 19:11:40 -04:00
Daniel Marjamäki 865588950a Preprocessor: quick fix for #7939 2017-03-22 10:53:21 +01:00
Robert Reif f099c6a110 Refactor symbol database value type support by making setValueTypeInTokenList and setValueType member functions of SymbolDatabase. Class variables are no longer passed around as parameters but accessed directly which simplifies the code. There should be no functional change. 2017-03-21 21:55:22 -04:00
orbitcowboy a7f1188151 Astyle run. 2017-03-21 14:22:28 +01:00
Simon Martin fb2b29dc7d Update TemplateSimplifier::getTemplateNamePosition to handle out-of-line template methods.
Add an optional extended description…
2017-03-19 20:44:20 +01:00
Daniel Marjamäki c18fe8262b Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))') 2017-03-19 07:26:11 +01:00
PKEuS 7c0aa4464c Fixed travis build by replacing Token::Match by simpleMatch()
Added missing files to cppcheck.vcxproj.filters
2017-03-16 21:15:10 +01:00
PKEuS 8a3fb4dd6c SymbolDatabase: Fixed return type token detection for template member functions (#7945) 2017-03-16 20:47:24 +01:00
PKEuS ca3e3b3cdb Fixed false positive multiCondition when & is used in both conditions (#7827) 2017-03-15 19:37:14 +01:00
PKEuS c638180753 Fixed crash in clang test suite introduced in b27ba72fdd 2017-03-15 19:22:42 +01:00
PKEuS 816106560a More conservative check for non-commutative operator+ in isSameExpression() (#7938) 2017-03-15 19:17:40 +01:00
PKEuS bcba27fbb9 SymbolDatabase: Removed unnecessary bailout in function matching for pointers in function overload matching 2017-03-15 18:45:33 +01:00
PKEuS b27ba72fdd SymbolDatabase: Support function overload matching for member variables (#7932) 2017-03-15 18:37:22 +01:00
PKEuS 92414b923a Library: Support variadic functions which are not a formatstr-function 2017-03-14 17:41:34 +01:00
Daniel Marjamäki 263c3596d5 known conditions: dont warn about 0 or 1 conditions as those look intentional 2017-03-08 18:39:19 +01:00
Daniel Marjamäki 8c707876ed Tokenizer: Don't simplify '({..})' wrongly 2017-03-08 11:41:18 +01:00
Daniel Marjamäki 5d7fa590af Don't check ignored function return value in ({..}). Ticket: #7934 2017-03-08 10:23:38 +01:00
PKEuS 00904ba32a Fixed false negatives in CheckOther::checkPassByReference() when assignment operator is used. 2017-03-07 21:49:28 +01:00
PKEuS 3da1de7893 Do not exclude std::shared_ptr and std::unique_ptr from checkPassByReference() (#7834)
These two types are larger than one pointer. Hence, passing by reference is faster.
2017-03-07 21:18:08 +01:00
PKEuS 1c3f010935 Fixed false positive: Exclude STL shared pointers from checkPassByReference() (#7834) 2017-03-07 21:04:19 +01:00
Daniel Marjamäki 5ea9519586 UseRetVal: Fix FN for methods 2017-03-05 22:23:16 +01:00
Daniel Marjamäki 2daf7f5430 Merge pull request #874 from simartin/ticket_7912
Ticket #7912: Properly preprocess files with decreasing line numbers, due to #line directives
2017-03-05 20:33:53 +01:00
Daniel Marjamäki e560ad1616 update std::string config 2017-03-05 18:19:49 +01:00
Simon Martin 43e4364675 Ticket #7912: Properly preprocess files with decreasing line numbers, due to #line directives. 2017-03-05 16:46:43 +01:00
Daniel Marjamäki 6c1096bf71 ValueType: First change to handle 'for (auto i : container)' 2017-03-05 15:40:29 +01:00
Daniel Marjamäki ab7cf5d215 ValueType: set ValueType for method that returns iterator 2017-03-05 14:53:32 +01:00
Daniel Marjamäki fa7501d3a5 ValueType: stl variables should now be handled 2017-03-05 10:33:17 +01:00
Daniel Marjamäki f3c0461001 ValueType: handling scoped types in 'new ...' 2017-03-05 10:24:51 +01:00
Daniel Marjamäki e0dd0a82ed ValueType: refactor and improve handling of 'new ...' 2017-03-05 10:02:47 +01:00
Robert Reif e02b2c4483 ValueType: handle new nothrow 2017-03-05 02:13:00 +01:00
Daniel Marjamäki 115ea08544 ValueType: Allow that type is library-container 2017-03-05 02:09:52 +01:00
Daniel Marjamäki c832b2f40b ValueType: Fixed bug 2017-03-05 01:39:56 +01:00
Daniel Marjamäki 920398615d ValueType: handle scoped types in parsedecl 2017-03-05 01:21:02 +01:00
Daniel Marjamäki 2f2ac46243 Replaced hardcoding for char16_t and char32_t with configuration 2017-03-04 16:30:42 +01:00
Daniel Marjamäki 12fe4a8b3e Fixed #7885 (ValueType: Wrong type for large hexvalue (platform=win32A)) 2017-03-04 14:19:14 +01:00
Daniel Marjamäki ecc59859e1 Don't simplify _Bool in TokenList 2017-03-04 11:13:28 +01:00
Daniel Marjamäki f0c353abcb TokenList: append 'U' if needed on hexvalues 2017-03-04 08:47:53 +01:00
Daniel Marjamäki 1c6c209353 Fixed #7890 (1.77 false positive from knownConditionTrueFalse with function-like macros) 2017-03-03 19:53:16 +01:00
Daniel Marjamäki b1ce229006 Small refactoring 2017-03-03 19:09:32 +01:00
Daniel Marjamäki 59c1c76a97 Fixed #7466 (Reference variable does not count side-effects (FP variableScope)) 2017-03-03 19:07:00 +01:00
Daniel Marjamäki b5f2fd3c55 Fixed #7738 (False positive deallocret - delete and return NULL pointer) 2017-03-03 18:36:06 +01:00
Daniel Marjamäki d1c66edb03 ValueFlow: Known values in conditional code 2017-03-03 01:29:34 +01:00
Daniel Marjamäki 45c5860ca4 Fixed #7926 (Memory Leak with auto not detected) 2017-03-02 22:24:26 +01:00
Daniel Marjamäki 9dc219f1ba CheckIO: Use ValueType more 2017-03-01 22:33:31 +01:00
Daniel Marjamäki 995d875cb2 SymbolDatabase: Refactoring 2017-03-01 18:09:50 +01:00
Daniel Marjamäki 51b5f1c286 Fixed #7931 (crash: SymbolDatabase: Variable::setFlag) 2017-03-01 17:13:22 +01:00
PKEuS 7eee6af4ce Fixed broken condition 2017-03-01 11:42:14 +01:00
PKEuS 2f0db369f0 Refactorization: Avoid construction of empty strings by using emptyString 2017-03-01 10:50:50 +01:00
PKEuS d501e488ca Refactorization: Reordered conditions in Scope::findFunction() 2017-03-01 10:27:01 +01:00
Daniel Marjamäki 279425499e Fixed #7930 (Improve check: Missing stlcstr warning for reference variable) 2017-03-01 02:03:08 +01:00
PKEuS 85768f1829 SymbolDatabase: Overload matching with boolean literals as argument and with arbitrary null-pointers 2017-02-28 22:43:47 +01:00
PKEuS 942644fde6 SymbolDatabase: Overload matching with character literals as argument 2017-02-28 22:08:41 +01:00
Daniel Marjamäki 841e0c2921 Fixed #7546 (Assignment to array element not detected if pointer addition is used) 2017-02-28 22:04:05 +01:00
Daniel Marjamäki 16c06e5714 Fixed #7588 (Opposite conditions in nested 'if' blocks lead to a dead code block.) 2017-02-28 18:46:28 +01:00
Ville Skyttä 2ccd5aec1a Comment spelling fixes
Add an optional extended description…
2017-02-28 12:22:59 +01:00
Daniel Marjamäki beaf29c158 SymbolDatabase: Update some properties for auto variables 2017-02-27 23:04:25 +01:00
Daniel Marjamäki 994f6b684d ValueType: initial handling of new 2017-02-27 20:57:28 +01:00
Matthias Krüger ce3bc006e7 fix build with -DMAXTIME=123 2017-02-27 14:00:06 +01:00
Matthias Krüger 35e7697474 switch some functions from const to static, as cppcheck suggests. 2017-02-27 13:51:33 +01:00
PKEuS 900d05d9dd Optimization: Do not attempt to find a matching function for if, for, while, etc. 2017-02-27 10:35:47 +01:00
Daniel Marjamäki 7ecd5db8fb ValueType: Handle auto in range for loop 2017-02-27 02:09:33 +01:00
Daniel Marjamäki 2da360eec5 ValueType: Handle 'auto *p = ..' 2017-02-26 22:43:10 +01:00
Daniel Marjamäki dad455c0dd ValueType: Handle 'auto'. First fix for #4345 2017-02-26 20:02:57 +01:00
Daniel Marjamäki d840005f06 Fixed #7656 (stlcstr - false positive) 2017-02-26 17:25:32 +01:00
Daniel Marjamäki f68fa72095 Fixed #7583 (Defect: False positive '(error) Reference to temporary returned') 2017-02-26 13:41:49 +01:00
PKEuS c1d8fd7f13 SymbolDatabase: Better handling of pointers in findFunction(), supporting const pointers and std::string overloads 2017-02-26 11:36:04 +01:00
PKEuS 4a27376694 SymbolDatabase: Implement two-stage fallback mechanism for matching function overloads, increasing matching accuracy 2017-02-25 23:12:00 +01:00
Daniel Marjamäki adc659f58b Fixed #7897 (MathLib::toDoubleValue: Does not handle character literal) 2017-02-25 21:58:09 +01:00
Daniel Marjamäki 26fc7abfac Fixed #7837 (Field dereference triggers format string type warning) 2017-02-25 18:22:14 +01:00
Daniel Marjamäki 2e91858640 Fixed #7877 (Tokenizer: Does not clear ValueFlow after first pass) 2017-02-25 17:57:39 +01:00
Daniel Marjamäki 55d7ab65b9 Fixed #7918 (::exit() not recognized as noreturn) 2017-02-25 12:12:39 +01:00
Daniel Marjamäki 99544069d1 CheckLeakAutoVar: better handling of noreturn functions. Partial fix for #7918. 2017-02-25 11:36:48 +01:00
PKEuS 3f1e2b4270 More conservative fallback for function overload matching 2017-02-24 20:56:47 +01:00
PKEuS 4e28d40bf0 Fixed matching long long overload to function call f(0) 2017-02-24 20:33:52 +01:00
PKEuS de86d40c97 Fixed handling of NULL and nullptr in CheckNullPointer 2017-02-24 19:44:28 +01:00
PKEuS b08f99a082 Fixed false negative: nullpointer passed as std::string argument (#7927)
Refactorization: Removed dead code from CheckNullPointer::parseFunctionCall()
2017-02-24 19:10:34 +01:00
Daniel Marjamäki a53f14da25 Fixed #7925 (False Positive identical condition) 2017-02-22 21:13:36 +01:00
Robert Reif 8e0f1ec788 Fixed #7909 (Crash in CheckMemoryLeakInClass) 2017-02-20 23:09:35 +01:00
Simon Martin 487f76cdd1 Ticket #7916: Don't incorrectly simplify return statements involving template instantiations. 2017-02-18 21:14:50 +01:00
Daniel Marjamäki 774a8979a3 Fixed #7095 (False positive: (warning) Return value of function to_string() is not used.) 2017-02-12 16:50:45 +01:00
Daniel Marjamäki 7c800d6ed7 Fixed #7447 (FP: ignoredReturnValue on C++11 uniform initialization) 2017-02-12 16:33:28 +01:00
Simon Martin 326d152aa2 Ticket #7914: Properly recognize template parameters that contains operators. (#870) 2017-02-11 10:13:41 +01:00
Matthias Krüger 6f1e7e897d simplify if(tok && Token::{simple,}Match) to if(Token::{simple,}Match). 2017-02-06 15:37:12 +01:00
Simon Martin 0943b2145b Ticket #7891: Do not remove spaces in the internal representation for template instantiations. 2017-02-05 17:35:29 +01:00
Matthias Krüger 92d9e810f3 templatesimplifier: remove redundant assignments inside switchcase. They will always be overwritten by an assignment outside of the switch near the end of the function. Found by clang analyzer. 2017-01-30 22:26:54 +01:00
Simon Martin 5262ed018e Ticket #7440: Function calls should not abort pointer alias analysis for local variables. 2017-01-27 22:56:28 +01:00
umanamente a012e5b5fb (Fixed #7846) Syntax error when using C++11 braced-initializer in function last argument
Add an optional extended description…
2017-01-23 12:50:36 +01:00
umanamente 2f609c2b9a Added cppcheck.natvis file for human readable debug information in Visual Studio.
Add an optional extended description…
2017-01-22 10:21:29 +01:00
umanamente 0c1ba8e8b4 (Fixed #7895) C++11 brace initialization. Added test. (#862)
Add an optional extended description…
2017-01-22 10:16:40 +01:00
PKEuS 3022d74801 Do not suggest pass by reference for std::initializer_list 2017-01-19 11:14:55 +01:00
amai2012 722fac391d Merge pull request #858 from simartin/ticket_7820
Ticket #7820: Properly report leaks with conditional deallocations followed by a return.
2017-01-18 09:31:49 +01:00
Simon Martin 9e76b21d7f Ticket #7820: Properly report leaks with conditional deallocations followed by a return. 2017-01-17 23:02:39 +01:00
orbitcowboy 6c71d74563 Cleanup: There is no need to clear a string directly after its creation. 2017-01-16 20:10:28 +01:00
Simon Martin ae939b1385 Teach CheckMemoryLeak about "alloc ; loop alloc ;" kinds of patterns. (#861)
Add an optional extended description…
2017-01-15 22:16:23 +01:00
Simon Martin c82d8a0d06 Ticket #7745: Simplify "alloc ; dealloc ;" blocks that we don't have any value for CheckMemoryLeak's analysis. (#860)
Add an optional extended description…
2017-01-15 22:14:37 +01:00
Daniel Marjamäki 47d39d0a14 Revert "Fixed #7888 (1.77 false positive from knownConditionTrueFalse with sizeof(int) == sizeof(long))"
This reverts commit a762511067.
2017-01-10 13:22:48 +01:00
Daniel Marjamäki 7bdd001a5f SymbolDatabase: Removed redundant 'else' 2017-01-09 22:48:05 +01:00
Daniel Marjamäki b7321e8dde Tokenizer: Rename struct 2017-01-09 22:40:30 +01:00
Daniel Marjamäki a762511067 Fixed #7888 (1.77 false positive from knownConditionTrueFalse with sizeof(int) == sizeof(long)) 2017-01-09 22:28:55 +01:00
Daniel Marjamäki b1f7e46491 Fixed #7323 (valueflow: global variables) 2017-01-09 15:53:08 +01:00
Simon Martin 417c7e36c0 Ticket #7548: Properly detect the end of template parameter default values during instantiation. 2017-01-08 09:38:29 +01:00
Matthias Krüger 064a4aa4cc improve constness of functions as per cppchecks suggestions. 2017-01-07 14:31:03 +01:00
Simon Martin bd92ddd386 Ticket #7850: Properly handle C functions called "class". 2017-01-06 21:16:28 +01:00
Robert Reif 4123b457d7 Fixed #7441 (SymbolDatabase: No scope when function return type not specified) 2017-01-06 11:53:17 +01:00
Robert Reif 139071d88b Fixed #7875 (New check: function declaration and definition argument names don't match) 2017-01-05 08:52:11 +01:00
PKEuS 8ba9ce4924 Set version to 1.77.99/1.78 dev 2017-01-01 11:58:39 +01:00
Daniel Marjamäki a184d5d421 SymbolDatabase: Refactoring 2017-01-01 11:34:05 +01:00
Robert Reif 4c25e798b1 Fixed #7865 (Tokenizer::createLinks2(): does does set links for <> in struct template) 2016-12-31 22:05:29 +01:00
Daniel Marjamäki bf5fa90952 updated version info 2016-12-31 18:35:08 +01:00
Simon Martin f43431408b Ticket #7685: Properly handle function calls as argument to a dealloc function. (#853)
Add an optional extended description…
2016-12-29 13:17:46 +01:00
orbitcowboy 24332b540d There is no need to clear a class member string in the Ctor. 2016-12-27 21:20:17 +01:00
Daniel Marjamäki 85ae3adeb2 Fixed #5144 (FP old memleak - tree structure) 2016-12-27 08:12:37 +01:00
Daniel Marjamäki 1b21767954 Fixed #5666 (False positive when modifiying std::string by pointer) 2016-12-26 17:13:35 +01:00
Daniel Marjamäki 7e7aa21029 astyle formatting
[ci skip]
2016-12-26 14:14:48 +01:00
Daniel Marjamäki 770abcf453 Fixed #5398 (False positive: Scope of variable can be reduced does not account for other variables not reduceable) 2016-12-26 14:14:40 +01:00
Daniel Marjamäki c8bc1c8f0e Merge pull request #852 from boos/cwe-mapping-16
CWE mapping of accessMoved, accessForwarded, nullPointerArithmeticRedundantCheck, nullPointerArithmetic
2016-12-25 22:45:08 +01:00
Daniel Marjamäki c8a450c9be uninitvar: Fixed a FP seen in daca2 2016-12-25 22:43:29 +01:00
Roberto Martelloni 04f24b4220 CWE mapping of accessMoved, accessForwarded, nullPointerArithmeticRedundantCheck, nullPointerArithmetic 2016-12-24 23:07:37 +00:00
PKEuS ea53bd22b7 Fixed false positive returnTempReference with operator++ (#7874) 2016-12-22 11:49:59 +01:00
Daniel Marjamäki 2ce4811998 astyle formatting
[ci skip]
2016-12-22 09:40:39 +01:00
Daniel Marjamäki df6ae9f3b4 Fixed #7847 (Can't detect shift negative values when some op is executed) 2016-12-22 09:40:19 +01:00
Daniel Marjamäki d79688c40b Fixed #7822 (False positive for uninitialized variable if array type is used) 2016-12-21 23:11:11 +01:00
Daniel Marjamäki 28af5c0379 Integer Overflow: Don't warn about left-shift expressions with negative result like '1<<31'. That is common practice. 2016-12-21 18:19:59 +01:00
Daniel Marjamäki 426d1b4196 Merge pull request #846 from simartin/ticket_7805
Ticket #7805: Ignore enumerators when simplifying known variables.
2016-12-21 17:58:48 +01:00
Daniel Marjamäki f40bdddbab ValueFlow: Better handling when casting calculation result 2016-12-20 23:09:50 +01:00
Daniel Marjamäki f0d91fb74b Fixed #7869 (False positive: Array index out of bounds) 2016-12-20 22:01:19 +01:00
Daniel Marjamäki 44ccbdedec ValueFlow: Improved value for cast 2016-12-20 21:37:25 +01:00
Daniel Marjamäki 606bb78297 ValueFlow: Better handling of casts 2016-12-20 19:32:21 +01:00
Daniel Marjamäki e14e86c103 ValueFlow: only set values in conditional code in subfunctions when sure 2016-12-20 11:06:20 +01:00
Daniel Marjamäki 807b653739 ValueFlow: Fix FP in for loops when 2nd expression is 0 2016-12-20 07:54:38 +01:00
Daniel Marjamäki f1ad7368f6 ValueFlow: bool values 2016-12-19 21:21:18 +01:00
Daniel Marjamäki aaf19c1e4f Fixed #7839 (Prefix increment triggers parameter modification warning) 2016-12-19 15:25:36 +01:00
Daniel Marjamäki f5ad7482a8 CheckBufferOverrun: Skip warnings about array index out of bounds in unions. Theoretically, the array is at least as large as the biggest union member. 2016-12-18 22:10:30 +01:00
Daniel Marjamäki 4558701c08 varid: don't generate varid and symboldatabase variable for function call parameter 2016-12-18 20:16:38 +01:00
Daniel Marjamäki 17aaecbd6b ValueFlow: Improved handling of sizeof 2016-12-18 14:03:48 +01:00
Daniel Marjamäki 461e5cc5c9 CheckBufferOverrun: Moved check from simplified to normal. This fixes a FP in asterisk. 2016-12-18 11:14:05 +01:00
Daniel Marjamäki 4ac5c78e0c Fix wrong iterator usage. Iterator that is erased must be non-const. 2016-12-17 22:20:50 +01:00