Commit Graph

261 Commits

Author SHA1 Message Date
Stefan Beller e0d71de23a symboldatabase: Remove unneeded check
scope1 cannot be null at that point of time. If it were, the program
would have crashed, before (it's dereferenced ->)
This commit doesn't just remove dead code, but eliminates a tricky bug,
possibly introduced by over-optimizing compilers:
An explanation why the compiler could produce bad code here is found at
http://blog.regehr.org/archives/970

This commit was enabled by http://css.csail.mit.edu/stack/

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
2013-08-20 14:06:20 +02:00
Robert Reif bf8a786265 reduce: add more settings from cppcheck cli 2013-08-19 06:06:53 +02:00
Robert Reif 914893013e Symbol Database: improved type handling. Ticket: #4952 2013-08-17 18:43:15 +02:00
Robert Reif b777388fb8 Symbol database: improved type handling (fix problems in previous commit). Ticket: #4952 2013-08-16 05:42:12 +02:00
Robert Reif f420de24ef SymbolDatabase: Optimisation of previous fix for #4952 2013-08-13 06:36:54 +02:00
Robert Reif cd3044c808 Fixed #4952 (SymbolDatabase: unknown types in log file) 2013-08-12 06:21:03 +02:00
PKEuS a9a5dc0354 Updated to AStyle 2.03, require this version 2013-08-07 16:27:37 +02:00
Robert Reif e6ab8f478b Symbol database: improved handling of array members 2013-07-20 17:51:13 +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
Daniel Marjamäki 4106972fdc Merge pull request #148 from JustRamires/master
Fixed segmentation fault in SymbolDatabase::SymbolDatabase(Ticket #4892)
2013-07-09 02:55:46 -07:00
Roman Zaytsev Borisovich 295869a866 Fixed segmentation fault in SymbolDatabase::SymbolDatabase(Ticket #4892) 2013-07-09 13:10:03 +04:00
Lucas Manuel Rodriguez d177c8fd03 Fixed #4824 (False positive: (warning) Member variable 'Foo::m_state' is not initialized in the constructor.) 2013-07-08 06:38:33 +02:00
Zachary Blair a381170886 Fixed #4874 (Minor spelling corrections) 2013-06-26 00:47:02 -07:00
Alexander Mai 0be1892b92 Fixed #4806 (Crash in Type::initBaseInfo() in clang testcode) 2013-06-16 21:46:01 +02:00
Roman Zaytsev Borisovich 4610b135dc Fixed #4694 2013-06-07 10:37:33 +04:00
Robert Reif 2c8360c607 Fixed #4789 (uninitMemberVar not found when constructor contains default parameters) 2013-05-18 18:33:24 +02:00
PKEuS cf5d8fa3df Use Token::link() instead of Token::findClosingBracket() whereever possible 2013-04-15 13:48:28 -07: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
PKEuS eb2962792f Implemented support for move constructors:
- Changed behaviour of Token::function - is now also set for declarations
- Resolved TODO in testclass.cpp
- removed redundant code in Scope::findFunction - it is safe to call nextArgument() on functions without arguments
- Use Token::function in checkother.cpp
2013-04-04 10:53:55 -07:00
PKEuS 188096665c Implemented support for rvalue references (C++11):
- Split up && when it is part of an rvalue reference declaration
- Added support into symbol database
- Current implementation sets Variable::isReference() to true also for rvalue references - they can probably be treated like normal references in many checks.

Changed behaviour of symbol database: Insert argument Variable of functions that are not implemented into SymbolDatabase::_variableList
2013-04-04 09:47:44 -07:00
Robert Reif a3f9b5c07d Fixed #4686 (Prefer prefix ++/-- operators for non-primitive types with template iterator) 2013-03-30 13:49:56 +01:00
Robert Reif 3f57b5a6ca Fixed #4682 (using 'struct' disables checking) 2013-03-28 06:36:49 +01:00
Daniel Marjamäki c0a34649c4 fixed 'duplicate expression' false positives for float-float. Ticket: #4639 2013-03-14 19:11:29 +01:00
PKEuS 641ac5c02a Fixed #4352: Ensure that class provides an iterator interface. 2013-03-14 09:00:22 -07:00
Robert Reif 4b9b87e310 Fixed #4646 (false positive: (style, inconclusive) Technically the member function 'C<T>::operator+=' can be const.) 2013-03-14 06:34:12 +01:00
Robert Reif ee942c5592 Symbol database: Fixed --debug printing. Ticket: #4650 2013-03-13 06:31:13 +01:00
PKEuS 14feaa8d39 Refactorizations:
- Fixed lots of cppcheck messages about functions that can be const or static
- Fixed possible nullpointer dereference message in symboldatabase.cpp
- Replaced tokAt(+-1) by next()/previous()
2013-03-12 07:42:00 -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 1fbef0e4e6 Reduced code duplication in symboldatabase 2013-03-05 10:53:24 -08: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 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
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 21bf5173e5 Symbol database: faster implementation. Ticket: #4494 2013-02-20 07:46:06 +01:00
Robert Reif e6915e7a78 Fixed #4536 (non-static member initializer causes false positive) 2013-02-18 06:33:53 +01:00
PKEuS 89cf24f23f Refactorization: use Function::nestedIn instead of Function::functionScope->functionOf, which is valid even if the function implementation is not seen. 2013-02-16 01:43:16 -08:00
Robert Reif c5ee083c82 Fixed #4388 (false positive 'noConstructor' in 1.57) 2013-02-15 06:44:07 +01:00
Robert Reif a1da067b88 Fixed #4585 (false positive, Variable 'b' is assigned a value that is never used when using+loop) 2013-02-14 06:31:41 +01:00
Robert Reif 5de26bfeb9 Fixed #4574 (noConstructor false positives introduced in cppcheck 1.58) 2013-02-13 06:00:04 +01:00
Robert Reif 1a58ae4994 Symbol database: handle when forward declaration doesn't match declaration. Ticket: #4531 2013-02-01 06:31:02 +01:00
Robert Reif 859793731d SymbolDatabase: Refactor findFunction handling. Ticket: #4494 2013-01-28 06:47:48 +01:00
Robert Reif a0d8fd26fe SymbolDatabase: improved handling of const in function parameters 2013-01-27 02:46:00 +01:00
Robert Reif 3b08b410a2 Symbol database: Improved function lookup (a.b.f()). Ticket: #4494 2013-01-25 06:49:04 +01:00
Robert Reif cecd726b11 Symbol database: Improved function lookup for foo.f(). Ticket #4494 2013-01-23 16:53:55 +01:00
XhmikosR 645126fb8e remove double trailing semicolons 2013-01-23 06:48:21 +01:00
Robert Reif ddb604d1a5 Symbol database: function lookup when :: is used. Ticket #4494 2013-01-22 06:55:25 +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
Thomas Jarosch 5c8b05ce94 Use Token::simpleMatch() for simple pattern
"internal" check reported:
[lib/symboldatabase.cpp:945]: (warning) Found simple pattern inside Token::Match() call: "> ("
2013-01-15 20:34:11 +01:00