Commit Graph

299 Commits

Author SHA1 Message Date
Alexander Mai f2e5da290b Replace 2 invalid test cases added while fixing #5793 by a valid one 2014-05-15 21:20:16 +02:00
Alexander Mai 146bf11aa7 #5793 - False positive: Deallocation of an auto-variable (at reference notation) 2014-05-12 19:53:49 +02:00
Alexander Mai d2ebd718a9 #5691 False positive: autovarInvalidDeallocation - function name 'delete' in C code 2014-05-01 07:32:37 +02:00
PKEuS ea23a0467b Fixed false positive #5732: autovarInvalidDeallocation on pointer to array 2014-04-27 12:18:33 +02:00
Alexander Mai 6a08c27183 Fix segfault in variableIsUsedInScope() - loop variable not check against NULL 2014-03-22 11:14:11 +01:00
Alexander Mai 3f30753122 Fixed #5537 (crash: clang ./lib/Basic/FileManager.cpp , since 354e84e7c8 , /lib/symboldatabase.h:288) 2014-03-09 08:17:24 +01:00
Alexander Mai 354e84e7c8 Fixed #2298 (new check: passing stack-address to free()) 2014-03-06 06:32:30 +01:00
Daniel Marjamäki 4dee3da1bd Merge pull request #245 from simartin/ticket_5478
Ticket #5478: Only functions and equal operators might return a temporary
2014-03-02 14:53:25 +01:00
Simon Martin 875a3f47e7 Ticket #5478: Only functions and equal operators might return a temporary. 2014-03-02 09:39:10 +01:00
Simon Martin ef3f135af2 Ticket #5050: Added test case since it works now. 2014-03-01 10:37:55 +01:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
PKEuS 4f0121ee2f Splitted simplification out of tokenize() 2013-12-30 17:45:28 +01:00
Daniel Marjamäki 0ef1529ba5 Fixed #5005 (false positive: (warning) Assignment of function parameter has no effect outside the function.) 2013-10-06 16:07:27 +02:00
Daniel Marjamäki 1234ec95f0 Fixed #4998 (False positive: Address of local auto-variable assigned to a function parameter) 2013-10-06 14:23:26 +02:00
Daniel Marjamäki c2a8f6f59a astyle formatting 2013-09-28 09:32:41 +02:00
Simon Martin d67a0add47 Ticket #5024: Don't crash upon invalid code when checking auto variables. 2013-09-28 00:14:12 +02:00
PKEuS a9a5dc0354 Updated to AStyle 2.03, require this version 2013-08-07 16:27:37 +02:00
Daniel Marjamäki cd5e32446f Fixed #4641 (False positive: Address of local auto-variable assigned to a function parameter) 2013-06-13 16:19:19 +02: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 25582dbde7 Simplify TestAutoVariables test cases 2013-04-13 18:38:15 +02:00
Ettl Martin 54d398c7dd unittests: removed not needed '\n' at the end of testcases. 2013-03-19 09:18:58 +01:00
PKEuS 33cf561d85 Refactorized check for assigning function parameters:
- Fixed false negative: Check is also valid for all non-references, not only for pointers.
- Fixed false negative: Usage before assignment doesn't require bailout
- Fixed false positive #4598 caused by inadequate usage of CheckUninitVar::isVariableUsage
- Made several member functions static
2013-02-18 08:52:49 -08:00
Daniel Marjamki 75e20a996d assign function pointer: Fixed false positive when pointer is used also. Ticket: #2930 2013-02-02 15:26:14 +01:00
Daniel Marjamki 6bb8dd605a assign function parameters: only show warning when --enable=warning or --enable=style is used. Ticket: #2930 2013-02-02 15:08:43 +01:00
Daniel Marjamäki cbbb582fc9 Fixed #2930 (new check: redundant assignment of pointer function parameter) 2013-02-01 19:16:17 +01:00
Reijo Tomperi 5d5f7085bf Updating year 2012 -> 2013 to .cpp and .h files and man page. 2013-01-01 18:29:08 +02:00
Robert Reif 0d4b87c71e SymbolDatabase: Improved find function functionality. Taking arguments into account 2012-10-14 17:30:37 +02:00
XhmikosR 3c14e4b52a test: tabs to spaces, remove trailing spaces and extra empty lines at the end of files 2012-09-17 13:51:40 +02:00
PKEuS 1e5d082251 Moved remaining part of c_str() checking to checkstl.cpp. Fixed false positive #4157. 2012-09-10 15:20:38 +02:00
PKEuS 4fb464982c Fixed crash reported in #4076 2012-08-22 10:17:23 -07:00
PKEuS e05a597066 Fixed false negatives in checkautovariables.cpp:
- Detect returning temporary instances (#4076)
- Added support for returning user defined types
2012-08-22 04:08:32 -07:00
Daniel Marjamäki 17c27f51ff Fixed #3791 (False positive: returnTempReference) 2012-07-18 07:22:29 +02:00
PKEuS 247d820027 Fixed #3972: Don't issue auto variable error when the address is assigned to a reference to a non-pointer. 2012-07-13 05:21:45 -07:00
PKEuS 0f1cb4c98c Message refactorization: checkassignif.cpp, checkautovariables.cpp 2012-07-07 11:31:18 -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
PKEuS 746beb98bf Added support for delete and delete[] in invalidDeallocation check (fixes #1773) 2012-04-26 16:44:33 +02:00
Daniel Marjamäki abcbe2e49f Fixed #3594 (false positive: returning reference to auto variable) 2012-03-28 18:21:06 +02:00
PKEuS 1ef99e2f21 Improved checkautovariables:
- Added support for checking a few more code patterns
- Simplified code by using more information from the symboldatabase
- Moved redundant part of c_str-check to checkstl
Two fixes according to output of pvs studio in testsimplifytokens.cpp
2012-03-01 18:38:20 +01:00
PKEuS c273d6d31d Refactorized checkautovariables.cpp. Removed indendation counters.
Fixed #3478
2012-01-08 15:32:22 +01:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Daniel Marjamäki 6a0c463ebd #3382 (Clarify error message 'invalid deallocation') 2011-12-30 10:32:55 +01:00
Daniel Marjamäki 096b22c46e #3434 (False positive Returning reference to auto variable) 2011-12-26 07:44:16 +01:00
PKEuS 9b685ba3c3 Code cleanup 2011-12-09 21:00:57 +01:00
PKEuS 1bef8d1247 Tokenizer: Code cleanups 2011-12-08 17:42:26 +01:00
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
Robert Reif e19cbf0cdd fix false positive introduced by previous false negative fix commit 2011-09-02 10:39:04 -04:00
Robert Reif 833865e736 fix #3066 (False positive: Inconclusive: Assigning address of local auto-variable to a function parameter.) 2011-09-01 22:22:33 -04:00
Robert Reif 5bad978833 fix line number in messagex for CheckAutoVariables::autoVariables 2011-09-01 20:34:31 -04:00
Robert Reif 2667e34a07 fix again #3064 (false negative: returning address of stack variable) 2011-09-01 18:30:49 -04:00
Robert Reif e7dc765ece fix #3064 (false negative: returning address of stack variable) 2011-08-31 21:36:31 -04:00
Robert Reif 21c9b6d262 add another test for #3030 (Improve check: Returning pointer to local array variable with '&' pointer operator) 2011-08-20 16:41:12 -04:00
Robert Reif 7eb43bc107 partial fix for #3030 (Improve check: Returning pointer to local array variable with '&' pointer operator) 2011-08-20 15:08:30 -04:00
Daniel Marjamäki 9a24492a00 Fixed #2975 (False positive: Return of the address of an auto-variable) 2011-08-10 18:16:31 +02:00
Daniel Marjamäki 2b8b0c44b2 Fixed #2969 (False positive: assign address of auto-var to function parameter, when function parameter is reassigned later) 2011-08-09 18:24:39 +02:00
Daniel Marjamäki 2b48c7624c Auto Variables: Reverted fix for #1514 because my idea was wrong. See ticket: #2944 2011-07-27 10:43:44 +02:00
Robert Reif 527c1aae33 fix #2931 (another false negative in auto variables checking when function parameter is a struct) 2011-07-22 08:31:31 -04:00
Robert Reif 84ca1902a5 fix #1514 (Improve CheckAutoVariables: assign autovariable address to effective parameter) 2011-07-21 22:37:36 -04:00
Robert Reif 4e64d35462 fix #2926 (false negative in auto variables checking when function parameter is a struct) 2011-07-21 22:26:42 -04:00
Robert Reif cc1ecccd01 fix #2928 (False positive (static variable misinterpreted as auto variable)) 2011-07-21 18:20:19 -04:00
Robert Reif 32f94a47cc fix #2925 (False negative: auto variables - assigning address of array to function parameter) 2011-07-20 19:02:54 -04:00
Robert Reif bb5dfa58a1 fix #2765 (Non local address detected as address of local auto-variable) 2011-05-06 19:26:04 -04:00
Robert Reif ccb831d375 fix regression #1819 (False positive: auto variable assignment (unseen typedef)) 2011-05-06 18:18:48 -04:00
Robert Reif 29c73e0571 fix false positive introduced in CheckAutoVariables::autoVariables conversion to use symbol database 2011-04-26 20:16:09 -04:00
Robert Reif 55898c0dfc convert last check in checkautovariables to use the symbol database 2011-04-23 09:50:56 -04:00
Robert Reif cd64d8476c fixed #2614 (missing varid on function parameter) 2011-04-23 09:37:50 -04:00
Martin Exner 2b08744b97 Fixed #2676 (setVarId: variables with global scope qualification :: don't get varids) 2011-04-18 06:56:39 +02:00
Robert Reif c9b2ab3c26 add debug message for function argument missing varid 2011-03-02 21:08:27 -05:00
Daniel Marjamäki 7507f64ee7 Fixed #2558 (false positive: (error) Returning reference to auto variable) 2011-02-12 15:39:26 +01:00
Robert Reif 1e0d538273 checkautovariables: refactor to use the symbol database 2011-02-07 19:26:34 -05:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Kimmo Varis 8369d0ddd6 Improving 'Wrong assignment of auto variable' error message.
Improving the error message as discussed at dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192&start=0
2010-12-04 09:55:20 +02:00
Robert Reif f12c0c7ada Tokenizer: add assert(_settings) to Tokenizer to insure the tokenizer always has settings. Ticket: #2219 2010-12-01 18:00:55 +01:00
Daniel Marjamäki 3d195f2326 Auto variables: improved the check for 'return retval.c_str()'. Ticket: #2191 2010-11-13 15:38:21 +01:00
Daniel Marjamäki cd94fa89e0 Tokenizer: More specific bail outs in simplifyKnownVariables 2010-11-07 11:07:56 +01:00
Daniel Marjamäki c907acf767 Fixed #1819 (False positive: auto variable assignment (unseen typedef)) 2010-10-22 21:12:56 +02:00
Reijo Tomperi 35d2a27b9c Update copyright year in all source files 2010-04-13 22:23:17 +03:00
Daniel Marjamäki 1c84dc814c Auto variables: Improved handling of temporaries 2010-01-27 19:16:32 +01:00
Daniel Marjamäki 32fcb8fe18 Auto variables: returning pointer to temporary .c_str() data 2010-01-26 22:11:34 +01:00
Daniel Marjamäki f62466493b New Check: Detect return of invalid reference 2010-01-23 20:39:12 +01:00
Slava Semushin 82ae064218 Fixed #1013 (autovariables: detect when assigning parameter **par)
http://sourceforge.net/apps/trac/cppcheck/ticket/1013
2010-01-02 03:53:34 +06:00
Reijo Tomperi db30c5b0d2 Fix #1069 (Minor spelling mistake across cppcheck)
http://sourceforge.net/apps/trac/cppcheck/ticket/1069
2009-12-08 20:10:08 +02:00
Daniel Marjamäki 09859c1019 refactoring the folder structure 2009-10-25 12:49:06 +01:00
Reijo Tomperi fdde2182b9 Fix GPL comments in all files. ">." was missing from the end. 2009-09-27 18:08:31 +03:00
Slava Semushin be89be8c30 Fixed #590 (False positive: Invalid deallocation when variables have same name)
http://sourceforge.net/apps/trac/cppcheck/ticket/590
2009-08-16 15:27:40 +07:00
Slava Semushin 4c32057180 Fixed ticket #541 (Wrong testcases produce unlogged error at Tokenizer::syntaxError)
http://sourceforge.net/apps/trac/cppcheck/ticket/541
2009-08-12 02:06:41 +07:00
Gianluca Scacco ba4754a784 Added new test for invalid deallocation 2009-08-09 15:43:00 +02:00
Slava Semushin 37fe631639 test/testautovariables.cpp: renamed some testcases.
Make it readable.

No functional change.
2009-07-28 00:36:56 +07:00
Slava Semushin 82ae0e305b checkautovariables: added newlines to make code more readable.
No code change.
2009-07-28 00:34:17 +07:00
Slava Semushin bb4b2b707c Fixed ticket #517 (False positive for extern variables: return of the address of an auto-variable)
http://sourceforge.net/apps/trac/cppcheck/ticket/517
2009-07-28 00:32:01 +07:00
Daniel Marjamäki a71d260308 Refactoring: Moved CheckOther::returnPointerToLocalVariable to CheckAutoVariables 2009-06-09 19:45:58 +02:00
Daniel Marjamäki 5747133fa8 Fix #370 (Assign auto variable to parameter false positive) 2009-06-06 21:25:41 +02:00
Slava Semushin e5c0383594 Strip redundant std::string usage from tests.
Done by command:
git grep -l ASSERT_EQUALS | xargs sed -i 's|ASSERT_EQUALS(std::string(\(".\+"\)),|ASSERT_EQUALS(\1,|'

Should be no functional change.
2009-06-01 02:50:25 +07:00
Reijo Tomperi 58eda6e978 Fix ticket #325 (Replace developer names in source files with AUTHORS file)
http://apps.sourceforge.net/trac/cppcheck/ticket/325
2009-05-30 08:48:12 +03:00
Slava Semushin 3a40c33d7b Updated wrong comments (looks like after copy&paste).
No code change.
2009-05-22 21:13:01 +07:00
Reijo Tomperi dd8b738f7f Initial fix for ticket #283 (segmentation fault when checking xterm sources)
http://apps.sourceforge.net/trac/cppcheck/ticket/283
It should print out error message now instead of crashing. Cleanup is needed.
2009-05-07 23:17:29 +03:00
Gianluca Scacco f5104d6d0a Added new test to autovariable 2009-03-28 21:54:12 +01:00
Gianluca Scacco c88a362893 Fixed ticket #228: false positive with usage of an auto-variable 2009-03-28 21:47:38 +01:00
Vesa Pikki f04bdccee4 Astyle formatting. 2009-03-22 15:15:16 +02:00
Gianluca Scacco 416115e38f Fixed error compiling testautovariables 2009-03-22 12:00:21 +01:00