Martin Ettl
babbee4e73
Fixed typos in comments, no functional changes.
2013-11-09 16:07:28 +01:00
Sam Truscott
6806fd8135
Extended Qt support through Library
2013-10-20 14:09:10 +02:00
Frank Zingsheim
67915749b0
Fixed #4723 (False positive: Pure virtual call within conditional clause)
...
conditional clauses directly in constructor/destructor cannot prevent
pure virtual function call otherwise this part of the code would never been called
2013-09-27 09:25:38 +02:00
Frank Zingsheim
445d08d082
Fixed #4723 (False positive: Pure virtual call within conditional clause)
2013-09-26 17:25:16 +02:00
PKEuS
8e84f30244
Refactorization: Make use of Function::retDef where it makes sense
2013-09-03 11:40:43 +02:00
PKEuS
b36a887608
Fixed false positive #5004
2013-09-03 10:54:10 +02:00
Lucas Manuel Rodriguez
92b7280d13
Fixed #4995 (False positive - Using 'memset' on class that contains a virtual method) - Better fix
2013-08-30 22:06:20 -03:00
Lucas Manuel Rodriguez
c26674dc97
Fixed #4995 (False positive - Using 'memset' on class that contains a virtual method)
2013-08-30 08:46:33 -03:00
Ettl Martin
e223e13747
Fixed #4987 (spellfix for verbose message in CheckClass::noConstructorError)
2013-08-28 05:48:31 +02:00
Daniel Marjamäki
80093f0a40
Fixed #4689 (False positive: Unused private function (used in default argument of constructor))
2013-08-26 16:41:23 +02:00
Lucas Manuel Rodriguez
006b8055e5
Fixed #4676 (Duplicated inherited member check)
2013-08-20 06:29:19 +02:00
PKEuS
a9a5dc0354
Updated to AStyle 2.03, require this version
2013-08-07 16:27:37 +02:00
Daniel Marjamäki
9c67af058a
SymbolDatabase: Renamed Variable::varId() to Variable::declarationId() to make it more clear how it works.
2013-07-20 12:31:04 +02:00
Robert Reif
870d29944b
Fixed #4852 (false positive: Member variable 'A::sz' is not initialized in the constructor)
2013-06-14 06:32:26 +02:00
Daniel Marjamäki
1476787f40
CheckClass: Fixed nullpointer check and then dereference warning.
2013-05-17 14:10:53 +02:00
Frank Zingsheim
54e7c8f6a2
Implemented support for move constructors:
...
Adapt code to Function::eMoveConstructor
introduced in commit eb2962792f
2013-04-10 21:57:22 +02:00
Frank Zingsheim
1935c544e0
Fixed #4656 (New check: Detect pure virtual function calls)
...
C++11: move constructor
2013-04-08 20:48:45 +02:00
Frank Zingsheim
47360f1191
Fixed #4656 (New check: Detect pure virtual function calls)
...
C++11: move constructor
2013-04-08 19:37:08 +02:00
Frank Zingsheim
5d55d40361
Fixed #4656 (New check: Detect pure virtual function calls)
2013-03-30 15:09:22 +01:00
PKEuS
ed477ceb74
Fixed false negative mentioned in #4354 .
2013-03-14 09:27:42 -07:00
Robert Reif
25c36b56fa
CheckClass: made warnings about uninitialized members in default constructors inconclusive. Ticket: #4639
2013-03-09 09:20:48 +01:00
PKEuS
9287e40e99
Incresed constness of several pointers in symboldatabase
2013-03-05 09:42:42 -08:00
PKEuS
a94598e447
Fixed some gcc and cppcheck messages
2013-03-05 07:07:59 -08:00
PKEuS
ca96aaa53b
Avoided unnecessary usage of symbolDatabase->isClassOrStruct()
2013-03-05 06:55:31 -08:00
PKEuS
7bc729bc63
- Moved more functionality from Scope to Type: BaseInfo and FriendInfo
...
- Replaced Scope->findQualifiedScope by SymbolDatabase::findScope
- Improved SymbolDatabase::findType
2013-03-05 06:28:40 -08:00
PKEuS
66a3555897
Implement initial support for Types in Symboldatabase:
...
- For each class/struct/union, a Type instance is added to SymbolDatabase::typeList.
- A scope is no longer created for declared but not defined types
Fixed name detection for classes when they are declared like this: "class ::Foo::Sub {..."
2013-03-05 04:33:38 -08:00
Daniel Marjamäki
b3a2b69120
fixed gcc warning
2013-03-04 19:28:27 +01:00
PKEuS
c24527dbde
Improved handling of dereferences in CheckClass::noMemset(), fixing false negatives and false positives related to multidimensional arrays and arrays of pointers.
2013-03-04 02:47:29 -08:00
PKEuS
d78c06dc3f
Replaced _settings->isEnabled("style") by _settings->isEnabled("warning") wherever warnings are issued
2013-03-03 02:41:59 -08:00
Daniel Marjamäki
9d195144ea
CheckClass: Fixed GCC warning
2013-03-02 07:30:55 +01:00
Robert Reif
ec7843e911
Fixed #4629 (False positive: warning (uninitMemberVar) - regression)
2013-03-02 07:24:51 +01:00
PKEuS
096aae4439
New check: Warn about using malloc() for classes containing virtual methods, std::-objects or constructors
2013-03-01 06:07:20 -08:00
PKEuS
0105f8223c
Simplified several Token::Match/simpleMatch calls when match string consists of a single pattern
...
Fixed two CheckInternal error messages
2013-03-01 03:42:04 -08:00
Robert Reif
509061afff
Fixed #4620 (False positive: Uninitialized variable in constructor (1.58))
2013-02-27 06:59:04 +01:00
Robert Reif
e6915e7a78
Fixed #4536 (non-static member initializer causes false positive)
2013-02-18 06:33:53 +01:00
PKEuS
711d0d7a33
Warn about memset(this, 0, sizeof(*this)); ( #1285 )
2013-02-16 11:02:43 -08:00
PKEuS
b27a3c802c
Fixed travis failure: use begin() instead of C++11 cbegin()
2013-02-16 02:35:54 -08:00
PKEuS
d3087602a1
Fixed false positive "function can be const" if a non-const expression is inside []-brackets ( #4406 )
2013-02-16 02:20:18 -08:00
PKEuS
afe45ff39f
Refactorized CheckClass::privateFunctions:
...
- Resolved todo about nested classes, fixed false negative, fixed wrong unit test
- Removed slow and unnecessary Token::findmatch
- Removed false positive when function implementation in friend class is not seen (#4384 )
2013-02-16 01:51:08 -08:00
Robert Reif
fe5de60f32
Fixed #4567 (false negative: The class 'B' does not have a constructor.)
2013-02-08 06:55:45 +01:00
Robert Reif
8e35860fc2
CheckClass: Refactoring. Use Token::variable(). Ticket: #4535
2013-02-02 16:30:17 +01:00
Robert Reif
859793731d
SymbolDatabase: Refactor findFunction handling. Ticket: #4494
2013-01-28 06:47:48 +01:00
Andrew C. Martin
4a73c93750
Fix compiler warnings and comment/string typos
...
- fix g++ warning:
> lib/checkother.cpp:3779: warning: comparison between signed and unsigned integer expressions
- fix suncc warning (see [everything2](http://everything2.com/title/C%252B%252B%253A+static+extern+%2522C%2522 )):
> "lib/checkmemoryleak.cpp", line 578: Warning (Anachronism): Formal argument __compar of type extern "C" int(*)(const void*,const void*) in call to bsearch(const void*, const void*, unsigned long, unsigned long, extern "C" int(*)(const void*,const void*)) is being passed int(*)(const void*,const void*).
- prefer empty() / isEmpty() over "size() > 0" (cases not caught by stlSize)
- fix word misspellings (mostly comments, a few output lines)
- Parenthesis => Parentheses (both variations were used in the codebase)
- fix typo and wording ("never alwayw") in gui/test/data/benchmark/simple.cpp's CheckOther::unsignedPositive():
```
- "An unsigned variable will never alwayw be positive so it is either pointless or "
+ "An unsigned variable can't be negative so it is either pointless or "
```
2013-01-16 07:37:07 -07:00
PKEuS
f5ebbff0a3
Fixed #4460 : Ensure that memset/memcpy is called on a pointer to a class instance.
2013-01-05 12:27:55 -08:00
Robert Reif
d37906041b
Fixed #4458 (False positive: noCopyConstructor in template class)
2013-01-04 10:35:24 +01:00
Daniel Marjamäki
6e58ed3040
Fixed #4454 (False positive: class member (POD) not initialized (when initialized to 0 in initializer list))
2013-01-02 13:59:57 +01:00
Reijo Tomperi
5d5f7085bf
Updating year 2012 -> 2013 to .cpp and .h files and man page.
2013-01-01 18:29:08 +02:00
Robert Reif
d2e8ab9c86
Fixed #4302 (Member variable not initialized in public delegate constructor)
2013-01-01 09:53:40 +01:00
Daniel Marjamäki
bf169e0c59
Replaced %name% with %type%
2012-12-31 10:45:37 +01:00
Robert Reif
07d118dee5
Fixed #4449 (segfault in CheckClass::initializeVarList())
2012-12-29 08:30:14 +01:00
Robert Reif
bd2f59bdf0
Fixed #4442 (crash of cppcheck while scanning gcc-testsuite (invalid code))
2012-12-28 08:36:20 +01:00
Robert Reif
a43ae677d7
Fixed #4419 (False positive: Class does not have a constructor)
2012-12-27 17:21:30 +01:00
Daniel Marjamäki
b39afb2cf9
Revert "Fixed #4419 (False positive: Class does not have a constructor)"
...
This reverts commit 9a79961b6c
.
There is a segmentation fault when checking lib/preprocessor.cpp
2012-12-24 07:46:55 +01:00
Robert Reif
9a79961b6c
Fixed #4419 (False positive: Class does not have a constructor)
2012-12-24 06:46:30 +01:00
Robert Reif
80848c6e0e
Fixed #4383 (Improve check: uninitialized member variable not detected when initialization is not proper)
2012-12-21 19:36:45 +01:00
Robert Reif
5a7ede2563
Fixed #4391 (False positive: ctor not detected after variable declaration)
2012-12-10 06:01:29 +01:00
Daniel Marjamäki
1c4afbce8c
Cleanup: Removed += and -= patterns from the checks. These should be simplified.
2012-11-30 07:08:16 +01:00
PKEuS
b0c1c2c819
Don't suggest using initialization list for static variables ( #4332 )
2012-11-04 11:59:09 +01:00
Daniel Marjamäki
e1dce66494
tweaked message
2012-10-28 13:03:40 +01:00
Robert Reif
c7961b147d
speed up checks by caching commonly looked up stuff in the symbol database
2012-10-11 06:12:24 +02:00
Robert Reif
bbfd676b4e
speed up checks by caching commonly looked up stuff in the symbol database
2012-10-10 20:42:07 +02:00
Daniel Marjamäki
2f069f550f
Removed Java/C# handling
2012-10-02 18:44:36 +02:00
PKEuS
5980eb81d1
Fixed cppcheck message in checkclass.cpp
2012-09-29 12:19:30 +02:00
Daniel Marjamäki
990340ba98
Fixed #4072 (False positive: Structure is not initialized in the constructor (1.55))
2012-09-23 18:29:05 +02:00
Daniel Marjamäki
37695d44f3
Fixed #4085 (tinyxml2 false positives)
2012-09-22 16:49:28 +02:00
Daniel Marjamäki
6d928a2ff7
Fixed #4119 (false positive with operator= when implemented in terms of swap)
2012-09-22 08:50:36 +02:00
Daniel Marjamäki
a65f427195
Fixed #3836 (False positive: variable not initialized in copy constructor/operator (attached example code)
2012-09-22 08:16:16 +02:00
Daniel Marjamäki
de8e592d00
Class: Show inconclusive warnings about unknown types that are not initialized in copy constructors. Ticket: #3611
2012-09-20 19:16:26 +02:00
Daniel Marjamäki
07db469c06
cleaned up braces
2012-09-20 16:49:26 +02:00
Daniel Marjamäki
7d3e661774
Fixed #3611 (CheckClass: uninitVar and operatorEqVarError false positives (non-copyable members))
2012-09-20 16:47:01 +02:00
Daniel Marjamäki
3ff792560f
Deactived bad message. Ticket #4154
2012-09-17 18:10:11 +02:00
Daniel Marjamäki
25befccb26
Revert "CheckClass::copyconstructors: Removed check. Because there is unfixed ticket #4154."
...
This reverts commit 066a1d48fe
.
2012-09-17 17:59:35 +02:00
Daniel Marjamäki
066a1d48fe
CheckClass::copyconstructors: Removed check. Because there is unfixed ticket #4154 .
2012-09-17 16:18:27 +02:00
PKEuS
508e9394d3
Added some nullpointer-checks and removed some redundant ones based on VS2012 code analysis results.
2012-09-17 15:22:51 +02:00
PKEuS
4e59e55229
Refactorization/Partial rewrite of CheckClass::copyconstructors():
...
- Reformatted check code and some test cases
- Fixed false positives #4148 (non-copyable/unknown base classes) and #4178 (copy ctor implementation not seen)
- Proper usage of STL containers
- Better support for initializer list
- Rephrased error messages
2012-09-10 13:31:30 +02:00
Ettl Martin
9a375744a4
fixed a wrong spelled word in comments
2012-09-07 11:34:58 +02:00
gaurav kaushik
9ad7dfd5fd
Fixed #211 and #214
2012-09-05 12:58:09 +02:00
PKEuS
4550cd2cd6
Refactorizations:
...
- Removed unnecessary 'if'
- Use symboldatabase instead of tokenizer to detect references and pointers
2012-08-20 08:27:43 -07:00
PKEuS
1b40668e04
Refactorizations:
...
- Made several functions (Check*::myName and others) because they don't touch depend on a specific instance. (cppcheck findings)
- Removed description of a check in CheckConst that has moved to CheckIO
2012-08-02 09:50:48 -07:00
PKEuS
88e4794d6e
Refactorized CheckClass::checkConst:
...
- Added checking for functions that can be even declared static (#1971 . Removed fix for #1563 )
- Consistent usage of Function::TokenDef to avoid problems with scope identifiers
- Rewrote parsing of function body making it more generic
- Removed three redundant tests
2012-08-01 10:24:38 -07:00
Ville Skyttä
dce16a970d
spelling fixes
2012-07-31 21:28:42 +02:00
PKEuS
cc1faad34a
Removed bailouts in CheckClass::privateFunctions and CheckUnusedFunctions when checking code with templates (unnecessary after 2c10e9a6ca
)
2012-07-29 08:05:54 -07:00
PKEuS
5c0cab238f
Fixed useInitializationList false positives ( #3988 )
2012-07-23 08:16:47 -07:00
Ville Skyttä
7ab2f6a9fa
Spelling fixes.
2012-07-21 18:11:20 +02:00
PKEuS
e8f4dce25f
Added check to CheckInternal: detect invalid patterns like "%typ%"
...
Replaced some Token::Match by Token::simpleMatch (suggestions of internal checks)
2012-07-11 08:45:16 -07:00
PKEuS
37d9d6fd7e
Improved parsing of C++11 initializer list ( #3956 ) in CheckClass::initializeVarList.
2012-07-10 05:47:51 -07:00
Edoardo Prezioso
fae40c4782
Change every C version of 'size_t' to C++ 'std::size_t'.
2012-07-09 13:30:18 +02:00
PKEuS
639f15645a
Message refactorization: checkbufferoverrun.cpp (2), checkclass.cpp, checkexceptionsafety.h
2012-07-09 02:11:05 -07:00
PKEuS
7c1b0a7602
Issue useInitializationList message only on variables of class types.
2012-06-06 03:03:51 -07:00
PKEuS
9dc8123151
Refactorizations:
...
- Use const string references instead of const strings copies when possible
- Fixed cppcheck warning about postfix increment in CheckIO
- Use symbolDatabase to detect pointers in CheckOther::checkAssignBoolToPointer
2012-05-25 03:09:41 -07:00
PKEuS
dc64ac2918
Removed unnecessary variable Function::start - The value is already stored in Function::functionScope->classStart.
2012-05-22 12:58:46 -07:00
PKEuS
f3f46b4861
Fixed #3820
2012-05-22 02:27:21 -07:00
PKEuS
f5ef6f255e
Hande try and do in initialization list usage check ( #3823 )
2012-05-22 01:35:56 -07:00
Edoardo Prezioso
892c125ff8
Fixed: lib/checkclass.cpp:538:85: warning: declaration of ‘name’ shadows a member of 'this'.
2012-05-19 21:51:39 +02:00
PKEuS
e77f348d82
New check: Suggest to use initialization list instead of assignment in constructor. ( #489 )
2012-05-18 07:54:58 -07:00
PKEuS
77927583f4
Fixed two compiler warnings spotted by edward-san (one of them was a real bug)
2012-05-17 08:29:32 -07:00
PKEuS
4825f78663
Fixed #2477 and #2669
2012-05-17 02:15:21 -07:00
PKEuS
3f5712bfb8
Fixed false positive "Function can be const" when 'this' is passed to a Memberfunction
2012-05-17 01:49:52 -07:00
PKEuS
ea601ef2b0
Fixed false positives about const correctness caused by incorrect handling of default arguments
2012-05-17 01:05:36 -07:00
PKEuS
6a05ad1cf8
Improved fix for #2698 and added test case
2012-05-16 12:36:05 -07:00
PKEuS
77df633904
Improved handling of function calls in const correctness check: Fixed #2702 , #2698 , #2729 .
2012-05-16 11:57:12 -07:00
PKEuS
42fd19fb37
Refactorization in checkclass.cpp:
...
- Improved handling of pointers and constants in constructor checking (-> Fixed #3801 )
2012-05-14 12:50:23 -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
PKEuS
31a252b057
Fixed #3746 : Issue operatorEqToSelf error only if the operator takes an object of the class as argument.
2012-04-25 20:25:51 +02:00
PKEuS
af80344ab7
Refactorizations in checkclass.cpp:
...
- Removed local isVirtual implementation in checkclass.cpp, use Function::isImplicitlyVirtual instead
- Don't bailout when we see C++-style casts in checkConst
- Don't bailout for this pattern "any << member << any"
- Improved/Fixed some test cases (-> #1305 )
2012-04-18 18:51:38 +02:00
PKEuS
cb064dc20e
Implemented generic mechanism for '<'-'>' "linkage" before link() works (Taken from Scope::findClosingBracket, but C++11 right angle bracket support added): Token::findClosingBracket
...
-> Replaced several indendation-counting mechanisms in tokenize.cpp
Fixed build failure in checkclass.cpp
2012-04-18 16:02:03 +02:00
PKEuS
425cbea6b1
Improvements in checkclass.cpp:
...
- Generalized CheckClass::noMemset:
-- Checking for all three mem...-functions for all patterns, generalized them so that we need less patterns
-- Use nextArgument() to jump over irrelevant arguments
- Replaced CheckClass::hasDeallocation by CheckClass::hasAllocation:
-- Reduced number of false negatives by returning also true whenever a member variable is allocated (also without previous deallocation)
-- Reduced code duplication
- Removed indendation counter and redundant variable in CheckClass::initializeVarList
2012-04-05 09:43:40 +02:00
Stefan Weil
37b98c2a56
Fix compiler warning
...
gcc warning:
lib/checkclass.cpp: In member function ‘void CheckClass::checkConst()’:
lib/checkclass.cpp:1197: warning: declaration of ‘name’ shadows a member of 'this'
Rename local variable 'name' to 's'.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2012-04-04 20:39:11 +02:00
PKEuS
e6bcab7c35
Fixed #3360 : "type const* var;" is now recognized as variable declaration.
2012-03-24 15:10:06 +01:00
PKEuS
b964551424
Fixed #3252
...
Make use of std::isupper instead of custom implementation
2012-03-24 13:48:33 +01:00
PKEuS
8c657872d1
Check for unused private functions now handles overloads - removed redundant and less powerful duplicate of CheckClass::isVirtualFunc.
...
CheckClass::initializerList does now also check copy constructors
Started fix for #3682 : use reportInconclusiveError
2012-03-24 10:50:19 +01:00
PKEuS
533db6421f
Renamed ID uninitialized member variables in constructors to "uninitMemberVar" to avoid ambiguity ( #2715 )
...
Refactorizations:
- Replaced another single-token-pattern
- Replaced a "continue" with a "break" statement, because its safe to assume that only one variable with a specific ID can exist in a scope
2012-03-11 14:29:00 +01:00
PKEuS
9a5f66030c
Improved unused private function check:
...
- Fixed #3628
- Added support for friend
Improved symbol database:
- friend scopes are now set
- Added findScopeByName function
Refactorizations:
- Removed some unnecessary "virtual" keywords
- Removed unnecessary _filename member variable, pass it as argument instead
- Made CppCheck::replaceAll static, since it is independant from a specific CppCheck instance, Pass string to be modified by reference
2012-02-24 20:45:56 +01:00
PKEuS
96ae010e48
- Correctly set Scope::function variable in symboldatabase
...
- Refactorizations
- Fixed some cppcheck warnings
2012-01-21 10:08:09 +01:00
PKEuS
c294b15360
Removed more indendation counters.
2012-01-15 12:31:49 +01:00
Kamil Dudka
e09b0330e4
Class: Don't warn about uninitialized union members because they are often combined with a second variable
2012-01-08 12:17:55 +01:00
Reijo Tomperi
8cae17fda8
Update year to 2012
2012-01-01 01:05:37 +02:00
Edoardo Prezioso
8f2ad53332
Add testcase for previous commit.
2011-12-30 18:47:42 +01:00
PKEuS
dca03c3ce2
Remove unnecessary includes
...
Also add a unit test related to #3427
Also improve the description text in checkclass and remove unused variable.
2011-12-23 23:31:48 +02:00
PKEuS
4abee3a345
Refactorings. Use reportError instead of reportInconclusiveError.
2011-12-17 11:39:20 +01:00
PKEuS
e5427fe487
Fixed #3048 , further improvements to const correctness check.
2011-12-15 20:18:52 +01:00
PKEuS
00d6a0e877
refactorizations for CheckClass and for less false negatives related to derived classes
2011-12-14 21:11:40 +01:00
PKEuS
8ed8206b44
Fixed #3296 (false positive (inconclusive): 'C::operator=' should return 'C &')
2011-12-14 15:37:43 +01:00
Edoardo Prezioso
4cad5d4df4
Workaround fixes to shut up some cppcheck '--inconclusive' whinings.
2011-12-13 00:24:34 +01:00
PKEuS
167a7e3e51
Various code cleanups
2011-12-08 21:28:34 +01:00
Edoardo Prezioso
767413adad
1)internal check found a 'findmatch' with simple string argument;
...
2)Style: uniform 'while (...)' when inside it there's an assignment;
3)Replace '0' with 'NULL' where there's comparison with a pointer.
2011-12-01 12:04:47 +01:00
Daniel Marjamäki
323019c48f
Fixed #3355 (False positive: member variable initialization (::ZeroMemory))
2011-11-30 21:28:16 +01:00
PKEuS
6b6f780057
code cleanups and refactorings
2011-11-26 21:02:04 +01:00
Richard Quirk
b0574cd02e
Fix ticket #2233 (unused private static function)
2011-11-23 21:28:08 +01:00
Daniel Marjamäki
1b1fd9d39c
Fixed #3196 (False positive: member variable not initialized in constructor (union))
2011-11-22 19:26:00 +01:00
Daniel Marjamäki
add2b3706b
Fixed #3352 (False positive: member variable not initialized (3D array))
2011-11-22 18:45:25 +01:00
Daniel Marjamäki
648fcb9e42
operator= should return reference: Made check inconclusive. See ticket #3296
2011-11-21 08:00:10 +01:00
Edoardo Prezioso
6889a28d31
1) Run runastyle;
...
2) Clarify some comments in 'Tokenizer::simplifyFlowControl' and in 'Tokenizer::eraseDeadCode';
3) Add some 'const' variables inside 'Tokenizer::eraseDeadCode'.
2011-11-20 19:06:55 +01:00
Daniel Marjamäki
77925dc629
Class checking: made 'technically function x can be const' inconclusive
2011-11-20 16:54:06 +01:00
Edoardo Prezioso
a32b05197d
Change every 'tokAt(1)' to 'next()' and every 'tokAt(-1)' to 'previous()'.
...
Added a safety check to ensure that a 'previous()' call doesn't crash (not sure if it's needed or not).
2011-11-20 15:59:37 +01:00
Edoardo Prezioso
11dd3c09ce
Change every 'tokAt(1)->' to 'next()->' because 'tokAt(1) == 0' is equivalent to 'next() == 0', hence the equivalent cppcheck crash.
2011-11-20 15:09:57 +01:00
Edoardo Prezioso
42e369a4b4
Change every 'tokAt(..)->link()' to 'linkAt(..)'.
2011-11-20 14:24:27 +01:00
Edoardo Prezioso
2c64d299ca
Change every 'tokAt(...)->str()' to 'strAt(...)'.
2011-11-13 13:10:59 +01:00
Daniel Marjamäki
af7bf5c805
removed 'explicit constructors' check. see comments in pull request #51 for the reasons.
2011-11-02 17:12:46 +01:00
Edoardo Prezioso
9dd3360cd6
Fix some complainted choices made in my older commits.
...
Note: probably you should do 'make clean' before using 'make' to rebuild it again. Maybe it's me but 'make' reports various errors when linking.
2011-11-01 13:23:47 +01:00
Edoardo Prezioso
433f4640a9
Fix some GCC warnings regarding the sign conversion.
2011-10-30 18:34:49 +01:00
Edoardo Prezioso
4fc7e86d7d
Fixed: with checkConst and checkVariableScope wanted still required "information" settings instead of "style".
2011-10-30 10:58:15 +01:00
Richard Quirk
2ca932a3ae
Add checks for explicit constructors
...
Single-argument constructors should be explicit. Constructors with
multiple arguments should not be marked explicit.
2011-10-29 18:24:16 +02:00
Thomas Jarosch
434fb933a8
Implement Token::findsimplematch und use it for simple patterns
2011-10-27 15:59:22 +02:00
Thomas Jarosch
54adb910ec
Use Token::simpleMatch instead of Token::Match for simple patterns
2011-10-27 15:59:22 +02:00
Daniel Marjamäki
6f8e42a5af
changed the astyle formatting flags
2011-10-13 20:53:06 +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
272783347b
another variation of false negative from #3149
2011-09-30 16:26:08 -04:00
Robert Reif
1dcb8b2382
really fix #3149 (false negative: Technically the member function 'A::f' can be const.)
2011-09-30 11:16:34 -04:00
Robert Reif
556d523e4f
fix #3149 (false negative: Technically the member function 'A::f' can be const.)
2011-09-29 20:16:52 -04:00
Robert Reif
540207533b
fix #3008 (New check: Order of initialisation list)
2011-09-27 21:07:37 -04:00
Robert Reif
1717bda382
fix wrong information about constness of function
2011-09-16 18:07:25 -04:00
Robert Reif
2670525b4f
better fix for #3114 (infinite recursion when operator= is overloaded)
2011-09-14 19:58:11 -04:00
Robert Reif
2bc7da2c64
quick fix for #3114 (infinite recursion when operator= is overloaded)
2011-09-14 19:04:06 -04:00
Robert Reif
2d952c65e4
fix #3051 (False positive: operator= should return reference (when function takes pointer argument))
2011-08-28 11:14:15 -04:00
Robert Reif
9a0d076295
fix #3052 (False Positive - Technically the member function 'Example::Clear' can be const.)
2011-08-28 09:21:00 -04:00
Robert Reif
1d7ab77251
fix #3043 (False Positive - Member variable 'ProgramRecPriorityInfo::profile' is not assigned a value in 'ProgramRecPriorityInfo::operator=')
2011-08-25 23:27:10 -04:00
Robert Reif
c7cb38b0b5
fix #3040 (False positive - Technically the member function 'PSIPTable::SetSection' can be const.)
2011-08-22 20:34:00 -04: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
ac6d67dc4d
add support for using global qualified :: memset on class and class member initialization
2011-08-04 20:37:27 -04:00
Robert Reif
e687ee9a9a
assume all std::*::size() and std::*::empty() are const in CheckClass::checkConstFunc()
2011-07-30 10:30:31 -04:00
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
6eecab5d73
fix #2807 (Wrong handling of function references when prefixed with &)
2011-06-29 07:19:34 -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
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
Robert Reif
79e5d2db15
run astyle
2011-04-20 19:07:28 -04: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
77aebd357e
Refactoring: add Token::isAssignmentOp and use it in CheckClass::checkConstFunc
2011-04-09 14:36:05 -04:00
Robert Reif
a39444a40f
change CheckClass::operatorEqToSelf to make better use of the symbol database
2011-03-31 19:53:35 -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
dd5e15b40c
output a debug message when a member variable is used that has a varid of 0
2011-03-27 14:27:14 -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
c27ecf5aeb
only break when we know we are inc/dec a member variable in CheckClass::checkConstFunc
2011-03-25 23:22:28 -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
ca50bc7850
move 2 CheckClass helper functions to follow externally called functions so code matches comments
2011-03-25 22:21:40 -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
14c07e988e
fix pointer/reference check in CheckClass::noMemset symbol database conversion
2011-03-22 22:29:39 -04:00
Robert Reif
5314cc02b2
convert remainder of CheckClass::noMemset to use symbol database
2011-03-22 22:23:57 -04:00
Robert Reif
468a983db1
use the symbol database to look up base classes in CheckClass::noMemset check
2011-03-22 21:24:28 -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
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
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
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
31a18b9b23
convert CheckClass::noMemset to use new variable lookup capability
2011-02-26 16:00:05 -05: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
ba6c2ca310
fix #2602 (segmentation fault of cppcheck ( class A {A& operator=(const A&); }; ))
2011-02-22 06:47:28 -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
537ac0cb34
use func->start rather than searching for '{' in CheckClass::privateFunctions
2011-02-20 08:36:06 -05:00
Robert Reif
7dd8a3283a
fix comment in CheckClass::initializeVarList
2011-02-19 20:09:07 -05:00
Robert Reif
fef1142997
fix #2592 (False positive: 'operator=' should return reference to self)
2011-02-19 20:02:16 -05:00
Daniel Marjamäki
227a6100f7
astyle formatting
2011-02-11 19:31:37 +01:00
Robert Reif
b8c5426bb8
fix #2567 Unused private function when implemented in different file
2011-02-11 08:00:41 -05: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
Greg Hewgill
be195a72c9
initialise Check::_name in constructor rather than relying on virtual Check::name()
2011-02-02 22:58:25 +13:00
Daniel Marjamäki
524498e439
Tokenizer: collapse operator function names into a single token. ticket: #2519
2011-01-27 18:44:20 +01:00
Daniel Marjamäki
1e25d74ba4
Class: better check if there are friends. ticket: #2459
2011-01-22 17:35:54 +01:00
Daniel Marjamäki
9551332321
Fixed #2459 (False positive with unused private function and friend)
2011-01-22 13:00:03 +01:00
Robert Reif
767e01e24a
Fixed #2478 (Crash when trying to analyze files (CheckClass::checkReturnPtrThis))
2011-01-21 19:54:41 +01:00
Robert Reif
d73709a620
Symbol database: rename variables. ticket: #2468
2011-01-21 07:42:41 +01:00
Pete Johns
94aafa482c
Fixed #2480 (false positive on unused private function)
2011-01-19 20:32:08 +11:00
Pete Johns
ea01c04108
Added parenths to fix build breakage.
2011-01-18 21:07:33 +11:00
Robert Reif
8631ee65a3
Fixed #2474 (false positive: Member variable 'A::m_SemVar' is not initialised in the constructor.)
2011-01-18 07:34:11 +01:00
Robert Reif
c994508c3e
Symbol database: Refactor the variables API. ticket: #2468
2011-01-18 07:32:06 +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
Robert Reif
d341b42b0c
Symbol database: increased constness. ticket: #2468
2011-01-16 18:13:54 +01:00
Robert Reif
66be74a5af
Symbol database: Refactorings. Move check-specific code to check. Ticket: #2468
2011-01-16 16:37:11 +01:00
Daniel Marjamäki
a97e28491f
Fixed #2407 (False positive: unused private function)
2011-01-16 12:16:31 +01:00
Robert Reif
0f6644e1ea
Symbol database: Refactorings
2011-01-16 11:18:12 +01:00
Reijo Tomperi
226b605774
Change year 2010 -> 2011 in license texts.
2011-01-09 21:33:36 +02: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
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
b6acfa809b
Symbol database: creates a single symbol database within Tokenizer on demand and changes all checks to use it
2010-12-07 07:08:49 +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
1bc8a2b6ba
Fixed #2172 (False positive: struct is not initialized in constructor)
2010-12-02 07:35:01 +01:00
Kimmo Varis
1a3175741f
Fixed #2268 ([GUI] Generic class name is shown for 'Message' while correct one for 'Summary')
2010-12-01 17:55:22 +02: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
1842a122da
reuse symbol database in checkmemoryleak.cpp. ticket: #2219
2010-11-23 18:41:07 +01:00
Robert Reif
27cae2f0d7
Symbol database: add global space and add all global functions and variables to it. Ticket: #2198
2010-11-20 07:26:50 +01:00
Robert Reif
77a5d4e399
Fixed #2204 (False positive when using const class members)
2010-11-16 07:30:55 +01:00
Robert Reif
6a06970e1b
CheckClass: Refactoring - organize each check so the check function comes first, any helper functions come second, and the message functions come last. Ticket: #2198
2010-11-14 06:50:33 +01:00
Robert Reif
894586f4dd
Fixed #2198 (SymbolDatabase: separate SymbolDatabase from CheckClass)
2010-11-13 07:31:56 +01:00
Robert Reif
0fffa1f651
This patch fixes a bug I introduced in the previous patch. It also speeds up nested class parsing by skipping the entire class implementation using { link to jump to } rather than parsing for }. Ticket: #2172
2010-11-12 19:29:20 +01:00
Robert Reif
4ddf6f3b44
Symbol database: code cleanups
2010-11-10 16:52:52 +01:00
Daniel Marjamäki
508c171945
Symbol database: add support for class inline functions with classes
2010-11-09 17:06:07 +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
23b50a3d81
Symbol database: delay finding class variables until after all classes have been found.
2010-11-08 17:12:25 +01:00
Robert Reif
662cd27f87
Symbol database: fixed problem
2010-11-06 20:27:12 +01:00
Robert Reif
0205498a12
Symbol database: improved handling of out of line functions returning function pointers
2010-11-06 13:31:56 +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
9435fde551
Tokenizer: Added function for checking if code is Java/C#
2010-10-28 18:51:55 +02: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
6a66d32871
JAVA: better handling of java code
2010-10-20 22:15:35 +02:00
Ettl Martin
7d1995dfaa
Merge branch 'master' of github.com:danmar/cppcheck
2010-10-17 21:56:05 +08: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
Ettl Martin
f25f3c64b4
fixed style waring (You should use ++ and -- as prefix whenever possible as these are more efficient than postfix operators) in lib/checkclass.cpp
2010-10-17 20:15:29 +08: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
Robert Reif
a6e915f0cd
Fixed #2081 (false negative: the function can be declared as const)
2010-10-11 17:43:36 +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
6eeed00888
Fixed #2067 (Template methods do not 'use' private ones)
2010-09-30 21:22:49 +02:00
Daniel Marjamäki
21bf58f1ec
Optimisation: small optimisation of CheckClass::privateFunctions
2010-09-20 19:43:03 +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
Robert Reif
69afc0a0db
Symbol database: fixed false positive. ticket: #1895
2010-09-11 08:23:30 +02:00
Robert Reif
5a6eff90d1
Symbol database: Refactoring. ticket: #1895
2010-09-10 07:02:49 +02:00
Robert Reif
6d35396720
Symbol database: refactoring - differentiate between member data initialization and assignment and save the order of variable declarations. makes it possible to create some additional checks. ticket: #1895
2010-09-09 07:26:40 +02:00
Robert Reif
c3762903a9
Symbol database: fixed false negative for uninitialized variable. ticket: #1895
2010-09-09 07:21:51 +02:00
Daniel Marjamäki
3a4cda0f0d
Fixed #2034 (false positive: unused private function (Borland C++ __property))
2010-09-07 18:37:43 +02:00
Robert Reif
28c5893ee0
const functions: fixed false negatives for the type P. ticket: #1884
2010-09-06 19:04:14 +02:00
Robert Reif
80fdf1ca51
Symbol database: Fixed false negatives for unused private functions. Ticket: #1895
2010-09-02 19:22:54 +02:00
Robert Reif
cb318c21e3
Symbol database: adds support for inline functions returning function pointers and starts to convert privateFunctions over to the symbol database. Ticket: #1895
2010-09-02 07:40:20 +02:00
Robert Reif
4153b7d24b
refactoring namespace handling. ticket: #2001
2010-09-01 16:47:53 +02:00
Robert Reif
7a8190e188
Fixed #2002 (Wrong operator() parsing)
2010-09-01 06:32:46 +02:00
Robert Reif
4463f650d0
Fixed #2003 (false positive in set functions)
2010-08-31 17:59:17 +02:00
Robert Reif
5aab602709
Fixed #2001 (No 'The function ... can be const' warnings when base class is in namespace.)
2010-08-31 17:57:42 +02:00
Robert Reif
c56911ba6a
Fixed #2000 (segmentation fault of cppcheck with bitfield)
2010-08-31 17:51:10 +02:00
Robert Reif
96d73c189c
Symbol database: better handling of operator functions. Ticket: #1895
2010-08-30 17:14:20 +02:00
Robert Reif
a862e982ff
Fixed #1993 (False negatives: uninitialised variables in constructor)
2010-08-29 16:36:10 +02:00
Robert Reif
b1bf201a8a
Symbol database: Refactorings. Ticket: #1895
2010-08-28 11:23:23 +02:00
Daniel Marjamäki
d45186d645
Added --debug-warnings that we can use to enable various debug warnings
2010-08-27 20:28:00 +02:00
Daniel Marjamäki
0597c50a47
Fixed #1966 (False positive: Unused private function (virtual function in base class))
2010-08-26 22:05:45 +02:00
Robert Reif
7b2b844b8e
Fixed #1964 (False positive: function can be const (get this))
2010-08-20 19:47:41 +02:00
Robert Reif
66de0d8f72
Fixed #1954 (False positive: function can be const (derived class))
2010-08-20 07:28:31 +02:00
Daniel Marjamäki
cfa7b4906e
Symbol database: bug fixes. Ticket: #1895
2010-08-18 22:42:04 +02:00
Robert Reif
86f1718b1c
Symbol database: Fixed the error reporting so errors are shown in the gui. Ticket: #1895
2010-08-17 17:20:54 +02:00
Robert Reif
cc079462dd
Symbol database: fixed problems with namespaces. Ticket: #1895
2010-08-16 18:55:39 +02:00
Daniel Marjamäki
e1d6320a55
quick fix for #1905 (false positive: the function '...' can be declared as const (member array is assigned))
2010-08-15 08:30:21 +02:00
Robert Reif
556ef9afcf
Symbol database: report error when it is detected that a variable id is missing. Ticket: #1928
2010-08-15 08:03:27 +02:00
Erik Lax
54b7f972c9
Fixed #1932 (false positive: unused private function)
2010-08-15 07:44:08 +02:00
Robert Reif
7c18ece65d
Symbol database: Fixed bug when end of namespace wasn't found. Ticket: #1895
2010-08-14 08:16:53 +02:00
Robert Reif
db78c3acdf
Symbol database: fixed linenr problem in virtual destructors check
2010-08-13 23:57:53 +02:00
Robert Reif
ab7bb876f9
Symbol database: Refactoring virtual destructors check. Ticket: #1895
2010-08-13 18:34:02 +02:00
Robert Reif
a994f235c5
Symbol database: move finding base classes until after all classes are found because of template instantiation. Ticket: #1895
2010-08-13 07:35:30 +02:00
Robert Reif
b92644a30c
Symbol database: refactoring variable handling. Ticket: #1895
2010-08-13 07:34:34 +02:00
Robert Reif
47c776247a
Symbol database: fix a small bug and add more tests. ticket: #1895
2010-08-12 07:38:27 +02:00
Robert Reif
c88aa242e8
Symbol database: better handling of 'friend'. ticket: #1895
2010-08-11 22:36:04 +02:00
Robert Reif
03c436a735
Symbol database: Refactoring
2010-08-10 18:01:33 +02:00
Robert Reif
217b9425b5
Fixed #1922 (False positive: function can be const when both const and non-const functions are provided.)
2010-08-09 17:54:16 +02:00
Robert Reif
12523bc745
Symbol database: Enhancements and fixes. Ticket: #1895
2010-08-09 17:50:26 +02:00
Daniel Marjamäki
262885f3e0
Fixed #1921 (false positive: the function '...' can be declared as const (inline friend))
2010-08-07 16:08:44 +02:00
Daniel Marjamäki
050011d287
Fixed #1881 (false positive: The function '...' can be const (nonconst code is hidden inside #if))
2010-08-07 13:08:36 +02:00
Daniel Marjamäki
54121a74ff
Symbol Database: Don't use it when it is not needed
2010-08-07 12:41:11 +02:00
Daniel Marjamäki
adc47f1820
Fixed #1487 (fix gcc compiler warnings)
2010-08-06 21:02:43 +02:00
Robert Reif
0bb07e6947
Create a symbol database
2010-07-26 16:46:37 +02:00
Robert Reif
f2f5b3ebf0
Fixed #1883 (false positive: (style) The function 'A::SetPos' can be const)
2010-07-20 09:43:27 +02:00
Robert Reif
4cf92992a8
Fixed #1883 (false positive: (style) The function 'A::SetPos' can be const)
2010-07-19 13:16:11 +02:00
Robert Reif
37b37218cf
Fixed #1882 (false negative: function can be declared const)
2010-07-19 08:40:46 +02:00
Robert Reif
7842658cb4
Refactoring CheckClass::initializeVarList. Ticket #1811
2010-07-18 20:58:16 +02:00
Robert Reif
689de10abf
uninitialized class members: better handling of nested classes
2010-07-18 20:43:51 +02:00
Robert Reif
81a053aa90
Fixed #1311 (false negative: missing const not found in derived classes)
2010-07-18 10:18:41 +02:00
Robert Reif
9c4bbd4c65
Fixed #1730 (False negative in 'variable not initialized in ctor')
2010-07-17 12:26:05 +02:00
Robert Reif
ad9d1375aa
Fixed #1875 (CheckClass::getVarList: simplify function use)
2010-07-17 12:25:14 +02:00
Robert Reif
d72365ab00
Fixed #1375 (false negative: uninitialized member variables not found in nested class constructors)
2010-07-15 10:16:16 +02:00
Robert Reif
fd352865ca
CheckClass: Improvements and refactorings for constructors and variables checking
2010-07-14 19:00:52 +02:00
Daniel Marjamäki
a6b6022497
Fixed #1851 (false positive: Member variable not initialized int ctor)
2010-07-14 18:50:29 +02:00
Robert Reif
ab088bcec9
Fixed #1847 (False positive: Method using std::swap<>() can be declared const)
2010-07-13 08:04:48 +02:00
Daniel Marjamäki
76133e0234
Class checking: Fixed FP for static arrays (not initialized in constructor)
2010-06-29 12:51:18 +02:00
Daniel Marjamäki
9fd89d3bdc
Fixed #1495 (False -s positive: Member variable not assigned a value in operator=)
2010-06-24 20:09:26 +02:00
firewave
6fd4ba6e4f
Avoid Visual Studio warnings about constant expressions
2010-06-24 04:24:25 +02:00
Daniel Marjamäki
5de124280a
Fixed #1783 (false positive: uninitalized variable in constructor/operator=, when calling overloaded functions)
2010-06-13 10:23:59 +02:00
Robert Reif
18bb7488b9
Fixed #1787 (false negative: out of bounds in derived class)
2010-06-13 07:17:50 +02:00
Daniel Marjamäki
68ad8219ed
Fixed #1722 (Member variable initialized in call to base class constructor)
2010-06-06 08:29:35 +02:00
Martin Ettl
f75ca79849
applied patch from php-coder from ticket 1724; removed TODO_TESTCASES;
2010-06-05 19:49:49 +02:00
Daniel Marjamäki
82f030df2c
the virtual destructor error message needs to be restricted. marked the checking as inconclusive for now.
2010-05-29 11:19:28 +02:00
Robert Reif
4306082fcf
Fixed #1708 (False positive for const)
2010-05-25 06:55:49 +02:00
Robert Reif
78614b8dc1
Fixed #1699 (False positive: The function '...' can be const)
2010-05-20 17:45:10 +02:00
Robert Reif
5dfbb38dc9
#1697 (false positive: The function can be const)
2010-05-20 06:52:59 +02:00
Erik Lax
20289b1f5b
Fixed #1683 (false positive: The function can be const)
2010-05-16 20:26:32 +02:00
Daniel Marjamäki
6edb2e77b4
Refactoring: Removed Severity::possibleStyle
2010-05-16 14:43:42 +02:00
Daniel Marjamki
8e3c39ae5b
Fixed #1678 (false positive: Member variable not initialized in the constructor, for arrays of undefined type)
2010-05-15 20:24:11 +02:00
Daniel Marjamäki
84c3ec9c4c
Fixed #1669 (Still seeing 'possible style' warnings in 1.43)
2010-05-10 21:22:59 +02:00
Daniel Marjamäki
ae576be088
refactoring: enable the 'suspicious pointer subtraction' checking
2010-05-01 21:43:47 +02:00
Zachary Blair
c26e619b23
Fixed #855 (Refactoring: move conditions into checks)
2010-04-20 23:38:25 -07:00
Robert Reif
76a683a73a
Fixed #1602 (functions defined in header outside of class cannot be const)
2010-04-18 15:40:31 +02:00
Reijo Tomperi
35d2a27b9c
Update copyright year in all source files
2010-04-13 22:23:17 +03:00
Daniel Marjamäki
e9b4ea44a2
Refactoring: Disable inconclusive checks. They can still be activated for debugging/testing purposes
2010-04-10 14:05:33 +02:00
Daniel Marjamäki
21717e05cd
Refactoring: use more specific conditions instead of std::isupper. Only the A-Z are interesting. This also fixes compiler errors.
2010-04-10 09:46:50 +02:00
Daniel Marjamäki
d360c01675
Fixed #1579 (False positive: function can be const when return type is unknown)
2010-04-09 19:15:39 +02:00
Daniel Marjamäki
1328a57103
Fixed #1584 (False positive: (static) Member variable not assigned a value in operator=)
2010-04-09 18:35:54 +02:00
Daniel Marjamäki
1b81a9d435
Fixed #1537 ('Unused private function' when using pointer to member function)
2010-04-08 19:06:54 +02:00
Reijo Tomperi
7caaee3739
Fix some of the warnings that appear with -Wshadow
2010-04-06 22:53:05 +03:00
Reijo Tomperi
5aa88ee5a2
Fix vs warnings. Apply patch from kidkat.
2010-04-06 21:35:21 +03:00
Daniel Marjamäki
f8367da1fd
Refactoring: broke out copy/pasted code
2010-04-03 09:17:16 +02:00
Daniel Marjamäki
427d155644
Fixed #1527 (Function can't be const if it has non-const operator overload call)
2010-04-02 22:03:07 +02:00
Robert Reif
805c683c1a
Cleanup: Removed unneeded code
2010-04-02 18:55:27 +02:00
Robert Reif
3507b06e0b
Fixed #1563 (false positive: function can be const (assignment to static))
2010-04-02 08:02:47 +02:00
Robert Reif
1dcbf02bd8
Fixed #1553 (false positive : uninitialized variable for struct timeval from <sys/time>)
2010-04-02 07:36:18 +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
Robert Reif
2825773918
Fixed #1552 (false positive: function can be const (array of struct))
2010-04-01 17:01:52 +02:00
Robert Reif
2c5fb55c3b
Fixed #1551 (false positive: The function 'A::vSet' can be const)
2010-04-01 16:59:35 +02:00
Robert Reif
a8c9aa1f8d
Fixed #1550 (Improve check: Assignment to self)
2010-04-01 16:40:12 +02:00
Robert Reif
78e54e17f2
Unit testing: Added test case for memset. Ticket: #1538
2010-03-31 19:53:53 +02:00
Robert Reif
7fb5b9b67b
Better checking for assignment to self. Ticket: #1550
2010-03-31 17:09:59 +02:00
Daniel Marjamäki
c213227133
Fixed #1535 (False positive: member variable not initialized, struct with constructor)
2010-03-29 20:34:47 +02:00
Robert Reif
62d2845014
Fixed #1492 (false negatives: array index out of bounds)
2010-03-28 15:56:13 +02:00
Robert Reif
2dc4222c9a
Refactoring: Added CheckClass::isMemberFunc
2010-03-28 11:46:42 +02:00
Daniel Marjamäki
16124ce646
Fixed #1516 (C++Builder properties mistaken for uninitialized variables)
2010-03-28 10:58:03 +02:00
Martin Ettl
e4bda66b28
extended The function can be const test
2010-03-27 14:11:46 +01:00
Robert Reif
2eceaaefc0
Fixed #1519 (false negative: the function can be declared as const)
2010-03-26 20:14:31 +01:00
Robert Reif
45865f54a8
Fixed #1525 (false negative: the function can be declared as const (member declared as mutable))
2010-03-26 19:06:00 +01:00
Robert Reif
307000b448
Fixed #1529 (false positive: function can be const (struct member variable))
2010-03-26 18:16:33 +01:00
Daniel Marjamäki
258e7e292e
Fixed #1496 (false positive: Member variable not initialized in the constructor 'X::m_d')
2010-03-26 17:19:33 +01:00
Robert Reif
a1528d3154
Fixed #1522 (false positive: function can be const (assignment in return))
2010-03-26 16:30:30 +01:00
Robert Reif
e95bc41e59
Fixed #1522 (false positive: function can be const (assignment in return))
2010-03-24 19:31:30 +01:00
Robert Reif
9808a59cc1
Fixed #1515 (false positive: The function 'wxThreadInternal::SetExitCode' can be const)
2010-03-23 07:37:20 +01:00
Robert Reif
637a34bfd2
Fixed #1517 (false negative: the function can be declared as const)
2010-03-23 07:34:34 +01:00
Robert Reif
92fe14e7f0
Fixed #1491 (False positive when putting an access specifier at the end of a class declaration)
2010-03-19 17:40:23 +01:00
Robert Reif
89c57c72c5
small const fix
2010-03-16 07:31:40 +01:00
Daniel Marjamäki
9fe9be1ea9
Fixed #1465 (false positive: unintialized class member)
2010-03-13 20:24:39 +01:00
Robert Reif
846a3a0186
Fixed #1491 (False positive when putting an access specifier at the end of a class declaration)
2010-03-13 08:06:20 +01:00
Robert Reif
f552ca5462
Fixed #1482 (Improve check const-function: function can be made const when assignment not to member variable (false negative))
2010-03-12 18:30:20 +01:00
Robert Reif
09ab841789
Fixed #1486 (--errorlist shows two identical id values)
2010-03-10 07:47:01 +01:00
Daniel Marjamäki
dbc235bd39
Function constness: I don't think it's necessary to show both definition and implementation location. I changed so only the location of the definition is shown. This fixes #1486 .
2010-03-09 07:29:03 +01:00
Robert Reif
7c283d1321
Fixed #1321 (Improve check const-function: function that is not implemented inline can be made const)
2010-03-05 17:06:25 +01:00
Robert Reif
0da133f8a0
Fixed #1451 (false positive: operator = should return reference to self)
2010-02-25 07:26:59 +01:00
Daniel Marjamäki
8f4edb5e45
Fixed #1409 (False positive: Buffer access out-of-bounds with strncpy and an array in typedef'ed struct)
2010-02-21 15:23:50 +01:00
Daniel Marjamäki
d5611a1a06
Fixed #1426 (false positive: returning LPVOID can be const)
2010-02-21 10:19:28 +01:00
Daniel Marjamäki
d0348fa57a
Fixed #1403 (false positive: The function can be const)
2010-02-20 09:55:51 +01:00
Robert Reif
9e61e7dda8
Fixed #1405 (false positive: operator = should return reference t
2010-02-17 22:46:03 +01:00
Daniel Marjamäki
9394816fcf
Refactoring: Use std::string instead of const char *
2010-02-14 19:58:17 +01:00
Daniel Marjamäki
0a6aa0f094
Fixed #1376 (Member variable not initialized in the constructor false positive)
2010-02-10 19:28:51 +01:00
Robert Reif
9591e09dd0
Fixed #1344 (false negative: missing const not found)
2010-02-08 07:25:19 +01:00
Daniel Marjamäki
fb09b2fd37
Fixed #1356 (Double-False positive: uninitialized variable)
2010-02-07 13:34:39 +01:00
Daniel Marjamäki
9e6ea07c14
CheckClass::noMemset: Refactoring so it handles more complex std template types
2010-02-04 21:49:58 +01:00
Daniel Marjamäki
da7e75f69e
Class checking: Minor refactoring when analysing memset on class
2010-02-04 20:53:04 +01:00
Daniel Marjamäki
9943262da0
Fixed #1287 (Use of memset on struct - std template types not handled)
2010-02-04 19:40:35 +01:00
Reijo Tomperi
6e48f57826
Remove debug print
2010-01-29 23:24:16 +02:00
Reijo Tomperi
1d5ba4e320
Improved updateClassList(), but not yet took it into use.
...
findClassFunction is now non-static.
updateClassList usage is currently commented out as it doesn't handle class inside a function
2010-01-29 23:22:18 +02:00
Daniel Marjamäki
f561441d90
Fixed #1319 (false negative: missing const not found)
2010-01-29 19:38:56 +01:00
Robert Reif
94c5d92b2b
Fixed #1323 (segfault with style in CheckClass::operatorEqRetRefThis())
2010-01-29 16:04:27 +01:00
Daniel Marjamäki
e12d115e9a
Fixed #1312 (false positive: missing const message on functions returning references)
2010-01-25 21:40:57 +01:00
Daniel Marjamäki
7ce4825f95
Fixed #1308 (False positive: The function 'x' can be const for a static member function)
2010-01-24 18:26:39 +01:00
Daniel Marjamäki
25ba399a50
const class functions: refactorings
2010-01-24 13:45:56 +01:00
Daniel Marjamäki
b4b97e5706
const: fixed false positive when using increment/decrement
2010-01-24 13:33:30 +01:00
Daniel Marjamäki
a0d8f44603
CheckClass: The operator< etc member functions can often be const
2010-01-23 22:36:04 +01:00
Daniel Marjamäki
aab05524e5
Fixed #1305 (False positive: The function 'x' can be const when indirectly calling a non-const member)
2010-01-23 21:08:40 +01:00
Daniel Marjamäki
9a6b450501
Fixed #1304 (False positive: The function 'x' can be const when modifing a member)
2010-01-23 20:59:20 +01:00
Daniel Marjamäki
5b76be4935
Fixed #1303 (False positive: The function 'x' can be const for a constructor)
2010-01-23 20:47:29 +01:00
Daniel Marjamäki
fb10396cb3
only run CheckClass::checkConst if style checking is on
2010-01-23 09:38:35 +01:00
Daniel Marjamäki
35c303943f
Partial fix for #13 - detect simple cases of member functions that can be const
2010-01-23 09:19:22 +01:00
Daniel Marjamäki
e9c8e1d8b1
doxygen and minor refactorings
2010-01-22 19:29:24 +01:00
Daniel Marjamäki
59de7934b7
Fixed #643 (Member variable not initialized not detected if any unknown function called)
2010-01-22 18:51:25 +01:00
Daniel Marjamäki
96359b14ff
Simplify function pointers
2010-01-20 21:19:06 +01:00
Daniel Marjamäki
81ca6e9f98
Revert "minor tweak in Borland C++ project file"
...
This reverts commit ad06ee4f71
.
2010-01-16 08:47:46 +01:00
Daniel Marjamäki
ad06ee4f71
minor tweak in Borland C++ project file
2010-01-16 08:17:40 +01:00
Daniel Marjamäki
2de49129dc
Fixed #1259 (false postive: Member variable 'A::b' is not assigned a value in 'A::operator=')
2010-01-12 21:36:40 +01:00
Robert Reif
60ef3ef872
Fixed #1233 (false positive: operator = should check for assignment to self)
2010-01-08 19:15:24 +01:00
Daniel Marjamäki
485f3c7708
Fixed #1221 ([False positive] Member variable not initialized with operator[] gives wrong result)
2010-01-06 19:04:15 +01:00
Robert Reif
e6cc897e29
Fixed #1224 (segmentation fault of cppcheck)
2010-01-05 21:55:33 +01:00
Robert Reif
2a546dc9c0
Fixed #1184 (improve test: operator =)
2010-01-03 08:26:02 +01:00
Robert Reif
bcafb30d0d
Fixed #1211 (add struct support for constructor checks)
2010-01-02 17:29:55 +01:00
Robert Reif
12641e2d76
Fixed #1184 (improve test: operator =)
2009-12-31 13:44:03 +01:00
Robert Reif
3a46ef0487
Fixed #1176 (void operator = check doesn't support struct)
2009-12-30 18:40:02 +01:00
Daniel Marjamäki
58e85d55e3
astyle formatting
2009-12-29 07:50:33 +01:00
Daniel Marjamäki
905533552d
Robert Reif: Fixed #1164 (only first void operator = found)
2009-12-29 07:48:37 +01:00
Daniel Marjamäki
74b9bccd07
code cleanup
2009-12-20 09:02:25 +01:00
Daniel Marjamäki
e7c0e4d482
Fixed #1093 (False positive: missing constructor)
2009-12-19 17:58:52 +01:00
Daniel Marjamäki
01cfa3b6bd
Fixed #1072 (False positive: class member initialization with '*p=0;')
2009-12-13 09:36:59 +01:00
Daniel Marjamäki
4d185f0935
Fixed #1080 (false positive: member variable not initialized)
2009-12-11 21:34:04 +01:00
Daniel Marjamäki
c2a37c5d69
class checking: It's a 'possible style' error if a private constructor is not initializing a member variable
2009-12-06 18:35:32 +01:00
Daniel Marjamäki
39614a699e
Uninitialized variables: detect uninitialized pointer array
2009-11-10 19:35:54 +01:00
Daniel Marjamäki
c301dc1907
Fixed #928 (false positive: member variable not initialized in constructor)
2009-11-10 19:30:37 +01:00
Reijo Tomperi
80c66f8ebc
Fix #895 (false positive: Suspicious pointer subtraction)
...
http://sourceforge.net/apps/trac/cppcheck/ticket/895
2009-11-04 21:36:27 +02:00
Daniel Marjamäki
09859c1019
refactoring the folder structure
2009-10-25 12:49:06 +01:00