Robert Reif
c6a804d306
add std::*.empty() to possible const functions in CheckClass::checkConstFunc
2011-07-30 09:44:20 -04:00
Robert Reif
74c1bdde77
fix #1593 (false negative: the function can be declared as const)
2011-07-30 08:48:11 -04:00
Robert Reif
ca2e8b057b
fix #2947 (False positive: member variable is not initialized (a[x::y] = 0;))
2011-07-27 12:03:44 -04:00
Robert Reif
54141f2e7f
fix #2943 (Symbol database: Wrong parsing of std::vector as base class.)
2011-07-27 11:23:22 -04:00
Robert Reif
77859b9a0f
fix #2878 (derived global class not tokenized properly (class A : ::B { };))
2011-06-30 07:25:36 -04:00
Robert Reif
443dd4c392
partial fix for #2867 handle derived class
2011-06-29 19:39:19 -04:00
Robert Reif
f403de7bad
partial fix for #2867 Tokenizer::removeRedundantAssignment didn't understand function local class and removed class variable
2011-06-28 19:48:28 -04:00
Robert Reif
0f6da27b9f
fix #2795 (hash operator[] is not 'const') (original patch by Sebastien Debrard) (modified to use the symbol database)
2011-06-03 22:00:27 -04:00
Robert Reif
42316f3e0b
fix #2792 (false positive: Member variable 'class::m_val' is not assigned a value in 'class::operator=')
2011-05-24 20:25:34 -04:00
Robert Reif
bd03768415
move symbol database tests to testsymboldatabase.cpp
2011-04-28 21:03:57 -04:00
Robert Reif
6abf29bd22
fix spelling of initialized in checkclass messages
2011-04-26 20:37:16 -04:00
Greg Hewgill
3fc1db51d1
Change symbol database such that the typestart token skips over type modifiers (const/static/mutable).
...
This fixes checking for the case of a memset() on a static variable.
2011-04-23 01:13:23 +12:00
Daniel Marjamäki
061eab4d22
Virtual destructors: Enabled the check again. I think it is conclusive now. Ticket: #2728
2011-04-20 18:03:16 +02: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
3c8644fcf8
added tests for #2710 (False negative on uninitialized member variable in a ctor.)
2011-04-08 07:39:30 -04:00
Robert Reif
cf65a73c47
fix CheckClass::operatorEq to check return type more closely (to match check description)
2011-03-31 19:40:28 -04:00
Robert Reif
1e1434e191
make member variable change detection simpler and more accurate for CheckClass::checkConst
2011-03-27 13:59:12 -04:00
Robert Reif
168db82fd6
better checking of assignment to array element in CheckClass::checkConstFunc
2011-03-25 23:02:13 -04:00
Robert Reif
f8e1735b0f
add support to CheckClass::checkConstFunc for ++/-- array elements
2011-03-25 22:37:32 -04:00
Robert Reif
6e6c86365f
add some missing ; at end of class and struct definitions in checkclass tests
2011-03-25 07:58:51 -04:00
Robert Reif
61e720c82b
fix #1288 (Use of memset on struct - nested structs not handled)
2011-03-23 21:58:58 -04:00
Robert Reif
7e3e5d628d
better fix for #2672 (False positive: function can be const, nested classes declared in one line)
2011-03-23 20:19:32 -04:00
Robert Reif
ac7f1f874e
add some more CheckClass::noMemset tests
2011-03-22 22:45:19 -04:00
Robert Reif
d36ed9aff1
fix #2670 (False positive: function can be const, overloaded functions)
2011-03-22 19:23:36 -04:00
Robert Reif
2277cb6965
fix #2663 (False negative: function can be const (changing unknown or uninitialised variable))
2011-03-20 13:29:52 -04:00
Robert Reif
41d80b5c8d
fix #2664 (False negative: function can be const (using type from another namespace))
2011-03-20 12:53:37 -04:00
Robert Reif
1de35c168d
fix #2657 (segmentation fault of cppcheck ( gcc-testsuite: return f(){} ))
2011-03-17 20:10:56 -04:00
Robert Reif
7e04ea0859
fix removal of throw() from const functions
2011-03-16 19:54:52 -04:00
Robert Reif
47531dd99c
fix #2637 (segmentation fault of cppcheck ( {} const const ))
2011-03-15 22:33:14 -04:00
Greg Hewgill
fa868e44ae
Support use of 'this->' when checking operator=() return type
2011-03-15 20:19:30 +13:00
Robert Reif
27f4b8b88b
Convert CheckClass::noMemset to use the symbol database to lookup types. This adds better support for namespaces and nested classes.
2011-03-12 22:41:21 -05:00
Greg Hewgill
1ec6a642dc
Revert "Check for memset on nested structs (ticket #1288 )"
...
Turns out this fix is incomplete.
This reverts commit a084697410
.
2011-03-10 20:19:31 +13:00
Greg Hewgill
a084697410
Check for memset on nested structs (ticket #1288 )
2011-03-09 23:02:49 +13:00
Greg Hewgill
3883afcbf4
Check for memset on objects with virtual functions (ticket #607 )
2011-03-09 22:10:39 +13:00
Greg Hewgill
70b4076111
refactor noMemset so it recursively checks parent classes for non-memset-compatible things
2011-03-09 21:29:30 +13:00
Robert Reif
f596a6959e
code cleanup and add more tests to CheckClass::noMemset()
2011-02-24 19:59:50 -05:00
Chuck Larson
db7ce1c13c
memset: using memset on struct/class that has std::string member variable. ticket: #1655
2011-02-24 18:38:45 +01:00
Robert Reif
5f84272a52
fix segfault: #2591 (cppcheck hangs with 100% cpu load ( class A : ))
2011-02-21 14:25:35 -05:00
Robert Reif
5984b6b53f
fix #2595 (False positive Technically the member function 'A::foo' can be const)
2011-02-20 20:01:54 -05:00
Robert Reif
fef1142997
fix #2592 (False positive: 'operator=' should return reference to self)
2011-02-19 20:02:16 -05:00
Robert Reif
e6eb160395
fix [B#2589 (segmentation fault of cppcheck (struct B : A))
2011-02-19 14:38:00 -05:00
Daniel Marjamäki
53aaf22633
CheckClass::noMemset: Added TODO test case
2011-02-16 21:31:35 +01:00
Robert Reif
2aefa5deb5
fix #2577 (segmentation fault of cppcheck)
2011-02-12 15:35:48 -05:00
Daniel Marjamäki
26f017e9c6
scripts: added tabs.pl - in my opinion it is bad to use tabs inside string constants. spaces or \t should be used instead.
2011-02-05 12:53:28 +01:00
Robert Reif
c592ccd35d
Fixed #2547 (segmentation fault of cppcheck)
2011-02-05 08:59:59 +01:00
Robert Reif
f87056fca3
Fixed #2539 (segmentation fault of cppcheck)
2011-02-04 20:19:49 +01:00
Robert Reif
8288c28b3f
Fixed #2537 (segmentation fault of cppcheck)
2011-02-03 07:57:10 +01: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
Daniel Marjamäki
524498e439
Tokenizer: collapse operator function names into a single token. ticket: #2519
2011-01-27 18:44:20 +01:00
Robert Reif
767e01e24a
Fixed #2478 (Crash when trying to analyze files (CheckClass::checkReturnPtrThis))
2011-01-21 19:54:41 +01:00
Pete Johns
38c37ad2d8
Moved array declaration detection into isVariableDeclaration()
2011-01-17 08:36:52 +11:00
Robert Reif
0f6644e1ea
Symbol database: Refactorings
2011-01-16 11:18:12 +01:00
Robert Reif
79b9939610
Fixed #2465 (False positive: not initialised variable, but there is default constructor for it.)
2011-01-15 07:59:37 +01:00
Reijo Tomperi
226b605774
Change year 2010 -> 2011 in license texts.
2011-01-09 21:33:36 +02:00
Robert Reif
5f078da7ad
Fixed #2425 (segmentation fault of cppcheck)
2011-01-07 18:58:14 +01:00
Robert Reif
03a484554c
Fixed #2415 (false positive: Member variable not initialized in constructor calling assignment operator)
2011-01-06 07:56:34 +01:00
Daniel Marjamäki
033e759c39
command line: added 'information' id to enable
2011-01-05 21:20:21 +01:00
Markus Elfring
e459ed1de3
Fixed #2389 (mistakable warning from 'CheckClass::uninitVarError')
2011-01-03 19:03:42 +01:00
Daniel Marjamäki
3c238882a2
Fixed TODO testcase. Use symbol database instead of token list. Ticket: #2375
2011-01-01 17:54:37 +01:00
Pete Johns
502cfe7243
Fixed #2384 ("The function 's::f' can be const" reported for pointer-to-pointer)
...
Moved check for pointer variables into isVariableDeclaration()
Can now handle multiple scopes and multiple levels of indirection. Simplified check for strucs and unions, too, reducing the size of getVarList().
skipScopeIdentifiers() and skipPointers() should probably be methods on class Token.
2010-12-31 22:12:32 +11:00
Pete Johns
5d0ace3a50
Fixed #2377 (Technically the member function xxx can be const)
...
TODO: Add unit test for getVarList() and refactor variable check.
[Removed my testcase for #2377 and removed two TODOs.]
2010-12-30 17:56:28 +11:00
Ettl Martin
ac42c0ba3b
const correctness: added further testcases for increment/decrement member functions
2010-12-30 02:05:44 +01:00
Ettl Martin
7b92378c3a
ticket 2377: added further testcases
2010-12-30 01:44:46 +01:00
Ettl Martin
c29824fc49
added todo testcase for ticket 2377 Technically the member function xxx can be const
2010-12-30 01:29:09 +01:00
Robert Reif
3f1f50e970
simplifyTypedef: operator typedef. Ticket: #2375
2010-12-29 20:22:06 +01:00
Daniel Marjamäki
3853f93b34
TestClass: addon for 12f28507
, fix a few more error messages.
2010-12-27 08:22:21 +01:00
Kimmo Varis
12f2850777
Improve the message about const function.
...
See discussion thread:
https://sourceforge.net/apps/phpbb/cppcheck/viewtopic.php?f=3&t=192
2010-12-26 23:44:03 +02:00
Daniel Marjamäki
be46d453c4
Information: Added new severity
2010-12-22 19:53:17 +01:00
vBm
46a11183a5
Fixed some spelling mistakes
2010-12-15 18:45:53 +01:00
Robert Reif
980a90071c
Fixed #2282 (Improve check: Function can be const)
2010-12-07 19:42:30 +01:00
Robert Reif
c20b8831ee
Fixed #2275 (False Positive: Member variable not initialized in the constructor)
2010-12-04 20:24:13 +01:00
Robert Reif
04b811b74f
Fixed #2273 (False Positive: Member variable not initialized in the constructor)
2010-12-04 17:47:00 +01:00
Robert Reif
2cd8bc74cc
Symbol database: The symbol database has a bug where it can find an out of line constructor when looking for a destructor. Ticket: #2272
2010-12-03 07:35:06 +01:00
Robert Reif
1bc8a2b6ba
Fixed #2172 (False positive: struct is not initialized in constructor)
2010-12-02 07:35:01 +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
Robert Reif
43dcc51752
Fixed #2252 (segmentation fault with enable=all)
2010-11-30 19:52:42 +01:00
Robert Reif
f90236a183
Fixed #2252 (segmentation fault with enable=all)
2010-11-30 19:40:32 +01:00
Kimmo Varis
87b69a10fa
Ticket #2240 (Improve no constructor-message).
...
Improve the message about missing constructor but having class
attributes. Have proper short and long messages.
2010-11-27 10:17:03 +02:00
Robert Reif
03b12c5494
Fixed #2230 (segmentation fault of cppcheck)
2010-11-25 07:43:39 +01:00
Robert Reif
08b86e0b7e
Fixed #2228 (False positive: Claims function can be const when it can not be (shared_ptr))
2010-11-25 07:15:33 +01:00
Robert Reif
f1eef49fcb
Fixed #2221 (segmentation fault of cppcheck)
2010-11-23 07:31:15 +01:00
Robert Reif
36b03bdd3e
Fixed #2179 (Segmentation fault in assignment operator)
2010-11-09 06:58:19 +01:00
Daniel Marjamäki
c2bf3647a4
Fixed #2178 (segmentation fault of cppcheck)
2010-11-08 19:47:19 +01:00
Robert Reif
662cd27f87
Symbol database: fixed problem
2010-11-06 20:27:12 +01:00
Robert Reif
003f99da82
Symbol database: Fixed bug. Ticket: #2149
2010-11-04 06:58:37 +01:00
Robert Reif
cf0403434d
Symbol database: Bug fix
2010-11-03 20:33:07 +01:00
Robert Reif
0fe72839d8
Symbol Database: Better handling of namespaces. Ticket: #2149
2010-11-02 18:30:57 +01:00
Daniel Marjamäki
fee20bafa0
Java: Removed bailout added in 120073f000
2010-10-28 18:01:51 +02:00
Robert Reif
b6aca47e11
Fixed #1195 (Uninitialized member variable not detected 'std::vector<int> *ints;')
2010-10-27 19:28:15 +02:00
Robert Reif
5a8f490f07
Fixed #2135 (False positive 'Can be const')
2010-10-27 19:25:34 +02:00
Daniel Marjamäki
cf86e11d05
Fixed #2111 (Class methods writing to a union are detected as 'can be const')
2010-10-24 16:43:10 +02:00
Daniel Marjamäki
120073f000
Java: fixed false positives about uninitialized variable
2010-10-23 10:56:30 +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
Robert Reif
a58094e827
Fixed #2089 (False negative: Function can be const (calling const function))
2010-10-13 07:26:41 +02:00
Robert Reif
907ed0ac6f
Fixed #2085 (False negative: function can be const when member variable is compared)
2010-10-12 07:57:09 +02:00
Daniel Marjamäki
14f12e0647
Fixed #2078 (false negative: member variable not intialized)
2010-10-10 07:57:26 +02:00
Daniel Marjamäki
a7cf68b9ef
Check Class: Removed the 'operator= should not return a const reference'
2010-09-18 20:05:34 +02:00
Robert Reif
0153dccb66
Symbol database: Skip bail out in constructors if a virtual function might be called because that would be undefined behaviour. Ticket: #1895
2010-09-14 07:16:53 +02:00
Robert Reif
6de1711515
Symbol database: reduce false negatives for 'uninitialized variable' when calling base class function. ticket: #1895
2010-09-12 22:40:51 +02:00