Commit Graph

482 Commits

Author SHA1 Message Date
amai2012 1538248922 Fix syntax in test code example 2019-08-26 20:45:14 +02:00
Daniel Marjamäki 9d26be8380 Fixed #5259 (Improve check: Uninitialized variable not reported when used in array initialization) 2019-08-24 14:43:35 +02:00
Paul Fultz II 5c488b9519 Fix issue 9190: FP uninitvar for struct member (#2112)
* Fix issue 9190: FP uninitvar for struct member

* Add more test cases

* Fix false negative
2019-08-24 11:27:47 +02:00
Daniel Marjamäki 35fb55d76c Fixed #5259 (Improve check: Uninitialized variable not reported when used in array initialization) 2019-08-24 08:01:55 +02:00
Paul Fultz II c0a8d628b9 Fix issue 6010: Uninitialized inner struct (#2098)
* Fix issue 6010: Uninitialized inner struct

* Show to root variable that is unitialized

* Warn on pointer dereferences
2019-08-23 06:23:20 +02:00
Paul Fultz II 1f747d0b14 Add regression test for 9281 (#2097) 2019-08-19 09:09:07 +02:00
Paul Fultz II ee7fe3aaa1 Fix FP: Unitialized variable when using a pointer
This fixes the FP in cases like this:

```cpp
void f() {
    bool b;
    bool * x = &b;
    if (x != nullptr)
        x = 1;
}
```

It tracks the indirection of the uninit value in valueflow.
2019-08-17 07:36:41 +02:00
Paul Fultz II 3aef0c9bd3 Fix issue 8715: regression uninitvar not detected (#2092) 2019-08-16 07:48:54 +02:00
Paul Fultz II af214e8212 Fix issue 8825: ValueFlow: uninitialized struct member (#2087)
* Pass uninit value across pointers

* Add more testing
2019-08-15 10:44:55 +02:00
Daniel Marjamäki e11dcc609b Fixed #7758 (Function array is seen as Uninitialized) 2019-07-24 18:20:23 +02:00
Rikard Falkeborn 06337cedf5 Run more tests on full token list (#2020)
Since all checks are run on the full token list and not the simplified
one, run the tests on the full token list as well.
2019-07-22 10:26:55 +02:00
Daniel Marjamäki 7ca35d181b uninitStructMember: Fixed FP shown in daca@home 2019-06-02 20:19:53 +02:00
Daniel Marjamäki b9ac77a31b Uninitialized variables: Fixed false positive 2019-03-09 11:30:45 +01:00
Sebastian c8003d47e2
checkuninitvar.cpp: Use argument direction "out" info from library cfg (#1730)
CheckUninitVar::isMemberVariableAssignment uses argument direction "out"
now also to check for assignment when the member variable is handed over
to a function by reference.
testuninitvar.cpp: Improve tests, use a test library configuration.
2019-03-08 18:42:24 +01:00
Daniel Marjamäki 8a3b73ffdb Do not write extra uninitvar warnings 2019-03-02 13:17:15 +01:00
Daniel Marjamäki e27a7a585f Fix uninitvar false positive when taking address of variable 2019-02-27 18:44:30 +01:00
Daniel Marjamäki 80143725dd Fixed #8999 (False positive uninitvar related to casting) 2019-02-27 17:58:25 +01:00
Daniel Marjamäki b248075aae Comment bailout
[ci skip]
2019-02-26 19:28:11 +01:00
Daniel Marjamäki 9e93e89a4d UninitVar: Fix false positives when there is possible cast 2019-02-26 19:26:46 +01:00
Daniel Marjamäki 6ca1aba4a7 UninitVar: Fix --experimental-fast issues 2019-02-10 19:00:01 +01:00
Daniel Marjamäki bd7790fd8c Update copyright year 2019-02-09 07:24:06 +01:00
Daniel Marjamäki 8dd641b8be Use OVERRIDE in test 2019-01-12 15:45:25 +01:00
Daniel Marjamäki c8901e9bab CTU: Find paths better 2018-12-30 16:23:25 +01:00
Daniel Marjamäki 271763e680 CTU: Refactoring 2018-12-25 21:11:23 +01:00
Daniel Marjamäki 0f63874c62 Take back the whole program analysis for null pointers and uninitialized variables 2018-12-18 07:56:33 +01:00
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
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Daniel Marjamäki 26e36a1d6b Fix FP uninitvar when stream bool operator is used 2018-04-18 16:13:24 +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 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 dbc6771a0b Uninitialized variables: Fix FP for unknown macro like 'list_for_each' 2018-02-04 22:30:08 +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 9109956c8c UninitVar: Improve whole program analysis, used isVariableUsage() 2018-01-25 21:49:21 +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 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 b9b47809f9 Fixed #8197 (iscast: '(b)&1' is not a cast) 2017-09-08 22:52:16 +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 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 b68c8d91ab Fixed #8039 (Tokenizer: wrong simplification of string) 2017-06-01 22:21:02 +02:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki 06102cb3d7 UninitVar: Don't warn for inconclusive values 2017-04-28 21:09:56 +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
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
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
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 ed4a47de45 Tokenizer: Improve syntax checking of switch,if,while 2016-07-22 16:54:24 +02:00
Alexander Mai 4816394511 #5970 false positive in Uninitialized variable: d - casting struct var to char*. It got fixed since 1.72, add regression test 2016-05-14 22:36:54 +02:00
Daniel Marjamäki 34b5e0ce99 Fixed #6873 (False positive uninitvar - variable initialized via pointer) 2016-02-07 18:48:57 +01:00
Daniel Marjamäki b908bb18a9 Fixed #5503 (FP: Uninitialized variable - initialize in in if and else branch) 2016-01-30 20:48:28 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02: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 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 459a4e0cbe Fixed #7121 (False positive 'Uninitialized variable' converting pointer to reference) 2015-11-10 10:18:24 +01:00
PKEuS b20a7e3192 Refactorization: Moved two tests to testgarbage.cpp
Fixed wrong comment in testcppcheck.cpp (forgotten in previous commit)
2015-11-06 21:58:49 +01:00
PKEuS 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
PKEuS 07b661ef62 Refactorization: Improved handling of preprocessor in test suite
- Set Preprocessor::macroChar to '$' once in the beginning to avoid problems when changing the order of tests
- Removed Preprocessor usage from where it is not required
- Fixed a TODO in testuninitvar.cpp
2015-10-07 14:18:57 +02:00
Alexander Mai c27fc31fcf #6997 segmentation fault (invalid code) in CheckUninitVar::checkIfForWhileHead. Detect invalid syntax. 2015-09-23 10:33:55 +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
Daniel Marjamäki ad007ca2d7 Uninitialized variables: better checking of arrays 2015-09-13 16:32:16 +02:00
Daniel Marjamäki d88dc3ed3e Reverted 00c54df07c (don't remove enum declarations) because it caused unexpected false positives 2015-09-06 18:37:22 +02:00
Daniel Marjamäki 00c54df07c Tokenizer: Don't remove enum declarations 2015-09-06 17:44:49 +02:00
Alexander Mai 8d2c4453ad Small optimizations for C code in Tokenizer. Add some regression tests for recently fixed results 2015-08-29 19:00:09 +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
Daniel Marjamäki e71ab70356 Fixed #6871 (False positive uninitvar - pointer to uninitialized char[]) 2015-08-08 14:52:46 +02:00
Daniel Marjamäki 8f309aed12 TestUninitVar: cleanup duplicate tests for function handling 2015-08-08 09:57:56 +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
Alexander Mai 6548f20d9a #4871 "Uninitialized variable" when try/catch on an if branch. Regression test, issue got fixed since 1.69 2015-07-25 19:02:20 +02:00
PKEuS 176b3925b3 Removed "verify" code in testrunner. Fixing its messages reduces the accuracy of the test suite. 2015-07-25 14:18:41 +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
Alexander Mai ed74a3dcc6 Testcase for #4683 added (which got fixed already) 2015-07-24 06:06:31 +02:00
PKEuS e95800bed4 Added regression test for #4816
Ran AStyle
2015-07-23 20:53:50 +02:00
PKEuS 795e5de903 Refactorization: Cleaned up after ExecutionPath removal 2015-07-23 20:37:09 +02:00
Daniel Marjamäki ea933e9873 CheckUninitVar: Removed ExecutionPath based checker 2015-07-23 17:28:18 +02:00
Daniel Marjamäki 995c4196b5 testuninitvar: use new checking instead of executionpath 2015-07-23 17:20:11 +02:00
Daniel Marjamäki 0b81a267f4 uninitvar: handling arrays in non-executionpath checker 2015-07-23 14:51:38 +02:00
Daniel Marjamäki 28fd6ce2f0 testuninitvar: use new checking instead of executionpath in 2 more testcases 2015-07-23 13:50:02 +02:00
Daniel Marjamäki c4f9a2a160 testuninitvar: update testcase 2015-07-23 12:58:38 +02:00
Daniel Marjamäki 79067ac031 uninitvar: use new checking instead of executionpath in more tests. small improvements in new checking to fix testcases. 2015-07-23 08:46:59 +02:00
Daniel Marjamäki 239f0d4ab4 testuninitvar: use new checking instead of executionpath in various testcases 2015-07-22 22:53:59 +02:00
Daniel Marjamäki 1de1aaa2f4 CheckUninitVar: Fix crash when AST is not created properly 2015-07-22 22:17:12 +02:00
Daniel Marjamäki 1f5eea98b5 CheckUninitVar: Fix a FP reported for invalid code 2015-07-22 21:58:06 +02:00
Daniel Marjamäki 42ed436e9d Tweaks in uninitvar, small steps to make it possible to remove the ExecutionPath 2015-07-22 20:31:58 +02:00
PKEuS bdd53b4142 Fixed false positive #6717 2015-07-21 12:13:59 +02:00