Commit Graph

495 Commits

Author SHA1 Message Date
Simon Martin 915acac0b8 Ticket #8734: Skip static member variables in CheckUninitVar. (#1388) 2018-09-22 16:52:34 +02:00
Daniel Marjamäki fc97a5b11c Uninitalized variables: Fixed false positive 2018-08-15 18:04:36 +02:00
Daniel Marjamäki 79ffe1d4fc Rename _tokenizer, _settings, _errorLogger 2018-06-16 16:10:28 +02:00
PKEuS 0090ae5cf2 Optimization in CheckUninitVar::checkStruct(): Replaced expensive inner loop on all scopes by loop on child scopes for faster lookup for inner unions.
This speeds up checking of very large code files; for example, it reduces checking time for SQLite amalgamation by more than 20%
2018-05-14 15:48:57 +02:00
Daniel Marjamäki f336c2efe7 Refactoring; Renamed Scope::classStart and Scope::classEnd 2018-04-27 22:36:30 +02:00
Daniel Marjamäki fba8208134 CheckUninitVar: Use isLikelyStreamRead 2018-04-22 17:04:54 +02:00
Daniel Marjamäki cc4977e140 Tweaking CheckUninitVar (<< and >> handling) 2018-04-22 16:39:57 +02:00
Daniel Marjamäki 4f6bd5d607 Fix Travis 2018-04-17 14:54:12 +02:00
Daniel Marjamäki c84628c28a Fixed #8494 (False positive: serialization class overloads operator) 2018-04-17 14:23:04 +02:00
Daniel Marjamäki a0906140a6 Suppressions: New extensible Suppressions xml format that allow more attributes. To start with it also allows symbolName. 2018-04-09 06:43:48 +02:00
jrp2014 d2160f00b2 Refactor lib/checkuninitvar.cpp 2018-04-06 08:04:06 +02:00
jrp2014 b6504c70ca Improve constness 2018-04-04 21:51:31 +02:00
Daniel Marjamäki 58066b1f0c Remove whole program analysis from 'uninitialized variables' and 'null pointer dereference' checkers. I think this logic can more or less be added in ValueFlow instead and then all ValueFlow checkers should get whole program analysis. 2018-02-06 14:56:17 +01:00
Daniel Marjamäki 71511f3131 Refactor f487182 2018-02-06 08:59:36 +01:00
Ivan Maidanski f487182075 Suppressed unused functions should not lead to nonzero exit code (#1026) (#1078)
This is a fix of commit 97ffec8.
2018-02-06 07:44:53 +01:00
Daniel Marjamäki dbc6771a0b Uninitialized variables: Fix FP for unknown macro like 'list_for_each' 2018-02-04 22:30:08 +01:00
Daniel Marjamäki 4998248501 Null pointers: Fixed false positives when running whole program analysis. Copied the fix from the CheckUninitVar::isUnsafeFunction. 2018-02-04 15:29:57 +01:00
Daniel Marjamäki d47b7726fa Uninitialized variables: Fix potential false positives in subfunction if there is early return or conditional writes 2018-02-04 09:40:57 +01:00
Daniel Marjamäki 1fe59faecb changed message ids for uninitvar/nullpointer errors that was found by whole program analysis 2018-02-03 16:05:07 +01:00
Daniel Marjamäki f5a11a6510 UninitVar: Speedup whole program analysis a bit 2018-01-29 15:15:35 +01:00
Daniel Marjamäki 9109956c8c UninitVar: Improve whole program analysis, used isVariableUsage() 2018-01-25 21:49:21 +01:00
Daniel Marjamäki 51c2ded23f Fix crash 2018-01-25 19:42:50 +01:00
Daniel Marjamäki 4d66609173 Fix Cppcheck warning, uninitialized member variable 2018-01-25 17:29:08 +01:00
Daniel Marjamäki f73da16e94 Revert "UninitVar: Better checking in whole program analysis"
This reverts commit b2bdc2687b.
2018-01-25 17:05:57 +01:00
Daniel Marjamäki b2bdc2687b UninitVar: Better checking in whole program analysis 2018-01-25 15:56:46 +01:00
Daniel Marjamäki ce60b326f4 Whole program analysis: Improved handling of nested calls 2018-01-24 22:53:14 +01:00
Daniel Marjamäki 512b9f512c Refactoring whole program analysis for CheckUninitVar and CheckNullPointer 2018-01-21 22:56:46 +01:00
Daniel Marjamäki 351b382a7b Null pointers: Whole program analysis 2018-01-21 19:51:15 +01:00
Daniel Marjamäki ea63e52d98 UninitVar: Improved function/method matching in whole program analysis 2018-01-21 10:40:35 +01:00
Daniel Marjamäki c331a10fa7 Refactorings, and try to ensure that analyzer info is stored/loaded properly 2018-01-15 19:12:31 +01:00
Daniel Marjamäki f2b2e87fb6 Uninitialized Variables: some additional tweaks. Try to fix Travis 2018-01-15 17:35:21 +01:00
Daniel Marjamäki 100887429d Uninitialized variables: Whole program analysis for function calls 2018-01-15 15:54:09 +01:00
Daniel Marjamäki c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Daniel Marjamäki 255b788d4d Fixed #4903 (Improve check: allocated but not initialized (condition)) 2018-01-02 23:20:46 +01:00
Daniel Marjamäki ba8222de1c ValueFlow: Put 'inconclusive' state in the ValueKind. A value can't be both known and inconclusive. 2017-09-20 22:41:36 +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 d160d27417 Fixed #8172 (False positive uninitvar on sizeof *ptr) 2017-08-23 22:17:49 +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 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
Ayaz Salikhov 3cd2f2d092 Don't cast bool to bool 2017-06-01 01:49:40 +03:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki 95db173e77 Fixed Cppcheck warning 2017-05-13 11:06:33 +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 06102cb3d7 UninitVar: Don't warn for inconclusive values 2017-04-28 21:09:56 +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 43454936e7 Fixed #8014 (FP: Uninitialized variable 'f(1,{..});') 2017-04-21 22:33:27 +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 2f0db369f0 Refactorization: Avoid construction of empty strings by using emptyString 2017-03-01 10:50:50 +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
Daniel Marjamäki c8a450c9be uninitvar: Fixed a FP seen in daca2 2016-12-25 22:43:29 +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
PKEuS 2f6350a0d0 Refactorized Library 2016-12-06 14:09:28 +01:00
Matthias Krüger b3ace258ab there is no need to have "if(tok && Token::Match(tok,..." since Token::Match checks "tok" by itselfs already. 2016-11-26 17:22:30 +01:00
orbitcowboy a81920cae1 checkunusedvar: Check pointer against NULL before dereferencing it. 2016-10-31 15:57:34 +01:00
orbitcowboy bc32ccc894 CheckUninitVar::isFunctionParUsage: Avoid implicit conversion from type bool to int. 2016-10-29 21:41:55 +02:00
PKEuS e1a21a8bb1 Fixed internal warnings 2016-10-08 11:34:25 +02:00
Harald Scheidl 9f1b70fa04 new can initialize memory, don't warn in this case (#7623) 2016-10-08 10:03:09 +02:00
Daniel Marjamäki 9711064b74 Fixed #6646 (False positive uninitvar - loopvariable initialized inside loop) 2016-08-04 14:39:54 +02:00
Robert Reif 55b3f0bf38 Fixed #752 (SymbolDatabase: Does not match function if redundant keywords mismatch (C++)) 2016-08-04 09:06:32 +02:00
Daniel Marjamäki 2187e8ba02 CheckUninitVar: Fixed FP when dereferencing multidimensional arrays. Refactoring of testing. The FP was spotted when looking at #7092 2016-08-02 14:27:51 +02:00
Daniel Marjamäki dc2a92263a Fixed #7426 (RFC: time to replace simplifyEnum?) 2016-04-22 06:02:54 +02:00
Daniel Marjamäki 34b5e0ce99 Fixed #6873 (False positive uninitvar - variable initialized via pointer) 2016-02-07 18:48:57 +01:00
Alexander Mai d3546ea410 #7321 segmentation fault in valueFlowSwitchVariableScope::isVariableDeclaration 2016-02-03 22:49:57 +01:00
Roberto Martelloni 50fc784550 Mapped error ids stlBoundaries, stlcstr, useAutoPointerContainer, useAutoPointerArray, sprintfOverlappingData, strPlusChar, shiftTooManyBits, integerOverflow, uninitstring, uninitdata, uninitvar, uninitStructMember, deadpointer, va_start_referencePassed, va_end_missing, va_list_usedBeforeStarted, va_start_subsequentCalls to their CWEs. 2016-02-03 12:53:23 +00: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
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Alexander Mai f762affea0 Small refactoring: replace NULL by nullptr, remove redundant static keyword, Tokenizer::setVarId() uses const variable 'notstart' 2015-11-30 22:13:49 +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
Daniel Marjamäki d93cf96a29 Fixed #6769 (false positive: Uninitialized struct member: epoch.integer) 2015-11-22 16:20:46 +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
Daniel Marjamäki d301cf28ec CheckUninitVar: Small logical fixes in conditions handling. 2015-11-21 08:32:25 +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
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
Daniel Marjamäki 5772bbd206 Fix Cppcheck warning 'explicit constructor' 2015-11-18 15:56:48 +01:00
Daniel Marjamäki 6b9c12e806 CheckUninitVar: Refactoring and gcc-compatibility fix 2015-11-18 15:16:50 +01:00
Daniel Marjamäki e6ceae213e CheckUninitVar: Improving multi-variable value handling 2015-11-18 14:56: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 963008089d Fixed false positive with range-based for-loop (#7078) 2015-10-28 16:37:46 +01:00
Daniel Marjamäki bfd8a69e74 Fixed #6243 (False positive: uninitialized variable, looping with goto) 2015-10-27 12:40:52 +01:00
PKEuS e989d4b11b Support C++11 array initialization in CheckUninitVar (#7010) 2015-10-24 12:06:40 +02:00
Daniel Marjamäki 305760f143 Uninitialized variables: Fix FP for struct array 2015-09-16 14:42:55 +02:00
Daniel Marjamäki af233efcce Uninitialized variables: tweaked checking of arrays / allocated buffers 2015-09-14 09:03:21 +02:00
Matthias Krüger 2ddd4c7197 fix [lib/checkuninitvar.cpp:836]: (warning) Found simple pattern inside Token::Match() call: "&" 2015-09-13 17:54:53 +02:00
Daniel Marjamäki ab38ab800e CheckUninitVar: don't rely on Tokenizer::simplifyKnownVar() to simplify references 2015-09-13 17:31:45 +02:00
Daniel Marjamäki ad007ca2d7 Uninitialized variables: better checking of arrays 2015-09-13 16:32:16 +02:00
Daniel Marjamäki 6ddd0a953f Fixed #6917 (False positive uninitvar - unused array declaration and ternary expression) 2015-08-29 13:19:28 +02:00
Simon Martin 6fb19b02d0 Properly differentiate arrays of pointers and pointers to arrays. 2015-08-25 21:19:19 +02:00
PKEuS ab8afec3eb Refactorizations:
- Avoid unnecessary loop iterations
- Avoid unnecessary condition checking
- Reduced code duplication in symboldatabase.cpp
2015-08-16 14:23:07 +02:00
Daniel Marjamäki 7ede9de502 Removed unused code. The isVariableUsed is used instead. 2015-08-15 07:43:39 +02:00
Daniel Marjamäki e71ab70356 Fixed #6871 (False positive uninitvar - pointer to uninitialized char[]) 2015-08-08 14:52:46 +02:00
Daniel Marjamäki 7ec8adeb93 Fixed #6701 (Uninitialized variable warning when header could not be found) 2015-08-08 08:53:08 +02:00
Daniel Marjamäki 4bebb80300 Fixed #6869 (False positive: uninitvar, array passed to function) 2015-08-05 10:19:17 +02:00
Daniel Marjamäki e598b07a6d Moved functions to astutils 2015-08-03 09:20:50 +02:00
Daniel Marjamäki acc1566f64 uninitvar: Improved condition handling. Fixes one problem when running 'tools/run_more_tests.sh test/testuninitvar.cpp' 2015-07-25 17:55:01 +02:00
Daniel Marjamäki 234669b02b Removed the UninitVar::analyseFunctions(). This was written for multifile checking however it did not work as it should => no multifile errors can be detected. 2015-07-24 08:30:38 +02:00