Commit Graph

5526 Commits

Author SHA1 Message Date
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 2b7a991c1a temporarily hide gcc warnings 2014-01-21 21:17:03 +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 a84fdf98cc Null pointer: remove old checking that is replaced by value flow checking 2014-01-21 19:50:52 +01:00
Daniel Marjamäki 20b73747e0 value flow: refactor. added Token::getMaxValue() 2014-01-21 16:58:23 +01:00
Daniel Marjamäki b91f42453b value flow: improved handling of cast 2014-01-20 22:26:55 +01:00
Daniel Marjamäki bb3cc67aaa value flow: improved calculations that depends on variable 2014-01-20 21:45:30 +01:00
Daniel Marjamäki 69109784e8 value flow: cleanup usage of valueflow. utility function Token::getValue was added. 2014-01-20 06:49:45 +01:00
Daniel Marjamäki add84187cc CheckOther: Removed old zero division check 2014-01-20 06:31:13 +01:00
Daniel Marjamäki 7ff7bc1c2e Fixed #5376 (false positive: zerodivcond (style) Either the condition 'B>0' is useless or there is division by zero) 2014-01-19 20:16:55 +01:00
Daniel Marjamäki 84c5f47eb1 value flow: bailout for class variables that are non-const 2014-01-19 11:55:02 +01:00
Daniel Marjamäki ccda78f347 value flow: fixed todo assertion for handling of conditions 2014-01-19 09:31:40 +01:00
Daniel Marjamäki cdaa7abf7e value flow: better handling of conditional code below || && ?: operators 2014-01-19 09:05:48 +01:00
Daniel Marjamäki 2d0a68cac2 cleanup redundant variable inconclusive 2014-01-18 19:51:57 +01:00
Daniel Marjamäki 77f3f6c21a valueflow: added setTokenValue that perform calculations using set value 2014-01-18 19:30:44 +01:00
Daniel Marjamäki 6a3a9ee8e7 ast: fixed tree for 'sizeof(struct S)' 2014-01-18 13:18:11 +01:00
Daniel Marjamäki c7032a8867 value flow: improved handling of loops 2014-01-18 11:54:00 +01:00
Daniel Marjamäki 498cdb8610 added debug output for the value flow 2014-01-18 09:58:32 +01:00
Ryan Pavlik 32bf275447 Fix case-insensitive string compare function on MinGW 2014-01-17 15:29:53 -06:00
Daniel Marjamäki 3e23e243f6 BufferOverflow: Updated message for out of bounds array index or redundant condition 2014-01-17 19:44:45 +01:00
Daniel Marjamäki 57d318b2e5 valueflow: better handling of increment/decrement 2014-01-17 19:28:28 +01:00
Daniel Marjamäki 18d6285ad2 BufferOverrun: Improved error message when array index is used before checking that its in limits 2014-01-17 18:56:46 +01:00
Daniel Marjamäki b2b5590f2b Refactoring: Moved astStringify to the Token class and renamed it to expressionString. This can often be useful when reporting error messages that contains source code. 2014-01-17 18:37: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 5721e1d745 CheckNullPointer: Removed some of the old checking that doesn't use ValueFlow 2014-01-17 17:47:59 +01:00
Daniel Marjamäki 311059f603 Tokenizer: Removed commented-out simplification 2014-01-17 17:44:33 +01:00
Daniel Marjamäki 3facc06cb7 CheckOther: Removed non-valueflow check for division by possible zero before condition 2014-01-17 17:42:54 +01:00
Daniel Marjamäki 0203a4a6f5 Tokenizer: Removed simplifyGoto as it's the cause of various FPs I see 2014-01-17 17:36:45 +01:00
Daniel Marjamäki 4eb746d7cc Tokenizer: Removed simplifyComparisonOrder 2014-01-17 17:25:56 +01:00
Daniel Marjamäki 0b4de97e2b value flow: Use ValueFlow in CheckBufferOverrun 2014-01-16 19:23:14 +01:00
Daniel Marjamäki 85b73f7c24 ast: fixed hang for weird loop: 'for (each_window(list,p))' 2014-01-16 16:58:50 +01:00
Daniel Marjamäki e72ec830ef ast: fixed hang in for-loop handling 2014-01-16 06:45:35 +01:00
Daniel Marjamäki 141e089329 ast: different handling of for loops. create a syntax tree for whole 'f(a;b;c)'. 2014-01-15 17:32:14 +01:00
Daniel Marjamäki c547c9a108 value flow: fixed fp when variable is used in for-loop condition 2014-01-14 17:57:50 +01:00
Daniel Marjamäki e45a2e2c61 Fixed #5347 (False positive: uninitialized variable (try catch)) 2014-01-14 06:24:09 +01:00
Robert Reif d679a4c1f7 Fixed #5248 (False positive: Invalid argument in scanf for %zd) 2014-01-14 06:09:13 +01:00
Daniel Marjamäki c1c2f4bbc6 value flow: fixed crash reported in #5343 when typeStartToken and typeEndToken are misplaced. 2014-01-13 20:54:09 +01:00
Daniel Marjamäki 7981e3d38f value flow: fix fp when gotos are used 2014-01-13 16:07:25 +01:00
Daniel Marjamäki bfc67a536a value flow: fixed fp when self-checking checkbool.cpp. added some comments. 2014-01-13 06:15:21 +01:00
Daniel Marjamäki b1bbb23225 value flow: fixed fp when checking symboldatabase 2014-01-13 05:52:28 +01:00
Daniel Marjamäki f6c7be91a9 Fixed cppcheck warning 2014-01-12 21:19:20 +01:00
Daniel Marjamäki 8b6f001f94 value flow: inconclusive handling of unknown functions 2014-01-12 19:48:20 +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 2e67ca06c0 value flow: some simplifications in unknown functions when there is library configuration 2014-01-12 18:19:00 +01:00
Daniel Marjamäki ab866be03a Tokenizer: Move 'else if' simplification to tokenize 2014-01-12 17:47:02 +01:00
Daniel Marjamäki d700114edf value flow: bailout if condition is defined by macro 2014-01-12 17:16:51 +01:00
Heinrich Schuchardt f6510a6b45 Fixed #5339 (Tokenizer::setVarId : function-pointer function argument not getting variable id, causing FP) 2014-01-12 15:15:09 +01:00
Daniel Marjamäki 3d79613f2b value flow: more bailouts when return/break/continue/goto is reached. TODO: handle these better. 2014-01-12 15:07:58 +01:00
Daniel Marjamäki 155990cb0e value flow: improved checking of do-while loops for non-local variables 2014-01-12 15:02:58 +01:00
Daniel Marjamäki 5b679fc732 value flow: fixed fp for data member 2014-01-12 14:37:26 +01:00
Alexander Mai 86763b401c Fixed #5340 (Preprocessor: not using errorLogger when reporting syntax errors) 2014-01-12 13:15:54 +01:00
PKEuS b775714e3d Moved several hardcoded function names in format string checking into libraries (std.cfg and windows.cfg).
Added support for loading a library in test suite.
2014-01-12 03:44:24 -08:00
Daniel Marjamäki 21d317b7d6 value flow: fixed redundant null pointer check 2014-01-12 12:38:41 +01:00
Daniel Marjamäki d8262963d9 value flow: condition in loop, bailout valueflow analysis before loop if there is assignment inside the loop 2014-01-12 11:58:10 +01:00
Daniel Marjamäki e3496080c8 Fixed #5334 (False positive: same expression on both sides of '||') 2014-01-12 07:40:56 +01:00
Daniel Marjamäki f58e1ab80e value flow: fixed fp in switch 2014-01-11 21:21:00 +01:00
Daniel Marjamäki 3625d179e5 value flow: don't perform value flow analysis in sizeof/typeof expressions 2014-01-11 21:10:01 +01:00
Daniel Marjamäki 680d3f1312 value flow: fixed fp for nested assignments 2014-01-11 20:53:23 +01:00
Daniel Marjamäki 4d045879aa value flow: fixed fp when while condition contains variable that is changed in loop body 2014-01-11 20:25:49 +01:00
Daniel Marjamäki 75f9111775 value flow: bailout when variable is used in assignment to itself 2014-01-11 15:36:09 +01:00
Daniel Marjamäki 1fc2c9fe79 ast: fixed syntax tree for statement enclosed in parentheses ';(expr);' 2014-01-11 15:18:39 +01:00
Daniel Marjamäki ceca6be22b Fixed #5334 (False positive: same expression on both sides of '||') 2014-01-11 15:15:01 +01:00
Daniel Marjamäki eaf8c83db5 value flow: refactoring. broke out function for skipping value simplifications in expressions. 2014-01-11 14:54:10 +01:00
Daniel Marjamäki 85dcb14813 value flow: bailout in valueFlowBeforeCondition if variable can be assigned by subfunction 2014-01-11 14:31:51 +01:00
Daniel Marjamäki 225001a45c value flow: changed astparent lookup 2014-01-11 12:47:47 +01:00
Daniel Marjamäki 02b92efd1a value flow: improved analysis of expressions below ?, && and || operators 2014-01-11 12:44:55 +01:00
Daniel Marjamäki 60348da1b5 value flow: fixed fp for rhs in && and || expressions 2014-01-11 11:30:34 +01:00
Daniel Marjamäki 1ad94a8be5 value flow: loosen up bailouts in valueFlowSubFunction 2014-01-11 07:52:25 +01:00
Daniel Marjamäki 57d241793f value flow: fix segfault if var is null 2014-01-10 18:30:41 +01:00
Daniel Marjamäki c687933e9f value flow: improved handling of for loops 2014-01-10 18:19:24 +01:00
Daniel Marjamäki 3eebc8a9f1 test1 2014-01-10 16:51:58 +01:00
Daniel Marjamäki 3e7f692d4d value flow: stop checking global variable when going out of function scope 2014-01-10 16:17:19 +01:00
Daniel Marjamäki acb103e214 value flow: skip scopes that don't contain variable 2014-01-10 16:13:39 +01:00
Daniel Marjamäki 81513b4346 value flow: Readded safety check that tok->astOperand1() is not NULL 2014-01-10 05:54:03 +01:00
Daniel Marjamäki d085705e8f value flow: assume that value of global const variable is not changed 2014-01-10 05:47:56 +01:00
Daniel Marjamäki a26c5736da Library: Allow loading xml data from memory 2014-01-09 21:58:56 +01:00
Daniel Marjamäki 752e9d0fb7 Tokenizer::varId: Fixed wrong varid for shadow types with same names as class members 2014-01-09 21:44:29 +01:00
Daniel Marjamäki 1be30bf022 ast: fixed handling of templates 2014-01-09 17:14:16 +01:00
XhmikosR f9dd9676be Fix the C4099 warning. 2014-01-09 16:58:42 +02:00
Daniel Marjamäki 04cb56e070 ast: fixed trouble with 'ab=a+(b/(c))+d;' where the '(c)' could be mistaken for a cast 2014-01-08 21:49:42 +01:00
Daniel Marjamäki 4f11086505 Tokenizer: Don't remove parentheses in 'a?b:(c>0?d:e)' 2014-01-08 20:53:33 +01:00
Daniel Marjamäki 32f2ee422f value flow: fixed segfault and added more handling of unsigned values 2014-01-08 20:10:38 +01:00
Daniel Marjamäki 644004573b Preprocessor: fixed 8.0E+007 in macros 2014-01-08 18:05:14 +01:00
Daniel Marjamäki 7c4a7ac3d5 value flow: starting to refactor CheckNullPointer::nullPointerDeRefThenCheck 2014-01-08 17:37:39 +01:00
Daniel Marjamäki 26a72d73fe value flow: improved subfunction handling when using && or || in function argument 2014-01-08 16:49:15 +01:00
Daniel Marjamäki a2fe1ebe92 value flow: pass result of bool operator to function 2014-01-08 16:17:47 +01:00
Daniel Marjamäki 6d22c9deaa value flow: if unsigned variable is compared against 1 with either >= or <= then assume it can have the value 0 2014-01-08 06:53:17 +01:00
Daniel Marjamäki 1e3c43e708 value flow: improved bailouts in ?: 2014-01-08 06:39:15 +01:00
Daniel Marjamäki dfee044925 value flow: Fixed wrong value in subfunction after conditional return 2014-01-08 06:04:51 +01:00
Daniel Marjamäki 1fb0b1750c value flow: Fixed FP in ?: 2014-01-07 19:46:13 +01:00
Daniel Marjamäki 740f72fdbd value flow: simple handling of for loops 2014-01-07 19:20:56 +01:00
Martin Ettl fa04273473 Merge branch 'master' of https://github.com/danmar/cppcheck 2014-01-06 18:51:15 +01:00
Daniel Marjamäki 126f2ed423 Fixed Visual Studio compiler error 2014-01-06 18:14:29 +01:00
Daniel Marjamäki a6320a35e0 value flow: added experimental subfunction handling 2014-01-06 16:37:52 +01:00
Daniel Marjamäki 58fb2e756b Value flow: added bailout on } 2014-01-06 11:27:56 +01:00
Daniel Marjamäki 39b47cc1e7 value flow: improved error message output for conditional division by zero 2014-01-06 10:51:17 +01:00
Daniel Marjamäki a5b79bc968 value flow: fixed bailout so it really bails out 2014-01-06 10:23:17 +01:00
Zachary Blair 4a2da09491 minor cleanups. initialize members in initialization list 2014-01-06 08:02:04 +01:00
Daniel Marjamäki c4fa3bb137 value flow: added bailouts for global variables and assignments 2014-01-06 07:44:58 +01:00
Daniel Marjamäki c32d0f1992 CheckInternal: Improved checking of multiCompare patterns. The multiCompare pattern can contain any %cmd% until there is non-%cmd% used. For instance %var%|%num% is handled ok. 2014-01-05 23:03:36 +01:00
Daniel Marjamäki a98c66b048 Fixed Token::Match pattern. See also #5310 2014-01-05 23:02:07 +01:00
Daniel Marjamäki 4620284cbf astyle formatting 2014-01-05 22:06:11 +01:00
Daniel Marjamäki 62c608141d CheckInternal: Improved checking of multiCompare patterns 2014-01-05 21:15:41 +01:00
Daniel Marjamäki 0877adb542 astyle formatting 2014-01-05 21:12:32 +01:00
Daniel Marjamäki afaf1473a8 Value flow: refactorings, write debug warning if iterating too far 2014-01-05 20:06:46 +01:00
Graham Whitted 86201c13cb Fixed #5097 (TemplateSimplifier::expandTemplate assertion failure) 2014-01-05 19:19:52 +01:00
Alexander Mai 77362fd671 Fixed #5289 (Crash: Stack overflow in isImplicitlyVirtual_rec when checking SVN) 2014-01-05 19:10:16 +01:00
Daniel Marjamäki 29c64cc34c Merge pull request #209 from simartin/ticket_5266
Ticket #5266: Properly tokenize "complex" static variable declarations.
2014-01-05 04:44:22 -08:00
Daniel Marjamäki deb3699bd8 value flow: Updated Visual Studio files 2014-01-05 09:52:37 +01:00
Daniel Marjamäki 9fabc7991a value flow: fixed segfault when checking lib/mathlib.cpp 2014-01-04 21:28:15 +01:00
Daniel Marjamäki 45278eadc7 value flow: fixed bugs 2014-01-04 21:23:17 +01:00
Daniel Marjamäki d8270c710a Add new experimental value flow analysis 2014-01-04 20:57:02 +01:00
Daniel Marjamäki f1054a50f6 Merge pull request #208 from simartin/ticket_5201
Ticket #5201: Get rid of internal error when checking valid C input for leaks
2014-01-04 05:18:44 -08:00
Daniel Marjamäki 93a9cb40df Fixed #5310 (Internal error: match compiler returned different result than parsed match) 2014-01-04 13:53:54 +01:00
Simon Martin d2cf9fd77c Ticket #5266: Properly tokenize "complex" static variable declarations. 2014-01-04 10:49:27 +01:00
PKEuS 55f68535b2 Set version to "1.64 dev"/1.63.99. Use version.h in cppcheck.cpp. 2014-01-04 10:41:13 +01:00
Daniel Marjamäki 6515691a47 1.63: Set version numbers 2014-01-04 09:32:37 +01:00
Simon Martin 6019f45249 Ticket #5201: Get rid of internal error when checking valid C input for memory leaks. 2014-01-03 23:27:56 +01:00
Daniel Marjamäki 7125682d1a Fixed #5274 (TokenList: macro handling) 2014-01-03 18:53:37 +01:00
Robert Reif cbe3862599 Fixed #5264 (Size specifier in printf functions is wrong for some types) 2014-01-03 15:58:45 +01:00
Alexander Mai 10ff45b54a Fixed #5306 (Implement --showtime=top5) 2014-01-03 10:45:14 +01:00
Alexander Mai ea10a722fc Fixed #5306 (Implement --showtime=top5) 2014-01-03 10:24:57 +01:00
Zachary Blair 7a6386bc4b Fixed #4867 (Memory Leak: Return value of malloc) 2014-01-03 10:12:32 +01:00
Alexander Mai f93d21c8df Fixed #5303 (Possible NULL pointer dereference in checkassert.cpp) 2014-01-03 09:32:05 +01:00
Daniel Marjamäki a94fccf51a astyle formatting 2014-01-02 21:47:35 +01:00
Sam Truscott 4333dd3c75 Update Qt to support Markup structure 2014-01-02 18:18:24 +01:00
Daniel Marjamäki b08880f20f Library: Changed ignorefunction to a set 2014-01-02 17:28:24 +01:00
Daniel Marjamäki 372c29c24e Fixed #5284 (duplicateExpression falsely reported by members of a union in some circumstances) 2014-01-02 16:58:07 +01:00
Daniel Marjamäki 2f91539d1d Preprocessor: don't insert macroChar inside .1 and 1. tokens 2014-01-02 11:21:23 +01:00
Daniel Marjamäki a1b0d190df Fixed #3688 (false positive: (inconclusive, posix) (warning) The buffer 'cBuffer' is not zero-terminated after the call to readlink().) 2014-01-02 10:46:19 +01:00
Alexander Mai 12df5300ba Fixed #5290 (Doxygen fixes (32be409)) 2014-01-01 20:46:00 +01:00
Martin Ettl 5a5277f2fa Tokenizer::simplifyVarDecl: Fixed crash when checking garbage code. 2014-01-01 19:15:32 +01:00
Martin Ettl 0dccd3a632 Tokenizer:simplifyFlowControl(): Fixed crash on garbage code. 2014-01-01 19:04:02 +01:00
Daniel Marjamäki d62055277d Fixed #4787 (False Positive: Unused private function) 2014-01-01 18:36:51 +01:00
Alexander Mai 5539e9ea0f Fixed #5279 (False positive: warning (uninitMemberVar): Member variable 'ToDoubleArray::mfNaN' is not initialized in the constructor. (modified #5170 example)) 2014-01-01 18:34:39 +01:00
Daniel Marjamäki cd65d8e54f Fixed #5169 (Preprocessor::removeComments : Bad handling of __asm) 2014-01-01 12:44:59 +01:00
Daniel Marjamäki 32be4094e7 Symbol database: only put variables in variable list 2013-12-31 17:51:56 +01:00
PKEuS 621cf6e777 Support arrays as template parameters in TemplateSimplifier::templateParameters 2013-12-31 13:59:32 +01:00
PKEuS 6f76dfcb22 Forward declare tinyxml type used in library.h to avoid problems with dynamic linked configuration. 2013-12-31 12:30:17 +01:00
Daniel Marjamäki 803182bf45 Reverted 'GUI: Added CFGDIR qmake flag' there are various installation problems and this only fixes one of them. 2013-12-31 10:35:34 +01:00
Daniel Marjamäki 7e71c41ba7 Preprocessor: Don't insert macroChar inside 1.f and 1.e+7 as that mess it up later. Thanks ettlmartin for telling me about this. 2013-12-31 10:24:14 +01:00
Daniel Marjamäki 8da0d84905 Library: fixed crash in Library::load if exename is NULL 2013-12-30 18:35:27 +01:00
Daniel Marjamäki 99703e1a3f Preprocessor: make sure 1E-7, 1E+7, 1e+7 in macros is output as a single token. Putting a macroChar before the 7 mess it up later. 2013-12-30 18:03:24 +01:00
PKEuS 4f0121ee2f Splitted simplification out of tokenize() 2013-12-30 17:45:28 +01:00
Daniel Marjamäki c143b02e67 GUI: Added CFGDIR qmake flag 2013-12-30 09:01:44 +01:00
Daniel Marjamäki 582baa5648 Preprocessor: make sure 1e-7 is output as a single token. puttin a macroChar before the 7 mess it up later. 2013-12-29 21:51:01 +01:00
Daniel Marjamäki 41e4194573 Tokenizer: set links for <> in 'a=new b<c>;' code 2013-12-29 15:37:27 +01:00
Daniel Marjamäki f2661dae4c astyle formatting 2013-12-29 13:44:13 +01:00
Daniel Marjamäki e13aa0dbc3 Fixed #5275 (FP mismatchAllocDealloc: user defined opendir()/closedir() on non-POSIX system) 2013-12-29 09:51:29 +01:00
Daniel Marjamäki ef3d3f2d40 Temporary fix for #5263 until tinyxml2 handle folders better. When https://github.com/leethomason/tinyxml2/issues/147 is fixed this should be reverted. 2013-12-28 21:57:13 +01:00
Daniel Marjamäki 4b72f01e99 clarify calculation: Fixed FP for 'a = (*p ? 1 : 2)' 2013-12-28 11:02:39 +01:00
Daniel Marjamäki e0eb000ac3 AST: Fixed problem with decrement 2013-12-27 14:40:59 +01:00
Daniel Marjamäki d3a848f2e6 Makefile: Added optional CFGDIR parameter that allows user to specify where Cppcheck will look for cfg files. 2013-12-26 18:41:51 +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 eb2ea1c28f AST: refactored CheckSizeof::sizeofCalculation() 2013-12-25 12:35:41 +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
Daniel Marjamäki 85c62f98d7 Library: added <markup> element 2013-12-22 18:44:31 +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 4769838b80 Library: Refactoring of markup code 2013-12-22 17:03:46 +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 a948b4f4b0 Revert "Preprocessor:removeParentheses: fixed potential buffer access out of bounds, if find returns std::string::npos."
This reverts commit 4fbe15c866.

As far as I see there can't be buffer access out of bounds. line always contain a '('.
2013-12-15 13:41:07 +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 98b6fa2eaf SymbolDatabase: Use std::size_t for Function::getArgument() argument since Function::argCount() returns a std::size_t 2013-12-14 08:35:46 +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 abdd29fce3 fixed FP when passing uninitialized buffer as 2nd argument to itoa 2013-12-13 07:51:33 +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 08cd0cd0f7 CheckOther::checkDuplicateExpression: Added TODO comment to readd checking for duplicate separated expressions 2013-12-13 06:40:35 +01:00
Daniel Marjamäki d2493fa3cb CheckMemoryLeak: Report OtherRes leaks as resource leak 2013-12-12 18:23:42 +01:00
Daniel Marjamäki 35189e80f2 Uninitialized variables: Fixed false positive for '*p=..' 2013-12-12 15:33:31 +01:00
Daniel Marjamäki 7321f92eff CheckUninitVar: Fix Coverity warning about possible null pointer. 2013-12-12 12:36:49 +01:00
Daniel Marjamäki 1b86615a69 Uninitialized variables: Fixed false positive for 'p=malloc; if (p) {}' 2013-12-12 11:44:07 +01:00
orbitcowboy 4fbe15c866 Preprocessor:removeParentheses: fixed potential buffer access out of bounds, if find returns std::string::npos. 2013-12-09 01:40:51 -08: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 83066edec0 Code cleanup 2013-12-10 06:29:06 +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 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
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 4e003c392e AST: code cleanup. Remove unreachable 'break' after 'return' 2013-11-18 23:24:58 +01:00
Daniel Marjamäki 45ee3b0fba AST: Refactoring new checkIncorrectLogic checking 2013-11-18 23:09:14 +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
Martin Ettl feb54a46fb Merge branch 'master' of https://github.com/danmar/cppcheck 2013-11-10 05:06:00 +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
Martin Ettl 3bf415fa2b checkbufferoverrun: improved constness of local variables. checkbufferoverrun:array_index(): added a bailout if the function is called with tok=NULL and added a NULL pointer check after a dynamic_cast. 2013-11-10 05:05:31 +01:00