Commit Graph

4805 Commits

Author SHA1 Message Date
Frank Zingsheim d387e8b770 Fixed #4711: (false positive: Consecutive return...) 2013-05-11 17:50:59 +02:00
Daniel Marjamäki 2f1050595d CppCheck: Added _simplify flag that can be used by clients to disable simplifications 2013-05-11 11:35:04 +02:00
Daniel Marjamäki b6bcdf2936 Fixed #4520 (segmentation fault of cppcheck (preprocessing)) 2013-05-09 18:50:24 +02:00
PKEuS fb480ebb0a Now really fixed #4604. 2013-05-09 15:39:33 +02:00
PKEuS 881b47e79d Revert "Improved handling of 0 initializations (#4604)"
This reverts commit 1201e417ec.
2013-05-09 15:32:02 +02:00
PKEuS 0a104c40b7 Fixed "Improved handling of 0 initializations (#4604)"
This fixes commit 1201e417ec.
2013-05-09 15:25:36 +02:00
PKEuS 982b9491d4 Improved handling of 0 initializations (#4604) 2013-05-09 06:23:25 -07:00
PKEuS c42b89fb88 Revert "Improved handling of 0 initializations (#4604)"
This reverts commit 1201e417ec.
2013-05-09 15:19:23 +02:00
PKEuS 1201e417ec Improved handling of 0 initializations (#4604) 2013-05-09 06:17:10 -07:00
Daniel Marjamäki cbe0a0825c Fixed #4725 (Tokenizer: Replace block declaration (^{}) with asm()) 2013-05-09 14:47:18 +02:00
Daniel Marjamäki 455b07a641 CheckAssert: Fixed shadow variable warning 2013-05-09 06:29:12 +02:00
Lena Herscheid e23038c4de Fixed #4775 (Check for assert() with side effects) 2013-05-07 21:35:16 +02:00
Daniel Marjamäki 67979f00be ErrorLogger: Make sure Token class is known 2013-05-07 18:18:15 +02:00
Frank Zingsheim bca751b9f4 Fixed #4773 (Regression: wrong detection of unitialized variable) 2013-05-06 18:45:00 +02:00
Daniel Marjamäki 4659745106 Fixed #4786 (segfault with one LibreOffice file) 2013-05-06 16:56:34 +02:00
Daniel Marjamäki 3f5a858800 dmake: update Makefile 2013-05-05 09:22:04 +02:00
Daniel Marjamäki ea60c5b14b CheckBufferOverrun: Code cleanup 2013-05-05 08:14:19 +02:00
Daniel Marjamäki 079d22fbee Fixed #4734 (False 'Possible null pointer dereference') 2013-05-03 16:18:44 +02:00
Zachary Blair de8ee5b042 Fixed #4554 (false negative: buffer access out of bounds) 2013-05-02 21:50:48 -07:00
Daniel Marjamäki bfb1bc50e3 Fixed #4760 (false negative: (error) usage of uninitialized variable (struct member)) 2013-05-02 20:34:15 +02:00
Daniel Marjamäki 44cb070e13 Fixed #4737 (False positive: Uninitialized variable 'do_something(&((char*)&var)[0],1);') 2013-05-01 13:52:28 +02:00
Frank Zingsheim 42068a3d60 Fixed #4767 (segmentation fault in expand template) 2013-05-01 13:28:01 +02:00
Daniel Marjamäki 287782a679 Fixed #4390 (False alarm 'Object pointed by an auto_ptr is destroyed using operator delete. You should not use auto_ptr for pointers obtained with operator new[].') 2013-05-01 11:11:57 +02:00
Daniel Marjamäki b2798e929d Improved fix for #4455, no false negatives if variable is used before first memset 2013-04-30 16:56:44 +02:00
Daniel Marjamäki cf75e2bb28 astyle formatting 2013-04-30 06:44:50 +02:00
Daniel Marjamäki 47ef8cf455 Fixed #4455 (redundantCopy when precleaning with memset) 2013-04-30 06:43:16 +02:00
Zachary Blair 1f97e0e5df Ticket #4510 - Reduced the scope of the safeFunctions variable to avoid a cppcheck style issue 2013-04-26 20:06:17 -07:00
Baris Demiray 548dd42aaf Fixed #933 (Leaks with struct members not detected) 2013-04-26 16:11:57 +02:00
Zachary Blair 2bc67d72c2 Ticket #4510 - Fixed a Travis build error resulting from reporting a warning when warnings are not enabled 2013-04-26 00:19:39 -07:00
Zachary Blair 35668380cf Fixed #4510 (False positive: "Possible null pointer dereference if the default parameter value is used" after init) 2013-04-25 00:25:56 -07:00
Daniel Marjamäki c3d1274db3 Reverted 'simplify NOT' since there are problems related to signedness of numeric values. 2013-04-24 06:32:34 +02:00
Daniel Marjamäki e1dd14626c Fixed #4735 (FP: Mismatching assignment and comparison) 2013-04-23 06:47:15 +02:00
Daniel Marjamäki a5b044a6e2 Fixed #4754 (False positive: Map literals trigger redundant code warning) 2013-04-20 07:51:44 +02:00
Daniel Marjamäki 9f8ce6f77f Fixed #4729 (Tokenizer::setVarId: Varid not tracked properly after function declaration with 'shadow' parameter name) 2013-04-19 18:36:16 +02:00
PKEuS c2664a063e Use existing Standards object instead of creating new one
Made const dummy variable static
2013-04-18 04:24:09 -07:00
Ettl Martin 21f9adf15e Merge branch 'master' of github.com:danmar/cppcheck 2013-04-16 11:26:08 +02:00
Ettl Martin cb343bd718 fixed typo in reporting Error 2013-04-16 11:25:45 +02:00
PKEuS cf5d8fa3df Use Token::link() instead of Token::findClosingBracket() whereever possible 2013-04-15 13:48:28 -07:00
Daniel Marjamäki 9ad39ca4c0 Fixed #4544 (Crash with this line : class CD : public CC< class CB< CA > >) 2013-04-12 16:38:12 +02:00
Daniel Marjamäki e8fbd39efd Templates: better handling of 'X<class Y>' template instantiations. Ticket: #4544 2013-04-11 18:58:39 +02:00
Ettl Martin e03a3946d0 avoid crash in checkother:wrongPipeParameterSize when a pointer with unknown size is provided. 2013-04-11 14:22:22 +02:00
Ettl Martin 33cfc1a52e fixed #4726: simplify bitwise Not (~ %num%) 2013-04-11 09:16:40 +02:00
Daniel Marjamäki a49fc57e00 Tokenizer: don't simplify 'a!=(b!=0)' to 'a!=b'. Ticket: #4697 2013-04-11 07:19:32 +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
Daniel Marjamäki 7fdaba43ed Uninitialized variables: Fixed fp when initializing struct with function in loop body 2013-04-10 20:46:44 +02:00
Daniel Marjamäki 96a5429cee Uninitialized variables: Assume that function initializes struct if it is unknown if it does 2013-04-10 20:04:32 +02:00
PKEuS 994c429b7d Moved checks related to sizeof usage from checkother into new file 2013-04-10 09:49:38 -07:00
PKEuS 42fcb04d0c Moved checks related to boolean type (not condition checking!) from checkother into new file 2013-04-10 09:25:50 -07:00
PKEuS 4e6d105cbd Added support for complex patterns to CheckOther::checkIncorrectStringCompare() 2013-04-09 09:16:35 -07:00
XhmikosR 8ac9b8e7a9 remove duplicate ";" and fours dots 2013-04-09 17:49:09 +02:00
PKEuS c487ea843d Better fix for #4706: Use Token::nextArgument() properly. Removed redundant ' in message 2013-04-09 08:30:53 -07:00
Daniel Marjamäki 4c8b17c040 Fixed #4717 (False positive: Uninitialized variable inside ({..})) 2013-04-09 17:02:11 +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
Daniel Marjamäki 0a17829021 removed extra newline 2013-04-08 19:52:48 +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
Daniel Marjamäki 894a2435ae Fixed #4718 (False positive: unititialized variable (value flow)) 2013-04-08 19:34:39 +02:00
PKEuS 95756409bc Fixed MSVC warning 2013-04-08 02:26:58 -07:00
Daniel Marjamäki 4abe1c0bac Fix Cppcheck message 2013-04-07 19:33:46 +02:00
Daniel Marjamki cd770fb106 Fixed #4310 (False positive 'boolean result in bitwise' message in template class (was #3818)) 2013-04-07 16:48:42 +02:00
Daniel Marjamäki f43d732f33 Fixed #4691 (False positive: Mismatching bitmasks in switch()) 2013-04-07 04:25:10 +02:00
Daniel Marjamäki 38680e3440 Fixed #4677 (Message for 'possible null pointer dereference, otherwise it is redundant to check..' is warning but says error) 2013-04-07 03:41:02 +02:00
zblair ecfe4eb5be Fixed #3372 (New check: dereference iterator and then checking it) 2013-04-04 21:14:59 -07:00
PKEuS fd7c90f68d Forgot to commit a file in eb2962792f. 2013-04-04 10:57:35 -07: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
Ettl Martin ba8cca8fa9 #4706 fix crash when a struct member is used as first argument. Replaced Token::nexArgument with %any% in Token::Match call. Added unittests in testing Token::nexArgument. 2013-04-04 15:12:18 +02:00
PKEuS c5d636c074 Replaced C function bsearch with std::binary_search 2013-04-03 01:35:08 -07:00
PKEuS 51685f24c5 Improved expression parsing in CheckNullPointer::isPointerDeRef() - fixed #4692 2013-04-03 01:27:08 -07:00
Frank Zingsheim 395a474ec2 Fixed #4695: Infinite recursion inside isRecordTypeWithoutSideEffects() 2013-04-01 12:41:14 +02:00
PKEuS 12f5ccfb4e Refactorized postfix operator check:
- Support class members
- Support references (removed wrong bailout)
- Removed wrong unit tests and wrong messages for std::cout << k-- << std::endl;
2013-03-31 04:17:23 -07:00
XhmikosR 99fc5f6203 checkbufferoverrun.cpp: fix a /W4 MSVC warning 2013-03-30 19:06:13 +01:00
PKEuS b180e92b4c Set version to 1.60 dev
Use WiX 3.7
2013-03-30 19:04:01 +01:00
Frank Zingsheim 5d55d40361 Fixed #4656 (New check: Detect pure virtual function calls) 2013-03-30 15:09:22 +01:00
Robert Reif a3f9b5c07d Fixed #4686 (Prefer prefix ++/-- operators for non-primitive types with template iterator) 2013-03-30 13:49:56 +01:00
Alexander Mai b9c27699b3 Fixed #4684 (cppcheck crash in template function call.) 2013-03-29 19:29:23 +01:00
PKEuS 4fc92f4c27 Fixed mistake in verbose message. 2013-03-29 11:27:54 -07:00
Daniel Marjamäki c733928505 1.59: Set versions 2013-03-29 18:06:13 +01:00
Daniel Marjamäki 2b51993b9f Fixed Cppcheck warning. Function can be const 2013-03-29 17:55:29 +01:00
Alexander Mai 7902cd0123 Fixed #4447 (false positive: (style) Variable 'X' is assigned a value that is never used (goto)) 2013-03-28 06:44:37 +01:00
Robert Reif 3f57b5a6ca Fixed #4682 (using 'struct' disables checking) 2013-03-28 06:36:49 +01:00
XhmikosR 945319d804 Add missing space in error message and break a long line. 2013-03-25 20:03:07 +01:00
Daniel Marjamäki 2d70af2c82 Reverted fix. It might be possible to make a better fix 2013-03-25 19:55:35 +01:00
Daniel Marjamäki 2b02013fa7 Fixed #4668 (False positive: uninitialized Variable after unknown macro) 2013-03-25 19:52:33 +01:00
PKEuS 37ac86dec9 Fixed #4666: Implemented proper variable scope checking for switch statements 2013-03-23 03:28:33 -07:00
Daniel Marjamäki c9469993e2 Uninitialized variables: Fixed false positives when using sizeof inside loop 2013-03-22 08:10:46 +01:00
Daniel Marjamäki a79354d51c Uninitialized variables: Fixed false positive when taking address of uninitialized array that is a struct member 2013-03-20 16:59:45 +01:00
Ettl Martin a08083a342 #4664: using Token::nextArgument() and std::string & 2013-03-20 11:53:25 +01:00
Daniel Marjamäki dd155b57e4 Fixed #4487 (False positive: variable is not assigned a value (pointer alias)) 2013-03-20 06:38:53 +01:00
Ettl Martin ff826d7c62 #4664: new check: (POSIX) write outside buffer size. 2013-03-19 08:22:48 +01:00
Daniel Marjamäki cc3139cf39 Tokenizer: Fixed 'variableScope' message. 2013-03-18 19:32:40 +01:00
Daniel Marjamäki 1b18bfc93c Fixed #3585 (errors not recognized when class has extra specification) 2013-03-18 19:09:04 +01:00
PKEuS d9f7042992 Fixed false negative #4663 2013-03-18 08:17:53 -07:00
Daniel Marjamäki a4a2f78a7a Fixed #4659 (portability: address value / integer false positive) 2013-03-17 17:25:57 +01:00
PKEuS 1e66e0b931 Fixed false negative #4657 2013-03-15 05:00:51 -07:00
Robert Reif c600479c20 Symbol database: Tweaked debug printing of unknown types 2013-03-15 06:48:57 +01:00
kchrist 740e790bf1 Fixed #4649 (false positive: Used file that is not opened; variables in struct) 2013-03-15 06:42:46 +01:00
Daniel Marjamäki c0a34649c4 fixed 'duplicate expression' false positives for float-float. Ticket: #4639 2013-03-14 19:11:29 +01:00
Daniel Marjamäki 369e80b021 Fixed #4465 (syntax error on valid C++ source file) 2013-03-14 18:52:22 +01:00
Daniel Marjamäki fe046a3350 CheckBufferOverrun: Fixed Cppcheck warning 'variable scope can be reduced' (found by travis) 2013-03-14 18:25:28 +01:00
PKEuS 096fa2f771 Fixed #4380 2013-03-14 10:18:48 -07:00
PKEuS ed477ceb74 Fixed false negative mentioned in #4354. 2013-03-14 09:27:42 -07:00
PKEuS 641ac5c02a Fixed #4352: Ensure that class provides an iterator interface. 2013-03-14 09:00:22 -07:00
PKEuS 0b22cb932e Fixed crash in test suite (#4595) 2013-03-14 04:21:38 -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
Alexander Mai f43ea5c491 Fixed #4594 (Analyzing errors about system headers not being found) 2013-03-13 19:50:50 +01:00
Daniel Marjamäki 1f04e2c228 Fixed #4439 (False positive: Uninitialized variable (casting address)) 2013-03-13 17:32:47 +01:00
Alexander Mai 59d636742e Fixed #4594 (Analyzing errors about system headers not being found) 2013-03-13 06:48:33 +01:00
Robert Reif ee942c5592 Symbol database: Fixed --debug printing. Ticket: #4650 2013-03-13 06:31:13 +01:00
PKEuS 292e52364c Refactorizations:
- Removed empty implementation of CheckUninitVar::runChecks()
- Avoided unnecessary string copying
2013-03-12 08:11:18 -07:00
PKEuS 796c3e101f Implemented better fix for #4644 2013-03-12 08:05:03 -07:00
PKEuS 2333aa2cc7 Don't use native separators for suppression matching 2013-03-12 07:53:18 -07: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
Alexander Mai 9d88cc63e8 Fixed #4642 (False positive: Returning an address value in a function with integer return type is not portable. (not returning address)) 2013-03-12 06:49:13 +01:00
Ettl Martin 3d1cdd0eec #4645 implemented correct range according manpage of usleep(). 2013-03-11 17:38:03 +01:00
Ettl Martin bb115573f7 #4645 implemented new check: (POSIX) argument of function usleep() too big. 2013-03-11 17:04:30 +01:00
PKEuS b3a9ac5c3b Fixed #4644: Don't assign varid to template parameter when 'typename' is used 2013-03-10 06:11:25 -07:00
Daniel Marjamäki 1f40af2ae2 Fixed #4637 (false positive: (error) Uninitialized member variable (missing function inlining)) 2013-03-09 17:55:49 +01: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 3a35944c9e Changes in token.h/cpp:
- Properly set Token::_type to eVariable, eFunction or eName, depending on _function, _variable or _varId being set.
- Token can't be a variable and a function at a time - put Token::_function and Token::_variable into a union.
2013-03-05 08:50:01 -08:00
PKEuS 99a73fe1d3 Don't assign a varid to a variadic function 2013-03-05 08:32:52 -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 5bdb74ca40 Refactorized CheckOther::checkRedundantCopy():
- Iterate over variable list instead of token list
- Don't stop whole checking after bailing out (continue; instead of break;)
- Support types with qualified names
2013-03-05 06:53:09 -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 0f03995995 Added support for different containers, while-loops and if to CheckStl::stlOutOfBounds() 2013-03-04 10:59:46 -08:00
Daniel Marjamäki b3a2b69120 fixed gcc warning 2013-03-04 19:28:27 +01:00
Daniel Marjamäki 78a3a58a5a Fixed #4628 (False positive: Variable is assigned a value that is never used) 2013-03-04 19:13:49 +01:00
Ettl Martin cc6d138209 fixed gcc warning about missing braces 2013-03-04 14:30:01 +01:00
Ettl Martin 687c3a4654 Merge branch 'master' of github.com:danmar/cppcheck 2013-03-04 14:25:51 +01:00
Ettl Martin c9b519bcd1 improved check: checkCastIntToCharAndBack. The check now handles (cin.get() != EOF) patterns. 2013-03-04 14:25:35 +01:00
PKEuS 34b1d75a10 Fixed handling of std::vector::insert() in CheckStl::pushback() 2013-03-04 02:57:09 -08: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 dc65667cec Fixed message about unused variable introduced in last commit 2013-03-03 10:46:01 -08:00
PKEuS 8a18f9ec3b Rewrote CheckOther::checkVariableScope() 2013-03-03 10:35:33 -08:00
PKEuS 5c1a05dcbe Refactorizations in CheckOther:
- Make CheckOther::checkCastIntToCharAndBack() work for multiple variables at once
- Improved messages of CheckOther::checkSuspiciousSemicolon() and CheckOther::checkPipeParameterSize()
2013-03-03 09:54:44 -08:00
PKEuS d78c06dc3f Replaced _settings->isEnabled("style") by _settings->isEnabled("warning") wherever warnings are issued 2013-03-03 02:41:59 -08:00
PKEuS d49f4a611a Reduced code duplication in tokenizer 2013-03-02 09:19:53 -08:00
Daniel Marjamki c4419ea920 AST: create possible NULL pointer dereference if tokenlist is empty. Ticket: #4630 2013-03-02 15:49:48 +01:00
Daniel Marjamki b9aba17b23 astyle formatting 2013-03-02 15:48:22 +01:00
Alexander Mai 0dca6e51a0 Fixed #4622 (Patch: Improve formatting for custom templates) 2013-03-02 15:16:18 +01: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
Daniel Marjamäki d7a52eaecd Fixed #4608 (false positive: (style) struct or union member is never used.) 2013-03-01 16:13:04 +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 bf9aa102f2 Fixed possible nullptr dereference warning 2013-03-01 03:53:47 -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
PKEuS 0a7fafa319 Fixed mistake in documentation 2013-03-01 02:47:50 -08:00
PKEuS f899e6ca30 Changed behaviour of %op% pattern accordingly to changes to Token::isOp(). Added %cop% as replacement for old %op% 2013-03-01 02:43:59 -08:00
PKEuS 7283152d58 Fixed MSVC warning - removed unused variable/function declaration. 2013-02-28 12:51:48 -08:00
PKEuS 670c4de8a9 Changed behaviour of Token::is*Op() functions:
- Rename Token::isOp() to Token::isConstOp() (indicating that the operator does _not_ modify the input variables)
- Create new Token::isOp(), returning true also for ++, -- and assignment operators
- Make Token::isExtendedOp() returning also true for all assignment and ++/-- operators
2013-02-28 12:50:29 -08:00
Daniel Marjamäki ecafe7a129 Fixed #4624 (Wrong error for instances of std::unique_lock (variable is never used)) 2013-02-28 17:02:58 +01:00
zblair ed03e2c845 Fixed #4539 (False positive: Possible null pointer dereference) 2013-02-27 23:45:21 -08:00
Daniel Marjamäki 94da3bd57f Fixed #4617 (False positive (style): noexcept for constructors) 2013-02-28 06:38:57 +01:00
Alexander Mai 4ae65ea454 Fixed doxygen warnings 2013-02-27 21:05:18 +01:00
Ettl Martin 8d682233d0 Implemented new check (Ticket #160): Storing getc() retun value in char variable and comparing to EOF. 2013-02-27 21:02:12 +01:00
Robert Reif 509061afff Fixed #4620 (False positive: Uninitialized variable in constructor (1.58)) 2013-02-27 06:59:04 +01:00
Daniel Marjamäki df55ce14a0 Fixed #4503 (False positive: Incomplete statement (std::vector<int> v{1};)) 2013-02-24 10:00:03 +01:00
Daniel Marjamäki 2edf95a1b9 Fixed #4367 (false positive: Class '...' is unsafe, '...' can leak by wrong usage) 2013-02-24 08:14:25 +01:00
Daniel Marjamki 5c7e1cf9ff Fixed #4387 (false positive 'constStatement' in 1.57) 2013-02-23 16:26:25 +01:00
Daniel Marjamki ee435bf885 Fixed #4600 (False positive Uninitialized struct member when using it as 'out parameter') 2013-02-23 15:57:58 +01:00
Daniel Marjamäki d5af34331b ast: clarify the code somewhat 2013-02-23 07:43:12 +01:00
Daniel Marjamäki bce99a9e2f Fixed #4394 (FP: Variable 'a' is not assigned a value) 2013-02-20 17:43:16 +01:00
Robert Reif 21bf5173e5 Symbol database: faster implementation. Ticket: #4494 2013-02-20 07:46:06 +01:00
Daniel Marjamäki 71b66209b7 Fixed #4300 (segmentation fault of cppcheck (invalid code)) 2013-02-20 06:58:27 +01:00
PKEuS 33cf561d85 Refactorized check for assigning function parameters:
- Fixed false negative: Check is also valid for all non-references, not only for pointers.
- Fixed false negative: Usage before assignment doesn't require bailout
- Fixed false positive #4598 caused by inadequate usage of CheckUninitVar::isVariableUsage
- Made several member functions static
2013-02-18 08:52:49 -08:00
Daniel Marjamäki 1c584208b4 Fixed #4329 (False duplicateBranch when branches use conditionally defined macros) 2013-02-18 17:18:33 +01:00
Robert Reif e6915e7a78 Fixed #4536 (non-static member initializer causes false positive) 2013-02-18 06:33:53 +01:00
Ettl Martin 73e2a8fdb5 Merge branch 'master' of github.com:danmar/cppcheck 2013-02-17 17:34:44 +01:00
Ettl Martin f451dd1137 #3521 implemented new check: wrong buffersize to pipe() function provided. 2013-02-17 17:33:32 +01:00
PKEuS 711d0d7a33 Warn about memset(this, 0, sizeof(*this)); (#1285) 2013-02-16 11:02:43 -08:00
Alexander Mai b892d2e14c Fixed #4300 (segmentation fault of cppcheck (invalid code)) 2013-02-16 18:31:43 +01:00
Daniel Marjamki 2a660fa3b4 Tokenizer: Fixed removeCast bug. Don't simplify (A)&b to A&b if A might be a type. Related with ticket: #4439 2013-02-16 16:58:36 +01:00
Daniel Marjamki 635b7d5a0e Fixed #4423 (Variable is assigned a value that is never used.) 2013-02-16 16:07:05 +01:00
PKEuS 0d316af4f2 Fixed false positive stlSize for code like "foo + 1 > bar.size()" (#4584) 2013-02-16 02:50:25 -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
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
PKEuS 27f7917349 Changed severity and message formatting of argumentSize message. 2013-02-16 00:52:27 -08:00
PKEuS 7b3493322d Fixed crash when running cppcheck on itself introduced in previous commit 2013-02-15 11:17:14 -08:00
PKEuS 44887df04f Fixed false positive redundantAssignment when calling function in assignment (#4513) 2013-02-15 09:40:34 -08:00
Daniel Marjamäki 382d7a10e8 Uninitialized variables: improved checking of c++ code 2013-02-15 18:13:47 +01:00
PKEuS ccd95d1749 Make redundantAssignment message inconclusive when printed on global variables to avoid false warning on semaphores/mutexes (#4467) 2013-02-15 09:01:10 -08:00
PKEuS e2655da1ec Properly handle return/break/continue in CheckIO::checkFileUsage() (#4466) 2013-02-15 08:30:43 -08:00
PKEuS 017b4a8a7f Treat references like global variables in CheckOther::checkRedundantAssignment() as they might refer to such. (#4425) 2013-02-15 08:09:31 -08:00
Robert Reif c5ee083c82 Fixed #4388 (false positive 'noConstructor' in 1.57) 2013-02-15 06:44:07 +01:00
Daniel Marjamki 452dc23742 Fixed #4480 (False positive : Inefficient usage of string::find) 2013-02-14 19:14:20 +01:00
Daniel Marjamäki 08ada4cc63 Fixed #2652 (container .size() check too strict) 2013-02-14 16:59:58 +01:00
Thomas Jarosch 72a40b4da4 Use Token::simpleMatch for simple patterns
"internal" check reported:
[lib/checkuninitvar.cpp:1101]: (warning) Found simple pattern inside Token::Match() call: "if ("
2013-02-14 12:35:13 +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
Frank Zingsheim 213d31b360 Fixed #4547 (Improve check: Duplicate conditions in 'if' and related 'else { if'.)
Local fix in CheckOther::checkDuplicateIf()
2013-02-12 21:43:12 +01:00
Daniel Marjamäki 1e550f9fdf Reverted fix for #4547: It causes fp. See #4573 2013-02-12 16:13:08 +01:00
Daniel Marjamäki 28e38a9e56 Fixed #4519 (false positive: (error) Uninitialized variable: eax (inline assembly usage)) 2013-02-12 15:59:23 +01:00
Ettl Martin c192e4d669 spellfixes 2013-02-12 15:21:27 +01:00
Ettl Martin dade326a99 #4566 implemented new check: redundantGetAndSetUserId on posix systems 2013-02-11 20:26:27 +01:00
Daniel Marjamäki 442db6cdf9 Fixed #4569 (False Positive: Uninitialised variable) 2013-02-11 18:31:14 +01:00