Commit Graph

526 Commits

Author SHA1 Message Date
Matthias Krüger 49e2573b5c fix -Wodr warning/violation putting struct 'VarInfo' into anonyous namespace
Was:

lib/checkclass.cpp:1994:8: warning: type ‘struct VarInfo’ violates one definition rule [-Wodr]
 struct VarInfo {
        ^
lib/checkleakautovar.h:32:7: note: a different type is defined in another translation unit
 class CPPCHECKLIB VarInfo {
       ^
lib/checkclass.cpp:1998:21: note: the first difference of corresponding definitions is field ‘var’
     const Variable *var;
                     ^
lib/checkleakautovar.h:40:39: note: a field with different name is defined in another translation unit
     std::map<unsigned int, AllocInfo> alloctype;
2015-09-08 16:57:28 +02:00
Simon Martin b4b636b6a2 Ticket #6959: Properly handle arrays of pointers in CheckClass::constructors. 2015-08-29 13:11:00 +02:00
Simon Martin 101cebbde1 Ticket #6957: Properly handle arrays of pointers in CheckClass::constructors. 2015-08-28 23:06:39 +02:00
Dmitry-Me 0cef076f10 Prefer previous() to tokAt(-1) 2015-08-28 15:19:24 +03:00
Simon Martin 2e2f9facf5 Ticket #6953: Fixed flawed logic in PR#650. 2015-08-27 23:35:22 +02:00
Simon Martin 8beb95e179 Fix CheckClass::checkMemset for arrays of pointers. 2015-08-23 19:57:58 +02:00
PKEuS ab8afec3eb Refactorizations:
- Avoid unnecessary loop iterations
- Avoid unnecessary condition checking
- Reduced code duplication in symboldatabase.cpp
2015-08-16 14:23:07 +02:00
PKEuS 4d80df2f4a Added pointer to Type to Token (similar to Token::Variable() and Token::function()):
- Accessible via Token::type()
- Renamed former Token::type() to Token::tokType()
- Removed SymbolDatabase::isClassOrStruct()
2015-08-15 11:19:21 +02:00
PKEuS b0bf69bae7 Fixed false positive #6763 and reordered conditions
Ran AStyle
2015-08-14 12:50:45 +02:00
PKEuS 8ed0180279 Use C++11 string.back() instead of string[string.length()-1] 2015-07-25 17:19:53 +02:00
PKEuS a3eb725c3f Support C++03-style of declaring a copy ctor as deleted (#6585) 2015-07-21 13:46:50 +02:00
Alexander Mai defee734f5 #6846 segmentation fault (invalid code) in CheckClass::hasAssignSelf 2015-07-20 19:04:34 +02:00
Alexander Mai 6e03e7dca2 Remove some code checking for invalid class hierarchy which got obsolete since 480a5672b0. Run astyle 2015-07-01 07:50:13 +02:00
Alexander Mai 40d7baa6bb Fix more (potential) multi-threading issues by moving static local vars (non-POD-type) to file scope 2015-06-13 16:22:43 +02:00
amai2012 e41beb4f8d Fix #6718 and #6719 (crashes on garbage code).
Local fixes avoiding access to NULL-token.  Also minor correction to
TemplateSimplifier::hasComplicatedSyntaxErrorsInTemplates()
2015-05-29 18:34:00 +02:00
Alexander Mai f0bc300198 #6510 False positive performance warning for std::list::size(). Fix this and other similar false positives. Refactoring of Variable::isStlType(), use fail-safe std::set instead of plain array. Run astyle 2015-05-17 20:02:41 +02:00
Daniel Marjamäki 88f59ad7e8 Partial fix for #6656 (Allow that CWE is mapped for error message) 2015-04-25 17:48:11 +02:00
Daniel Marjamäki ad6db2ba81 Reverted 105de8e917, new checker had FPs that need to be fixed. 2015-04-25 15:35:31 +02:00
Matthias Krüger 42f0955e3f Move more setting checks out of loops and use const bools instead. Reorder a few related checks.
Follow up to eedcb6abcb .
2015-04-10 14:31:19 +02:00
Gustav Palmqvist 105de8e917 #220 uninitialized variable: using variable in ctor before it has been initialized. Implement new check usageBeforeInitialization 2015-04-07 22:01:13 +02:00
Matthias Krüger eedcb6abcb move setting flags checks out of for loops, make them const. 2015-04-07 07:23:28 +02:00
Frank Zingsheim 1f5265c1bd Fixed #6253 ([False Positive] Variable not initialized in the constructor) 2015-04-06 19:47:21 +02:00
Matthias Krüger 592177200a don't print warning message if --enable=warning is not given.
message was of type:
(warning) Call of pure virtual function 'foo' in constructor.
2015-04-06 13:34:44 +02:00
Dmitry-Me 0383998aea Better variable name 2015-03-23 11:58:56 +03:00
PKEuS cd84d78e92 Ran AStyle, fixed VS2015 warning in symboldatabase.h 2015-03-11 20:26:53 +01:00
Jakub Melka e1e1dbfe97 Ticket #695: Fixed VS 2010 issue, switched to "style" severity, changed error messages and updated unit tests 2015-03-10 19:35:12 +01:00
Jakub Melka 2af9212b16 Ticket #695: new style check : explicit declaration of ctor 2015-03-07 20:07:54 +01:00
Alexander Mai 26c2c4a824 Extend verbose message for memsetClassFloat 2015-02-22 15:41:02 +01:00
PKEuS 18b0e14590 Refactorizations: Fixed a pattern in checkbufferoverrun.cpp, simplified one in checkclass.cpp 2015-01-31 12:32:05 +01:00
PKEuS b2835051df Refactorization: Renamed Token::Match pattern %var% to %name%, implement new pattern %var% which is true if varId > 0. 2015-01-31 12:32:04 +01:00
Dmitry-Me c79bfdce2c CheckClass: Better checking of what operator= returns 2015-01-24 11:18:33 +01:00
Thomas Jarosch fd01cafb1b Clean up redundant pointer operations 2015-01-17 16:29:50 +01:00
Robert Reif ba1c24ee65 Fixed #6422 (symbol database: put function flags into a single flag variable) 2015-01-08 05:45:31 +01:00
Daniel Marjamäki ff11ba9847 Updated copyright year to 2015 2015-01-03 12:14:58 +01:00
Dmitry-Me 14f13afa0a Don't care which type protected operator= returns 2014-12-26 15:38:22 +01:00
Dmitry-Me 5e37275b2a Code cleanup. Use 'isDelete' instead of token match 2014-11-28 17:50:23 +01:00
Dmitry-Me f926958acb Fix false positive about return type when there's =delete in operator= declaration 2014-11-25 15:52:52 +01:00
Robert Reif d12f14844a Fixed #6279 (False Positive: Member variable 'Fred::i' is not initialized in the constructor) 2014-11-20 06:18:29 +01:00
Robert Reif 67385cfc4b Symboldatabase: improved look up of delegate constructors 2014-11-13 06:29:51 +01:00
PKEuS e5d63195cb Fixed #5983: Support storing pointers/references to member variables in CheckClass::checkConst() 2014-11-02 13:38:03 +01:00
PKEuS 38af865560 Fixed false positive: Member variable not initialized in the constructor with array and (*this) (#5754) 2014-09-29 16:49:20 +02:00
PKEuS 03b1afc28c Loops over all varIds should start at 1. 2014-09-28 09:47:11 +02:00
PKEuS e8f7279039 Refactorization: Moved detection of STL strings to SymbolDatabase 2014-09-05 12:03:08 +02:00
PKEuS a8dc17c1d9 Fixed false positive #5566. 2014-08-26 11:29:26 +02:00
PKEuS f01d7543f6 #6077: Don't warn about memcpy/memmove on class containing floats. 2014-08-20 15:12:53 +02:00
PKEuS 8188578cf2 SymbolDatabase: Fixed handling of nested types for function arguments
Removed unnecessary loops between var->typeStartToken() and var->typeEndToken()
2014-08-19 11:55:00 +02:00
PKEuS 5d302716e7 Refactorized Variable::isIntegralType() and Variable::isFloatType():
- Cached property
- Make use of it in several checks
- float* is flagged as floating point type
2014-08-09 11:45:13 +02:00
PKEuS 728d0fb9dc Merge pull request #390 from Dmitry-Me/suppressGccShadowingWarning
Avoid GCC name shadowing warning.
2014-08-09 10:34:36 +02:00
PKEuS c4635cf698 Improved check: portability message when calling memset on a class with floating point numbers (#5421) 2014-08-08 09:49:09 +02:00
PKEuS e4b55cf843 Fixed a bug and two warnings introduced recently. 2014-08-06 13:35:39 +02:00