Commit Graph

474 Commits

Author SHA1 Message Date
Robert Reif c3c3eb74e8 fix #2929 (Additional Unused variable check) 2011-07-21 18:37:37 -04:00
Robert Reif ed30edf9d3 simplify CheckOther::checkIncorrectLogicOperator() by using more pattern matching 2011-07-18 07:34:49 -04:00
Robert Reif 76d0872c0d made #2827 fix more generic by adding more ops and using pattern matching rather than string matching 2011-07-17 16:28:00 -04:00
Robert Reif 4149617978 fix #2827 to use numeric comparisons 2011-07-16 23:05:35 -04:00
Robert Reif 430d22032d fix #2827 condition always false or true) 2011-07-16 22:06:23 -04:00
Zachary Blair 997a3652d2 Fixed #2822 (New check: Duplicate break statements in switch) 2011-07-14 17:12:56 -07:00
Robert Reif 270b2b1772 fix #2904 (Memory leak not detected when creating a new class instance) 2011-07-14 19:15:59 -04:00
Daniel Marjamäki 0007351ef4 spell check of error message. contant => constant 2011-07-05 19:59:58 +02:00
Daniel Marjamäki 8cd2c3115e Fixed #2866 (Detect sign extension bugs) 2011-07-05 18:41:27 +02:00
Greg Hewgill 657b003dc8 Fix spelling error in warning identifier 2011-07-05 19:54:23 +12:00
Robert Reif b32b2c6d87 add support for checking unused std::string local variables 2011-07-02 19:25:10 -04:00
Robert Reif 301e59cea0 fix false positive for unused local class/struct variable 2011-07-01 08:45:29 -04:00
Robert Reif 18e6509c5d add support in CheckOther::functionVariableUsage() for checking structures that are declared with struct keyword 2011-07-01 07:42:20 -04:00
Robert Reif 3225c9dd9b cleanup isStatic in CheckOther::functionVariableUsage() 2011-07-01 07:15:59 -04:00
Robert Reif 7826b5e22d add support for detecting unused function variables of type class or struct 2011-06-30 21:58:11 -04:00
Daniel Marjamäki 97d47fa20e Fixed #2805 (false positive: [NotAssigned1.cpp:5]: (style) Variable 'y' is not assigned a value) 2011-06-08 19:54:01 +02:00
seb777 e06b2419a4 fix #2786 (new check: Using sizeof with numeric constant)
Add unit test and improve check with negative constant because in cppcheck %num%
means 'integer'
2011-05-28 16:40:01 +08:00
seb777 287840e6bc fix #2786 2011-05-25 01:45:58 +08:00
Daniel Marjamäki 144d811e54 Fixed #2780 (false positive: variable p is not assigned a value 'int p[2]; *p = 0;') 2011-05-11 18:58:25 +02:00
Robert Reif 2db67863a7 #2700 (common logic or cut and paste errors) make duplicate branches inclnclusive 2011-05-08 13:22:42 -04:00
Daniel Marjamäki 3629f953f0 Fixed #2770 (False positives (scope can be reduced / variable is assigned value that is never used)) 2011-05-06 21:16:01 +02:00
Zachary Blair 46645ab327 Fixed #2722 (new check: statement that is always true (strcmp)) 2011-04-25 22:45:27 -07:00
Daniel Marjamäki 46afc54c10 astyle formatting 2011-04-20 06:41:26 +02:00
Daniel Marjamäki 8417c4eb28 const parameter: Added comment to reduce false negatives for various classes in the std namespace 2011-04-20 05:40:06 +02:00
Daniel Marjamäki 68e7003bb1 Fixed #2734 (False positive: reports 'should be passed by reference' for std::streamoff) 2011-04-19 20:07:54 +02:00
Robert Reif c238b1bba6 fix #2730 (The same expression on both sides of != is OK when checking for NaN) 2011-04-18 19:20:27 -04:00
Robert Reif 56212370d1 add check for same expression on both sides of an operator (part of #2700) 2011-04-10 10:25:02 -04:00
Robert Reif 434783530a Merge branch 'master' of github.com:danmar/cppcheck 2011-04-10 09:57:34 -04:00
Robert Reif 4a50aca7b2 fix a bug in checkDuplicateBranch where removed type info like signed/unsigned was not checked for difference 2011-04-10 09:57:09 -04:00
Daniel Marjamäki e5d43d4ed2 Renamed Settings::stupid to Settings::experimental 2011-04-10 15:55:08 +02:00
Daniel Marjamäki 30ee9ba6e4 Added Settings::stupid flag that can be used to hide checking that generates false positives. 2011-04-10 13:23:45 +02:00
Daniel Marjamäki f284c3a11f CheckOther: Code cleanup. Use %oror% 2011-04-10 11:52:12 +02:00
Daniel Marjamäki ec5ddb16b4 CheckOther: Use %op% in CheckUnsignedDivision 2011-04-10 11:31:04 +02:00
Robert Reif 66de41b313 partial fix for #2700 (common logic or cut and paste errors) 2011-04-09 17:05:27 -04:00
Robert Reif d22fcb8184 fix bug in previous commit: fix #311 (add detection of duplicated if else-cases) 2011-04-09 16:34:16 -04:00
Robert Reif 7e403ae210 fix #311 (add detection of duplicated if else-cases) 2011-04-09 15:14:01 -04:00
Daniel Marjamäki 7d93bfb42e Refactoring: Use Token::isArithmeticalOp instead of hardcoded conditions 2011-04-09 18:50:05 +02:00
Daniel Marjamäki 8e711b7925 Refactoring: there was almost duplicate functions 'isOp'. Created a new Token::isOp function instead. 2011-04-08 19:40:22 +02:00
Daniel Marjamäki 4ac3c7fe3b clarify calculation: fixed false negative for 'int x = a - b ? 2 : 3' 2011-04-04 21:33:16 +02:00
Daniel Marjamäki 63acd9bb3e Clarify calculation: Added warnings for << and >> 2011-04-03 22:12:22 +02:00
Daniel Marjamäki 29422b8552 clarify precedence: made the short message shorter 2011-04-02 17:27:36 +02:00
Daniel Marjamäki 855b01cd5a Clarify precedence 'a*b?c:d' : warn for addition, subtraction and division also. tried to clarify the message more 2011-04-02 11:43:20 +02:00
Daniel Marjamäki b8cda19ca6 Fixed #2655 (false positive: (warning) Redundant code: Found a statement that begins with numeric constant) 2011-03-30 21:57:01 +02:00
Stefan Weil 0e4cf7a2d6 Spell checks 2011-03-30 16:44:16 +02:00
Daniel Marjamäki 27506b4231 Fixed #2661 (False positive: object destroyed immediately) 2011-03-20 09:55:26 +01:00
Daniel Marjamäki 3e1df1b463 Clarify condition: re-enabled check 2011-03-13 12:16:55 +01:00
Daniel Marjamäki ed11a9e3cb Fixed #2639 (False positive: confusion between struct and function) 2011-03-13 08:38:40 +01:00
Daniel Marjamäki 29ab409af5 Merge branch '2390b' of https://github.com/elfring/cppcheck into elfring-2390b 2011-03-12 11:58:24 +01:00
Greg Hewgill 2716b856f4 throwing an exception is a valid immediate exit from switch 2011-03-12 07:27:31 +13:00
Robert Reif 79f0fe7d1c refactor symbol database and checks to use list of Scope rather than list of Scope pointers 2011-03-10 19:43:29 -05:00
Daniel Marjamäki db48158b28 Suspicious condition: Added new check for conditions that contains assignment+comparison 2011-03-09 22:20:14 +01:00
Daniel Marjamäki 06abaf95a5 Incorrect string compare: reduce noise when using strncmp on string literal 2011-03-07 21:37:13 +01:00
Greg Hewgill b9df7735c5 switchCaseFallThrough is now an inconclusive check 2011-03-06 13:06:30 +13:00
Greg Hewgill 8c245cfd2f switchCaseFallThrough is now a coding style check (ticket #2623) 2011-03-06 09:43:27 +13:00
Greg Hewgill 70fcbe94f4 avoid warning on first case (in case there are declarations before first case) 2011-03-05 00:45:58 +13:00
Greg Hewgill 8c1d7ef316 avoid crash when else condition doesn't have braces to link 2011-03-05 00:45:58 +13:00
Greg Hewgill ad45737805 more gracefully handle unexpected blocks inside switch 2011-03-05 00:45:57 +13:00
Greg Hewgill a532a9690e full implementation of switch case fall through 2011-03-05 00:45:57 +13:00
Greg Hewgill 93ea774484 initial simplistic implementation of switchCaseFallThrough 2011-03-05 00:45:57 +13:00
Zachary Blair e1b2569b81 Fixed #432 (New check: wrong usage of ! operator in conditions) 2011-02-27 12:30:22 -08:00
Daniel Marjamäki 85b1ea21cf Fixed #2590 (segmentation fault of cppcheck ( {}int )) 2011-02-19 09:56:17 +01:00
Daniel Marjamäki dfba4b7332 Fixed #2585 (segmentation fault of cppcheck (CheckOther::clarifyCalculation)) 2011-02-17 21:30:59 +01:00
Daniel Marjamäki 2657d36d03 Fixed #2502 (False positive: redundant assingment of object to itself) 2011-02-12 14:27:07 +01:00
Sébastien Debrard f5ed52b84b fix #2569 check postfix increment on boolean 2011-02-11 23:38:23 +01:00
Daniel Marjamäki 5175e4ff3f Fixed #2535 (false positive: (style) Variable 'A' is not assigned a value) 2011-02-09 19:20:44 +01:00
Erik Lax aeae5a867d Fixed #2550 (Bad substr/strncmp comparison) 2011-02-08 19:49:29 +01:00
Daniel Marjamäki 5640845a17 Fixed #2498 (False positive: redundant assignment) 2011-02-04 21:08:42 +01:00
Kimmo Varis 7d73b523be Clarify few verbose messages.
Dan pointed out to me earlier that he wants both short- and
verbose messages to be independently understandable. So modifying
some verbose messages to be easier to understand without the short
message.
2011-02-04 11:10:24 +02:00
Raphael Geissert f8e2d50e6f Use Token::simpleMatch where no special patterns are needed 2011-02-02 13:27:02 -06:00
Raphael Geissert 8d5863133c Use Token::simpleMatch where no patterns are used 2011-02-02 13:27:01 -06:00
Raphael Geissert cf2b6f7bc1 Remove useless spacing at the end of *Match strings 2011-02-02 13:27:01 -06:00
Raphael Geissert d592250284 Fix sizeof sizeof check to handle sizeof(sizeof type) 2011-02-02 11:49:32 -06:00
Daniel Marjamäki defeded4b5 Fixed #2529 (False positive: array 'req[3]' index 4 out of bounds) 2011-02-01 21:46:07 +01:00
Sébastien Debrard 078c36921d runastyle 2011-01-26 20:10:56 +01:00
Sébastien Debrard 3e7f29d6f9 fix #2510 Improve check 'sizeof for array given as function argument' 2011-01-26 20:08:06 +01:00
Sébastien Debrard 5d661d25a8 typo: message 2011-01-26 09:35:11 +01:00
Sébastien Debrard e82c190429 Merge branch 'master' of https://github.com/danmar/cppcheck
Conflicts:
	test/testother.cpp
2011-01-25 10:05:03 +01:00
Sébastien Debrard 4cf56dac2b Fix 2495 incorrect sizeof error message 2011-01-25 09:57:58 +01:00
Daniel Marjamäki a596a7a8fe Fixed #2494 (New check: clarify calculation when using ?: operator) 2011-01-24 21:40:49 +01:00
Sébastien Debrard c7b8bd543f fix ticket 155 - char array 2011-01-24 19:04:56 +01:00
Debrard Sébastien 27dce075e0 Fixed #155 (check size of a variable whose type is a sized array) 2011-01-22 19:21:56 +01:00
Robert Reif d73709a620 Symbol database: rename variables. ticket: #2468 2011-01-21 07:42:41 +01:00
Daniel Marjamäki ecac93ebed Fixed #2462 (false positive: (warning) Redundant code: Found a statement that begins with numeric constant) 2011-01-19 18:37:33 +01:00
Daniel Marjamäki 965c1a94fd Fixed #2475 (False positive in structure initialisation: The scope of the variable bits can be reduced) 2011-01-17 20:51:15 +01:00
Robert Reif 959e10cee5 Symbol database: renamed classes. ticket: #2468 2011-01-17 18:29:19 +01:00
Robert Reif bf9528558e Symbol database: pulled out classes into global scope. ticket: #2468 2011-01-17 07:21:59 +01:00
Zachary Blair 481907ef14 Fixed #2457 (CheckOther::checkIncorrectLogicOperator: hang if variable id is 0) 2011-01-16 13:57:29 -08:00
Daniel Marjamäki 93d1313186 Refactoring: Check if type is class/struct through symbol database 2011-01-16 19:57:29 +01:00
Daniel Marjamäki e6a1efa13b Fixed #2302 (Duplicate id 'unusedVariable') 2011-01-16 18:45:05 +01:00
Robert Reif d341b42b0c Symbol database: increased constness. ticket: #2468 2011-01-16 18:13:54 +01:00
Daniel Marjamäki bb2862bc97 fixed unit test 2011-01-15 21:04:20 +01:00
Daniel Marjamäki 94ebb24d3d Optimising: about 5% improvement with Visual Studio executable 2011-01-15 20:55:51 +01:00
Daniel Marjamäki 36c1807228 Fixed #2458 (false positive: (warning) Redundant code: Found a statement that begins with numeric constant) 2011-01-13 20:12:57 +01:00
Reijo Tomperi 226b605774 Change year 2010 -> 2011 in license texts. 2011-01-09 21:33:36 +02:00
Daniel Marjamäki d758929490 Fixed #2433 (strtol: false positive when strtol isn't used in function call) 2011-01-08 09:23:51 +01:00
Daniel Marjamäki 37b1f7c296 memsetZeroBytes: improved error message. ticket: #2421 2011-01-06 16:27:22 +01:00
Raphael Geissert 6ec4497919 [PATCH] Check for calls to memset() where 0 bytes are to be filled
Inspired by Silvio Cesare's work
2011-01-06 11:31:58 +01:00
Daniel Marjamäki 033e759c39 command line: added 'information' id to enable 2011-01-05 21:20:21 +01:00
Markus Elfring 3fc0317997 Bug #2390: Enclose the output of a variable name with quotes in "CheckOther::variableScopeError"
The variable name output was enclosed by quotation marks in the member
function "CheckOther::variableScopeError" and corresponding test functions.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
2011-01-03 05:15:20 +01:00
Zachary Blair 68700b3561 Fixed #2382 (Catching exceptions by value instead of reference) 2010-12-31 12:48:24 -08:00