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
Zachary Blair
d11b5163b7
Fixed #2382 (Catching exceptions by value instead of reference)
2010-12-31 03:01:38 -08:00
Daniel Marjamäki
fd27be2440
Fixed #2372 (internal error in logicaloperator check (varid=0))
2010-12-29 10:07:28 +01:00
Kimmo Varis
e8b81f909d
Change 'Scope of variable'-message to information message.
2010-12-27 16:48:03 +02:00
Daniel Marjamäki
660de98c0c
Fixed #2365 (Internal error: Token::Match called with varid 0)
2010-12-27 14:06:32 +01: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
ecad249ae2
Fixed #2346 (False positive: pointer is assigned value that is never used. used here: 'pCol = pCol->GetNext()')
2010-12-25 19:17:53 +01: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
Daniel Marjamäki
0f9415a5fb
Fixed #2330 (unreadVariable error for a fstream object when only extraction operator (>>) is used)
2010-12-21 19:02:00 +01:00
Robert Reif
244974a61a
unused variables: fixed false negatives with the help of the symbol database. ticket: #2317
2010-12-21 08:13:40 +01:00
Daniel Marjamäki
f73cce9eca
Fixed #2317 ((style) Variable is allocated memory that is never used)
2010-12-20 18:31:16 +01:00
Daniel Marjamäki
02892499d2
Fixed #2286 (Variable 'ownKilled' is assigned a value that is never used)
2010-12-19 18:27:31 +01:00
Robert Reif
a2aa601899
CheckOther: Use SymbolDatabase. Ticket: #2318
2010-12-18 20:35:40 +01:00
Robert Reif
f2d69acbfd
Symbol database: reuse in CheckOther. Ticket: #2318
2010-12-16 19:04:47 +01:00
vBm
46a11183a5
Fixed some spelling mistakes
2010-12-15 18:45:53 +01:00
Daniel Marjamäki
b25e6ff24c
Fixed #2279 ((style) struct of union member is never used)
2010-12-05 18:33:53 +01:00
Daniel Marjamäki
93ebdca313
Fixed #2264 (False positive: variable assigned value that is never used)
2010-12-03 18:45:49 +01:00
Daniel Marjamäki
8118e4755a
Fixed #2263 (False positive: variable assigned value that is never used)
2010-12-02 20:08:05 +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
564d896715
Run astyle.
2010-11-28 23:29:06 +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
2c3f9a9dce
Small fix to error message.
...
Start with capital letter and no space in beginning.
2010-11-27 20:41:08 +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
d021cd9074
VS: fixed compiler warning. Ticket: #2200
2010-11-20 11:28:47 +01:00
Daniel Marjamäki
fd64a7e683
Mutual exclusion: Disable this check until #2162 is fixed.
2010-11-20 07:43:07 +01:00
Daniel Marjamäki
d250cb5aa2
Fixed #2206 (False positive: variable is assigned a value that is never used (array initializers))
2010-11-15 17:53:55 +01:00
Daniel Marjamäki
7b3e7f6467
Fixed #2205 (False positive: variable is assigned a value that is never used (assigning to dereferenced casted pointers))
2010-11-15 17:30:07 +01:00
Zachary Blair
36d80d6eaa
Fixed #2058 (Warn for unused variable when only doing malloc/free)
2010-11-14 17:37:36 -08:00
Daniel Marjamäki
ba7a3b376e
Fixed #2167 (Drop linefeeds from error messages)
2010-11-11 19:54:43 +01:00
Daniel Marjamäki
27b7638901
Visual Studio: Fixed compiler warnings about assignment in condition
2010-11-08 17:29:08 +01:00