Commit Graph

379 Commits

Author SHA1 Message Date
Daniel Marjamäki b6f4dbd067 Uninitialized variables: Fixed TODO assertion (related with ticket #3106) 2012-06-23 16:06:20 +02:00
Daniel Marjamäki 7f5950967e Reviewed handling of >> in return statements in C files in UninitVar checking 2012-06-23 15:47:48 +02:00
Daniel Marjamäki f0f69ed818 Reviewed handling of << and >> in C files in CheckUninitVar 2012-06-23 12:41:00 +02:00
Daniel Marjamäki e2964c0c9e Uninitialized variables: Fixed false negative when ? operator is used in rhs 2012-06-23 12:19:03 +02:00
Daniel Marjamäki d2dbaca24b Reviewed handling of unknown types in C files in UninitVar 2012-06-22 19:57:07 +02:00
Daniel Marjamäki abaa044e03 Reviewed handling of unknown types in CheckUninitVar 2012-06-22 16:39:39 +02:00
Daniel Marjamäki 354406441a Fixed #3906 (false positive uninitvar for vector pointer) 2012-06-22 16:26:43 +02:00
Daniel Marjamäki edea4ef131 Refactoring: Renamed CheckNullPointer::isPointer to Token::isUpperCaseName 2012-06-21 19:00:53 +02:00
Daniel Marjamäki ce5c38f52c Fixed #3890 (False positive Uninitialized variable on returning default value on a class member) 2012-06-19 20:04:10 +02:00
Daniel Marjamäki cc5e06b5d2 Fixed #3861 (uninitialized variables) 2012-06-13 19:09:51 +02:00
Daniel Marjamäki c5da030674 Fixed #3869 (References to items in array result it 'Uninitialized variable' errors) 2012-06-08 16:17:55 +02:00
Simon Martin cede3fc805 Get rid of a warning 2012-05-26 15:49:40 +02:00
PKEuS f4bf94ca4f Fixed #3845 2012-05-25 07:28:32 -07:00
PKEuS 79445e52ad Refactorized CheckUninitVar to use SymbolDatabase 2012-05-25 04:40:18 -07:00
Daniel Marjamäki fc7f78244e Fixed #3708 (False positive: uninitialized variable (allocation, unknown nonpointer type)) 2012-05-14 18:34:39 +02:00
PKEuS db914d7185 Fixed compiler errrors and warnings mentioned in #3783 2012-05-07 06:34:47 -07:00
PKEuS dd5e9aa454 Make use of recently implemented Token::type() functionality 2012-04-25 09:56:07 +02:00
Daniel Marjamäki fb6c7f33f0 Fixed #3707 (Uninitialized variable with operator >> and templates) 2012-04-24 19:50:54 +02:00
PKEuS 710fefeef0 Refactorizations:
- Replaced some indendation counters by Token::link() or usage of symbolDatabase
- Use Token::nextArgument() to jump to target parameter
2012-04-21 23:05:37 +02:00
Daniel Marjamäki 2757229064 Fixed #3666 (False positive: Uninitialized variable (taking address)) 2012-03-16 17:28:05 +01:00
Daniel Marjamäki 47c7e346aa Uninitialized variables: Another fix for false positives when it's known that inner conditions are true 2012-02-06 19:26:28 +01:00
Daniel Marjamäki d6a887e1f9 Uninitialized variables: Fixed false positives when goto is simplified and inner condition is known to be true/false 2012-02-06 07:32:29 +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
Daniel Marjamäki b8faee9d30 Fixed #3497 (False positive: Uninitialized variable) 2012-01-21 20:42:41 +01:00
PKEuS c294b15360 Removed more indendation counters. 2012-01-15 12:31:49 +01:00
Edoardo Prezioso 37f3aa1528 Fixed ticket #3486 (segmentation fault of cppcheck) 2012-01-13 23:53:53 +01:00
Daniel Marjamäki 47716ee4ca Fixed #3497 (False positive: Uninitialized variable) 2012-01-13 07:26:56 +01:00
Daniel Marjamäki 01759b03f9 Fixed #3463 (Uninitialized variable variable pointer) 2012-01-02 11:25:13 +01:00
Reijo Tomperi 8cae17fda8 Update year to 2012 2012-01-01 01:05:37 +02:00
Edoardo Prezioso b2f8161862 Rewrite fix of ticket #3415 (Segmentation fault in new check for uninitialized variables):
new simplify: 'code ; ({ some_code ; });' to 'code ; some_code ;';
remove the sanity check in checkunusedvar, so when it crashes again it's easy to spot a bigger problem;
'internal' reported 'Token::Match' with simple pattern.

'Tokenizer::tokenize()' refactorings:
make one loop with many simple simplifications instead of many loops with one simplification.
some style changes.
2011-12-28 16:55:59 +01:00
Daniel Marjamäki 91874214d8 Refactoring: Added utility function that determine if scope ends with a call to a noreturn function 2011-12-27 18:00:12 +01:00
Daniel Marjamäki 32ed84f4c5 Uninitialized variables: Fixed false positives when using typeof() 2011-12-27 17:03:48 +01:00
Daniel Marjamäki 7c606c4e3b Uninitialized variables: Fixed false positives for such code: 'if (cond1) { a=0; } if (cond1) { if (cond2) { use_a; } }' 2011-12-27 13:16:16 +01:00
Daniel Marjamäki f6b201bb3b Uninitialized variables: Fixed false positives when pointer is dereferenced in unexpanded macro 2011-12-27 10:18:49 +01:00
Daniel Marjamäki fdb6ee2ad7 Uninitialized variables: Fix false positives related to for loop 2011-12-27 08:18:05 +01:00
Daniel Marjamäki 5bac8eca37 Uninitialized variables: Fixed false positives (caused by my 'check more variables' commit) 2011-12-26 22:14:52 +01:00
Daniel Marjamäki 5aaec7adc5 Uninitialized variables: Better handling of variable usage in condition 2011-12-26 18:56:40 +01:00
Daniel Marjamäki 59cd099ba7 Uninitialized variables: Fixed false positives caused by recent commit when potentially uninitialized variable is read in condition 2011-12-26 18:32:42 +01:00
Daniel Marjamäki 481fa532a8 Uninitialized variables: Fixed false positives caused by recent improvement when variable is potentially initialized in else block. 2011-12-26 18:17:13 +01:00
Daniel Marjamäki c56e2e7cf9 Uninitialized variables: Fixed false positives for unconditional inner scopes 2011-12-26 17:52:32 +01:00
Daniel Marjamäki 025518c474 Uninitialized variables: Fixed false positives when goto is used. 2011-12-26 16:46:10 +01:00
Daniel Marjamäki 8eb067358c Uninitialized variables: check more variables 2011-12-26 14:01:46 +01:00
Daniel Marjamäki f48edb63a3 Uninitialized variables: Improved checking when there are multiple if/else and a certain path causes an error 2011-12-26 12:36:35 +01:00
Daniel Marjamäki ba5558748d Uninitialized variables: Fixed false 'dangerous usage of strncpy' positive when resulting string is used by strncpy 2011-12-23 08:44:28 +01:00
Daniel Marjamäki f09a5b408b Uninitialized variables: Fixed false positives when sizeof is used in condition. Ticket: #3369 2011-12-17 16:08:55 +01:00
Daniel Marjamäki fe8393aafc Uninitialized variables: Fixed false positives in sizeof. Ticket: #3369 2011-12-17 09:51:45 +01:00
Daniel Marjamäki dfedb920f8 Uninitialized variables: Fixed false positive when address of variable is taken inside = { .. }. Ticket: #3369 2011-12-17 07:56:46 +01:00
Daniel Marjamäki 0572321572 Fixed #3423 (Uninitialized variable in operator>>) 2011-12-16 20:34:44 +01:00
Daniel Marjamäki 5f1fadec7b Uninitialized variables: Fixed false positives when many 'if' are used. Ticket: #3369 2011-12-16 19:56:32 +01:00
Daniel Marjamäki 1f329d7b41 Uninitialized variables: Fixed false positive for x 'a[x=1]'. Ticket: #3369 2011-12-16 18:12:47 +01:00
Daniel Marjamäki e723ef0569 Uninitialized variables: Fix false positives for '= { .. }'. Ticket: #3369 2011-12-16 18:04:10 +01:00
Daniel Marjamäki d2d7e25f3f Uninitialized variables: Fixed false positive in for condition. Ticket: #3369 2011-12-15 20:48:26 +01:00
Daniel Marjamäki 40f2f4f7f6 Uninitialized variables: Fixed false positives when there are assembler code. Ticket: #3369 2011-12-15 20:29:57 +01:00
Daniel Marjamäki 167530bf60 Uninitialized variable: Fixed test failure. Ticket: #3369 2011-12-15 20:15:37 +01:00
Daniel Marjamäki f797307edc Uninitialized variables: Fix false positive if variable is used after return (goto). Ticket: #3369 2011-12-15 20:05:11 +01:00
Daniel Marjamäki 10228881c7 Uninitialized variables: Fixed false positives when taking address. Ticket: #3369 2011-12-15 19:38:06 +01:00
Daniel Marjamäki 6221145be8 Fixed #3414 (false positive: (error) Uninitialized variable: SOutput) 2011-12-15 18:30:59 +01:00
Daniel Marjamäki 005b1cff61 Fixed #3417 (False positive: Uninitialized variable when conditionally set) 2011-12-15 18:15:58 +01:00
Daniel Marjamäki 3a432fa959 Uninitialized variables: better handling of initialization with >>. Ticket: #3369 2011-12-15 16:55:55 +01:00
Daniel Marjamäki b3c35d4b32 Fixed #3415 (Segmentation fault in new check for uninitialized variables) 2011-12-15 16:49:14 +01:00
Daniel Marjamäki 295f486cde Uninitialized variables: Detect more errors when variable is given as array index. Ticket: #3369 2011-12-14 19:56:58 +01:00
Daniel Marjamäki 63e2f64b9c Uninitialized variables: Fixed false positives for loops. Ticket: #3369 2011-12-14 18:54:03 +01:00
Daniel Marjamäki 8e3e634ce0 Uninitialized variables: Detect more errors. Ticket: #3369 2011-12-14 18:28:30 +01:00
Daniel Marjamäki 419ae2a135 Uninitialized variables: Fixed false positive in new checking when variable is initialized in condition 2011-12-14 17:17:24 +01:00
Daniel Marjamäki ba463295c2 Uninitialized variables: improved check to detect more errors. Ticket: #3369 2011-12-14 06:00:17 +01:00
Daniel Marjamäki c7ce87d060 Uninitialized variables: Fixed false positives for break/continue/throw 2011-12-14 05:45:52 +01:00
Daniel Marjamäki 458fa0874a Uninitialized variables: Started writing a new check. Ticket: #3369 2011-12-13 21:57:27 +01:00
PKEuS c9f5117cf5 Fixed #3407 (False positive: (inconclusive) Found duplicate branches for if and else. (inline assembler)) 2011-12-13 21:42:38 +01:00
Edoardo Prezioso 767413adad 1)internal check found a 'findmatch' with simple string argument;
2)Style: uniform 'while (...)' when inside it there's an assignment;
3)Replace '0' with 'NULL' where there's comparison with a pointer.
2011-12-01 12:04:47 +01:00
Daniel Marjamäki 414e0ecc3c Uninitvar: Reactivated the checking 2011-11-30 18:57:52 +01:00
Daniel Marjamäki b92959809c Uninitvar: Made checking experimental 2011-11-20 15:19:56 +01:00
Edoardo Prezioso 42e369a4b4 Change every 'tokAt(..)->link()' to 'linkAt(..)'. 2011-11-20 14:24:27 +01:00
Edoardo Prezioso 2c64d299ca Change every 'tokAt(...)->str()' to 'strAt(...)'. 2011-11-13 13:10:59 +01:00
Daniel Marjamäki f7fe665b00 Fixed #3231 (False positive: uninitialized variable '({...})') 2011-10-30 18:19:09 +01:00
Daniel Marjamäki 7035d4cdd2 astyle formatting 2011-10-30 17:41:05 +01:00
Daniel Marjamaki 71f08d0a66 Fixed #3222 (false positive: Uninitialized variable with function pointer) 2011-10-30 17:22:30 +01:00
Daniel Marjamäki 0d1046eeeb Merge pull request #51 from richq/explicit
Explicit constructors
2011-10-30 01:38:26 -07:00
Daniel Marjamäki 316aa920eb Fixed #3245 (False positive: Dangerous usage of 'string' (strncpy doesn't always 0-terminate it)) 2011-10-29 19:11:42 +02:00
Richard Quirk a0a5b36667 Ensure single-argument constructors are explicit 2011-10-29 18:24:30 +02:00
Daniel Marjamäki 6f8e42a5af changed the astyle formatting flags 2011-10-13 20:53:06 +02:00
Daniel Marjamäki 417dc1ff2a Fixed #3159 (Uninitialized variable false positive) 2011-10-02 20:38:58 +02:00
Reijo Tomperi 236d0eb178 Fix #2813 (False negative: Uninitialized variable not found for realloc)
http://sourceforge.net/apps/trac/cppcheck/ticket/2813
Patch provided by: marekzmyslowski
2011-09-28 21:46:09 +03:00
Daniel Marjamäki 1a7511ed48 Fixed #3106 (False positive: Uninitialized variable check has inconsistent behavior with ternary operator) 2011-09-20 21:00:05 +02:00
Daniel Marjamäki c7d0beefa8 uninitstring: fix false negatives when non-zero memset is used. Ticket: #3050 2011-09-05 19:42:48 +02:00
Daniel Marjamäki 85d83d86ac Fixed #3060 (False positive: Uninitialized variable: fresh) 2011-09-04 12:53:53 +02:00
Daniel Marjamäki c7886ca1c4 Fixed #3058 (False positive: Uninitialized variable: data) 2011-09-03 18:53:14 +02:00
Daniel Marjamäki dc629b4c39 Fixed 'possible null pointer dereference' warning messages 2011-07-28 08:12:21 +02:00
Daniel Marjamäki 5cb701d3c1 Fixed #2946 (False positive: Uninitialized buffer variable (init in subfunction)) 2011-07-27 10:34:12 +02:00
Daniel Marjamäki 4e55fb604c Fixed #2945 (False positive: Uninitialized variable reading from stream) 2011-07-26 21:30:58 +02:00
Daniel Marjamäki 9a3f95613a Uninitialized variables: Fixed false positive if there is assignment in return statement 2011-07-24 22:41:40 +02:00
Daniel Marjamäki 1bb7a1c23c Fixed #2938 (Uninitialized variable not detected when part of expression) 2011-07-24 22:26:11 +02:00
Daniel Marjamäki 982b645ff4 Fixed #2775 (Uninitialized variable: Not detected when uninitialized struct pointer is dereferenced in sub function) 2011-07-04 21:04:32 +02:00
Daniel Marjamäki b9ee867344 Fixed #2764 (False positive: Uninitialized variable '&(x[0])') 2011-05-05 21:26:18 +02:00
Daniel Marjamäki e22f69daf4 Fixed #2753 (False negative: dereference uninitialized pointer 'buf[0] = 0;') 2011-04-26 20:26:09 +02:00
Daniel Marjamäki ad8fb37fb0 CheckUninitVar: Use %op% 2011-04-10 11:28:18 +02:00
Daniel Marjamäki 92ab1ef8e7 fix 2011-02-26 20:08:37 +01:00
Daniel Marjamäki b5020468f6 Fixed #2467 (false positive: possible nullptr dereference) 2011-01-17 19:23:00 +01:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Daniel Marjamäki 21af64049c Fixed #2401 (false positive: Uninitialized variable: result) 2011-01-05 20:44:04 +01:00
Daniel Marjamäki c8775344d6 uninitialized variables: Added some comments 2011-01-01 18:24:27 +01:00
Daniel Marjamäki d8f241e033 gcc: fixed -Wconversion errors 2010-12-31 09:51:27 +01:00
Daniel Marjamäki 8bdb05da6e Uninitialized variables: typeof doesn't dereference. Ticket: #2367 2010-12-30 21:30:46 +01:00
Daniel Marjamäki d4e3e7e201 Fixed #2367 (false positive: (error) Uninitialized variable: s) 2010-12-27 21:19:10 +01:00
Daniel Marjamäki 448c03c6e6 Fixed #2367 (false positive: (error) Uninitialized variable: s) 2010-12-27 21:05:33 +01:00
Daniel Marjamäki aff3623fec Fixed #2345 (False positive: uninitialized variable (in sub-condition in if inside a loop)) 2010-12-23 09:16:29 +01:00
Daniel Marjamäki fc9c450eed Fixed #2320 (false positive: Uninitialized variable: kbuf) 2010-12-18 10:06:21 +01:00
Daniel Marjamäki c2335f845e Fixed #2306 (False positive: array of std::string is reported as uninitialized) 2010-12-17 21:20:04 +01:00
Daniel Marjamäki b4be71aa4e checkuninitvar: fixed possible null-pointer dereference. thanks orbitcowboy for spotting it. 2010-12-01 18:05:57 +01:00
Daniel Marjamäki 234b1e0098 Fixed #2265 (False positive: Uninitialized variable: path) 2010-11-30 18:40:36 +01:00
Daniel Marjamäki 095f725b3c Fixed #2218 (False positive: Data is allocated but not initialized) 2010-11-27 17:34:54 +01:00
Daniel Marjamäki fc57e06cdd Fixed #2226 (segmentation fault of cppcheck) 2010-11-24 18:08:21 +01:00
Daniel Marjamäki e8ca76e02e Fixed #2200 (MathLib: Calculation overflow) 2010-11-20 10:05:33 +01:00
Daniel Marjamäki aa653fe42b Uninitialized variables: Fixed simple undetected case for '= %var% |' and '| %var% ;' 2010-11-16 20:16:44 +01:00
Daniel Marjamäki eb54be2b2a Uninitialized variables: Cleanup '+=' handling. This is simplified in the Tokenizer now. 2010-11-16 20:09:23 +01:00
Daniel Marjamäki 35c72db251 Uninitialized variables: Fixed simple undetected case for '= %var% -' 2010-11-16 20:07:41 +01:00
Daniel Marjamäki cbdae275ed Uninitialized variables: Fixed false negative. Ticket: #2207 2010-11-16 20:01:57 +01:00
Daniel Marjamäki 6d1c0687c9 Fixed #2202 (false postive: Data is allocated but not initialized: rbdc) 2010-11-15 17:11:08 +01:00
Daniel Marjamäki 47d37e7a05 Uninitialized variables: Fixed false negatives when calling unknown function with uninitialized variable by value: 'f(a+1)' 2010-11-13 15:10:17 +01:00
Daniel Marjamäki bf15236b9e Fixed #2196 (False positive: Invalid data is allocated but not initialized (initialization in loop)) 2010-11-13 10:33:35 +01:00
Daniel Marjamäki 3303c40879 uninitialized variables: fixed problem when parsing loop bodies 2010-11-13 08:03:59 +01:00
Daniel Marjamäki 9d7a623985 Uninitialized variables: Passing uninitialized array as parameter to function. Ticket: #2188 2010-11-12 17:38:25 +01:00
Daniel Marjamäki e523d5a3a3 Fixed #914 (improve check: usage of uninitialized variable) 2010-11-12 17:14:37 +01:00
Daniel Marjamäki 1204043556 Fixed #2148 (uninitialized variable: false negative, function parameter that is passed by value) 2010-11-12 17:06:14 +01:00
Daniel Marjamäki 6b489230e8 Fixed #2188 (Does not detect initialization) 2010-11-12 16:11:44 +01:00
Daniel Marjamäki 624ce205b9 Fixed #2185 (False negative: when constant is undefined a 'dangerous usage of strncpy' is not found) 2010-11-10 20:20:05 +01:00
Daniel Marjamäki 65c7b6eb8b Uninitialized variables: better handling of for example 'a[1] = 1+a[2];' 2010-11-05 19:24:14 +01:00
Daniel Marjamäki a90a7202cb Uninitialized variables: detect usage of dead pointer: '*p += 10' 2010-11-05 17:04:41 +01:00
Daniel Marjamäki bc283d8b99 Uninitialized variables: Broke out the checking into separate file 2010-10-31 12:31:11 +01:00