PKEuS
e2bab4b6a3
Implemented Function::nestedIn to be able to identify the scope the function belongs to, even if Function::functionScope.functionOf is not available.
...
Refactorized usage of SymbolDatabase in checkOther:
- Don't copy Function instances in checkExpressionRange
- Simplifications by more accurate usage of information in database
2012-05-24 08:40:43 -07:00
PKEuS
97c4af44ca
Refactorizations in checkOther:
...
- More accurate usage of symbolDatabase to reduce code and false negatives
- Avoided unnecessary construction of pattern string
- Only search for class/struct definition before usage
2012-05-24 06:34:59 -07:00
Daniel Marjamäki
77e9106ec0
Fixed #3634 (False positive: compareBoolExpressionWithInt when using boost::tuples)
2012-05-22 19:01:21 +02:00
PKEuS
b81eafe0dc
Splitted CheckIO from CheckOther.
2012-05-20 02:57:07 -07:00
Daniel Marjamäki
f803a18d50
Fixed #3749 (false positive: same expression on both sides of operator)
2012-05-17 07:26:57 +02:00
Ettl Martin
8a7b141246
added testcase for ticket 3689
2012-05-14 09:57:30 +02:00
PKEuS
06a77679d4
Refactorizations:
...
- Added support for pointers in self assignement check
- Removed redundant for loop in checknullpointer.cpp
- Fixed warning about signed/unsigned mismatch in cppcheck.cpp by making Settings::_maxConfig unsigned
2012-05-11 10:38:19 -07:00
PKEuS
ec00824fd3
Fixed #3357 :
...
- Print "inconclusive" tag in cli
- Fixed inconclusive handling in checkbufferoverrun.cpp
- Merged reportInconclusiveError into reportError by adding an additional parameter "bool inconclusive" which is false per default
2012-05-06 10:37:41 -07:00
Ettl Martin
bb8342fbb4
fixed misspelled word 'Comparision' --> 'Comparison'
2012-04-26 23:04:55 +02:00
PKEuS
5ac7552e4e
New check: Comparision of modulo results that are always true/false.
2012-04-26 15:23:47 +02:00
PKEuS
6a37c36ee8
Fixed #3741
...
Removed redundant nullpointer check (cppcheck catch)
2012-04-18 16:35:04 +02:00
PKEuS
8e5949c6ce
Added several C++11 algorithms and containers to CheckStl
...
Added pattern "> %varid%" to CheckStl::stlBoundries()
Fixed message in checkOther (#1320 )
2012-04-17 12:54:01 +02:00
Ettl Martin
7be01da8e9
fixed ticket 3693. Added modulus operator to Mathlib + unittests. Added a test to checkother to ensure the testcase of ticket 3693 does not trigger an error message.
2012-04-12 14:02:09 +02:00
Daniel Marjamäki
66227c4da0
Fixed #3609 (clarifyCondition delivers false positives when using Windows-Traits as a template)
2012-04-08 18:07:11 +02:00
PKEuS
b0f571b25c
Fixed #3383 : If there is an empty line between subsequent break statements, only issue a message for inconclusive checking
2012-04-05 10:38:29 +02:00
PKEuS
c1fc7a2218
Improved CheckOther::checkComparisonOfBoolWithInt and CheckOther::checkComparisonOfBoolExpressionWithInt:
...
- Added support for comparision of bool constant with number constant (-> fixed #1877 ) and integer variable with boolean expression
- Moved a check from checkComparisonOfBoolWithInt to checkComparisonOfBoolExpressionWithInt
- Generalized some patterns
- Made error message more accurate concnerning the "neither 0 nor 1" part.
- Reduced number of Token::Match calls
2012-04-02 15:45:51 +02:00
PKEuS
033e4a2c1f
Fixed #3676 .
2012-04-02 11:21:04 +02:00
PKEuS
4f1f6e1824
Improved simplification of calculations:
...
- Use more generic patterns
- Look on operator precedence more consequently
-> Made a TODO test case from a test case that worked previously, because the calculation is simplified so that the problem isn't detected any more.
Changed comment "Coding style checks" to "Checks", because it didn't fit
2012-03-27 21:29:50 +02:00
PKEuS
989ac449e4
Made invalidPointerCast message inconclusive for casting from floating point type* to char* ( Fixed #3639 )
2012-03-25 12:55:39 +02:00
Daniel Marjamäki
ca6a93816b
Merge pull request #89 from HeisSpiter/master
...
Merged two checks to get a better one regarding sizeof
2012-03-25 02:38:04 -07:00
PKEuS
e4d92055e7
Improved sizeofCalculation check:
...
- Bailout on expanded macros for conclusive checking
- Support for more operators
- Removed indendation counter
Improved checkSignOfUnsignedVariable:
- Made the patterns more generic
- Improved verbose error message (-> Fixed #3080 )
2012-03-25 11:32:00 +02:00
Pierre Schweitzer
2b5ddb7858
Merge the strncmp & malloc sizeof checks into a more generic test that handles several cases where sizeof is misused, or could be misused
2012-03-23 21:47:13 +01:00
Pierre Schweitzer
ec44967e13
Add a new test to check improper sizeof usage. It's for the moment limited to malloc calls.
2012-03-21 21:13:09 +01:00
PKEuS
b6057a1148
Improved CheckOther::checkIncorrectLogicOperator:
...
- Added a lot of additional pattern
- Rewrote error messages to make them more understandable and better fitting to the situation. (Fixed #3664 )
- Cleanup in unit tests
Improved message of static string comparision check
2012-03-15 20:38:28 +01:00
PKEuS
7cfffc9c9d
Improved CheckOther::checkIncorrectLogicOperator:
...
- Implemented automatic swapping of conditions and operands
- Added several patterns
- Added support for conditions outside of if/while
2012-03-12 19:06:30 +01:00
PKEuS
6f164de609
Improved static string comparision check: Implemented #3214
...
Fixed false negative on argument count of fnprintf/snprintf when first variable argument is a string. (#3655 )
Uncommented call of virtualDestructorError in getErrorMessages in checkclass.h
Refactorizations:
- Rearranged code in checkother.h to make ordering more consistent and to increase encapsulation of private data
- Replaced some single-token-patterns
2012-03-11 11:01:39 +01:00
PKEuS
ef6e381d47
Improved bitwise on boolean check to make it working on more code patterns
...
Refactorizations in checkother.cpp:
- Make use of symboldabase instead of: indentation counters, manual detection of variable declarations
- Removed some indexing variables to reduce calls to tokAt and the numbers given to this function
- Use tok->nextArgument() to jump to a specific argument
2012-03-03 21:14:20 +01:00
PKEuS
1747813a8b
Added check for invalid pointer casts ( #1255 )
...
Detect sign extension problems when variable is a reference (#3637 )
Refactorizations:
- Tokenizer::getFiles returns a reference instead of a pointer, because its guaranteed that no nullpointer is returned
- Remove signed/unsigned in one step for "%type% signed|unsigned"
- Fixed recently introduced compiler warning in symboldatabase.cpp
2012-02-26 11:56:32 +01:00
Zachary Blair
0e791929b5
Ticket #3598 - Added a missing ASSERT_EQUALS() statement to the end of checkDoubleFree()
2012-02-18 12:13:21 -08:00
PKEuS
8ea5df62c4
- Improved support for numbers in code:
...
-- Use MathLib::toLongNumber for conversion in tokenizer (Fix #3610 )
-- Handle octal numbers in tokenizer
- Refactorizations in MathLib::toLongNumber and Settings
2012-02-17 15:47:08 +01:00
Zachary Blair
9d75641ef8
Fixed #3598 (false positive: (error) Memory pointed to by 'a' is freed twice.)
2012-02-16 21:03:38 -08:00
Zachary Blair
69567515ce
Ticket #3581 - added missing newlines to the test code
2012-02-04 11:39:29 -08:00
Zachary Blair
8f827aa65f
FIxed #3581 (double free false positive when exception rethrown)
2012-02-04 11:24:40 -08:00
PKEuS
d5c2c7db88
- Moved checkCatchExceptionByValue from CheckOther to CheckExceptionSafety
...
- Fixed false positive: throw outerCatchVar; in inner catch is now correctly handled
- Added eTry and eCatch to Scope::isLocal -> Scopes inside catch are now detected by symbol database
2012-02-02 16:17:42 +01:00
Zachary Blair
589a2461bd
Fixed ticket #3550 (false positive: (error) Memory pointed to by 'pxpm' is freed twice)
2012-01-24 22:43:44 -08:00
Zachary Blair
0415444e28
Merge branch 'master' of github.com:danmar/cppcheck
2012-01-19 23:02:33 -08:00
Zachary Blair
b89adff9fd
Fixed Ticket #3300 (false negative: doublefree of pointer)
2012-01-19 22:59:54 -08:00
Daniel Marjamäki
525e7fba20
Fixed #3490 (False positive: sscanf with %c)
2012-01-18 23:57:08 +01:00
PKEuS
461565c50a
Fixed #3517 and #3513
2012-01-15 12:32:02 +01:00
Reijo Tomperi
dd18f595b1
Fix #3516 (inaccurate warning: "An unsigned variable will always be positive" (unsigned n; if (n >=0);))
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3516
2012-01-14 12:50:09 +02:00
Daniel Marjamäki
65ce55e675
Fixed #3472 (false positive: (error) Passing value 0 to log() leads to undefined result)
2012-01-08 12:07:25 +01:00
Daniel Marjamäki
94d220e370
Refactoring: Made Preprocessor::getcode nonstatic
2012-01-06 08:01:50 +01:00
PKEuS
eabdc9082e
Fixed false positives related to %*[] in scanf format string ( #3468 )
2012-01-04 11:22:42 +01:00
PKEuS
621d43e9e4
Fixed #3461 : Support for %m* on scanf-functions
2012-01-02 14:05:58 +01:00
Reijo Tomperi
8cae17fda8
Update year to 2012
2012-01-01 01:05:37 +02:00
Erik Lax
3d0c1a3301
Fix #3457 (Statement following goto can be executed)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3457
2012-01-01 00:11:03 +02:00
Marek Zmysłowski
dd8316474a
Fixed #3335 (new check: warn about potential missuse of isgraph-like functions)
2011-12-29 08:08:37 +01:00
Reijo Tomperi
0a588496a0
Fix astyle and test failures.
2011-12-28 22:05:10 +02:00
Daniel Marjamäki
8e94e2261b
Comparing bool with int: Fixed false positives
2011-12-23 19:11:51 +01:00
PKEuS
8213a15b2a
improving checkSizeofForStrncmpSize
2011-12-23 18:11:34 +01:00
Daniel Marjamäki
e9d697b636
Fixed #3419 (false positive: (style) Same expression on both sides of '&'.)
2011-12-23 16:08:53 +01:00
PKEuS
409364747c
Fixed #3441 (segmentation fault of cppcheck (%: return ; ()))
2011-12-23 12:46:59 +01:00
Daniel Marjamäki
df8504f0ea
Clarify calculation: Fixed false positives when there are various function calls
2011-12-23 12:13:39 +01:00
Daniel Marjamäki
f8181df340
Fixed #3410 (Comparing bool against bool produces false positive)
2011-12-20 06:38:05 +01:00
PKEuS
0205582161
Fixed #3327 (printf with std::string as parameter)
2011-12-18 19:41:21 +01:00
PKEuS
a311904a0f
Patch that fixes some bailouts for isEnabled('style') in both directions. Improved checkSizeofForNumericParameter's error message, made it 'warning', made it non-experimental.
2011-12-16 19:21:14 +01:00
PKEuS
c9f5117cf5
Fixed #3407 (False positive: (inconclusive) Found duplicate branches for if and else. (inline assembler))
2011-12-13 21:42:38 +01:00
PKEuS
9b685ba3c3
Code cleanup
2011-12-09 21:00:57 +01:00
PKEuS
97eecb78a7
Fixed #3381 (false positive: (style) Statements following return, break, continue, goto or throw will never be executed)
2011-12-07 18:20:52 +01:00
PKEuS
1f438b0505
Fixed #3375 (Improve check: Detect unreachable code)
2011-12-03 11:43:23 +01:00
Daniel Marjamäki
9a84c5845a
Fixed #3373 (False posititive: incorrect %* handling in sscanf)
2011-12-02 17:09:32 +01:00
Richard Quirk
b2ea78543b
Fix false positive with non-const function calls
2011-12-01 19:57:04 +01:00
Daniel Marjamäki
98480bf504
Fixed #3354 (Incorrect both sides of '||' expression match when using increment in expression.)
2011-12-01 17:46:33 +01:00
Daniel Marjamäki
31b576de3b
Fixed #3334 (Test for same expression on both sides of '&' reports false positive)
2011-12-01 17:07:55 +01:00
PKEuS
ee3e10ea97
Fixed #3364 (Crash in printf parsing)
2011-11-30 20:23:29 +01:00
Daniel Marjamäki
b61c01c6a4
Fixed #3356 (false positive: (warning) Comparison of a boolean with integer that is neither 1 nor 0)
2011-11-29 18:14:57 +01:00
Daniel Marjamäki
b538f49a6e
Merge pull request #61 from richq/sameexpr
...
Fix for #3317 - same expression on both side of '&&' false positives
2011-11-29 08:50:02 -08:00
Daniel Marjamäki
522da8d258
sizeof for numeric constant : disabled check. see ticket #3179
2011-11-27 18:50:21 +01:00
PKEuS
71c8669261
Fixed #3311 , #3313 and #3339 (printf format string false positives)
2011-11-27 07:29:09 +01:00
Richard Quirk
d28cf42d4c
Fix ticket #3317 (same expression false positives)
...
Add a check for function calls that have no side effects. That means
known const methods and a list including strcmp, strlen, etc.
If the function is not known to be side effect-free then no style
warning is given.
Add test cases for the duplicate expressions.
2011-11-23 21:39:03 +01:00
Richard Quirk
511ac0ab1f
Remove false positives for nested logic
2011-11-23 21:39:03 +01:00
Daniel Marjamäki
5b5ea29f23
Mismatching format string parameters. Made check experimental. See tickets #3311 , #3313 and #3339
2011-11-21 07:31:06 +01:00
Richard Quirk
91713ffe84
Fix false positives for %[ in scanf
2011-11-20 16:48:54 +01:00
Marek Zmysłowski
994f08fdf0
Fixed #886 (new check: wrong value passed to isgraph function)
2011-11-17 16:31:16 +01:00
Daniel Marjamäki
b7cc9779c4
Merge pull request #59 from richq/sameexpr
...
Improved same expression check for ticket #3274
2011-11-08 23:56:36 -08:00
Reijo Tomperi
7a294c1f79
Fix #3307 (Invalid format string/parameter mismatch warning)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/3307
2011-11-09 00:16:37 +02:00
Richard Quirk
d1bc8819f9
Fix for same expression separated by commas
...
The code branch tested by the previous check for && is now different, so
I've changed the test to use == instead. There was also a missing case
when the expression was followed by a comma instead of being preceded by
one.
2011-11-08 21:56:54 +01:00
Richard Quirk
d5664dd6cf
Improved %or% and & checks
2011-11-08 21:56:54 +01:00
Richard Quirk
4cb97edbaf
Improved same expression check for ticket #3274
...
Expand the logic for the check for the same expression on both sides of
the || and && operators. Now expressions can be more complex, with the
"alt" variable helping to fudge operator precedence to avoid false
positives.
2011-11-08 21:54:42 +01:00
Daniel Marjamäki
fa076598ad
Fixed #3233 (false positive: (style) Checking if unsigned variable 'i' is less than zero.)
2011-11-06 18:24:37 +01:00
Edoardo Prezioso
6e2f2816de
Improve same expression check: remove '%op%' pattern and add ',' for the same expressions as an argument inside a function.
...
Improve compound assignment simplification: use already defined 'isAssignmentOp' and extend the adding parenthesis to a generic operator, not only to the arithmetical ones. See: http://en.cppreference.com/w/cpp/language/operator_precedence
2011-11-06 14:35:53 +01:00
Daniel Marjamäki
e11c1f7975
Fixed #3265 (false positive: comparison of bool with nonzero integer)
2011-11-06 08:21:34 +01:00
Edoardo Prezioso
99463d3368
Improve same expression check: take count of operations and assignments before the same expression and add missing 'return' pattern to the struct member variable part of the check.
2011-11-05 22:25:01 +01:00
Richard Quirk
a3f2c1e651
Improve for same expression on both sides of operator
2011-11-05 15:46:11 +01:00
PKEuS
0c469bae41
Fixed #3089 (New Check: Detect wrong usage of printf/scanf)
2011-11-05 07:29:53 +01:00
Edoardo Prezioso
68cb7a2731
Fix all the test failures caused by my previous commit.
2011-10-30 11:27:27 +01:00
Edoardo Prezioso
44a234f9b0
Fixed lots of test failures caused by my previous commit.
...
There are still some which I don't know how to fix.
2011-10-30 11:21:46 +01:00
Daniel Marjamäki
b67cb077a3
fix unit test failure
2011-10-29 12:21:22 +02:00
Richard Quirk
665cdfabdc
Warn when sizeof is used in strncmp ticket #2095
...
This checks for the case where the user thought sizeof(buf) gave the
size in bytes of 'buf' in code like the following:
const char *buf = "Hello World";
strncmp(buf, other, sizeof(buf));
2011-10-28 22:14:55 +02:00
Richard Quirk
90c7db15a0
Add check for comparison of identical string variables
2011-10-28 22:12:51 +02:00
Richard Quirk
4ba6ac7332
Add strncmp to the list of static string comparison functions
2011-10-28 22:12:51 +02:00
Thomas Jarosch
9a1b195d79
Fixed #3187 (Remove code duplication in 'other' unit test)
2011-10-23 12:20:43 +02:00
Reijo Tomperi
3568b5a841
Improved memset with 0 bytes check. TODO done (unit test).
...
Patch from: PKEuS <philipp.kloke@web.de>
2011-10-22 23:34:10 +03:00
Edoardo Prezioso
91c6608175
Improve fix of #934 (be careful of macros code).
2011-10-22 20:43:42 +02:00
PKEuS
20179673ce
Fixed #934 (new check: missuse of std::cout)
2011-10-22 17:12:52 +02:00
Edoardo Prezioso
9e5beab4a8
Nitpicky fix of the missing ';' after the memset command inside the test case.
2011-10-20 21:46:34 +02:00
PKEuS
ea02bd905a
Fixed #3225 (Boolean comparison with string literals)
2011-10-18 21:37:03 +02:00
Daniel Marjamäki
6f8e42a5af
changed the astyle formatting flags
2011-10-13 20:53:06 +02:00
Zachary Blair
82366918ff
Fixed #2627 (switch case fall through: redundant strcpy)
2011-10-13 01:27:22 -07:00
Thomas Jarosch
849bee8437
[PATCH] Detect suspicious use of semicolon after 'if/for/while'
...
statements if they are followed by a {..} block.
Examples are:
for (int i = 0; i < 10; ++i);
{
printf("i)";
}
or
if (i == 100);
{
die("Wrong argument");
}
This new check is active if you enable inconclusive checks.
2011-10-11 08:41:39 +02:00
Zachary Blair
fcf360825a
Fixed #2955 (New check: Using && instead of &)
2011-10-10 10:11:17 -07:00
PKEuS
5f9b916dcc
Fixed #2115 (new check: endless loop (unsigned comparison that is always true))
2011-10-09 20:35:46 +02:00
Thomas Jarosch
7d13d25638
Fixed #3181 (Add missing return statements)
2011-10-08 12:45:56 +02:00
Daniel Marjamäki
73fb6725e6
Readded CheckOther::bitwiseOnBoolean as inconclusive check
2011-10-06 22:01:48 +02:00
Daniel Marjamäki
09109f19f8
Removed CheckOther::bitwiseOnBoolean check. The reasons can be seen in my comments in ticket #3062 .
2011-10-05 20:46:07 +02:00
PKEuS
494d3af3d1
Fixed #1877 (Be more strict about int vs. bool, part II)
2011-10-05 20:30:36 +02:00
Kimmo Varis
3cfe7ca1a7
Move "information" errors to "style" errors.
...
"information" severity is documented in lib/errorlogger.h as:
Checking information.
Information message about the checking (process) itself. These
messages inform about header files not found etc issues that are
not errors in the code but something user needs to know.
It IS NOT for errors in the code. All the current "information"-
severity errors fit nicely into description of the "style"-
severity.
We definitely need to separate processing information and actual
errors in the code. It is highly confusing for users to mix these
two different things. Hence all current "information" code error
messages are moved to "style" category.
Ticket: #3165 (Stop misusing the 'information' error severity!)
2011-10-05 20:44:00 +03:00
Robert Reif
2d717d77cd
reduce false negatives for checking for CheckOther::checkSignOfUnsignedVariable()
2011-09-26 21:24:34 -04:00
Robert Reif
302daeb9bd
add test for #3110 (false positve: style) Boolean result is used in bitwise operation. Clarify expression with parentheses)
2011-09-12 20:46:00 -04:00
Daniel Marjamäki
55230baf78
Fixed #3086 (false positive: Boolean result is used in bitwise operation.)
2011-09-11 09:46:01 +02:00
Philipp Kloke
2f62d180fe
Fixed #1740 (Undefined Behavior: Divide by zero)
2011-09-10 16:12:53 +02:00
seb777
074ad10a30
fix #195 Unusual shift operation - check this kind of code
...
return x >> ! y ? 8 : 2;
2011-09-06 22:37:19 +02:00
seb777
5c7ed46e0c
Following the discussion XX, replace the keyword C99 '_Bool' with the 'bool' keyword in the process of tokenization\nSee f29b7f9f08
2011-09-03 23:15:33 +02:00
Daniel Marjamäki
d23c58d387
enable: break out 'performance' and 'portability' from the 'style' id. Ticket: #3074
2011-09-03 15:30:30 +02:00
Robert Reif
f29b7f9f08
fix #3062 (false negative: Boolean variable is used in bitwise operation)
2011-09-02 17:19:06 -04:00
Robert Reif
6f3131da8c
fix a serious symbol database bug where parts of a function could be skipped
2011-08-23 20:12:29 -04:00
Robert Reif
9fbef3ca7b
fix #3011 (new check: when first comparison is true, the 2nd comparison is always true)
2011-08-19 13:28:37 -04:00
Daniel Marjamäki
a735790e77
using boolean result in bitwise operation. fix false positive for '.. != (char *) &x'
2011-08-19 18:55:20 +02:00
Daniel Marjamäki
2dd1e290eb
fixed false positives for the 'bitwise operator / comparison operator' check
2011-08-19 18:06:28 +02:00
Daniel Marjamäki
314d5f1e79
fixed false positive for 'using bitwise operation on boolean result'
2011-08-19 17:07:26 +02:00
Daniel Marjamäki
c107fdd2d4
Fixed #3018 (false positive: (style) Suspicious condition (assignment+comparison), it can be clarified with parentheses)
2011-08-19 13:54:06 +02:00
Daniel Marjamäki
40b493e621
Improve check: Clarify condition (using boolean result in bitwise operation)
2011-08-19 13:40:54 +02:00
Daniel Marjamäki
4606251ce8
Fixed #3001 (False Positive: Redundant assignment to itself)
2011-08-19 07:23:11 +02:00
Daniel Marjamäki
e5ff920ea9
Suspicious condition: Better handling when rhs is non-numeric
2011-08-19 00:56:15 +02:00
Daniel Marjamäki
a7728fef48
New check: warn about such suspicious conditions: '(a & b == c)'
2011-08-19 00:15:20 +02:00
Kimmo Varis
cfcfa3f000
Use "enabled" list for the style checking.
...
Settings-class currently enables style checking via dedicated
boolean attribute. All other CLI's enable-options are handled
through the enable-list. This commit moves style-check enabling
to use the enable-list.
Main advantage is the consistency how options are handled/stored
in the Settings class. Which also unifies using them for the other
code. You need to enable certain type of checks? Use the
addEnabled()-method. You want to check if certain type of checks
are enabled? Use the isEnabled()-method.
2011-08-07 10:28:52 +03:00
Robert Reif
85b2bd21dc
fix #2968 (new check: testing if unsigned variable is less than 0)
2011-08-06 19:23:09 -04:00
Daniel Marjamäki
dc629b4c39
Fixed 'possible null pointer dereference' warning messages
2011-07-28 08:12:21 +02:00
Daniel Marjamäki
d2c0e5e7e6
Fixed #2821 (New Check : bool pointer null truth assignment)
2011-07-28 07:28:24 +02: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
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
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
Kimmo Varis
c7d99fe9a7
Remove ErrorLogger::reportStatus() method.
...
The ErrorLogger::reportStatus() is not lib code interface. The CLI
code does the looping through file list and gives one file at a
time for the core code. Hence lib has no any idea about the
progress and it can't provide such information.
Also the recent commit (6d858b6
) caused a GUI build failure by
adding CLI code dependency to GUI. Which is big no-no.
This is admittedly a hack. But it allow us to build all modules
again.
2011-04-27 23:27:02 +03:00
Greg Hewgill
6d858b63a1
Report percentage complete based on file size
...
This patch makes the (reasonable) assumption that the total size of all checked
files fits in a 'long' type.
2011-04-26 22:26:23 +12: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
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
Daniel Marjamäki
739b6a93e2
Fixed #2713 (False positive (Redundant assignment))
2011-04-16 12:07:56 +02: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
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
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
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
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
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
c8394909c0
Relax detection of 'fall through' comment so it only adds a suppression if it immediately precedes 'case' or 'default'
2011-03-06 12:14:10 +13:00
Greg Hewgill
8c245cfd2f
switchCaseFallThrough is now a coding style check (ticket #2623 )
2011-03-06 09:43:27 +13:00
Greg Hewgill
e12ae654a8
Support a few more common styles of "fall through" comment
2011-03-05 18:02:38 +13:00
Greg Hewgill
c5f8a06a97
add TODO for case where simplifyGoto() does the wrong thing
2011-03-05 00:45:59 +13:00
Greg Hewgill
cc7e05a5b0
fix case where fall through comment precedes preprocessor line
2011-03-05 00:45:58 +13:00
Greg Hewgill
8e839a46e8
add TODO for pathological case
2011-03-05 00:45:58 +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
610d2efaea
recognise fall through in c style comments
2011-03-05 00:45:58 +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
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
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
Raphael Geissert
d592250284
Fix sizeof sizeof check to handle sizeof(sizeof type)
2011-02-02 11:49:32 -06:00
Pete Johns
2d1ccad44e
Turned failing ASSERT_EQUALS into TODO_ASSERT_EQUALS.
2011-02-01 19:55:39 +11:00
Greg Hewgill
dcc0f28f34
check that misused scope object does not pick nested class
2011-02-01 08:07:41 +13:00
Pete Johns
098f0bf3e6
Fixed #2526 (Make TODO_ASSERT_EQUALS take three arguments (value, to_be, as_is)?...
...
Removed replaced EXPECTED with...
WANTED (to-be): The future expected value.
CURRENT (as-is): Documenting how cppcheck behaves now.
This removes the need for an ASSERT_EQUALS but enforces the check for every TODO_ASSERT_EQUALS.
2011-01-30 23:20:11 +11: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
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
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
Reijo Tomperi
226b605774
Change year 2010 -> 2011 in license texts.
2011-01-09 21:33:36 +02:00
Daniel Marjamäki
37b1f7c296
memsetZeroBytes: improved error message. ticket: #2421
2011-01-06 16:27:22 +01:00
Daniel Marjamäki
ed71c57f1f
astyle formatting
2011-01-06 12:07:18 +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
d11b5163b7
Fixed #2382 (Catching exceptions by value instead of reference)
2010-12-31 03:01:38 -08:00
Kimmo Varis
e8b81f909d
Change 'Scope of variable'-message to information message.
2010-12-27 16:48:03 +02:00
Kimmo Varis
ad89a84796
Improve error message about overlapping buffers for s[n]printf().
...
See forum thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192&start=0
2010-12-26 23:44:01 +02:00
Daniel Marjamäki
81c5576eb4
Misused scope objects: Don't use this check if the checked file is a pure C file. Ticket: #2352
2010-12-25 08:43:52 +01:00
Robert Reif
f12c0c7ada
Tokenizer: add assert(_settings) to Tokenizer to insure the tokenizer always has settings. Ticket: #2219
2010-12-01 18:00:55 +01:00
Kimmo Varis
8d8945ac57
Improve "Assert statement 'varname' -message.
...
Modifying the message so that we have short message and verbose
message. As discussed in dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-11-29 20:12:21 +02:00
Kimmo Varis
85735e382f
Improve the 'suspicious code sizeof sizeof' -message.
...
As discussed at dev-forum:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-11-28 14:20:46 +02:00
Kimmo Varis
837605b05b
Ticket #2239 (Too long "short" message about function parameter passing)
...
Have a proper short message for the parameter passing warning and
improve the message.
2010-11-27 10:46:34 +02:00
Zachary Blair
215cb5ac8d
Fixed #2162 (false positive: Mutual exclusion over ||)
2010-11-21 00:06:43 -08:00
Daniel Marjamäki
fd64a7e683
Mutual exclusion: Disable this check until #2162 is fixed.
2010-11-20 07:43:07 +01:00
Ettl Martin
88cc29ea0a
mathlib: added todo testcases for ticket #2200
2010-11-15 21:03:49 +01:00
Zachary Blair
10a4dde105
Fixed #2137 (Invalid mutual exclusion report)
2010-11-04 00:10:25 -07:00
Daniel Marjamäki
14803643ca
empty string test: Removed this check
2010-11-03 17:56:14 +01:00
Daniel Marjamäki
bc283d8b99
Uninitialized variables: Broke out the checking into separate file
2010-10-31 12:31:11 +01:00
Daniel Marjamäki
df8a93bf97
Null pointers: Broke out the checking into separate file
2010-10-31 11:51:25 +01:00
Daniel Marjamäki
995e39200b
Fixed #2130 (Invalid possible NULL pointer dereference, etc.)
2010-10-27 20:20:10 +02:00
Daniel Marjamäki
fc98bcdcb2
Fixed #2141 (false positive: possible null pointer dereference)
2010-10-27 19:42:47 +02:00
Daniel Marjamäki
fd153eac02
Fixed #2142 (false positive: null pointer dereference (throw))
2010-10-27 19:38:42 +02:00
Daniel Marjamäki
9370f552ac
Fixed #2134 (sizeof(*list) complains of null pointer dereference)
2010-10-26 18:26:02 +02:00
Daniel Marjamäki
893f7fa347
Fixed #2130 (Invalid possible NULL pointer dereference, etc.)
2010-10-26 17:40:30 +02:00
Daniel Marjamäki
bdd6d6d53d
null pointer: use simplified token list in the 'check and deref' checking
2010-10-25 21:05:43 +02:00
Daniel Marjamäki
132aa8d0c4
uninitialized variables: fixed fp when analysing loops
2010-10-25 20:56:15 +02:00
Daniel Marjamäki
026514db1a
Fixed #2127 (null pointer dereference after condition (SRD nr 522))
2010-10-25 19:43:54 +02:00
Zachary Blair
26afb04dc5
Fixed #2105 (Incorrect operator: mutual exclusion over ||)
2010-10-24 18:14:21 -07:00
Daniel Marjamäki
24a2def3ad
Execution Path: Fixed FP in improved handling of loop bodies
2010-10-24 19:14:40 +02:00
Daniel Marjamäki
8f707e5e46
Null pointers: Better handling of loops
2010-10-24 18:51:14 +02:00
Daniel Marjamäki
6601de7681
uninitialized variables: refactoring handling of loop bodies
2010-10-24 18:26:59 +02:00
Daniel Marjamäki
b66d3c8858
Fixed #2125 (uninitialized variable: better handling of for loops)
2010-10-24 18:12:48 +02:00
Daniel Marjamäki
92a1e9e76e
Severities: Added 'warning' and 'performance' severities. No changes to the command line options nor to the XML format. Ticket: #2106
2010-10-17 14:41:00 +02:00
Debrard Sebastien
fb928b6778
Fixed #2018 (Postfix Operators)
2010-10-14 19:17:40 +02:00
Pete Johns
fbd3d92aa9
Fixed #2084 (False positive: object destroyed immediately (struct and function with same name))
...
Tightened up class definition matching so as not to match C-style struct tags.
2010-10-13 20:37:53 +11:00
Debrard Sebastien
1a4e3dcc44
increment check
2010-10-12 19:54:39 +02:00
Daniel Marjamäki
3dfcbfc0e0
assignment in assert: modified the error message to better explain the reason why the warning is given.
2010-10-11 17:59:08 +02:00
Zachary Blair
d9967d4fd2
Fixed #2079 (detect side effects in assert)
2010-10-10 13:05:06 -07:00
Daniel Marjamäki
3340010376
fix unit testing
2010-10-10 14:23:05 +02:00
Daniel Marjamäki
a3367874d9
Fixed #1778 (false negative: nullpointer dereference (std::string pointer))
2010-10-09 07:57:34 +02:00
Daniel Marjamäki
7b4e08385d
STL: refactoring CheckStl::erase so ExecutionPath is used
2010-10-05 20:54:13 +02:00
Pete Johns
4bf9ff26ea
Fixed 2071 (false positive: object destroyed immediately (when using '= { ... }'))
...
Simplified check within CheckOther::checkMisusedScopedObject() as a result.
2010-10-04 08:16:11 +11:00
Daniel Marjamäki
cd8ef1cded
Revert "temporarily disable the 'object destroyed immediately' message"
...
This reverts commit fa94312c9a
.
2010-10-03 18:05:08 +02:00
Daniel Marjamäki
fa94312c9a
temporarily disable the 'object destroyed immediately' message
2010-10-03 16:59:13 +02:00
Pete Johns
78795dc3ac
Fix false positive: Misused Scope Object does not pick constructors of local class declarations.
...
It does pick up if there is an unused construction within the function, though.
2010-10-02 22:59:04 +10:00
Pete Johns
365b1bed1a
Fixed false positive: checkMisusedScopedObject no longer errors on calls to function objects.
2010-10-02 21:25:16 +10:00
Pete Johns
b72b699b76
Fixed false-positive: Object is referenced on construction
...
struct Foo {
void bar() {
}
};
void fn() {
Foo().bar(); // This caused a false-positive
}
2010-10-02 20:26:29 +10:00
Pete Johns
3f72d3a877
Check misused scope object does not pick local class method.
...
Also fixed mistyped withinFuntion ->withinFunction.
2010-10-02 20:12:52 +10:00
Pete Johns
0017655f55
Added test for functor false-positive [passing]
...
Also removed typedef's following danmar's review and renamed isClassresults -> isClassResults to make more clear.
2010-10-02 18:45:24 +10:00
Pete Johns
6e0ef3eda2
Fixed #1132 (Detection of misused scope objects in functions)
...
Emits error in the form:
[useless_lock.cpp:18]: (error) instance of "Lock" object destroyed immediately
...if an instance of a class or struct is unnamed and therefore destroyed
straight after creation.
Only checks for misused scope objects within functions.
Optimised isIdentifierObjectType() by memoizing.
2010-10-02 14:22:26 +10:00
Pete Johns
50c2fa9ab0
Revert "Fixed #1132 (Detection of misused scope objects)"
...
This reverts commit c6acdccfa0
.
2010-10-01 20:52:16 +10:00
Pete Johns
c6acdccfa0
Fixed #1132 (Detection of misused scope objects)
...
Emits error in the form:
[useless_lock.cpp:18]: (error) instance of "Lock" object destroyed immediately
...if an instance of a class or struct is unnamed and therefore destroyed
straight after creation.
Removed "internal error" from token.cpp, since in this case varid would be NULL.
2010-10-01 20:30:21 +10:00
Daniel Marjamäki
415cbc63c3
Fixed #2066 (false positive: uninitialized variable when initializing through function pointer)
2010-09-27 19:26:09 +02:00
Daniel Marjamäki
de3c761790
Fixed #2052 (False positive: possible null pointer dereference 'else continue')
2010-09-18 14:56:07 +02:00
Daniel Marjamäki
fce70508f7
Fixed #2045 (False negative: Uninitialized variable (found with gcc))
2010-09-17 20:38:37 +02:00
Daniel Marjamäki
1c3862bd35
Execution Paths: fixed TODO test cases
2010-09-17 19:31:45 +02:00
Daniel Marjamäki
f843678a07
Redundant conditions: some refactorings
...
* removed the 'redundant null pointer' check. sometimes it's unsafe to delete NULL pointer. and this check doesn't point out errors anyway.
* moved the 'redundant condition' check for set::remove. Moved it to CheckStl.
2010-09-16 18:49:23 +02:00
Daniel Marjamäki
7e67bb53b8
Fixed #2049 (False negative: 'Uninitialized variable' error won't show)
2010-09-15 20:04:50 +02:00
Daniel Marjamäki
0418731473
Fixed #2030 (False positive: Uninitialized variable when function does not return)
2010-09-10 19:02:40 +02:00
Daniel Marjamäki
5688412f00
Fixed #2030 (False positive: Uninitialized variable when function does not return)
2010-09-07 20:25:29 +02:00
Daniel Marjamäki
cfbc06c8b6
removed 'empty catch block' check. to avoid false positives we'll need to check if it is bad with an empty catch block (dead pointer/undefined behaviour/etc)
2010-09-05 13:27:58 +02:00
Daniel Marjamäki
a2b4e5641f
Fixed #2010 (missing continue in switch check ?)
2010-09-04 14:24:45 +02:00
Daniel Marjamäki
fb4fce466e
Fixed #2014 (False positive with longjmp)
2010-09-03 07:18:01 +02:00
Daniel Marjamäki
190a0040b7
Null pointer: Fixed false positive
2010-09-02 21:08:58 +02:00
Daniel Marjamäki
df87ce9e04
Fixed #1945 (False positives when a for loop header is in a macro)
2010-08-26 21:57:48 +02:00
Daniel Marjamäki
72916caee6
Reverted 7398453cb0
2010-08-15 21:25:14 +02:00
Sbastien Debrard
7398453cb0
Refactoring of obsolete functions checks. Ticket: #1940
2010-08-15 21:22:33 +02:00
Zachary Blair
c8087d3389
Fixed #162 (Initialisation of a variable by itself)
2010-08-14 21:34:04 -07:00
Daniel Marjamäki
5846630fa9
Added scanf check. Modified patch submitted by Eric Sesterhenn
2010-08-14 15:15:12 +02:00
Daniel Marjamäki
029613d4c4
Fixed #1923 (False positive: Possible null pointer derefence in else if)
2010-08-07 19:59:56 +02:00
Daniel Marjamäki
e7e86ef333
calculation in sizeof: added two more ASSERT_EQUALS to guard against false positives
2010-08-07 10:12:39 +02:00
Daniel Marjamäki
c395e51389
New check: look for calculation inside sizeof
2010-08-06 22:57:10 +02:00
Daniel Marjamäki
65f7bcbfa5
null pointers: fixed TODO assertion - dereference pointer in function call and then checking that it is not NULL
2010-08-05 08:19:36 +02:00
Daniel Marjamäki
6f228033d2
null pointers: fixed todo test case
2010-08-05 08:06:19 +02:00
Daniel Marjamäki
239d264432
uninitialized variables: fixed false negatives when uninitialized pointer data is read
2010-08-04 21:13:40 +02:00
Daniel Marjamäki
9c17114668
Fixed #1893 (false positive: dereferencing null pointer (try/catch))
2010-07-24 14:27:18 +02:00
Daniel Marjamäki
bbf2c6c6e6
Fixed #1880 (false positive: Uninitialized array (initialized in subfunction))
2010-07-19 10:03:54 +02:00
Martin Ettl
6cc3f76668
#1880 : added todo testcase (false positive: (error) Uninitialized variable: y)
2010-07-18 18:55:53 +02:00
Daniel Marjamäki
1fb4758583
Fixed #1855 (false positive: uninitialized variable (function call in switch condition))
2010-07-18 13:19:37 +02:00
Daniel Marjamäki
11a72461f3
Fixed #1835 (false positive: uninitialized variable when using ?)
2010-07-08 11:16:49 +02:00
Daniel Marjamäki
a1793edabe
Fixed #1825 (*log(0) error)
2010-07-07 09:03:40 +02:00
Daniel Marjamäki
1b20f8d27d
Fixed #1824 (false positive: unitialised variable)
2010-07-06 13:18:28 +02:00
Daniel Marjamäki
c811acaa50
Fixed #1818 (False positive: Dangerous usage of strncpy (copying a constant string))
2010-07-05 12:45:39 +02:00
Zachary Blair
5ea28ccbba
Fixed #157 (Forgetting to put a break in a switch statement)
2010-06-30 00:10:30 -07:00
Daniel Marjamäki
c6888845a0
Fixed #1815 (False positive: uninitialized variable when using ? operator)
2010-06-30 08:28:34 +02:00
Daniel Marjamäki
ad0908cb3f
Fixed #1808 (false positive: uninitialized variable with multiple assignment)
2010-06-25 19:39:30 +02:00
Nicolás Alvarez
df3d98a7c2
Fix typos in sizeofsizeof error message.
2010-06-19 17:16:14 -03:00
Daniel Marjamäki
82b63dd736
Fixed #1633 (tokenizer: simplifyKnownVariable: improved handling of arithmetic)
2010-06-19 14:00:45 +02:00
Zachary Blair
efefceabae
Fixed #920 (new style check: find empty catch blocks)
2010-06-14 23:45:46 -07:00
Daniel Marjamäki
cb7e9fbec1
Fixed #1776 (False Negative: Unitialized array)
2010-06-14 08:36:34 +02:00
Martin Ettl
c9cd5ea250
added a todo testcase for ticket 1778
2010-06-09 01:21:52 +02:00
Daniel Marjamäki
472bd9dabe
Fixed #1726 (False negative: null pointer dereference in switch block)
2010-06-06 12:15:31 +02:00
Daniel Marjamäki
07e00d57d9
Fixed #1725 (segfault in ExecutionPath::bailOutVar (probably caused by #1721 fix))
2010-06-05 09:45:35 +02:00
Daniel Marjamäki
b11e23eb08
Fixed #1721 (False negative: uninitialized variable in switch block)
2010-06-03 20:02:58 +02:00
Daniel Marjamäki
37ae4692bb
Uninitialized variables: fixed false negative when using uninitialized variable inside malloc call
2010-05-30 10:30:51 +02:00
Daniel Marjamäki
1ec49430e3
Uninitialized variables: better handling when uninitialized variables are used in function calls
2010-05-30 09:31:10 +02:00
Daniel Marjamäki
ab41879246
ExecutionPath: Better handling of 'FOREACH (..) {}'
2010-05-30 09:00:18 +02:00
Daniel Marjamäki
f41334e58a
ExecutionPath: better handling of 'FOREACH(..){..}'
2010-05-30 08:26:44 +02:00
Daniel Marjamäki
406cbda563
Uninitialized variables: better handling of struct variables
2010-05-30 07:55:11 +02:00
Daniel Marjamäki
d3c20cac81
Fixed #1712 (False negative: dereferencing uninitialized pointer)
2010-05-27 19:00:52 +02:00
Daniel Marjamäki
88e9a4ade6
Fixed #1704 (false negative: null pointer dereference)
2010-05-26 19:16:42 +02:00
Daniel Marjamäki
75c9355e9a
Added some multipass checking for the uninitialized variables. It is still experimental. You can activate it with the '--test-2-pass' switch. Some more refactorings are needed to make it truly usable, the main thing is to make it thread safe.
2010-05-21 19:35:18 +02:00
Daniel Marjamäki
6edb2e77b4
Refactoring: Removed Severity::possibleStyle
2010-05-16 14:43:42 +02:00
Daniel Marjamki
972046c4bd
Added test CheckOther::sizeofsizeof. Inspired by #1682
2010-05-15 14:06:45 +02:00
Daniel Marjamäki
7c52c8683d
Fixed #1662 (false positive: Data is allocated but not initialized, when using sprintf)
2010-05-09 07:48:52 +02:00
Daniel Marjamäki
2901434773
Fixed #1658 (false negative: uninitialized pointer usage)
2010-05-08 19:23:46 +02:00
Daniel Marjamäki
bd22a18dc1
Refactoring: Changed 'possible style' to 'style'
2010-05-08 09:49:01 +02:00
Zachary Blair
21b7eb61f5
Fixed #959 : (new check: wrong usage of fflush()) Simplified and set severity to error
2010-05-06 23:08:10 -07:00
Zachary Blair
707d27f3d8
Fixed #959 (new check: wrong usage of fflush())
2010-05-03 23:14:45 -07:00
Daniel Marjamäki
cccccff96f
Fixed #1629 (False negative: null pointer derefence not detected 'c[0] = 0')
2010-04-28 22:07:39 +02:00
Daniel Marjamäki
2666aad207
Fixed #1632 (false positive: unintialized variable)
2010-04-28 21:33:11 +02:00
Daniel Marjamäki
eb82a89758
ExecutionPath: Better handling of if
2010-04-25 11:55:57 +02:00
Daniel Marjamäki
a15e25f9fe
Fixed #1571 ('C-style pointer casting' should not be reported for C files)
2010-04-24 16:46:09 +02:00
Daniel Marjamäki
f3bea249ac
Removed the check for unreachable code. The g++ warning -Wunreachable-code is recommended instead. This closes #1603 (break after a return or goto should not be an error in a switch statement).
2010-04-24 14:30:45 +02:00
Zachary Blair
680a470741
Fixed #1564 (CppCheck does not recognise redundant IF)
2010-04-22 01:21:54 -07:00
Zachary Blair
c26e619b23
Fixed #855 (Refactoring: move conditions into checks)
2010-04-20 23:38:25 -07:00
Reijo Tomperi
35d2a27b9c
Update copyright year in all source files
2010-04-13 22:23:17 +03:00
Zachary Blair
bd7dc9946e
Fixed #1530 (possible new check: strlen return value versus zero.)
2010-04-13 19:30:25 +02:00
Daniel Marjamäki
38a28e28ec
Fixed #1581 (False positives 'The scope of the variable x can be reduced')
2010-04-09 16:53:27 +02:00
Martin Ettl
4bc325f077
#ticket 1513: added sqrt() support
2010-04-05 20:20:20 +02:00
Martin Ettl
fe7c6aed9f
#ticket 1513: added pow() support
2010-04-05 20:07:53 +02:00
Martin Ettl
218c18496d
#ticket 1513 added fmod() support
2010-04-05 19:45:33 +02:00
Martin Ettl
d4923e2a92
added atan2() check to ticket #1513
2010-04-05 19:35:56 +02:00
Daniel Marjamäki
61e1c4183f
Uninitialized variables: better handling of 'a[b[..]]' when b is not initialized
2010-04-05 09:04:30 +02:00
Daniel Marjamäki
d26a2cfc16
Uninitialized variables: Detect reading uninitialized data through array/pointer variable
2010-04-05 08:38:26 +02:00
Daniel Marjamäki
abceff497b
Refactoring: some refactoring of ExecutionPath. The foundError was removed. No automatic bailout of all checks are made when errors are found.
2010-04-04 11:24:52 +02:00
Daniel Marjamäki
78852b08ab
Fixed #1566 (false negative: uninitialized variable)
2010-04-04 09:17:53 +02:00
Daniel Marjamäki
849be383e6
Tokenizer: tokenize 1E-2 into a single token
2010-04-04 08:01:05 +02:00
Reijo Tomperi
a1d0defbc0
astyle fix
2010-04-02 21:42:06 +03:00
Martin Ettl
c391a03db6
added acos() check to ticket #1513 ; added testcases for MathLib::toDoubleNumber(), now double conversion of zeros is handled correctly; changed assertEquals() function of testsuite parameters from unsigned int to double. This is needed to avoid overflow of unsigned int by comparing negative floating point values.
2010-04-02 20:23:37 +02:00
Daniel Marjamäki
734b10e650
Fixed #1479 (false positive: unintialized variable when using goto)
2010-04-02 08:35:05 +02:00
Daniel Marjamäki
8b5aae9adb
astyle formatting
2010-04-02 07:32:03 +02:00
Daniel Marjamäki
0cad22314e
Reverted 'astyle fix'. Those changes are not in sync with my astyle configuration/setup.
2010-04-02 07:30:58 +02:00
Martin Ettl
193aa7d1d3
astyle fix
2010-04-02 02:21:53 +02:00
Martin Ettl
b5fb01c202
ticket #1513 new check: Detecting obviously wrong math call arguments passed to math functions)
2010-04-02 02:19:38 +02:00
Daniel Marjamäki
c3edc5fd89
Fixed #1148 (improve check: usage of uninitialized variables)
2010-03-28 21:27:06 +02:00
Daniel Marjamäki
c7867af3c5
Fixed #1533 (False positive: Uninitialized variable)
2010-03-28 10:42:37 +02:00
Raphael Geissert
c0e09c4cb3
Fixed #1511 (false negative null pointer deref when dereferencing pointers to constants)
2010-03-26 16:44:46 +01:00
Daniel Marjamäki
15d67a2369
Fixed #1503 (False positive for uninitialized variable)
2010-03-16 19:09:37 +01:00
Daniel Marjamäki
7f42ed3ad0
Fixed #1472 (false positive: Data is allocated but not initialized: service)
2010-03-07 09:08:52 +01:00
Daniel Marjamäki
6ca4b008d0
null pointer: Fixed better error message for 'possible null pointer' + removed redundant check in our Tokenizer.
2010-02-28 07:26:50 +01:00
Reijo Tomperi
b35acc1e6b
Add TODO test case for #1444 (inline suppression suppress all errors of the same type in a function)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/1444
2010-02-25 22:55:09 +02:00
Daniel Marjamäki
0b2ad2164f
Fixed #1442 (false positive: getting offset instead of dereferencing a null pointer)
2010-02-22 21:30:21 +01:00
Daniel Marjamäki
6a03fa604c
Fixed #1402 (false positive: uninitialized variable)
2010-02-20 09:35:57 +01:00
Daniel Marjamäki
b59d79c303
readded checks for unused variables and unreachable code that were removed in 42c608b6f0
2010-02-18 18:45:13 +01:00
Daniel Marjamäki
db2c362604
Fixed #1389 (false positive: uninitialized variable)
2010-02-17 18:10:50 +01:00
Reijo Tomperi
7e2e20c2d3
astyle fix
2010-02-08 09:35:53 +02:00
Monika Lukow
2d5d060514
Fixed #1094 (Improve check: unusual pointer arithmetic: 'ch+str')
2010-02-07 21:44:11 +01:00
Daniel Marjamäki
0d18050b55
Fixed #984 (improve output if strncpy is followed by strncat)
2010-02-05 17:35:18 +01:00
Daniel Marjamäki
1b9afc82a4
Reverted 4f30468c80
. There was false positives such as #1335 so please fix them and then re-commit.
2010-02-01 19:46:51 +01:00
Monika Lukow
4f30468c80
Fixed #1094 (Improve check: unusual pointer arithmetic: 'ch+str')
2010-01-31 11:42:02 +01:00
Daniel Marjamäki
48f3921c36
Null pointer dereference: sending to output stream
2010-01-30 14:40:33 +01:00
Daniel Marjamäki
019f775aa5
TestOther::uninitvar1: refactoring. splitting up this function into multiple functions
2010-01-24 15:23:21 +01:00
Daniel Marjamäki
43c8fe895c
Fixed #1301 (False positive: Data is allocated but not initialized)
2010-01-23 21:25:17 +01:00
Daniel Marjamäki
037ecffc34
detect when function pointer that is null is used
2010-01-23 09:15:30 +01:00
Daniel Marjamäki
7b986c831d
Report when using uninitialized function pointer
2010-01-23 07:57:57 +01:00
Daniel Marjamäki
2e707974d0
Fixed #1273 (scope of variable limited not detected in latest versions)
2010-01-21 18:50:56 +01:00
Daniel Marjamäki
fbf428550a
Fixed #1262 (cppcheck false positives: 'Possible null pointer dereference', 'Uninitialized variable')
2010-01-17 19:08:45 +01:00
Daniel Marjamäki
a7bddc8fd3
Fixed #1268 (Null pointer dereference false positive)
2010-01-14 20:02:38 +01:00
Daniel Marjamäki
cefa695dba
Fixed #1265 ((error) Uninitialized variable on macro expansion)
2010-01-13 19:37:55 +01:00
Daniel Marjamäki
374def4a53
Fixed #1070 (Improve scope error message)
2010-01-12 19:34:33 +01:00
Daniel Marjamäki
d3b7f5931f
Fixed #1174 (improve check: Unintialized variable not detected in subfunction)
2010-01-11 22:28:07 +01:00
Daniel Marjamäki
b8b6b0ec32
Uninitialized variables: fixed false positives when using pointer aliasing
2010-01-11 19:25:01 +01:00
Daniel Marjamäki
8be54b592d
ExecutionPath: better handling of for/while/do/switch, it doesn't bail out everything
2010-01-10 22:05:51 +01:00
Daniel Marjamäki
c5966bba59
Fixed #1225 (false negative :: uninitialized variable not detected when using enums)
2010-01-10 20:36:15 +01:00
Daniel Marjamäki
b82cb2e41e
Fixed #1218 (Improve check: incrementing uninitialized variable i++)
2010-01-10 09:09:37 +01:00
Daniel Marjamäki
4c641ed80c
Fixed #1189 (false negative: using uninitialized variable i 'a[i] = 0;')
2010-01-09 22:26:05 +01:00
Daniel Marjamäki
2dd0907146
fixed segmentation fault
2010-01-08 21:54:24 +01:00
Daniel Marjamäki
ca74f57fd0
Fixed #1237 (Uninitialized variable false positive for return-value pattern in pan source code.)
2010-01-08 21:24:48 +01:00
Daniel Marjamäki
e248f7d3e5
Fixed #1023 (improve check: Unintialized variable not detected when using +=)
2010-01-03 18:49:13 +01:00
Daniel Marjamäki
e286896d75
Fixed #1216 (false positive: uninitialized variable when using exit|abort)
2010-01-03 15:35:32 +01:00
Daniel Marjamäki
fa535ff3ae
Fixed #440 (NULL referencing not detected)
2010-01-03 13:30:20 +01:00
Daniel Marjamäki
1032eb2449
Fixed #1214 (false positive: uninitialized variable 'bool fixed = std::ios_base::fixed;')
2010-01-03 08:03:28 +01:00
Daniel Marjamäki
d82079e86f
Fixed #1209 (False positive: uninitialized variable c when it is initialized with 'ab(sizeof(xyz), &c)')
2010-01-02 18:16:44 +01:00
Daniel Marjamäki
2e62a3f4c7
Fixed #1202 (false positive: uninitialized variable when using 'do')
2010-01-02 09:08:36 +01:00
Daniel Marjamäki
071b7b463d
Fixed #1200 (false positive 'uninitialized variable' when using throw)
2010-01-01 20:12:39 +01:00
Daniel Marjamäki
f8bd59f5b5
Fixed #1191 (false positive: uninitialized variable)
2010-01-01 19:43:02 +01:00
Daniel Marjamäki
7ecd333ffa
Fixed #1188 (false negative: dereferencing p, which is a null pointer 'int y = 5 + *p')
2009-12-31 20:00:20 +01:00
Daniel Marjamäki
0159287437
Fixed #1183 (False positive: uninitialized variable p 'd = bar(sizeof(*p));')
2009-12-31 09:10:20 +01:00
Daniel Marjamäki
0ee3d7e46a
Fixed #1182 (False positive: uninitialized variable 'int *pa = &a;')
2009-12-30 21:42:15 +01:00
Daniel Marjamäki
ae3ff7d376
Fixed #1087 (uninitialized data not detected 'char z = *str')
2009-12-30 20:37:11 +01:00
Daniel Marjamäki
461d826eff
Fixed #1105 (improve check: uninitialized variable not detected for 'a = a')
2009-12-30 20:15:44 +01:00
Daniel Marjamäki
d83131ca92
Fixed #1041 (passing a nullpointer to a reference)
2009-12-30 17:42:41 +01:00
Daniel Marjamäki
06ee643c6a
Fixed #1177 (False positive: pointer is not dereferenced 'sizeof(*p)')
2009-12-30 11:32:46 +01:00
Daniel Marjamäki
2a28ca72cc
Fixed #1166 (improve check: using uninitialized pointer to create reference 'int &r(*p);')
2009-12-29 20:36:20 +01:00
Daniel Marjamäki
71b328d703
Robert Reif: Fixed #1163 (post increment test broken for complex template types)
2009-12-29 19:24:48 +01:00
Daniel Marjamäki
cfdf2b8cfe
Fixed #1160 (Null pointer dereference vs. goto)
2009-12-29 09:17:07 +01:00
Daniel Marjamäki
9aca2e7680
Fixed #1156 ([False positive] Uninitialized variable - class member in constructor)
2009-12-28 12:51:28 +01:00
Daniel Marjamäki
b1e963fe2c
Fixed another issue with #1154 (false positive: Data is allocated but not initialized)
2009-12-27 18:00:43 +01:00
Daniel Marjamäki
1c0f3ee179
Fixed #1154 (false positive: Data is allocated but not initialized)
2009-12-27 17:35:18 +01:00
Daniel Marjamäki
738987a686
Fixed #1138 (improve check: dereferencing uninitialized pointer)
2009-12-27 17:20:34 +01:00
Daniel Marjamäki
fbfe5a4bd1
Fixed #1153 (False positive: uninitialized data for reinterpret_cast)
2009-12-27 09:27:05 +01:00
Daniel Marjamäki
ab7ffd2391
Uninitialized variables: Fixed false positive for 'if (ptr)'
2009-12-26 16:22:14 +01:00
Daniel Marjamäki
a82a085d10
Fixed #1151 (false positive: Data is allocated but not initialized)
2009-12-26 09:30:02 +01:00
Daniel Marjamäki
9819b75e17
ExecutionPath: Refactoring if-handling
2009-12-25 20:50:23 +01:00
Daniel Marjamäki
b5291825ce
Fixed #683 (wrong usage of strcmp)
2009-12-25 19:45:21 +01:00
Daniel Marjamäki
9b05850e97
fixed unit testing
2009-12-23 20:00:12 +01:00
Daniel Marjamäki
ea51c3e098
Refactoring the uninitialized variable / null pointer checks so they use a common function to inspect function calls
2009-12-23 19:51:32 +01:00
Daniel Marjamäki
a7d48f2eb4
Fixed #1147 (Improve check: return uninitialized variable)
2009-12-23 17:55:03 +01:00
Daniel Marjamäki
b6c320de8a
Fixed false positives about uninitialized variables
2009-12-23 15:01:23 +01:00
Daniel Marjamäki
ef21ba7425
Fixed #1137 (false positive: uninitialized variable when using a class object)
2009-12-23 13:57:01 +01:00
Daniel Marjamäki
5a89cc3259
Robert Reif: Fixed #1139 (false negative: CheckOther::postIncrement() only finds at most one problem)
2009-12-23 13:38:54 +01:00
Daniel Marjamäki
2bd60ab6c8
Fixed #1133 (Uninitialized array: strchr, strrchr, etc)
2009-12-22 21:08:29 +01:00
Daniel Marjamäki
566cfce8da
Fixed #1128 (false positive: Data is allocated but not initialized)
2009-12-22 21:00:52 +01:00
Daniel Marjamäki
aaf908bd5e
astyle formatting
2009-12-22 19:18:02 +01:00
Daniel Marjamäki
11da89784f
Eric Sesterhenn: Fixed #1130 (False positive uninitialized variable)
2009-12-22 19:16:34 +01:00
Daniel Marjamäki
2e0566bf7a
Fixed #1096 (Non-obvious error message: Overlapping data buffer)
2009-12-21 21:05:55 +01:00
Daniel Marjamäki
b3b07321ca
ericsesterhenn: Fixed #1091 (improve check: nullpointer dereference not detected)
2009-12-21 19:09:13 +01:00
Daniel Marjamäki
d9cf70c1c6
Fixed #1119 (false positve: uninitialized variable y when y is assigned in inner expression 'x = (y = 10)')
2009-12-20 13:55:17 +01:00
Daniel Marjamäki
e03ff727d4
Fixed #1103 (false positive: uninitialized variable when using references)
2009-12-15 19:50:48 +01:00
Daniel Marjamäki
9646f62ec1
Fixed #1075 (False positive: uninitialized variable 'return bar(s);')
2009-12-11 19:58:29 +01:00
Daniel Marjamäki
91114c50d2
Fixed #1061 (false positve: uninitialized variable)
2009-12-09 20:05:06 +01:00
Daniel Marjamäki
2d180ab918
newcheck: added the 'newcheck' functionality. It's still in early state so it needs refactoring
2009-12-06 18:41:28 +01:00
Daniel Marjamäki
ded2e68c2e
Fix #1022 (False positive: uninitialized variable when using local struct)
2009-11-29 19:23:31 +01:00
Daniel Marjamäki
a3a3ff4349
fixed testcase so it's valid syntax
2009-11-17 19:06:53 +01:00
Daniel Marjamäki
d866c174cf
Fixed
2009-11-15 20:26:07 +01:00
Daniel Marjamäki
469a8e4032
Fixed #925 (uninitialized deletion not detected)
2009-11-15 20:01:57 +01:00
Reijo Tomperi
9275b49688
Fix #964 (Integer division by zero exception)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/964
2009-11-15 17:44:30 +02:00
Daniel Marjamäki
822f64ec9a
Fixed #953 (false positive: 'uninitialized variable' with function pointer)
2009-11-15 12:42:04 +01:00
Daniel Marjamäki
ebf907cbc0
Fixed #936 (false positive: uninitialized variable '.. else return; .. ')
2009-11-14 20:37:54 +01:00
Daniel Marjamäki
ec6d66ff45
Fixed #913 (false positive: uninitialized variable)
2009-11-14 08:00:17 +01:00
Daniel Marjamäki
e0b1303b50
Fixed #929 (Uninitialized variable false positive)
2009-11-10 18:05:55 +01:00
Daniel Marjamäki
d85fb9dd3d
unit testing: minor syntax updates
2009-11-09 20:40:30 +01:00
Daniel Marjamäki
4b04ed9ad9
Fixed #910 (false positive: uninitialized variable for array)
2009-11-08 07:31:01 +01:00
Daniel Marjamäki
d88c236efe
uninitialized data: minor fix to handle 'new char [' better
2009-11-07 14:54:12 +01:00
Daniel Marjamäki
60caefe069
uninitialized data: added more checking for allocated data
2009-11-07 09:10:15 +01:00
Daniel Marjamäki
c561a36cc7
uninitialized variables: better checking of strncpy
2009-11-06 19:06:45 +01:00
Daniel Marjamäki
7397bfc765
Fixed #904 (false positive: uninitialized variable)
2009-11-06 16:50:02 +01:00
Daniel Marjamäki
53f7b12b4f
Fixed #902 (false positive: uninitialized variable when variable is initialized in macro)
2009-11-06 16:02:13 +01:00
Daniel Marjamäki
442584151b
Fixed #897 (false positive: uninitialized variable when assigning pointer to array to struct member)
2009-11-05 21:07:04 +01:00
Daniel Marjamäki
c3dff9a6d3
Fixed #893 (False Positive: Uninitialized variable b in a[0] = b[0] = '\0';)
2009-11-03 21:02:16 +01:00
Daniel Marjamäki
797e9aeaf5
Fixed #890 (false positive: Uninitialized variable when pointer takes the address to array)
2009-11-03 17:03:53 +01:00
Daniel Marjamäki
8d57cef7f9
Fixed #764 (usage of unitialized variable not detected)
2009-11-02 19:58:49 +01:00
Daniel Marjamäki
169bcfcff2
Fixed #882 (false positive: uninitialized variable)
2009-11-02 18:31:22 +01:00
Daniel Marjamäki
4abbe9ffd4
Fixed #889 (false positive: uninitialized variable)
2009-11-02 16:28:15 +01:00
Reijo Tomperi
eebbc1b906
Fix #884 (False positive: Possible null pointer reference about a non-pointer)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/884
2009-11-01 13:08:37 +02:00
Daniel Marjamäki
c83d9cd786
Fixed #843 (new check: Passing uninitialized array to strlen/strdup/strcpy/strcat/etc)
2009-10-31 16:36:56 +01:00
Daniel Marjamäki
266291baf4
Fixed #876 (false positive: uninitialized variable)
2009-10-31 10:30:32 +01:00
Daniel Marjamäki
45df223bfb
Fixed #875 (Uninitialized variable: initialization in subfunction)
2009-10-30 18:28:01 +01:00
Daniel Marjamäki
7dbf22aa3f
null pointer: fixed false positive when condition checks if pointer is ok
2009-10-30 15:14:24 +01:00
Daniel Marjamäki
2cf849a9b8
uninitialized variables: fixed false positive when switch is used
2009-10-30 14:52:20 +01:00
Daniel Marjamäki
765c824c6f
Uninitialized pointers: It's allowed to dereference uninitialized non-pointer variables
2009-10-30 14:31:37 +01:00
Daniel Marjamäki
44a9c9b458
Fixed #874 (false positive: uninitialized variable)
2009-10-30 14:06:40 +01:00
Daniel Marjamäki
768225bb1b
uninitialized variables: fixed false positives for member variables
2009-10-30 13:43:00 +01:00
Daniel Marjamäki
c424d4c8af
uninitialized variables: Added TODO testcase for removing false positives
2009-10-29 22:51:08 +01:00
Daniel Marjamäki
c6d7fad84f
uninitialized variables: added check
2009-10-29 21:34:43 +01:00
Daniel Marjamäki
09859c1019
refactoring the folder structure
2009-10-25 12:49:06 +01:00
Daniel
e5f13b4de2
Fixed #839 (False positive: possible null pointer dereference after new)
2009-10-20 20:57:38 +02:00
Daniel Marjamäki
857c95e7b5
Null pointers: Detect code where the assignment is conditional
2009-10-19 17:32:43 +02:00
Reijo Tomperi
ad5d87ee14
Fix #802 (possible null pointer dereference reported for reference)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/802
2009-10-08 11:55:37 +03:00
Reijo Tomperi
014ad937cf
Optimize speed and fix one false positive with stl checks.
2009-10-07 23:38:21 +03:00
Reijo Tomperi
d9ae2c171e
Detect referenced by value errors for std::map also.
2009-10-07 00:04:54 +03:00
Daniel Marjamäki
c3d56c1d13
Fix #797 (false positive: variable scope when using function call)
2009-10-06 17:45:28 +02:00
Reijo Tomperi
6901bcae79
Fix #771 (False positive. Null pointer dereference in a switch case)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/771
2009-10-05 14:46:38 +03:00
Reijo Tomperi
1df8f38423
Fix #793 (Improve passedByValue check)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/793
2009-10-05 11:59:28 +03:00
Slava Semushin
6b0d364f57
Fixed #782 (Checks are missing test cases)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/782
2009-10-04 15:05:58 +07:00
Reijo Tomperi
f9871c2d54
Fix #745 (false positive: possible null pointer dereference , while)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/745
2009-09-30 21:42:14 +03:00
Reijo Tomperi
724c78fb4d
Fix #750 (cppcheck wants variable outside do-loop to be only inside loop)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/750
Fix #758 (False positive on variable scope with boost foreach)
http://sourceforge.net/apps/trac/cppcheck/ticket/758
2009-09-30 00:56:43 +03:00
Reijo Tomperi
63523316a2
Check nullpointer check is now executed without --style flag
...
Added TODO test case for nullpointer check
2009-09-29 16:38:05 +03:00
Reijo Tomperi
64f0f3b308
Fix #751 (if-condition considered redundant even with else-branch)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/751
Fix also other issue with if(a.b) delete c.b;
Fix also other issue with if(a.b.c) delete a.b.c;
2009-09-29 00:18:40 +03:00
Reijo Tomperi
fdde2182b9
Fix GPL comments in all files. ">." was missing from the end.
2009-09-27 18:08:31 +03:00
Reijo Tomperi
16e55f4f89
Improve C style pointer cast detection
...
http://sourceforge.net/apps/trac/cppcheck/ticket/724
2009-09-24 23:46:08 +03:00
Daniel Marjamäki
7f2ca357b0
Fixed #673 (False positive: null pointer dereference when dynamic cast is used)
2009-09-19 10:54:10 +02:00
Daniel Marjamäki
e4291a5966
Fixed #676 (The scope of variable can actually not be limited)
2009-09-17 21:05:12 +02:00
Reijo Tomperi
8ab26e85cf
Don't warn about division by zero if zero if floating point number.
...
Fix bug from mathlib isInt() and add test case from which few are false positives
2009-09-01 22:06:46 +03:00
Reijo Tomperi
0d468d97c7
Fix #630 (Division by zero check only looks at first character of divisor)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/630
Thanks to liam_routt for finding this and providing fix for it.
2009-09-01 17:00:26 +03:00
Reijo Tomperi
6fb44e733b
Fix ticket #612 (Division by zero not detected when zero has type suffix)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/612
2009-08-30 22:02:09 +03:00
Daniel Marjamäki
5d2c409e46
Fixed #623 (False positive: possible null pointer dereference when using the ?: operator)
2009-08-28 08:48:37 +02:00
Daniel Marjamäki
c25e1963b1
Fixed #498 (Tokenizer: simplify 'goto')
2009-08-24 23:10:12 +02:00
Slava Semushin
e6120a5725
Fixed #581 (Wrong usage of div-function)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/581
2009-08-23 10:37:09 +07:00
Slava Semushin
ec050d2563
TestOther::varScope5: fixed syntax error in test case.
...
Testrunner complains about "Unlogged error at Tokenizer::syntaxError"
since 74bbe945f6
commit.
2009-08-22 21:29:09 +07:00
Daniel Marjamäki
439ff8b144
Fixed #599 (False positive: null pointer dereference)
2009-08-21 12:42:40 +02:00
Slava Semushin
74bbe945f6
Fixed #272 ("The scope of the variable XXX can be limited" not detected when variable is initilialized during declaration)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/272
2009-08-17 02:12:57 +07:00
Daniel Marjamäki
ad4ea01750
Fixed #583 (False positive: the nullpointer check doesn't handle goto properly)
2009-08-12 18:54:52 +02:00
Slava Semushin
4c32057180
Fixed ticket #541 (Wrong testcases produce unlogged error at Tokenizer::syntaxError)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/541
2009-08-12 02:06:41 +07:00
Daniel Marjamäki
e7feac506c
Refactoring: updated the nullPointer message so it contains the name of the pointer
2009-08-11 17:18:01 +02:00
Daniel Marjamäki
e6713e9774
null pointers: fixed a false positive
2009-08-01 11:30:37 +02:00
Daniel Marjamäki
2d9e4e1a73
null pointers: detect when there are possible null pointer dereferencing when looping through a linked list both in inner and outer loops at the same time
2009-07-31 10:49:43 +02:00
Daniel Marjamäki
228e926654
null pointers: Added a todo testcase
2009-07-30 21:57:23 +02:00
Daniel Marjamäki
4e66dc105e
null pointers: Fixed false positive when 'do' are used
2009-07-29 11:17:22 +02:00
Daniel Marjamäki
a6d696bf40
Fixed #504 (false positive: null pointer dereference)
2009-07-25 20:36:02 +02:00
booga
9fa8c0ee9c
astyle FTW (should have read about that sooner)
2009-07-24 19:23:30 -04:00
booga
52e2e775b2
Fix #476 STL Container checks.
...
Fix #473 Add post increment check for STL objects and Classes.
2009-07-24 18:36:15 -04:00
Daniel Marjamäki
5b81c92a14
null pointers: fixed false positives when checking if pointer is null at many locations ( #485 )
2009-07-23 19:59:29 +02:00
Daniel Marjamäki
06c8ff9d0d
null pointers: fixed false positives ( #49 )
2009-07-23 19:02:14 +02:00
Daniel Marjamäki
d0f1d885ed
null pointers: dereferencing a pointer and then checking if it's null ( #49 )
2009-07-23 14:13:46 +02:00
Daniel Marjamäki
e36994f54b
astyle formatting
2009-07-22 18:48:42 +02:00
Daniel Marjamäki
ba36c9426b
null pointers: better checking when dereferencing pointer and then checking if it is null ( #485 )
2009-07-21 17:00:11 +02:00
Daniel Marjamäki
45f8560537
invalid pointer usage: broke out CheckOther::invalidPointer from the CheckOther::nullPointer ( #485 )
2009-07-21 12:09:58 +02:00
Daniel Marjamäki
ce595dd5c7
Merge branch 'master' of git@github.com:danmar/cppcheck
2009-07-21 07:41:43 +02:00
Reijo Tomperi
973bb164ea
Fix ticket #486 (C-style pointer casting misses const pointers)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/486
2009-07-20 22:52:27 +03:00
Daniel Marjamäki
0e208eb52f
null pointer dereferencing: fixed another false positive ( #485 )
2009-07-20 19:59:55 +02:00
Daniel Marjamäki
05a1c50ff2
null pointer dereferencing: removed a few false positives in the new check that I added ( #485 )
2009-07-20 19:30:33 +02:00
Daniel Marjamäki
b7ba49114c
Fixed #485 (detect when code is checking for null after dereferencing)
2009-07-20 18:53:41 +02:00
Slava Semushin
d3490abd64
Finally fixed ticket #284 (style check: redundant condition improvement)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/284
2009-07-18 21:42:08 +07:00
Reijo Tomperi
8b0e481d46
Refactoring: Rename member functions to follow naming guidelines.
2009-07-05 23:16:43 +03:00
Daniel Marjamäki
12c9f09780
Fixed #420 (WarningOldStylePointerCast() needs a test case)
2009-06-19 12:01:27 +02:00
Reijo Tomperi
b7171c3cd2
Fix ticket #413 (false positive: C-style pointer casting for pure virtual function)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/413
2009-06-18 23:26:21 +03:00
Daniel Marjamäki
35b6b2588e
Fixed ticket #374 (False positive: The scope of variable can be limited)
...
A few refactorings and fixes were made
2009-06-12 16:17:51 +02:00
Daniel Marjamäki
a71d260308
Refactoring: Moved CheckOther::returnPointerToLocalVariable to CheckAutoVariables
2009-06-09 19:45:58 +02:00
Reijo Tomperi
9cd5558f5e
Fix ticket #364 (false positive:: division by zero)
...
http://apps.sourceforge.net/trac/cppcheck/ticket/364
2009-06-06 00:33:13 +03:00
Slava Semushin
52a8368b02
Strip redundant std::string usage from tests.
...
Second round: handle empty strings.
Done by command:
git grep -l ASSERT_EQUALS | xargs sed -i 's|ASSERT_EQUALS(std::string(\(".*"\)),|ASSERT_EQUALS(\1,|'
Should be no functional change.
2009-06-05 07:43:55 +07:00
Slava Semushin
e5c0383594
Strip redundant std::string usage from tests.
...
Done by command:
git grep -l ASSERT_EQUALS | xargs sed -i 's|ASSERT_EQUALS(std::string(\(".\+"\)),|ASSERT_EQUALS(\1,|'
Should be no functional change.
2009-06-01 02:50:25 +07:00
Reijo Tomperi
58eda6e978
Fix ticket #325 (Replace developer names in source files with AUTHORS file)
...
http://apps.sourceforge.net/trac/cppcheck/ticket/325
2009-05-30 08:48:12 +03:00
Daniel Marjamäki
650d58e3de
Fix for ticket 337 ('scope can be limited' false positive with variables referenced by pointers)
2009-05-27 19:38:26 +02:00
Slava Semushin
f5300ae56c
Part of fix for ticket #284 (style check: redundant condition improvement)
...
Fixed case "if (p) delete [] p;" and also added test case for it.
http://apps.sourceforge.net/trac/cppcheck/ticket/284
2009-05-24 00:32:53 +07:00
Slava Semushin
bc62472a18
Part of fix for ticket #284 (style check: redundant condition improvement)
...
Fixed case "if (p != NULL) delete p;" and also added test case for it.
http://apps.sourceforge.net/trac/cppcheck/ticket/284
2009-05-24 00:30:27 +07:00
Daniel Marjamäki
1ae24066fe
null pointer dereferencing: check that its a pointer that is dereferenced to avoid false positives when using classes that behave almost like pointers ( #295 )
2009-05-10 08:43:16 +02:00
Daniel Marjamäki
ca8f25fced
return pointer to local array: fixed false positive when return value is converted to for instance a std::string ( #255 )
2009-04-19 16:47:54 +02:00
Daniel Marjamäki
263c5b9e5a
division with zero => division by zero
2009-03-29 20:27:10 +02:00
Daniel Marjamäki
d7aee72fcd
zero division: it's an error
2009-03-29 18:47:05 +02:00
Daniel Marjamäki
022dbc651e
removed TestOther::zeroDiv3 - it is not valid
2009-03-28 08:02:15 +01:00
Daniel Marjamäki
4059a2ad05
added check for zero division. The code was written by Nguyen Duong Tuan
2009-03-28 07:49:47 +01:00
Daniel Marjamäki
c0b608059a
possible null pointer dereference after a while-loop
2009-03-27 17:19:34 +01:00
Daniel Marjamäki
afcaa30b51
Fixed ticket 216 (False positive: variable scope)
2009-03-24 20:59:56 +01:00
Daniel Marjamäki
c0039a2551
added testcase
2009-03-24 20:24:03 +01:00
Daniel Marjamäki
9f1c3cc535
refactoring the rest of the classes
2009-03-20 18:16:21 +01:00
Reijo Tomperi
fc8f47145a
Copyrights updated
2009-03-01 19:52:33 +00:00
Daniel Marjamäki
c7b068c174
variable id: fixed so that the variable ids are assigned correctly (ticket:126)
2009-03-01 16:37:02 +00:00
Reijo Tomperi
a06861948b
Fixed: Ticket #78 Change (always) into (error) in error messages
2009-02-05 21:06:32 +00:00
Daniel Marjamäki
aeb573d529
returning pointer to local array
2009-02-04 18:49:19 +00:00
Daniel Marjamäki
3457b38d7a
errmsg: write severity in the message
2009-01-31 08:33:31 +00:00
Reijo Tomperi
176dd41306
Fixed Ticket #40 , Check copyright texts in files, now that we have new developers.
2009-01-21 20:04:20 +00:00
Nicolas Le Cam
f6d121443e
unreachableCode: Moved warning of a break statement following a return in --style; Added a test case; Minor optimization.
2009-01-18 21:19:02 +00:00
Daniel Marjamäki
f409861492
strPlusChar: Fixed false positives
2009-01-18 17:42:41 +00:00
Daniel Marjamäki
66e93b24e2
str plus char: added simple variable handling
2009-01-15 17:12:33 +00:00
Daniel Marjamäki
8bbd4b9401
str plus char: Added check and error message for str + ch
2009-01-15 16:57:51 +00:00
Daniel Marjamäki
980b10bfc9
errmsg: Added 'unsigned division'
2009-01-12 17:12:14 +00:00
Daniel Marjamäki
2e77f3bf04
setVarId: Fixed bug (variable id for struct member not correctly set)
2009-01-11 10:03:21 +00:00
Daniel Marjamäki
a2a8378749
astyle: updated the code style
2009-01-10 14:29:59 +00:00
Daniel Marjamäki
8c4260519c
sprintf: fixed bug "false positive when variable is used again after snprintf"
2009-01-10 14:27:31 +00:00
Daniel Marjamäki
985b8fa05f
sprintf: fixed false positives with "sprintf(buf, "%i", sizeof(buf));
2009-01-10 11:19:17 +00:00
Reijo Tomperi
42b661630b
astyle changes, missed from previous commits
2009-01-08 21:08:14 +00:00
Daniel Marjamäki
24530ebd60
sprintf: check for dangerous usage with sprintf|snprintf with
...
overlapping data
2009-01-08 06:24:08 +00:00
Reijo Tomperi
e435a1f1d6
Refactoring: Added src/ and test/ folders. Moved source files to those folders, updated makefile and codeblocks project file.
2009-01-06 14:18:36 +00:00