Commit Graph

5119 Commits

Author SHA1 Message Date
Daniel Marjamäki e0eb000ac3 AST: Fixed problem with decrement 2013-12-27 14:40:59 +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 742a6935ea Calculation in sizeof: Fixed FP for sizeof(Fred**) 2013-12-26 13:52:58 +01:00
Daniel Marjamäki 29e74222fb Sizeof calculation: Fixed FP for sizeof(int*[2]) 2013-12-26 13:41:21 +01:00
Daniel Marjamäki 5d5e347418 AST: better handling of 'sizeof(void*)' 2013-12-25 22:08:53 +01:00
Daniel Marjamäki 915cb6c757 Fixed #5261 (AST: cast not handled well (a::b&)x) 2013-12-25 21:19:28 +01:00
Daniel Marjamäki aa65799c19 pointerArithBool: Updated error message 2013-12-25 19:56:00 +01:00
Daniel Marjamäki 6182394966 Uninitialized variables: Fixed false positive taking value of pointer that is allocated but not initialized 2013-12-25 14:00:27 +01:00
Daniel Marjamäki 26dfddac6b UninitVar: Fixed false positive when checking if allocated pointer is null 2013-12-24 12:48:17 +01:00
Daniel Marjamäki 4c44e62159 AST: Refactored CheckOther::clarifyCalculation 2013-12-24 10:07:20 +01:00
Daniel Marjamäki 753559fff3 Uninitialized variables: Don't warn about try/catch exception variables 2013-12-24 07:39:15 +01:00
Daniel Marjamäki 042d3afb80 CheckOther::checkDuplicateExpression: Readded warnings when there is a expression between the duplicate expressions 'X || Y || X' 2013-12-24 07:21:46 +01:00
Daniel Marjamäki ac30a84c3a Refactoring: Replaced CheckOther::checkCCTypeFunctions with configuration 2013-12-23 19:58:33 +01:00
Daniel Marjamäki a3dd65caee Fixed #5126 (new check: missing pointer dereference or pointer overflow 'if (p+1)') 2013-12-23 18:39:05 +01:00
Daniel Marjamäki 661784a170 Fixed #5255 (False positive (error) Uninitialized variable: ptr2 - calling a static member function) 2013-12-23 16:50:27 +01:00
Daniel Marjamäki e2fa6a291c Uninitialized variables: Fixed false negatives for loop variables / pointer dereference 2013-12-23 12:27:00 +01:00
Daniel Marjamäki 596b4bd405 astyle formatting 2013-12-23 12:26:12 +01:00
Daniel Marjamäki e747b6c49b Merge pull request #202 from simartin/ticket_5214
Ticket #5214: Added test case (ticket already fixed in mainline).
2013-12-23 02:49:25 -08:00
Daniel Marjamäki 76b907fe65 Fixed #5252 (Improve check: use Library to validate function arguments in invalidFunctionUsage) 2013-12-23 10:06:45 +01:00
Daniel Marjamäki be03d4718a Library: Added <valid> element that is used to define valid input values for functions 2013-12-22 19:10:14 +01:00
Simon Martin 02dc49624d Ticket #5214: Don't read out of bounds upon invalid ternary operator. 2013-12-22 18:13:52 +01:00
Daniel Marjamäki e2bc99aa24 Fixed #5154 (Tokenizer: wrong handling of msvc 'for each') 2013-12-17 06:34:27 +01:00
Daniel Marjamäki 762806499f Fixed #5182 (Tokenizer::simplifyEnum: template function call as enum value) 2013-12-16 07:07:00 +01:00
Daniel Marjamäki 92305ed1f9 Fixed #5170 (False positive: warning (uninitMemberVar): Member variable 'ToDoubleArray::mfNaN' is not initialized in the constructor.) 2013-12-15 14:07:29 +01:00
Daniel Marjamäki 7938692b01 Fixed #5212 (Tokenizer::simplifyEnum bad simplification of enum value (1<<0)|(1<<1)) 2013-12-15 07:47:04 +01:00
Daniel Marjamäki f599e3184c Fixed #5174 (Tokenizer: member function 'abort' returns) 2013-12-14 11:12:48 +01:00
Daniel Marjamäki fdcb6634df Fixed #5190 (FP Use const reference to avoid data copying) 2013-12-14 08:46:18 +01:00
Daniel Marjamäki 57ecdd693c Fixed #5149 (false positive: (error) Dereferencing 'memory' after it is deallocated / released) 2013-12-14 07:37:24 +01:00
Daniel Marjamäki 80dec5a976 Uninitialized variables: Fixed FP when taking address of uninitialized variable 2013-12-13 20:10:22 +01:00
Daniel Marjamäki 7fe923bfc5 Uninitialized variables: Fixed FP when the variable is initialized in do-while condition 2013-12-13 13:27:01 +01:00
Daniel Marjamäki 3e6fbc6517 Fixed uninitialized variable FP after realloc if it fails. Related with ticket: #5240 2013-12-13 07:15:59 +01:00
Daniel Marjamäki 35189e80f2 Uninitialized variables: Fixed false positive for '*p=..' 2013-12-12 15:33:31 +01:00
Daniel Marjamäki 1b86615a69 Uninitialized variables: Fixed false positive for 'p=malloc; if (p) {}' 2013-12-12 11:44:07 +01:00
Daniel Marjamäki 4e7594748d Uninitialized variables: Fixed false positive for 'p=malloc; if (python tools/daca2.py b)' 2013-12-12 09:17:41 +01:00
Daniel Marjamäki 9f62740e1d Fixed #5236 (varid 0: vlc: src/misc/objects.c:126) 2013-12-12 08:44:00 +01:00
Daniel Marjamäki a4f9cb78d5 Uninitialized variables: Fixed false positives when passing allocated pointer to function 2013-12-11 05:54:42 +01:00
Daniel Marjamäki ef15e40de5 Uninitialized variables: error when passing uninit pointer to function 2013-12-10 18:36:16 +01:00
Daniel Marjamäki 5ba02d2fdd AST: Always use AST 2013-12-09 18:06:19 +01:00
Daniel Marjamäki be5c00d215 Uninitialized variables: check function arguments 2013-12-09 15:58:42 +01:00
Daniel Marjamäki f686cd6516 astyle formatting 2013-12-04 20:54:37 +01:00
Daniel Marjamäki 14a00046a3 Fixed #5207 (Struct uninitialized members useage is not giving error (malloc).) 2013-12-04 20:32:20 +01:00
Simon Martin fe75686595 Ticket #5203: Don't crash when checking buffer overrun for invalid code. 2013-11-30 07:40:32 +01:00
Daniel Marjamäki 0c5282b1af Fixed #5081 (False positive: (error) Uninitialized variable: f (handling of C-cast not correct)) 2013-11-28 16:04:47 +01:00
Daniel Marjamäki 771dc2e1ad AST: Improved handling when calling function through function pointer hidden within parantheses '(a.f)(1,2)' 2013-11-27 06:17:00 +01:00
Daniel Marjamäki 3b11ee9e0e AST: Improved handling of brackets 2013-11-25 20:58:40 +01:00
Daniel Marjamäki d8b25da73c Fixed #4740 (False Positive: Uninitialised variable 'int *a[2][19]; int **b = a[0];') 2013-11-25 06:38:23 +01:00
Daniel Marjamäki da540a3bb3 AST: Improved astIsFloat handling of expressions 2013-11-25 04:26:15 +01:00
Daniel Marjamäki abdf2bb9d4 AST: fixed isSameExpressions handling of ({..}) 2013-11-25 04:08:28 +01:00
Daniel Marjamäki 94e2bf7a11 AST: Handle ({..}) 2013-11-25 04:07:44 +01:00
Robert Reif 43f00942dd Fixed #5197 (SymbolDatabase: bad handling of unknown macros in function declaration) 2013-11-25 03:43:39 +01:00
Daniel Marjamäki 13cd0f41f6 AST: Fixed FP in isSameExpression when there are different casts 2013-11-24 15:17:08 +01:00
Alexander Mai 38b2f6b9b0 Fixed #5168 (segmentation fault (invalid code) in Tokenizer::simplifyVarDecl) 2013-11-24 11:07:11 +01:00
Daniel Marjamäki 8b77b7711c Merge pull request #199 from simartin/ticket_5168
Ticket #5168: Don't crash when simplifying bit-fields for invalid code.
2013-11-24 01:55:02 -08:00
Simon Martin 9817da00ec Ticket #5168: Don't crash when simplifying bit-fields for invalid code. 2013-11-23 20:33:03 +01:00
Daniel Marjamäki 4fe6951b4c Library: Fixed loading of 'resource' 2013-11-23 18:16:40 +01:00
Daniel Marjamäki 7fc07989a7 UninitVar: Fixed false positive 'data is allocated but not initialized' when there is assignment 2013-11-23 10:24:29 +01:00
Robert Reif 0afdbc73da Fixed #5195 (Crash below CheckIO::checkWrongPrintfScanfArguments()) 2013-11-23 08:40:35 +01:00
Daniel Marjamäki 8cca41774d Fixed #4446 (Crash on complex C++ template) 2013-11-21 20:27:24 +01:00
Daniel Marjamäki 2c1f579b3b Library: Fixed formatstr handling 2013-11-21 16:32:53 +01:00
orbitcowboy b74db1b791 Tokenize:simplifyFloatCast(): added corresponding suffix, incase of type 'float'. 2013-11-20 23:58:43 -08:00
Alexander Mai 7d45e9be73 Fixed #5122 (duplInheritedMember on private variables) 2013-11-21 05:39:23 +01:00
Daniel Marjamäki ef108c49ec Tokenizer: simplify enums better. add parentheses to enforce operator precedence. 2013-11-20 18:04:28 +01:00
Daniel Marjamäki e8eeb90adb AST: Fixed 'same expression' false positives (git merge --squash s, <<, >>) 2013-11-20 16:18:09 +01:00
orbitcowboy 1798fc3645 testtokenize:simplifyFloatCasts(): Added testcases for double and long double. 2013-11-17 08:44:05 -08:00
Daniel Marjamäki 27a40b10e1 AST/incorrectLogicOperator: Better handling of large doubles where x+1=>x 2013-11-20 06:33:34 +01:00
Daniel Marjamäki 6869d0de30 AST: Handle L'x' 2013-11-20 05:57:56 +01:00
Daniel Marjamäki 47b98470eb Tokenizer: Simplify float casts of integer constants 2013-11-19 18:07:12 +01:00
Daniel Marjamäki f8cf64afef Fixed #4710 (Template parser bug: const in constructor changes template names) 2013-11-19 06:07:25 +01:00
Daniel Marjamäki ff5f223a1d Fixed #5116 (false positive: memset on class (nested struct)) 2013-11-18 16:56:00 +01:00
Daniel Marjamäki 033cb19656 Same expression: Don't write warnings for same expression on both sides of arithmetical operators 2013-11-17 17:21:39 +01:00
Daniel Marjamäki 71e61fb1ed Uninitialized variables: Fixed false positive when using ?: 2013-11-17 12:42:53 +01:00
Daniel Marjamäki 77e09d72a1 Uninitialized variables: Fixed false negatives when using ({}) 2013-11-17 12:11:18 +01:00
Daniel Marjamäki d342387b95 Uninitialized var: Fixed false negatives for self assignment 2013-11-16 18:07:33 +01:00
Daniel Marjamäki 2a640a59c2 Tokenizer: Improved handling of pointer aliases. This fixes some false negatives. 2013-11-16 17:30:04 +01:00
Daniel Marjamäki cfd6b0c384 UninitVar: fixed false negatives for function calls 2013-11-16 12:02:21 +01:00
Daniel Marjamäki 8c7e3d14aa Fixed #5119 (Preprocessor: Using -D suppresses __cplusplus for C++ files) 2013-11-15 19:21:21 +01:00
Daniel Marjamäki 30720affd6 Tokenizer::setVarId: Fixed hang when checking libgc 2013-11-15 16:16:22 +01:00
Daniel Marjamäki 5af2fe6e5b AST: improved 'incorrect logic' checking when there are nested expressions 2013-11-15 06:51:35 +01:00
Daniel Marjamäki d1721b9d1b AST: Improved 'same expression on both sides of operator' checking for nested operators 2013-11-15 06:35:46 +01:00
Daniel Marjamäki 203d3e916b Fixed #5173 (false positive Variable XX is reassigned a value before the old one has been used) 2013-11-14 16:10:00 +01:00
Daniel Marjamäki 673400920d AST: Fixed 'a[1][2]' 2013-11-13 17:52:56 +01:00
Daniel Marjamäki 7fe51eb58b Fixed #4989 (False positive: Wrong processing of __asm block) 2013-11-13 06:04:00 +01:00
Daniel Marjamäki 1ecade2657 AST: don't warn about duplicate expressions around '+' operator. It might be more efficient than using for instance '*2' 2013-11-11 20:03:59 +01:00
Daniel Marjamäki 58d7caded1 AST: improved handling of casts 2013-11-11 16:39:34 +01:00
Daniel Marjamäki 4027848761 incorrectLogicOperator: fixed FP when comparing char values. improved handling of float comparisons. 2013-11-10 18:06:51 +01:00
Daniel Marjamäki 807f62520c Fixed crash caused by endless recursion in redundant assignments check 2013-11-10 17:20:40 +01:00
Alexander Mai 687aeb4f5f Fixed #5158 (segmentation fault (valid code)) 2013-11-10 16:22:52 +01:00
Daniel Marjamäki bb746261d3 AST: Fixed crash 2013-11-10 15:51:33 +01:00
Daniel Marjamäki 0dd17f9fad Merge pull request #198 from simartin/ticket_5073
Ticket #5073: Don't crash upon invalid do-while loop.
2013-11-10 03:09:16 -08:00
Daniel Marjamäki cadb284a3d Refactored the AST checking of CheckOther::checkIncorrectLogicOperator() 2013-11-10 11:59:18 +01:00
Simon Martin 185b88c6e3 Ticket #5073: Don't crash upon invalid do-while loop. 2013-11-08 23:13:21 +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
Robert Reif 52df31b501 Fixed #5153 ((debug) Scope::checkVariable found variable ')') 2013-11-08 12:56:32 +01:00
Robert Reif a6ef3a224a Fixed #5151 (false negative: improper formatstring - vector::at()) 2013-11-08 12:44:05 +01:00
Daniel Marjamäki b0ce42565e AST: Added experimental new implementations for CheckAssignIf::comparison, CheckOther::checkIncorrectLogicOperator and CheckOther::checkDuplicateExpression 2013-11-07 14:38:08 +01:00
Daniel Marjamäki fb04c8ff84 Fixed #5107 (redundantAssignment when pointer changes) 2013-11-04 23:46: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 6ad2491817 AST: uninstantiated template 2013-11-04 22:58:47 +01:00
Daniel Marjamäki 8ff412fcee Fixed #5142 (False positive with floating-point special cases in conditions) 2013-11-04 11:56:43 +01:00
Daniel Marjamäki de29991c11 AST: Rewrite using standard approach 2013-11-04 11:26:16 +01:00