Commit Graph

5668 Commits

Author SHA1 Message Date
Daniel Marjamäki 31755b621c Merge pull request #246 from simartin/ticket_5356
Ticket #5356: Added test case that works following the fix for #5506.
2014-03-02 14:55:52 +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 4057242cb2 Ticket #5356: Added test case that works following the fix for #5506. 2014-03-02 10:10:58 +01:00
Simon Martin 875a3f47e7 Ticket #5478: Only functions and equal operators might return a temporary. 2014-03-02 09:39:10 +01:00
Daniel Marjamäki 16e06b3f2a Merge pull request #243 from simartin/ticket_5050_testcase
Ticket #5050: Added test case since it works now.
2014-03-02 08:54:53 +01:00
Simon Martin 3518e02d23 Ticket #5506: Skip template parameters when determining whether a template is a declaration or a definition. 2014-03-01 14:58:47 +01:00
Simon Martin ef3f135af2 Ticket #5050: Added test case since it works now. 2014-03-01 10:37:55 +01:00
Alexander Mai 50a184c3e9 Fixed #5166 (segmentation fault (invalid code) in lib/checkother.cpp:329 ( void * f { } void b ( ) { * f } )) 2014-02-27 18:24:51 +01:00
Alexander Mai a02bbfa47e Fixed #5492 (Fix small bug in MathLib::isFloat()) 2014-02-27 16:08:49 +01:00
Daniel Marjamäki 7dbfd67da3 Fixed #5493 (False positive: Found a statement that begins with numeric constant / string constant - in the presence of initialization list.) 2014-02-26 06:18:52 +01:00
Daniel Marjamäki 8550289722 Fixed #5452 (AST: wrong handling of unary ::) 2014-02-25 06:36:10 +01:00
Alexander Mai 0747b55485 Fixed #5304 (Wrong simplification of numbers like 001E+07 to 1.0) 2014-02-24 18:52:31 +01:00
Daniel Marjamäki 8dd7f02e45 Fixed #5381 (Some false positives that came up when using --enable=performance file.c) 2014-02-23 11:02:39 +01:00
Martin Ettl c3a08bf108 TestMathLib: added robustness tests for testing MathLib::isFloat. Ensure it works correctly for preceeding and trailing white spaces. 2014-02-22 21:36:51 +01:00
Martin Ettl 01730d4d16 #5304: added a losts of TODO testcases for MathLib::isFloat(). 2014-02-22 19:55:57 +01:00
Martin Ettl 42a3c5d083 #5304: added a losts of TODO testcases for MathLib::isFlot(). 2014-02-22 19:50:40 +01:00
Daniel Marjamäki f6b42633e8 Fixed #5434 (FP: Out-of-bounds access with ternary operator in loop) 2014-02-22 17:59:12 +01:00
Daniel Marjamäki 34730f623a Fixed #5301 (False positive: (error) Division by zero - variables read from input stream) 2014-02-22 12:09:54 +01:00
Alexander Mai 82a2279425 Fixed #5304 (Wrong simplification of numbers like 001E+07 to 1.0) 2014-02-20 16:56:49 +01:00
Daniel Marjamäki ed9153ee80 Symbol database: added simple mismatch check in Scope::findFunction when passing address to function that expects a reference 2014-02-19 06:35:51 +01:00
Daniel Marjamäki 690c37633b ValueFlow: Fixed bad values after break/continue 2014-02-17 20:07:38 +01:00
Daniel Marjamäki c050a92bae Fixed #5468 (crash: freebsd: llvm/RegionPrinter.cpp - AST failure) 2014-02-17 17:37:39 +01:00
Daniel Marjamäki d37359217c Merge pull request #241 from lanurmi/more-nullptr
Change some more 0 literals into nullptr.
2014-02-16 23:29:23 +01:00
Lauri Nurmi 70a67eaf85 Change some more 0 literals into nullptr. 2014-02-16 13:38:50 +02:00
Daniel Marjamäki fdcb325d70 DuplicateBranch: Made warning inconclusive since it's in most cases noise 2014-02-16 11:04:27 +01:00
Daniel Marjamäki 23efc68dd7 use nullptr 2014-02-16 10:32:10 +01:00
Lucas Manuel Rodriguez 052840f8f5 Fixed #4818 (New check: Check memset() 2nd parameter) 2014-02-15 15:06:00 -03:00
Daniel Marjamäki fd3a8a2a18 Update copyright 2014-02-15 07:45:39 +01:00
Daniel Marjamäki a1d9873558 Fixed #5465 (crash: AST doesnt produce good output for 'class C:public :🅰️:b<c>{..};') 2014-02-14 06:30:51 +01:00
Pavel Roschin df69f4e4be Library: add mk[sd]temp to Posix 2014-02-11 17:02:33 +04:00
Daniel Marjamäki 8305015dea astyle formatting 2014-02-08 08:51:38 +01:00
Pavel Roschin 19a8cfd960 Library: add new "define" tag
This tag will allow to add some preprocessor defs into library.
It would be useful to provide more information about libraries
implementation details. As example GLib's library include tag
was added that helps to detect more memory leaks.
2014-02-07 10:13:36 +04:00
Daniel Marjamäki 3c0619cba5 astyle formatting 2014-02-05 18:49:34 +01:00
Pavel Roschin 4f38d7ae31 Library: add full GLib/GTK support 2014-02-05 19:52:24 +04:00
Daniel Marjamäki 3c6bfac89c Merge pull request #234 from scriptum/rpg-use-whitelist-from-library
CheckMemoryLeak: use library while checking whitelist functions
2014-02-05 11:41:47 +01:00
Daniel Marjamäki ec80068cd9 Merge pull request #228 from simartin/osx_build_restore
RFC: Restore build on OSX
2014-02-05 11:30:34 +01:00
Pavel Roschin 0dd227419d CheckMemoryLeak: use library while checking whitelist functions 2014-02-05 12:16:50 +04:00
Daniel Marjamäki 6ac9e180e0 ast: fixed hang when checking beid 2014-02-05 06:05:48 +01:00
Daniel Marjamäki 2ed3b40937 ast: fixed hang when checking bin-prot 2014-02-04 19:33:26 +01:00
Daniel Marjamäki 486a3192c0 Fixed #5246 (false positive: (warning) Logical conjunction always evaluates to false: t > 0 && t < 1.) 2014-02-04 06:50:29 +01:00
Daniel Marjamäki 8c40f4fee0 astyle formatting 2014-02-03 18:51:07 +01:00
Daniel Marjamäki ed4fa9f154 Merge pull request #231 from scriptum/rpg-add-glib-tests
Add GLib library, add GLib tests (some new bugs found)
2014-02-02 10:49:33 -08:00
Daniel Marjamäki ec61143623 Merge pull request #233 from orbitcowboy/master
Fixed #389: Providing negative value to memory allocation function.
2014-02-02 10:47:37 -08:00
Pavel Roschin 651ebcf17b Add GLib library, add GLib tests (some new bugs found) 2014-02-02 22:45:57 +04:00
Daniel Marjamäki ef35b6b1b4 Merge pull request #230 from xypron/5355
5355: False positive var not assigned
2014-02-02 10:10:55 -08:00
Daniel Marjamäki 0166a717c5 Merge pull request #229 from scriptum/#3236
Added regression for #3236
2014-02-02 09:52:14 -08:00
Heinrich Schuchardt 6bfd4af5f7 5355: False postive var not assigned
Avoid false positive "variable not assigned" for

struct Fred{
};
void foo () {
  Fred fred;
  throw fred;
}

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2014-02-01 22:40:35 +01:00
Martin Ettl 6ca7daec10 Fixed #389: Providing negative value to memory allocation function. 2014-02-01 22:38:29 +01:00
Pavel Roschin e06e96e864 Added regression for #3236 (Failure to detect memory leak if pointer members are added) 2014-02-01 15:51:29 +04:00
Simon Martin 8ff9696374 OSX's compiler supports C++11 but one needs to use GNU's STL to build cppcheck, that does not have cbegin/end. 2014-02-01 07:40:08 +01:00
Daniel Marjamäki b3bfd5014d Fixed #5433 (FP:Possible null pointer dereference) 2014-01-31 15:43:34 +01:00
Daniel Marjamäki 9aa9530e0d Fixed #5426 (crash: btrfs-progs cmds-inspect.c) 2014-01-31 06:19:36 +01:00
Lucas Manuel Rodriguez a34d2eb7b3 Fixed #4938: (.empty() method false positive for non-STL classes) 2014-01-30 18:09:24 -03:00
Daniel Marjamäki d6e3b3d3f3 ast: fixed syntax tree for 'a=(b)?1:0'. The parentheses should not be in the syntax tree 2014-01-30 17:31:06 +01:00
Daniel Marjamäki 30b56437c1 Merge pull request #226 from scriptum/rpg-fix-function-parameter
CheckMemoryLeak: improve leak checking in function parameters
2014-01-28 20:32:56 -08:00
Daniel Marjamäki 312780b6fc TestTokenizer: refactored line2 test case 2014-01-28 17:18:28 +01:00
Kamil Dudka dee18d10a8 Fixed #5423 (fix parsing of #line NNNN "file.c") 2014-01-28 17:15:07 +01:00
Daniel Marjamäki abe8439917 Fixed #5416 (False positive: Array accessed at index, which is out of bounds.) 2014-01-28 16:55:10 +01:00
Lucas Manuel Rodriguez 2048313915 Add Variable::isStlType function 2014-01-28 11:44:56 -03:00
Pavel Roschin 2396073262 CheckMemoryLeak: improve leak checking in function parameters 2014-01-28 17:30:36 +04:00
Daniel Marjamäki 2108251851 Fixed #5417 (ast: avoid hang when '({})' is used) 2014-01-28 06:11:53 +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 6e6de82323 CheckMemoryLeak: test alloc/dealloc configuration in posix.cfg 2014-01-27 16:51:18 +01:00
Daniel Marjamäki c8a1424e10 Fixed #5406 (crash inside valueFlowBeforeCondition() on files from kernel-git) 2014-01-27 06:18:42 +01:00
Daniel Marjamäki 2b8cf462c9 CheckMemoryLeak: Move posix-opendir/closedir to library 2014-01-26 17:02:36 +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 0c47555423 CheckNullPointer: use library instead of hard coded info 2014-01-26 16:19:49 +01:00
Daniel Marjamäki be082a8e4a value flow: added bailout for conditional return/continue/break when number_of_if is bigger than 0 2014-01-26 15:50:25 +01:00
Daniel Marjamäki c5971b7137 value flow: fix fp when conditional value is assigned 2014-01-25 20:14:49 +01:00
Daniel Marjamäki c1e35e1df1 value flow: fixed multivariable problem in condition 2014-01-25 19:13:33 +01:00
Daniel Marjamäki df0995edf5 Fixed #5403 (Value flow: FP because post increment/decrement is not handled correctly) 2014-01-25 18:31:02 +01:00
Daniel Marjamäki bc9ad08831 Fixed #5245 (false positive: Uninitialized variable (assignment inside ternary operator)) 2014-01-25 10:12:50 +01:00
Daniel Marjamäki 35b51468cb value flow: Fixed FP for division then check in for loop: 'for (a=b/x;x>0;x--)' 2014-01-25 09:22:32 +01:00
Daniel Marjamäki 4647a9fc93 Fixed #5401 (value flow: fp when there are increment/decrement) 2014-01-24 18:22:38 +01:00
Daniel Marjamäki 1cac7e1686 value flow: better handling in function call bailout of casting address of variable 2014-01-24 17:47:49 +01:00
Tobias Weibel 9d55265e6b Replaced duplicated logf(2.0) with logf(2.0f) unittest 2014-01-23 16:19:30 +01:00
Daniel Marjamäki ec034c1d59 Fixed #5386 (ast: hang when code is 'for (T a : b)') 2014-01-23 06:13:24 +01:00
Daniel Marjamäki 0dbb86f0cb Cleanup ExecutionPath from CheckBufferOverrun 2014-01-22 21:25:37 +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 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 98305e9163 astyle formatting 2014-01-20 06:31:28 +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 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 d0d56aee4a TestValueFlow: split up valueFlowBeforeCondition into smaller functions 2014-01-18 08:45:24 +01: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 36acfb6d20 Fixed Cppcheck warning. db is dereferenced before its checked against NULL 2014-01-17 18:10:10 +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 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 d43191a9e3 value flow: remove duplicate test case 2014-01-14 18:13:17 +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 eb774054b0 Merge pull request #210 from matthiaskrgr/travis
travis: rewrite config file.
2014-01-13 10:44:36 -08:00
Daniel Marjamäki 7981e3d38f value flow: fix fp when gotos are used 2014-01-13 16:07:25 +01:00
Daniel Marjamäki b1bbb23225 value flow: fixed fp when checking symboldatabase 2014-01-13 05:52:28 +01:00
Matthias Krüger 962018b722 revert: commit f6da9d4e3c
"testcmdlineparser: comment out unused functions fileListStdin(), ignorepaths{1-4}(), ignorefilepaths{1,2}()"
instead suppress the files.
also suppress unused variable in test/testpreprocessor.cpp
2014-01-12 22:47:21 +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 2e67ca06c0 value flow: some simplifications in unknown functions when there is library configuration 2014-01-12 18:19:00 +01:00
Daniel Marjamäki d700114edf value flow: bailout if condition is defined by macro 2014-01-12 17:16:51 +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
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
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 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 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 4e7e56df9f astyle formatting 2014-01-11 07:54:06 +01:00
Daniel Marjamäki 1ad94a8be5 value flow: loosen up bailouts in valueFlowSubFunction 2014-01-11 07:52:25 +01:00
Matthias Krüger f6da9d4e3c testcmdlineparser: comment out unused functions fileListStdin(), ignorepaths{1-4}(), ignorefilepaths{1,2}() 2014-01-10 21:08:12 +01:00
Matthias Krüger 4f918e1c8c testsuite: remove function todoAssert() which is unused according to cppcheck. 2014-01-10 21:08:11 +01:00
Matthias Krüger d9ce61a9d6 testsuite: according to cppcheck, the function printTests() is not used, remove it. 2014-01-10 21:08:11 +01:00
Matthias Krüger 6feb0faf4c testbool: same for checkComparisonOfBoolWithBool 2014-01-10 21:08:11 +01:00
Matthias Krüger 3602cc2f6a testsymboldatabase: run symboldatabase32, probably someone forgot to implement this. 2014-01-10 21:08:11 +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 acb103e214 value flow: skip scopes that don't contain variable 2014-01-10 16:13:39 +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 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 96b62c6ccb Fix the C4800 warnings. 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 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 9c50deda64 value flow: reverted TestOther, don't use value flow in test cases yet 2014-01-08 16:18:50 +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 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 d172e9bb29 value flow: Fixed testing 2014-01-06 10:09:49 +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 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
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 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
PKEuS 574c27b1b2 Removed VS9 solution 2014-01-04 10:55:27 +01:00
Simon Martin d2cf9fd77c Ticket #5266: Properly tokenize "complex" static variable declarations. 2014-01-04 10:49:27 +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
Zachary Blair 7a6386bc4b Fixed #4867 (Memory Leak: Return value of malloc) 2014-01-03 10:12:32 +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
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 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 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 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 e13aa0dbc3 Fixed #5275 (FP mismatchAllocDealloc: user defined opendir()/closedir() on non-POSIX system) 2013-12-29 09:51:29 +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 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
Daniel Marjamki 9959c2866c AST: fixed hang for ',&x..' 2013-11-03 15:05:58 +01:00
Daniel Marjamki 8910bae801 Fixed #5137 (Defining empty macro from commandline does not seem to work) 2013-11-03 09:46:03 +01:00
Daniel Marjamki bcc8384a95 Fixed #5145 (False Positive: Variable 'A' hides enumerator with same name) 2013-11-03 09:34:48 +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 11abd23fa7 astyle formatting 2013-11-02 22:58:47 +01:00
Daniel Marjamäki 769b4617c3 Fixed #5142 (False positive with floating-point special cases in conditions) 2013-11-02 22:58:23 +01:00
Daniel Marjamäki a50e5c2c23 Merge pull request #195 from simartin/ticket_5139
Ticket #5139: Properly handle recursive macro definitions
2013-11-02 11:21:13 -07:00
Daniel Marjamäki c505f5ea23 Fixed AST problem for 'if ((a.b&c)==d){}' 2013-11-02 19:18:58 +01:00
Daniel Marjamäki bbdfd8b5c7 Make it possible to create AST, by using the --ast flag 2013-11-02 18:37:35 +01:00
Simon Martin 95c08d5613 Ticket #5139: Properly simplify recursive macro definitions 2013-11-01 16:47:22 +01:00
Martin Ettl 5f89777182 testoptions: reverted commit 184db3900e 2013-11-01 01:28:05 +01:00
Martin Ettl 63d9fd4210 Merge branch 'master' of https://github.com/danmar/cppcheck 2013-10-29 01:48:58 +01:00
Daniel Marjamäki e446a28b3d Refactoring FileLister and Path so they don't depend on Library 2013-10-31 19:09:01 +01:00
Martin Ettl 184db3900e testoptions: fixed buffer access out of bounds issue. The ctor of options requires an array of at least two elements, but. 2013-10-29 01:48:30 +01:00
Daniel Marjamäki d3bd373798 Fixed #5131 (False Positive: %u in format string requires 'unsigned int' but the argument type is 'int'.) 2013-10-31 17:20:00 +01:00
Daniel Marjamäki 352c459e28 Merge pull request #194 from simartin/ticket_5121
Ticket #5121: Handle static variable declarations depending on one another
2013-10-30 22:09:44 -07:00
Alexander Mai 14787cde99 Fixed #5129 (FP:arithOperationsOnVoidPointer on void**) 2013-10-31 06:04:51 +01:00
Daniel Marjamäki 06c5bd0daa Fixed #5128 (False positive zerodivcond 'a ? 1 / a : 0') 2013-10-30 16:51:00 +01:00
Simon Martin d67722ebdf Ticket #5121: Handle comma separated static variable declarations depending on one another 2013-10-30 15:48:00 +01:00
Simon Martin 463ef2e71e Ticket #5120: New test case, that works now that #5125 is fixed 2013-10-30 10:15:03 +01:00
Simon Martin 052be76635 Ticket #5125: Avoid infinite recursion for recursive class definitions 2013-10-29 21:41:47 +01:00
orbitcowboy 097510c4ef Tokenizer:simplifyMathFunctions_fma: added a todo testcase. 2013-10-29 09:26:26 -07:00
Daniel Marjamäki 5c072993e3 CheckBool: Fixed false negative when assigning bool to pointer '; s.p = true; ' 2013-10-29 16:16:52 +01:00
orbitcowboy e8fdf4cdd2 Tokenizer:simplifyMathExpressions: added more testcases. 2013-10-24 21:33:00 -07:00
PKEuS bd752cabcf Let TinyXML2 handle fopen/fclose. Added testlibrary.cpp to VS10 solution 2013-10-27 17:32:38 +01:00
Daniel Marjamäki 569a29bc4a Library: Added simple testing 2013-10-27 17:10:43 +01:00
Robert Reif 94187c41c2 Fixed #5104 (False positive: Invalid argument in printf and scanf for vector template) 2013-10-27 10:48:49 +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 ec3ab74631 Preprocessor: Use set instead of list to track '#pragma once' usage 2013-10-27 10:33:37 +01:00
Daniel Marjamäki 51ad9ab6ac Fixed #4896 (FP Uninitialized variable on template function) 2013-10-26 18:39:40 +02:00
Daniel Marjamäki 8687e85e56 Fixed #4850 (False positive: invalidIterator1 detected when iterator container is member of some struct) 2013-10-26 17:48:20 +02:00
Daniel Marjamäki 853d9dd7a9 Fixed #4956 (false positive: Variable 'myIsFirst' is assigned a value that is never used.) 2013-10-26 15:22:28 +02:00
XhmikosR 32e2a5b879 test/testother.cpp: Fix a C4800 MSVC warning. 2013-10-25 18:14:16 +03:00
Daniel Marjamäki 364757e1e1 Fixed #5089 ('inconclusive' output printed although --inconclusive not specified) 2013-10-23 06:42:52 +02:00
Daniel Marjamäki d1b03d9c31 Fixed false positive for 'object is destroyed immediately' when there is no code after the object 2013-10-22 19:37:11 +02:00
Daniel Marjamäki a55056c770 Fixed #5105 (false positive: (warning) Either the condition 'b!=0' is useless or there is division by zero) 2013-10-22 16:18:42 +02: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
Sam Truscott 6806fd8135 Extended Qt support through Library 2013-10-20 14:09:10 +02:00
Daniel Marjamäki fc26de89a9 Fixed #5082 (False positive: (error) Possible null pointer dereference: p2) 2013-10-20 13:37:36 +02:00
Daniel Marjamäki 5d7e0aebf4 Fixed #5084 (False positive: (style) Same expression on both sides of '&&') 2013-10-19 18:04:53 +02:00
Daniel Marjamäki 6aa03efa2f Fixed #5103 (Don't show 'The scope of the variable can be reduced' if there is no explicit block with { }) 2013-10-19 17:27:02 +02:00
Daniel Marjamäki f8710cb984 Fixed #5102 (Crash if -D is used when scanning simple preprocessor code.) 2013-10-18 06:47:55 +02:00
Robert Reif b41ab8a4d5 Fixed #5088 (Token::Match called with varid 0. in libreoffice sd/source/ui/table/TableDesignPane.cxx) 2013-10-14 21:05:54 +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
orbitcowboy 9debeab47c Tokenizer:simplifyMathExpressions: fixed false negative patterns for simplification. 2013-10-11 11:58:37 -07:00
Daniel Marjamäki bb0385321f Fixed #5074 (False positive: Duplicate expression (macro)) 2013-10-13 17:42:06 +02:00
Martin Ettl a674ed1aa9 Tokenizer:simplifyMathFunction: added simplifcation for fma[f|l]() functions. 2013-10-13 16:28:02 +02:00
Martin Ettl e18ebf313f Tokenizer:simplifyMathFunctions: added support for more math functions. 2013-10-13 15:41:47 +02:00
Martin Ettl cdb47813d5 Tokenizer:simplifyMathFunctions: added support for cosh[f|l], cos[f|l] and erfc[f|l] functions. 2013-10-13 14:23:10 +02:00
Felipe Pena c37ba4cbcf - Fixed false positive when using typeof/__alignof__ 2013-10-12 13:46:14 -03:00
Daniel Marjamäki 783bb6eb0b Test that there is no segfault in CheckOther::checkZeroDivisionOrUselessCondition when the SymbolDatabase is invalid. Ticket: #5045 2013-10-10 22:23:52 +02:00
orbitcowboy 6eaa2f2444 Tokenizer:simplifyMathFunctions: added support for acos[f|l] functions. 2013-10-09 07:59:32 -07:00
orbitcowboy 58c09f80b6 Testother: split up a large testfunction, no functional change. 2013-10-09 07:48:46 -07:00
Daniel Marjamäki 682e68b1b6 Fixed #5077 (False positive: Comparison of boolean result with relational operator ((X + (Y < 0)) <= b)) 2013-10-09 05:43:50 +02:00
Martin Ettl f08325284c Tokenizer:simplifyMathFunctions: added support for acosh[f|l]() functions. 2013-10-07 22:10:58 +02:00
Daniel Marjamäki 9ce7efc6e4 commaSeparatedReturn: made checking experimental for now because there are false positives (#5076) 2013-10-08 18:05:07 +02:00
orbitcowboy 90b2c5ddce testtokenize: split up large testcases for simplifying math functions. 2013-10-08 07:05:05 -07:00
Daniel Marjamäki 4f88fdcf4a Check64Bit: Fixed false positive about returning integer for 'p+(n*80)' 2013-10-08 06:36:45 +02:00
Robert Reif 1959377423 Fixed #4963 (cppcheck and testrunner Visual Studio 2008 build failure) 2013-10-08 05:36:52 +02:00
Daniel Marjamäki f9cf148012 CheckBool: Skip 'bool' type checking in C code 2013-10-07 18:41:07 +02:00
Daniel Marjamäki b81de5494e CheckBool: Fixed false positive for calculation using bool result in rhs 2013-10-07 18:01:08 +02:00
Daniel Marjamäki d2025363d0 CheckBool: Fix false positive for '(a != boolexpr || c)' if a is a int 2013-10-07 17:44:19 +02:00
Daniel Marjamäki 83f9503839 CheckBool: Fixed false positives for non-bool expressions that contain ! operator 2013-10-07 16:37:51 +02:00
Daniel Marjamäki 023d0e7cb8 Fixed #5072 (False positive: comparisonOfBoolWithInvalidComparator even without explicit bool type) 2013-10-07 16:16:07 +02:00
Daniel Marjamäki 4cd0108b93 Fixed #4976 (False positive: (style) A pointer can not be negative (git/sha1_file.c)) 2013-10-06 16:52:27 +02: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 9f23b7a1b4 Fixed #5063 (False positive for comparisonOfBoolWithInvalidComparator) 2013-10-06 10:39:08 +02:00
Daniel Marjamäki c234cace6d Fixed #5064 (Tokenizer::simplifySizeof: Doesn't simplify 'sizeof !! (a==1);' properly) 2013-10-06 08:20:10 +02:00
Daniel Marjamäki 946722faf0 Fixed #4968 (False positive: Structure with 'read' member is confused with read() function.) 2013-10-05 18:25:44 +02:00
Robert Reif 7098fc6039 CheckIO: fixed handling of unknown types. Ticket #5051 2013-10-05 16:47:06 +02:00
Daniel Marjamäki 6830d5f7a4 Fixed #5042 (false positive: Redundant code (set filled in initialization list)) 2013-10-05 12:26:09 +02:00
Daniel Marjamäki f2fdd967f5 Fixed #5046 (False positive: Boolean value assigned to pointer) 2013-10-05 08:53:37 +02:00
Daniel Marjamäki 348f3fa97f Fixed #5058 (False positive: (warning) Comparison of a boolean expression with an integer.) 2013-10-05 08:33:33 +02:00
Robert Reif 5dbc02250f This patch adds pointer to format string support to printf. Ticket: #5051 2013-10-05 07:47:52 +02:00
Robert Reif 44559a1fb2 Fixed #5069 (sizeof(void) when variable name is override) 2013-10-05 07:40:59 +02:00
Robert Reif 6c06cdd24d CheckIO fixes. Ticket: #5051 2013-10-04 17:30:55 +02:00
Martin Ettl a8cf8f0984 Tokenizer:simplifyMathFunctions: fixed false positives when simplifying special pow() cases. 2013-10-03 22:54:45 +02:00
Martin Ettl f8bd33f2bc Tokenizer:simplifyMathFunctions: added support for log()-functions. Improved testcases and documentation. The function simplifyMathFunctions() returns now true in case a simplifcation is made. This function is called within a while loop to guarantee all simplifications are made. 2013-10-03 20:52:07 +02:00
Martin Ettl 548e2f3fbf Tokenizer:simplifyMathExpression: fixed false negatives in simplifying Pythagorean and Hyperbolic identities. 2013-10-03 15:41:12 +02:00
Robert Reif 59de30823e CheckIO: This patch adds support for fprintf_s, fscanf_s and %I. Ticket: #5051 2013-10-03 06:37:40 +02:00
Robert Reif 5aba841499 CheckIO: Handling of casts (#4964) 2013-10-02 04:12:46 +02:00
Martin Ettl fa5ee8fd13 Tokenizer: simplifyMathFunctions: added more simplifications for exp(), exp2() and log2() functions. 2013-10-01 20:30:59 +02:00
orbitcowboy b6d7e797a2 Testtoken:matchNumeric(): extended testing about some missing testcases. 2013-09-30 15:55:36 -07:00
orbitcowboy 5a158987ce Added todo testcase for false positive: Comparison of boolean with expression with an integer. 2013-09-30 11:21:28 -07:00
Robert Reif cc6745fef6 CheckIO: Fixed false positives when using _snprintf_s and _snwprintf_s. Ticket: #5057 2013-10-01 05:49:44 +02:00
Martin Ettl f0cbeb5233 simplifyMathFunctions: added support for exp(),sqrt(),cbrt() functions. 2013-09-29 18:11:17 +02:00
Robert Reif c37c6617d3 Fixed #5057 (Microsoft secure printf/scanf support.) 2013-09-30 19:55:21 +02:00
Daniel Marjamäki e3b7bce72b Fixed #4907 (False positive 'uninitStructMember' on structs with unions) 2013-09-30 06:35:31 +02:00
Daniel Marjamäki 1c513f330a Fixed #5055 (False negatives when using -I (external source code)) 2013-09-29 18:59:27 +02:00
Robert Reif d3798958f4 CheckIO: Fixed false positive when using wchar_t (#5051) 2013-09-29 15:25:18 +02:00
Martin Ettl 0527aefb11 Improved simplifyMathFunctions when simplifying special cases of pow(x,y)-function. 2013-09-29 15:11:09 +02:00
Daniel Marjamäki 973bdcc6d8 Fixed #4929 (false positive: Division by zero (standard function div())) 2013-09-29 11:13:49 +02:00
Robert Reif c5723ab46a CheckIO: Clarify format check warnings 2013-09-29 10:42:47 +02:00
Martin Ettl 5aaaff46ee Fixed #5049: new check: (warning) Comparison of two identical variables with isgreater(result,result) evaluates always to false. 2013-09-26 07:07:48 +02:00
Martin Ettl 805d082cd1 Tokenizer:simplifyMathFunction: added support for [ll]div() functions and corresponding unittests. The simplifcation is only performed, if a division by 1 is detected. 2013-09-26 07:01:08 +02:00
Steve Duan cf0c666d79 Fixed #5041 (Improve check: support 'auto' for 'Iterator used after element has been erased') 2013-09-28 11:50:45 +02:00
Daniel Marjamäki 4a02ca8202 SymbolDatabase: handle method with unknown macro 'void f() MACRO {..}' 2013-09-28 11:44: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
Frank Zingsheim 67915749b0 Fixed #4723 (False positive: Pure virtual call within conditional clause)
conditional clauses directly in constructor/destructor cannot prevent
pure virtual function call otherwise this part of the code would never been called
2013-09-27 09:25:38 +02:00
Martin Ettl 32e1831716 #5046 - Added todo testcase 2013-09-26 01:03:34 +02:00
Martin Ettl ea5bcfaa35 Fixed #5040 - simplify more math functions. 2013-09-26 00:44:16 +02:00
Frank Zingsheim 445d08d082 Fixed #4723 (False positive: Pure virtual call within conditional clause) 2013-09-26 17:25:16 +02:00
Robert Reif 44d86e97c0 Fixed #4920 (Microsoft ATL/MFC CString::Format argument checking) 2013-09-26 16:20:01 +02:00
Robert Reif 2de3ebcb1e CheckIO: fixed some more false negatives. Ticket: #4964 2013-09-24 06:43:03 +02:00
Daniel Marjamäki 17c0bb3cab revert 027e5cc8. the div() standard function should not be reimplemented. create a different fix. Ticket: #4929 2013-09-23 18:01:15 +02:00
Daniel Marjamäki 698e9e2b59 reverted ee14ea4f. I think this fix was too generic. If there is a union in the struct then only the union members should be skipped. 2013-09-23 17:52:42 +02:00
Daniel Marjamäki ee14ea4fc2 Fixed #4907 (False positive "uninitStructMember" on structs with unions) 2013-09-23 07:20:20 +02:00
Daniel Marjamäki 64454068ec Fixed #4934 (false positive: Uninitialized variable (loop with inner condition '(x=1)')) 2013-09-23 06:07:01 +02:00
Daniel Marjamäki 027e5cc860 Fixed #4929 (false positive: Division by zero (standard function div())) 2013-09-22 09:52:12 +02:00
Robert Reif 5c4c397372 CheckIO: add scanf argument type checking. Floating point and integer checking is complete but string checking is incomplete and character checking is missing. Ticket #4099 2013-09-22 06:56:31 +02:00
Alexander Mai 6eab4abaf2 Fixed #5030 (Segmentation fault below CheckMemoryLeakStructMember::isMalloc()) 2013-09-21 18:10:29 +02:00
Daniel Marjamäki 965d8f0ecc Fixed #5033 (segmentation fault (valid code) in CheckOther::checkZeroDivisionOrUselessCondition) 2013-09-21 17:44:25 +02:00
Martin Ettl 4cc153a6f3 Fixed #5032: fix wrong unittest case in testtoken::matchNumeric. 2013-09-21 17:40:18 +02:00
Martin Ettl d5f514c820 Fixed #5031: simplify labs|fabs|abs(-1) to 1. 2013-09-21 16:59:06 +02:00
Daniel Marjamki 3de9431507 Fixed #5022 (Improve check: Division by zero or useless condition, function call) 2013-09-15 17:46:52 +02:00
Robert Reif 19745bbb7d Fixed #5021 (Confusing message about %lf format in printf()) 2013-09-15 16:38:45 +02:00
Ettl Martin 5a671f8914 Fixed #5023 (Add support for asinf,acosf,asinl,acosl (...) functions) 2013-09-13 19:49:25 +02:00
Robert Reif 4d82e37078 Fixed #5021 (Confusing message about %lf format in printf()) 2013-09-12 05:54:05 +02:00
PKEuS 0439f25bbd Fixed wrong unittest introduced in b36a887608 2013-09-10 12:57:28 +02:00
Robert Reif 9be2f6b5d4 Fixed #4964 (printf format argument check only supports simple variables) 2013-09-08 20:21:00 +02:00
Daniel Marjamäki 4b1254bc8d Merge pull request #168 from simartin/ticket_4994
Ticket #4994: Don't crash when checking variable scope for invalid input
2013-09-08 06:57:42 -07:00
Simon Martin 843833f907 Ticket #4994: Don't crash when checking variable scope for invalid input. 2013-09-07 21:16:25 +02:00
Daniel Marjamäki 51ad747317 Fixed false positive in new 'x>-1<5' check when using templates 2013-09-07 18:24:35 +02:00
Daniel Marjamäki 6bb6506ce2 checkZeroDivisionOrUselessCondition: Fixed false positive when function is called and variable is passed to it 2013-09-07 16:18:11 +02:00
Daniel Marjamäki 08556d071e Fixed #5016 (false negative: condition is always true / comparing boolean result with '<' (x > -1 < 5)) 2013-09-07 11:32:11 +02:00
Daniel Marjamäki 83c460fc56 Fixed #5017 (New check: division by zero, otherwise condition is redundant) 2013-09-07 07:40:10 +02:00
Daniel Marjamäki 40c5924292 CheckIO: Handle classes derived from STL 2013-09-07 07:20:06 +02:00
Robert Reif 489a3a6e53 Fixed #5015 (strings not being concatinated properly) 2013-09-06 05:36:33 +02:00
Daniel Marjamäki 9000c233fa Fixed #5012 (Hang when there is syntax error 'else }') 2013-09-05 06:38:07 +02:00
Robert Reif 2fe91e290c CheckIo: Improved %d handling 2013-09-05 06:04:41 +02:00
Robert Reif 921a1aaa4f CheckIO: Improved handling of %u 2013-09-05 01:46:58 +02:00
Daniel Marjamäki 3b8e9f5a2a Fixed #4899 (False positive on unused variable) 2013-09-03 17:02:46 +02:00
PKEuS 05af4f82ce Test GetShowErrorMessages in testcmdlineparser.cpp 2013-09-03 11:41:16 +02:00
PKEuS b36a887608 Fixed false positive #5004 2013-09-03 10:54:10 +02:00
PKEuS 6b47ed414a Fixed Function::retDef initialization:
- Move/Copy Constructors and Destructors do not have a return type neither
- Fixed crash in SymbolDatabase::printOut
- Added testing
2013-09-03 10:48:01 +02:00
Daniel Marjamäki 5d7518aa57 simplifyCalculations: Improved handling of casts (#4899) 2013-09-03 06:27:11 +02:00
Robert Reif 0dddd424a4 CheckIO: Improved handling of function return type 2013-09-03 05:50:19 +02:00
Daniel Marjamäki 6819f5ed18 Fixed #4860 (Segfault with another Clucene file) 2013-09-02 05:58:55 +02:00
Daniel Marjamäki a781a83822 Preprocessor: Quicker response for --check-config. No 'normal' code is needed so skip it. 2013-09-01 07:13:48 +02:00
Robert Reif 8790f6d73f Fixed #4999 (Crash with simple code snipped in rev ab30fa3) 2013-08-31 18:58:55 +02:00
Robert Reif 05f2f0e419 CheckIO: improved type info - keep track of original typename. 2013-08-31 06:26:39 +02:00
Lucas Manuel Rodriguez 92b7280d13 Fixed #4995 (False positive - Using 'memset' on class that contains a virtual method) - Better fix 2013-08-30 22:06:20 -03:00
Lucas Manuel Rodriguez c26674dc97 Fixed #4995 (False positive - Using 'memset' on class that contains a virtual method) 2013-08-30 08:46:33 -03:00
Daniel Marjamäki 4a1d1ce1a1 Fixed #3471 (Unused functions: take __attribute__((constructor)) in to consideration) 2013-08-30 06:27:46 +02:00
Robert Reif fc435ae9aa CheckIO: fix false negative for a function in a base class not being found, fix false positives and negatives for std::vector operator [] 2013-08-30 05:41:59 +02:00
Lucas Manuel Rodriguez acd65a6829 Fixed #4991: False Positive - Dangerous usage of 'arr' (not null-terminated) 2013-08-29 08:12:05 -03:00
Robert Reif 2950eb08cb CheckIO: fix some %I64 related false positives. Ticket: #4964 2013-08-29 05:49:16 +02:00
Daniel Marjamäki 3bd1d53c75 Fixed #4941 (segmentation fault (invalid code) in Tokenizer::setVarId) 2013-08-28 19:52:41 +02:00