Commit Graph

410 Commits

Author SHA1 Message Date
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
Simon Martin d218b95349 Ticket #5776: Since the fix is in Tokenizer, it makes more sense to have a Tokenizer unit test. 2015-07-19 00:10:47 +02:00
Simon Martin 1f73d71542 Ticket #5776: Simplify (&a)->b into a.b 2015-07-17 23:27:35 +02:00
Daniel Marjamäki 02df692b0b Fixed #4760 (false negative: (error) usage of uninitialized variable (struct member)) 2015-06-19 18:21:46 +02:00
Simon Martin 0ebaa9b8c4 Ticket #6463 (dupe of #6680): Added test case. 2015-06-05 23:57:42 +02:00
Simon Martin da302b3912 Ticket #6680: Members can be initialized by operator>>. 2015-05-10 14:27:15 +02:00
Daniel Marjamäki d563bd73f4 Fixed #6583 (False positive uninitvar - exit() ignored?!) 2015-04-08 15:35:04 +02:00
Daniel Marjamäki 42c4aa1c49 Fixed #4880 (false negative: uninitialized variable, handling of conditional noreturn scopes) 2015-03-14 17:59:11 +01:00
PKEuS bc5132e0ac Refactorization: Moved declaration of errout, ... to testsuite.h, uniformized style 2015-03-11 22:54:43 +01:00
PKEuS 9bafa3bf25 Fixed false positive #6575 2015-03-11 20:25:27 +01:00
Daniel Marjamäki 6363c1359d TestUninitVar: moved out posix.cfg testing 2015-02-17 18:16:29 +01:00
Daniel Marjamäki d900148e6b TestUninitVar: Fix compile error 2015-02-17 18:09:23 +01:00
Daniel Marjamäki e5c098c7de TestUninitVar: move out posix.cfg testing 2015-02-17 18:08:19 +01:00
PKEuS 21cb0cfd60 Take simplifyIfNotNull and simplifyIfNot out of simplifyTokenList1 (first step for #6072) 2015-01-31 20:12:02 +01:00
PKEuS 789665dadf Fixed #6455: Show uninitvar even for const variables 2015-01-31 13:21:22 +01:00
PKEuS b69528eb80 Bailout in Token::getValueTokenDeadPointer() if reference is used (#6399) 2015-01-30 19:29:37 +01:00
PKEuS 0d151b45b5 Better support for funciton pointers in checkuninitvar.cpp (#6404) 2015-01-30 19:16:25 +01:00
Daniel Marjamäki 6b20172a36 Moved cfg tests from TestUninitVar 2015-01-30 16:35:17 +01:00
orbitcowboy 180d7389a0 Fixed #6457: Added missing podtype defintions to posix.cfg. 2015-01-26 08:35:22 +01:00
Martin Ettl 0ef43c05dc Removed accidently added ';' [ci skip] 2015-01-23 17:31:21 +01:00
Martin Ettl ac551807b6 posix.cfg: Added support for blkcnt_t datatype. 2015-01-23 17:29:18 +01:00
PKEuS ee046af20c Fixed false positives #6450 and #6451 2015-01-23 19:38:39 +01:00
PKEuS da35a74589 Fixed false negative: Passing uninitialized variable to stream (#4673) 2015-01-22 22:56:41 +01:00
PKEuS da5a04f071 Fixed recently introduced FP in checkuninitvar.cpp if address of variable is passed to a function 2015-01-22 21:22:02 +01:00
PKEuS f4d11a4209 Fixed false negatives on try and non-executable scopes in checkUninitVar, removed unnecessary function parameters 2015-01-22 13:55:19 +01:00
orbitcowboy a7ded1e19f Merge branch 'master' of https://github.com/danmar/cppcheck 2015-01-22 06:53:23 +01:00
PKEuS 7364cc8040 Fixed false positive in fityk: operator new calling constructor 2015-01-22 10:37:31 +01:00
orbitcowboy 2cfb286558 Added test case for #5412. 2015-01-22 06:53:11 +01:00
orbitcowboy dd241501f3 Added test case for #6341. 2015-01-22 06:37:09 +01:00
PKEuS c3e47f7eaa Fixed false positive in CheckUninitVar and internal message 2015-01-21 22:26:44 +01:00
PKEuS 94c3c45350 CheckUninitVar: Use function information from library, bailout for '?' 2015-01-21 22:02:25 +01:00
PKEuS ecb9d87e42 Fixed false positive: Bailout in checkuninitvar.cpp if setjmp is found 2015-01-21 16:49:34 +01:00
PKEuS 8f1e44f1b7 Stricter false positive testing: Perform old and new check on uninitialized variables false positives tests (with a few exceptions for FP in old checker that don't exist in the new one) 2015-01-21 16:45:15 +01:00
PKEuS 81dc96f373 Refactorization: Rearranged code in testuninitvar.cpp, avoid copying of settings 2015-01-21 16:26:27 +01:00
PKEuS 5334aaa25f Refactorization:
- Removed a few unit tests of old uninitialized variable checking expecting other results than same test for new checking
- A few tweaks to new uninitvar checking to improve results when run on tests for old check
- switched some (TODO) tests to new check if the TODO is fixed
2015-01-21 16:17:58 +01:00
PKEuS 346532d312 Fixed false positives in CheckUninitVar::checkStruct() 2015-01-21 13:11:48 +01:00
PKEuS 54de731cac Refactorized CheckUninitVar::checkScope(), fixed false negative 2015-01-21 12:20:03 +01:00
Robert Reif 3b8540fdc0 Fixed #6424 (false negative: Use of 'class Ns::C' silence Cppcheck) 2015-01-19 06:38:54 +01:00
Daniel Marjamäki a87fb96eaf Uninitialized variables: fix fp when 'a=((b)=c)' is used 2015-01-06 18:03:40 +01:00
Daniel Marjamäki f2e5fbd30d Uninitialized variables: bailout when ({..}) are used to avoid fp. it can be handled better. 2015-01-06 07:44:04 +01:00
Daniel Marjamäki b3c2ea2c4f CheckUninitVar: Fix fp for 'int x=2+x();' when x() is an unseen preprocessor macro 2015-01-04 11:13:20 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Daniel Marjamäki b8371ebd87 Revert 2e45df3b. Because there are FP. 2014-12-18 06:37:15 +01:00
orbitcowboy 2e45df3b72 Fixed #6341: false negative uninitvar pattern "return foo ( %var%" 2014-12-17 17:43:31 +01:00
orbitcowboy f13475ceb2 Refactoring of testuninitvar: Splitted large test functions into smaller pieces. 2014-12-16 22:02:03 +01:00
orbitcowboy ade7365cc0 testuninitvar: moved more tests to checkUninitVar2, which does not rely on ExecutionPath. 2014-12-15 19:47:20 +01:00
orbitcowboy bf4b6dfd19 testuninitvar: changed test cases to do not rely on ExecutionPath. 2014-12-15 15:41:03 +01:00
orbitcowboy 32cd7d727d Fixed #6325: false negative: uninitialized variable usage (write, posix). 2014-12-15 10:05:44 +01:00
Daniel Marjamäki 051d42ae6b astyle formatting 2014-11-20 14:20:09 +01:00
orbitcowboy f5d804f71a running astyle 2014-11-20 10:13:03 +01:00
Robert Reif c5e15950df Fixed #6230 (SymbolDatabase: Wrong function() is set for token) 2014-11-17 16:04:44 +01:00
Daniel Marjamäki de7e9223b8 Fixed #6272 (Improve check: multifile checking in checkbufferoverrun) 2014-11-15 10:43:49 +01:00
Daniel Marjamäki b766071272 Fixed #4970 (false positive: conditionally initialized variable used in if-clause (git/notes.c)) 2014-11-01 14:03:02 +01:00
Frank Zingsheim 41a54fceba Fixed false positives about uninitialized member variables if variable has a default value (#5500) 2014-10-16 21:57:43 +02:00
PKEuS 6955e719cf Collected garbage code tests and moved them to testgarbage.cpp 2014-10-16 10:59:46 +02:00
Alexander Mai b0c34390cd Fix FP: tmpnam() expects a valid pointer, an uninitialized array (of conforming size) is fine 2014-09-27 20:29:54 +02:00
Daniel Marjamäki bbbe2c1b94 Fixed #6169 (False positive: passing uninitialized struct buffer member to strncpy) 2014-09-15 15:58:21 +02:00
Daniel Marjamäki 865a252c89 astyle formatting
[ci skip]
2014-09-14 10:29:12 +02:00
Dmitry-Me 1e298a31cf Refactoring tests. Use utility function to warn about unsimplified code in tests. 2014-09-13 12:59:32 +02:00
Dmitry-Me a2b30c7801 Detect -> accesses on uninitialized pointers 2014-09-12 10:19:00 +04:00
Dmitry-Me f7824bfd00 CheckNullPointer::isPointerDeRef: Improve handling of static member variables and functions 2014-09-09 05:36:09 +02:00
Alexander Mai f94e208862 #6116 False positive uninitvar - first argument to wcstombs(). Correct stf.cfg 2014-09-01 19:53:24 +02:00
Daniel Marjamäki b8e356462a Dead pointer: Fixed FP for subfunction pointer argument 2014-08-14 06:47:19 +02:00
PKEuS 8130fda4ae Implemented support for C++11 uniform initialization in several checks. 2014-08-05 16:11:42 +02:00
Daniel Marjamäki a2f776b1b7 Dead pointer: Added checking for dead pointer usage when pointer alias local variable that has gone out of scope. 2014-08-05 06:24:23 +02:00
Daniel Marjamäki 3169a2d215 astyle formatting
[ci skip]
2014-07-06 17:50:21 +02:00
amai2012 0ddd7752b5 Avoid crash reported in #5943 (using the example from duplicate ticket #5971)
Replace a few size_t/unsigned int by std::size_t
2014-07-06 14:48:24 +02:00
Daniel Marjamäki a4a6f3e1be Tokenizer: Removed Tokenizer::simplifyConditionOperator(). Using the AST and ValueFlow, it should be much easier to parse ?: than before. 2014-06-10 19:30:13 +02:00
Daniel Marjamäki 8cc1f664d8 Uninitialized member variable: Fixed false negative when struct is read 2014-05-10 20:20:55 +02:00
Daniel Marjamäki 4c344adcf1 Uninitialized struct member: fixed false negative when struct assignment is seen 2014-05-10 19:56:44 +02:00
Daniel Marjamäki 04cd261ee2 Fixed #5664 (false positive: (error) Uninitialized variable: j (Comma operator in for loop)) 2014-04-21 10:32:29 +02:00
Daniel Marjamäki c8ae1e4751 Fixed #5658 (false positive: (error) Uninitialized variable: s) 2014-04-10 15:59:37 +02:00
Daniel Marjamäki 9b1d058410 Fixed #5660 (false positive: (error) Uninitialized variable: result) 2014-04-10 06:40:53 +02:00