Commit Graph

442 Commits

Author SHA1 Message Date
Daniel Marjamäki 8dd641b8be Use OVERRIDE in test 2019-01-12 15:45:25 +01:00
Daniel Marjamäki aa4f61acdf CTU: Avoid FP in else block 2018-12-31 08:24:39 +01:00
Daniel Marjamäki fb6a291370 CTU: Avoid FP in code protected by &&,||,? 2018-12-31 08:16:21 +01:00
Daniel Marjamäki 91a580cbd7 CTU: more warnings 2018-12-30 18:31:37 +01:00
Daniel Marjamäki c8901e9bab CTU: Find paths better 2018-12-30 16:23:25 +01:00
Daniel Marjamäki d18f5d8709 CTU: Reuse CheckNullPointer::isPointerDeRef in the nullpointer isUnsafeUsage 2018-12-29 09:26:57 +01:00
Daniel Marjamäki 271763e680 CTU: Refactoring 2018-12-25 21:11:23 +01:00
Daniel Marjamäki a1dca6acd5 Fix CTU nullpointer check 2018-12-25 12:04:01 +01:00
Daniel Marjamäki bc34f0239d Disable the subfunction value flow analysis. It does not work well and needs to be rewritten. There are false positives. 2018-12-18 14:36:49 +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
Daniel Marjamäki ef35b86b4a Multipass Valueflow 2018-11-03 15:53:24 +01:00
Daniel Marjamäki 45379a3aa6 Updated copyright year for modified files
[ci skip]
2018-06-10 22:07:21 +02:00
IOBYTE ce50df8047 Fix override warnings. (#1234) 2018-05-15 16:37:40 +02:00
Paul Fultz II 0197343e0c Fix false positive when using null arithmetic with class type (#1214) 2018-05-09 09:06:49 +02:00
Daniel Marjamäki 7dfbe7389b Clarify null pointer arithmetic message 2018-05-02 12:57:24 +02:00
Daniel Marjamäki b2343a2d4b Fixed #8518 (Clarify warning for a NULL pointer which is received by a function call parameter.) 2018-05-01 17:30:29 +02:00
Paul Fultz II d8b3fa5c70 Fix #8482: Regression with valueflow (#1159)
* Fix regression with valueflow

* Simplify test case
2018-04-09 16:13:17 +02:00
PKEuS bbfcccf078 Refactorization: Replace several push_back-sequences by initializer lists 2018-04-09 09:41:24 +02:00
Paul d240a36a60 Extend nullPointerArithmetic to check for addition as well 2018-04-03 21:32:37 +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 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 c4caee6b18 Updated copyright year 2018-01-14 15:37:52 +01:00
Ayaz Salikhov 28aa939d69 iwyu - include what you use 2017-05-27 04:33:47 +02:00
Daniel Marjamäki 040d2f0012 Use simplecpp lexer in test cases 2017-05-18 21:52:31 +02:00
Daniel Marjamäki 8d75d1b920 Partial fix for #8028 (ValueFlow: Origin/callstack of value) 2017-05-15 20:05:11 +02:00
Daniel Marjamäki 7fd04cd8d0 Updated Token::expressionString(), write '->' instead of '.' 2017-04-30 14:22:18 +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
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
PKEuS 2f6350a0d0 Refactorized Library 2016-12-06 14:09:28 +01:00
Stefan Weil 57b57428c2 Fix some typos in comments (found by codespell)
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-27 11:40:42 +01:00
Frank Zingsheim d4f01583b6 Fixed TODO (check if function parameter is non-const reference etc..) by common function 2016-11-01 14:06:30 +01:00
Daniel Marjamäki efa3aba32a Remove Tokenizer::simplifyNull() 2016-10-18 21:44:02 +02:00
Daniel Marjamäki af5dd2c29e New check: Pointer overflow (null pointer subtracted) 2016-10-09 15:15:29 +02:00
Daniel Marjamäki ed4a47de45 Tokenizer: Improve syntax checking of switch,if,while 2016-07-22 16:54:24 +02:00
PKEuS 923f7f843d Better distinguishing between possible and known null pointer dereferenciations (#7157) 2016-01-30 20:43:40 +01:00
Daniel Marjamäki 4a3ece5847 CheckNullPointer: Fix FP for 'buf[p]' when p is NULL 2016-01-20 08:42:58 +01:00
Lauri Nurmi 996c9244d8 Update copyright year to 2007-2016. 2016-01-01 15:34:45 +02:00
Daniel Marjamäki 0f9d90d2be Changed Copyrights. Removed my name. 2015-11-18 20:04:50 +01:00
PKEuS 3a5cef8a7e Refactorization: Improved usage of Settings instances in test suite 2015-10-07 18:40:03 +02:00
Frank Zingsheim 1fd9ba0cc4 Fixed #6988 (incorrect nullPointer error for string) 2015-09-13 10:53:05 +02:00
Daniel Marjamäki 871b02ea88 removed testcase for #5238. it's not good enough. 2015-08-15 07:38:56 +02:00
Martin Ettl 84486605ec #6392: Added a regression test case. 2015-08-15 01:00:36 +02:00
Martin Ettl 278808daa9 #5238: Added a regression test case. 2015-08-15 00:49:07 +02:00
Martin Ettl 640ec3a099 #6491: Added a regression test. 2015-08-15 00:31:26 +02:00
Alexander Mai 0b96b9d984 #6505 ValueFlow: handle 2 related if in valueFlowSubFunction. Regression test. Bug got fixed before 2015-07-31 21:15:43 +02:00
Daniel Marjamäki 6790d91fbb Improve error messages for conditional values. make valueFlowSwitchVariable values conditional that depend on the case. Partial fix for #6884. 2015-07-29 19:54:57 +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 eb0db322eb Fixed #6560 (ValueFlow: handling ternary operator better in valueFlowSubFunction) 2015-05-24 17:02:00 +02:00
Daniel Marjamäki bdc024bd7c Fixed 6634 (false positive: dereferencing null pointer in a sizeof operation) 2015-04-20 13:46:02 +02:00
Robert Reif 4ceb24630d Fixed #6568: Scope for template class member function missing in symboldatabase 2015-04-09 21:01:47 +02:00
Daniel Marjamäki fd6bd97972 Fixed #6495 (Improve check: uninitialized variable, 3rd function argument) 2015-03-14 19:23:33 +01:00
PKEuS bc5132e0ac Refactorization: Moved declaration of errout, ... to testsuite.h, uniformized style 2015-03-11 22:54:43 +01:00
PKEuS 451a277b18 Refactorization: Support function default values in ValueFlow, removed now obsolete CheckNullPointer::nullPointerDefaultArgument().
-> Use valueFlowForward() to parse values passed to functions
-> valueFlowForward(): Set value in first occurrence of a variable in a condition
2015-02-01 15:15:00 +01:00
PKEuS 21cb0cfd60 Take simplifyIfNotNull and simplifyIfNot out of simplifyTokenList1 (first step for #6072) 2015-01-31 20:12:02 +01:00
Daniel Marjamäki 8d2f271921 clean up cfg tests in TestNullPointer 2015-01-30 06:51:03 +01:00
Daniel Marjamäki 9bbad1b622 TestNullPointer: Moved posix.cfg tests 2015-01-30 06:43:40 +01:00
Daniel Marjamäki 0949baac9b TestNullPointer: moved out std.cfg checking 2015-01-29 06:07:48 +01:00
Daniel Marjamäki 70a38b1da6 TestNullPointer: Moved some std.cfg tests to the cfg testing 2015-01-28 16:22:45 +01:00
PKEuS 3274a00b82 Moved some more tests to testgarbage.cpp 2015-01-21 10:04:46 +01:00
Daniel Marjamäki fe8d04e840 CheckNullPointer: Fix FP when x is NULL and address is calculated with expression '&x->y.z[0]' 2015-01-05 14:54:24 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
PKEuS c4fd8919a2 Fixed #6014: Added plausibility check before issuing null pointer messages on function calls defined in library 2015-01-02 13:35:39 +01:00
orbitcowboy def3491829 posix.cfg: Added support for readdir(). 2014-12-10 17:44:21 +01:00
Alexander Mai d11eb4931a #6306 false positive with strxfrm NULL argument. Adjust std.cfg in favor of no false positive 2014-12-07 15:24:27 +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
PKEuS b724784f0b Removed obsolete comments 2014-10-18 11:18:07 +02:00
PKEuS a99fd364ef Restored functionality to detect std::string(0) calls as null pointer dereferences (#6189) 2014-10-16 19:12:02 +02:00
Alexander Mai 21c85118d6 #6189 assign with operator= a '\0' to a std::string is not an error 2014-09-26 20:40:44 +02:00
Daniel Marjamäki ee93d30d94 ValueFlow: improved valueflow for loops that assign variable and then break 2014-09-23 16:06:02 +02:00
Alexander Mai 98d4c944e3 #6163 False nullPointer for strtok(NULL, ...). Correct std.cfg 2014-09-15 20:57:34 +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
Daniel Marjamäki 05617d7285 Fixed #6118 (False positive: divide by zero - if condition not evaluated properly) 2014-09-04 17:52:14 +02:00
PKEuS 4e9b145727 Added unit test for #3392 2014-09-02 12:03:05 +02:00
Alexander Mai 3aeecb8a05 #6100 False positive nullPointer - calling mbstowcs(NULL,). wcstombs has also been fixed 2014-08-27 19:32:53 +02:00
orbitcowboy 95c49ec5dc Extended std.cfg about more missing functions. Moved POSIX functions to posix.cfg. Extended posix.cfg about more memory allocating functions. 2014-06-25 12:00:24 +02:00
orbitcowboy f57e875351 Astyle run; Extended std.cfg and avr.cfg about a few more functions. 2014-06-23 11:59:14 +02:00
Daniel Marjamäki f78cbda2db Refactoring: Removed CheckNullPointer::nullPointerByCheckAndDeRef and implemented needed analysis in ValueFlow instead. 2014-06-22 10:02:14 +02:00
Daniel Marjamäki ef81bc363a ValueFlow: analysis in condition. 2014-06-19 17:29:41 +02:00
PKEuS 9dd4ac68c0 Refactorization in CheckNullPointer:
- Use AST to detect dereferences
- Added more unit tests
- Removed handling of unknown constructs in CheckNullPointer::isPointerDeRef()

Added link to verbose message cstyleCast.
2014-05-22 19:48:00 +02:00
Alexander Mai 91e7116de1 Fix regression from first attempt fixing #5811 (9dce9bddcb) 2014-05-17 19:14:29 +02:00
Alexander Mai 9dce9bddcb #5811 false postive: (error) Null pointer dereference 2014-05-17 18:18:20 +02:00
Daniel Marjamäki e04351ec33 re-enable tests in testnullpointer 2014-05-17 16:44:44 +02:00
Martin Ettl b363d0641a posix.cfg: Fixed FP for getcwd().First and second parameter is allowed to be zero. 2014-05-02 04:56:12 +02:00
Daniel Marjamäki 7317785e32 astyle formatting
[ci skip]
2014-04-27 10:20:21 +02:00
Alexander Mai 0b8dcbb441 Fix compiler warning about dead code due to disabled tests 2014-04-27 09:48:21 +02:00
Martin Ettl ed54b93317 Fixed FP in posix.cfg and mkdir() for second parameter. 2014-04-18 21:46:32 +02:00
orbitcowboy 66329fe8b8 posix.cfg: Fixed FP for isatty() function and added unit cases. 2014-04-10 17:53:04 +02:00
orbitcowboy baf8d09a0d Fixed FP for nullpointer dereference when using putchar. 2014-04-09 17:02:17 +02:00
orbitcowboy dd61c5db47 Fixed FP, nullpointer for memchr. 2014-04-08 18:39:50 +02:00
Alexander Mai a06371e063 Fixes for Doxygen + code formatting 2014-04-07 20:39:19 +02:00
unknown 9ae59290dd #5645 False positive Null pointer derefence about first argument to fputc() 2014-04-07 12:08:34 +02:00
Daniel Marjamäki a6557f8c74 Null pointer: Fixed false positive discovered by Travis when self-checking cppcheck 2014-04-02 19:39:42 +02:00
PKEuS 3950a62ef2 Added unit test for #2626 2014-03-28 10:06:24 +01:00
PKEuS 825b8b7c66 Unit test for #3589 2014-03-27 19:16:30 +01:00
PKEuS 7e4081f7f5 Treat syntaxError and cppcheckError as InternalErrors (throw as exception, #4268) 2014-03-27 13:15:21 +01:00
PKEuS 1677e2913e Regression test for #5061. 2014-03-26 12:17:27 +01:00
PKEuS 9b4b90f6a0 Avoid loading libraries multiple times in test suite
-> Massive speedup for test suite (especially on slow systems)
2014-03-24 09:59:05 +01:00
Martin Ettl e00f50b850 Fixed #5597 and added abort() support to stdcfg. 2014-03-21 17:36:48 +01:00
orbitcowboy 6507824a34 Added support for putchar() to std.cfg. 2014-03-20 05:49:38 +01:00
orbitcowboy 80e3b49cfc Added support for ftell() and puts() to std.cfg. 2014-03-20 04:10:41 +01:00
orbitcowboy 30006cf06f Added support for fputs() to std.cfg. 2014-03-20 02:13:41 +01:00
orbitcowboy b37e9601c1 Added support for fgetc() to std.cfg. 2014-03-20 00:59:52 +01:00
Martin Ettl fe1b46c174 Extended std.cfg 2014-03-19 21:08:48 +01:00
PKEuS 86e6bb430a New check: Warning, if positioning operation (fseek) is performed on a file opened in "a" mode 2014-03-17 11:02:03 +01:00
Martin Ettl 80b1271d01 Astyle running and added test cases for functions in std.cfg. 2014-03-10 02:21:44 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Daniel Marjamäki b8b573321e CheckNullPointer: Update std.cfg and test that updates are correct 2014-01-27 17:33:16 +01:00
Daniel Marjamäki 87b67e9b77 TestNullPointer: Added test configuration for 'memcmp' that is needed by a test 2014-01-26 16:32:28 +01:00
Daniel Marjamäki 1d7bb05faf Remove ExecutionPath from CheckNullPointer 2014-01-22 20:24:51 +01:00
Daniel Marjamäki f3f7e6d302 value flow: replacing executionpath checking of null pointers 2014-01-22 20:16:31 +01:00
Daniel Marjamäki 43db1ee797 value flow: use more specific bailouts when analysing value flow after assignment 2014-01-22 06:38:25 +01:00
Daniel Marjamäki cc38dec3ad value flow: a bit better handling of assigned variable 2014-01-22 06:10:17 +01:00
Daniel Marjamäki a27ccbd0f8 value flow: start implementing value flow analysis of assigned value 2014-01-21 21:13:49 +01:00
Daniel Marjamäki 30cae358d8 Removed the --value-flow flag. ValueFlow analysis will always be enabled from now on. 2014-01-17 18:07:05 +01:00
Daniel Marjamäki c9e9262682 value flow: use checknullpointer checking based on new value flow analysis in the TestNullPointer 2014-01-12 19:51:05 +01:00
Daniel Marjamäki 5d2a39b580 CheckNullPointer: improved function call checking when new value flow analysis is used 2014-01-12 19:27:26 +01:00
Daniel Marjamäki bef56d7a70 reverted change I pushed by mistake 2014-01-12 15:44:40 +01:00
Daniel Marjamäki 424675982a dmake: use -std=c++0x instead of -std=c++11 as it's supported by earlier gcc 2014-01-12 15:38:51 +01:00
Daniel Marjamäki 7c4a7ac3d5 value flow: starting to refactor CheckNullPointer::nullPointerDeRefThenCheck 2014-01-08 17:37:39 +01:00
Daniel Marjamäki 7125682d1a Fixed #5274 (TokenList: macro handling) 2014-01-03 18:53:37 +01:00
PKEuS 4f0121ee2f Splitted simplification out of tokenize() 2013-12-30 17:45:28 +01:00
Daniel Marjamäki 872b6e8fcc Fixed VS compiler warning. Using 'struct' for class. Thanks XhmikosR for reporting. 2013-12-26 17:48:25 +01:00
Daniel Marjamäki 20b84fcdee Null pointers: Don't warn when first argument to freopen() is NULL 2013-11-08 13:22:07 +01:00
Daniel Marjamäki 7996d609be Fixed #5108 (false positive: uninitialized variable (assignment in function parameter)) 2013-11-04 23:09:15 +01:00
Daniel Marjamäki 5f0cfa0ee4 Fixed #4983 (False positive warning 'Possible null pointer dereference: lblList - otherwise it is redundant to check it against null.' with sizeof lblList[0]) 2013-11-02 23:56:10 +01:00
Daniel Marjamäki 4a6274dcc0 Merge pull request #183 from felipensp/null_ptr_typeof
- Fixed false positive when passing pointer to typeof()
2013-10-27 02:37:31 -07:00
Daniel Marjamäki fd0f2d7900 Fixed #4929 (False positive: possible null pointer deref (checks dont handle && and || well)) 2013-10-22 10:47:48 +02:00
Daniel Marjamäki fc26de89a9 Fixed #5082 (False positive: (error) Possible null pointer dereference: p2) 2013-10-20 13:37:36 +02:00
Felipe Pena ecb0e70250 - Fixed false positive when passing pointer to typeof() 2013-10-12 10:19:15 -03:00
Robert Reif 1fccfd50eb Fixed #5080 ((error) Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers) 2013-10-12 10:50:59 +02:00
Lucas Manuel Rodriguez a70b0cd0f3 Fixed FP: Null pointer dereference 2013-08-24 16:50:19 -03:00
PKEuS a9a5dc0354 Updated to AStyle 2.03, require this version 2013-08-07 16:27:37 +02:00
Daniel Marjamäki a1fafa7f06 Library: added <formatstr> and <strz> to argument checks 2013-07-22 20:21:45 +02:00
Daniel Marjamäki fa7f8ddc78 Library: Renamed Argument to ArgumentChecks to make it a bit more clear 2013-07-16 09:40:31 +02:00
Daniel Marjamäki d25e7d4a21 Library: fixed problems 2013-07-16 08:21:38 +02:00
Daniel Marjamäki 24dfc052e2 astyle formatting 2013-07-15 21:57:58 +02:00
Daniel Marjamäki 7443883b9c Library: Improved handling in CheckNullPointer::parseFunctionCall for Library data 2013-07-15 18:55:40 +02:00
Daniel Marjamäki c389e08353 Fixed #4728 (simplify known variables better (%var% & %num%, bitwise and)) 2013-06-26 18:13:28 +02:00
Daniel Marjamäki 10849e220b Fixed #4809 (Review CheckNullPointer::parseFunctionCall) 2013-06-07 06:37:53 +02:00
Daniel Marjamäki 079d22fbee Fixed #4734 (False 'Possible null pointer dereference') 2013-05-03 16:18:44 +02:00
Zachary Blair 35668380cf Fixed #4510 (False positive: "Possible null pointer dereference if the default parameter value is used" after init) 2013-04-25 00:25:56 -07:00
Daniel Marjamäki 4e65800adf TestRunner: Updated warning message when there is unsimplified code 2013-04-16 16:54:19 +02:00
Daniel Marjamäki fdac502c39 Simplified TestNullPointer test cases 2013-04-15 19:00:15 +02:00
PKEuS 693c6e84cb Removed more duplicate unit tests 2013-04-13 01:49:17 -07:00
Daniel Marjamäki 38680e3440 Fixed #4677 (Message for 'possible null pointer dereference, otherwise it is redundant to check..' is warning but says error) 2013-04-07 03:41:02 +02:00
PKEuS 51685f24c5 Improved expression parsing in CheckNullPointer::isPointerDeRef() - fixed #4692 2013-04-03 01:27:08 -07:00
Ettl Martin 1b9c1c03fa unittests: removed not needed '\n' at the end of testcases. 2013-03-20 15:36:16 +01:00
Ettl Martin 7c0905cd4e #4665 added todo unittest 2013-03-19 08:47:05 +01:00
zblair ed03e2c845 Fixed #4539 (False positive: Possible null pointer dereference) 2013-02-27 23:45:21 -08:00
Daniel Marjamki abd536b84c Null pointer: Changed 'possible null pointer dereference - otherwise condition is redundant' to warning 2013-02-02 15:46:29 +01:00
Daniel Marjamäki fc42aa3a30 Fixed #4523 (false positive: (error) Possible null pointer dereference) 2013-01-30 16:52:12 +01:00
Daniel Marjamäki 509dd9a989 Fixed #4523 (false positive: (error) Possible null pointer dereference) 2013-01-29 17:12:14 +01:00
Frank Zingsheim 096cb1bd88 Fixed #3686: false positive: Possible null pointer dereference (inconclusive) 2013-01-21 19:38:59 +01:00
Zachary Blair 309edbbdc5 Fixed #4389 (False positive: Possible null pointer dereference if the default parameter value is used) 2013-01-09 23:22:54 -08:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Daniel Marjamäki f127d56719 Null pointer: Fixed FP when there are 'return p?p->x:0;' 2012-12-25 14:23:50 +01:00
PKEuS 4737966caf Unit test cleanup: Removed some empty lines and whitespaces before \n. 2012-12-06 10:19:22 -08:00
Zachary Blair 095824373a Fixed #3302 (new check: nullpointer dereference) 2012-11-20 23:56:17 -08:00
PKEuS 4ee955fc8c Improved CheckNullPointer::isPointerDeRef():
- Fixed #4240
- Added support for wstring/wchar_t
2012-11-10 19:53:20 +01:00
Robert Reif 8e14d7682c Symbol database: fix some function prototype bugs that were found during check conversions. Ticket: #4266 2012-10-30 15:48:06 +01:00
Daniel Marjamäki fefd8529c6 Fixed #4007 (False positive: 'Possible null pointer dereference' when using short-circuit evaluation) 2012-10-07 19:06:49 +02:00
Daniel Marjamäki c9c04f9691 Fixed #4038 (FP: possible null pointer dereference) 2012-09-23 09:20:16 +02:00
Daniel Marjamäki ffd5c82b4f Fixed #4118 (False null-pointer warning when check is indirect) 2012-09-18 19:16:28 +02:00
PKEuS 31e7e41098 Fixed and refactorized broken CheckNullPointer::CanFunctionAssignPointer():
- return true if parameter is passed by reference (fixes #4111)
- Use symboldatabase
- Improved handling of inconclusive
2012-09-06 18:33:15 +02:00
Daniel Marjamäki 985ac662ee Fixed #4035 (False positive: Memory leak: pTempFile) 2012-08-25 12:00:25 +02:00
PKEuS 35d94c26d5 Changed creation of SymbolDatabase. Database always created after Tokenizer::tokenize() and Tokenizer::simplifyTokenList() instead of on-demand creation by Tokenizer::getSymbolDatabase.
-> With Token::scope() it is possible to access the symboldatabase without having to call getSymbolDatabase(). The change increases safety because it is guaranteed that the database is available in all checks, even if the specific check doesn't call getSymbolDatabase
- Tokenizer::_symbolDatabase does no longer have to be mutable -> Increased const correctness

The change above required two additional changes:
- A bug causing a debug message was fixed in the symboldatabase that became visible in the test suite by the change above.
- Simplify expressions like "struct struct Foo" which might be result of typedef instanciation.
2012-08-12 03:01:24 -07:00
PKEuS 25ecd3ed71 Message refactorization: checknullpointer.cpp
Removed a duplicate test in checknullpointer.cpp
2012-08-05 01:38:48 -07:00
Daniel Marjamäki a733c9b603 Fixed #3914 (false positive null pointer dereference, assignment in conditional) 2012-07-23 10:05:55 +02:00
Daniel Marjamäki d1b4bea304 Fixed #3807 (False positive: possible null pointer dereference) 2012-05-31 18:41:00 +02:00
PKEuS e8cd119ebd Improved parsing of functions that accept nullpointers but no uninitialized data (Fixed #3811) 2012-05-16 00:56:39 -07:00
PKEuS ec00824fd3 Fixed #3357:
- Print "inconclusive" tag in cli
- Fixed inconclusive handling in checkbufferoverrun.cpp
- Merged reportInconclusiveError into reportError by adding an additional parameter "bool inconclusive" which is false per default
2012-05-06 10:37:41 -07:00
Daniel Marjamäki d5442280b1 Fixed #3597 (Errors in evaluation of chained assignment operators) 2012-05-01 07:06:14 +02:00
PKEuS 8e362ad5f7 Fixed #3771
Stronger testing for false positives in inconclusive checking in checknullpointer.cpp
2012-04-30 12:36:41 +02:00
Daniel Marjamäki 6ae135124e Tokenizer::setVarId: better handling of initializer lists 2012-04-23 18:26:27 +02:00
PKEuS fc8749e952 Improved nullpointer check:
- Fixed #3673
- Fixed potential issue with constructor calls (like #3697)
- Added support for operator+ on std::string
2012-04-02 12:12:02 +02:00
Ettl Martin 8e9c09659f astyle run 2012-04-01 15:56:48 +02:00
Ettl Martin 083954049f #1927 added testcase. 2012-04-01 15:54:41 +02:00
PKEuS 0340764726 Improved nullpointer check: Detect dereferences by streams (#410)
Refactorizations:
- Replaced || by %oror% in Token::Match patterns
- Replaced some simple patterns by direct comparisions, replaced Match call with simpleMatch
- Increased data encapsulation by making more members private in CheckNullpointer
2012-03-16 17:24:03 +01:00
August Sodora e0bee0e037 Fixed #3567 (False positives in boolean expressions) 2012-03-07 20:31:23 +01:00
PKEuS 2e13a51d08 Fixed #3591 2012-02-13 19:46:45 +01:00
Erik Lax f1dbd1a89a Fixed #3518 (False negative: Possible null pointer dereference (in the same condition)) 2012-02-11 16:15:38 +01:00
PKEuS 42f418db54 - Improved nullpointer check: Fixed #1171
- Improved accuracy of function analysis in symboldatabase
- Code cleanups
2012-02-11 12:26:48 +01:00
Daniel Marjamäki 036b2a84bf Fixed #3570 (False Postive for 'nullPointer' check) 2012-02-01 20:38:47 +01:00
PKEuS 22c1ce8a68 Fixes for #3480 and #3568. 2012-01-31 15:49:34 +01:00
Daniel Marjamäki 01f6bbda62 Null pointers: fixed false positive when '?' is used in return statement. Ticket: #3560 2012-01-28 08:06:03 +01:00
PKEuS 5c2af0b2e3 - initialising std::string with 0 in initialisation list is partially detected in nullpointer check (#3520)
- executionpath checking makes use of symboldatabase
- CheckExceptionSafety::checkRethrowCopy makes use of symboldatabase
2012-01-26 16:50:59 +01:00
PKEuS 42a75692d4 Improved nullpointer check:
- More accurate checking for dereferences and non-dereferences
- improved checking for nullpointer dereferences after return statement
- Supports pointer dereferences by std::string
- Code optimization/refactorization
2012-01-25 15:16:22 +01:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Daniel Marjamäki 385afffb14 Null pointers: show inconclusive errors if functions are called. Assume they won't assign the pointer. Ticket: #3443 2011-12-26 07:13:10 +01:00
Daniel Marjamäki b742c03b65 Fixed #3443 (false positives: possible null pointer dereference (calling unknown function)) 2011-12-25 17:01:45 +01:00
Daniel Marjamäki 2bb5de4c89 Fixed #3425 (False positive: Null pointer dereference (pointer is checked in macro)) 2011-12-18 13:33:23 +01:00
Daniel Marjamäki e008a0508b Null pointers: Fixed false positive when sizeof without parentheses are used 2011-12-17 12:44:11 +01:00
Daniel Marjamäki e2dd085b60 Fixed #3394 (False positive: possible null pointer dereference) 2011-12-08 19:30:14 +01:00
Daniel Marjamäki c90558f730 Fixed #3358 (False null pointer dereference positive with ternary ?: operator) 2011-12-03 13:10:07 +01:00
Daniel Marjamäki 9a84c5845a Fixed #3373 (False posititive: incorrect %* handling in sscanf) 2011-12-02 17:09:32 +01:00
Daniel Marjamäki 6763e596b9 Fixed #3345 (false positive: possible null pointer dereference (guarded by &&)) 2011-12-02 06:11:55 +01:00
PKEuS ee3e10ea97 Fixed #3364 (Crash in printf parsing) 2011-11-30 20:23:29 +01:00
PKEuS be0acad11f Improvements to Nullpointer dereference on function call check:
printf format string parser improved (similar to my recent patch
on the argument counter), frexp/modf supported (#1572), Code
cleanup
2011-11-28 22:32:07 +02:00