Robert Reif
4de9e29adc
Fixed #5706 (operators with noexcept broken)
2014-04-29 04:37:13 +02:00
Daniel Marjamäki
1233d8e47f
Fixed #5657 (false positive: (error) Possible null pointer dereference: p)
2014-04-28 15:54:54 +02:00
Daniel Marjamäki
3300d39854
Fixed #5721 (valueFlowBeforeCondition: stop when goto label is seen)
2014-04-28 06:21:48 +02:00
Alexander Mai
ead3f28e06
Small enhancements for doxygen
2014-04-27 21:42:10 +02:00
Daniel Marjamäki
9c74d914d7
Fixed #5667 (Tokenizer: simplify 'void (X::*f)()' to 'void *f')
2014-04-27 19:49:21 +02:00
Daniel Marjamäki
d279f3fb41
Fixed #5736 (AST: proper handling of 'a=(b).c;')
2014-04-27 18:03:50 +02:00
Daniel Marjamäki
9f2e37da37
AST: fixed 'a.b++' and '*c[5]--'
2014-04-27 16:02:24 +02:00
PKEuS
ecec4b0b46
Fixed false positive #5187 : arithOperationsOnVoidPointerError when referencing void*
2014-04-27 12:18:33 +02:00
PKEuS
866ab1ce14
Fixed false positive #5689 : Care about usage of return values of memory functions
2014-04-27 12:18:33 +02:00
PKEuS
ea23a0467b
Fixed false positive #5732 : autovarInvalidDeallocation on pointer to array
2014-04-27 12:18:33 +02:00
Daniel Marjamäki
bde6698bcd
Fixed #5731 (False positive with opposite conditions)
2014-04-27 10:21:20 +02:00
Daniel Marjamäki
7317785e32
astyle formatting
...
[ci skip]
2014-04-27 10:20:21 +02:00
Alexander Mai
17ec0af6a7
#5734 A FP literalWithCharPtrCompare was issued upon comparison with a char referenced within a string literal
2014-04-27 09:40:13 +02:00
Alexander Mai
520aaf71b8
Fix some doxygen comments and add shortcut for tok==NULL to Token::simpleMatch()
2014-04-27 09:32:02 +02:00
Alexander Mai
1317063b21
Fix some more (clang++) compiler warnings
2014-04-26 20:44:21 +02:00
Robert Reif
ca9386859b
Tokenizer: replace ') const| {' pattern to detect function start
2014-04-26 18:31:56 +02:00
Robert Reif
cd6332d960
Tokenizer: replace ') const| {' pattern to detect function start
2014-04-26 18:30:09 +02:00
Alexander Mai
b5c580a59e
Fix some clang warnings - most related to semantic doxygen errors
2014-04-26 16:17:26 +02:00
Alexander Mai
b74e997435
Fix false positive nullPointer messages within sqlite3 after goto by adding a suitable bailout inside valueFlowAfterAssign()
2014-04-26 14:41:28 +02:00
Daniel Marjamäki
11856b51aa
AST: Fixed handling of 'a=b(c**)+1'
2014-04-26 13:32:08 +02:00
Daniel Marjamäki
c34616a6ba
AST: Fixed handling of 'a = b.c[++(d.e)];'
2014-04-26 13:16:34 +02:00
Frank Zingsheim
ffa55bbaa0
Fixed #5725 (FP: multicondition Expression is always false because 'else if' in pngwrite.cxx (LibreOffice))
2014-04-26 11:59:38 +02:00
Daniel Marjamäki
853d56030b
Fixed #5559 (false positive: (error) Possible null pointer dereference: pSTRunner)
2014-04-26 11:27:58 +02:00
Reijo Tomperi
ae23ab64b7
Change encoding to UTF-8 for two header files that were not using UTF-8.
2014-04-26 00:41:33 +03:00
Daniel Marjamäki
8602d13dc9
Fixed #5722 (AST: wrong handling of 'x = ((a[i])->getx)();' - the 'x' is an operand of the =)
2014-04-25 06:06:54 +02:00
Dmitry-Me
a7c7b00407
Reuse variable value, return earlier.
2014-04-24 12:24:40 +04:00
Daniel Marjamäki
9406f3428a
IncompleteStatement: Fixed false positive when '({..})' blocks are used
2014-04-24 06:32:29 +02:00
Alexander Mai
5c98e4d039
Merge branch 'master' of https://github.com/danmar/cppcheck
2014-04-23 20:50:48 +02:00
Alexander Mai
9412f9d216
#5717 Segmentation fault when providing multiple --include=/path/to/header arguments.
2014-04-23 20:50:16 +02:00
Daniel Marjamäki
d144197d7e
Fixed segfault
2014-04-23 19:49:16 +02:00
Daniel Marjamäki
aea528c763
enum: don't simplify enum constant that is assigned
2014-04-23 17:10:17 +02:00
Daniel Marjamäki
272fcc18d8
Don't warn about redundant number statement in '({ do_something(); 0; })'
2014-04-23 16:23:19 +02:00
Dmitry-Me
9b74d43473
Rename local variable plus return a bit earlier on edge condition.
2014-04-23 11:18:09 +04:00
Frank Zingsheim
87354bf9d2
Fixed #5707 (false negative: unreachable code is not detected (code after return))
2014-04-23 07:58:43 +02:00
Daniel Marjamäki
3c5cf299e3
Fixed #5708 (Improve oppositeInnerCondition)
2014-04-23 07:57:13 +02:00
orbitcowboy
a6af8f5dcf
#5748 : Fixed FP (wrongmathcall) do not warn if an object calls a function foo.log(0).
2014-04-23 01:23:38 +02:00
Daniel Marjamäki
fe80f858d1
ValueFlow: Improved analysis in the valueFlowAfterAssign
2014-04-22 16:10:20 +02:00
Alexander Mai
2c3807f089
#5703 - Segfault recursive loop - Patch by zingsheim
2014-04-21 22:13:02 +02:00
Alexander Mai
623e5db0b2
#5702 crash: clang: test/Parser/cxx0x-member-initializers.cpp (bailout withn an internal error)
2014-04-21 21:44:17 +02:00
Mark de Wever
6f3e3f5e2e
Fixed #5701 (FP for std::unordered_map::operator[]; there is no const version)
2014-04-21 16:39:44 +02:00
Daniel Marjamäki
52e0e4453b
Fixed #5646 (FP: pointer to array is not assigned a value.)
2014-04-21 16:14:49 +02:00
Daniel Marjamäki
c98beafb6d
Fixed #5675 (wrong AST generated for 'a>>=b')
2014-04-21 13:05:34 +02:00
Daniel Marjamäki
a202956471
Uninitvar: Refactoring. Use AST instead of token matching to see if variable is used in RHS of assignment.
2014-04-21 12:01:02 +02:00
Daniel Marjamäki
04cd261ee2
Fixed #5664 (false positive: (error) Uninitialized variable: j (Comma operator in for loop))
2014-04-21 10:32:29 +02:00
Daniel Marjamäki
0ced16d17a
CheckExceptionSafety: Fixed crash when a function is missing function scope
2014-04-21 08:01:01 +02:00
Robert Reif
6ff5de2118
Fixed #5697 (Check for throw in __attribute__((nothrow)) function)
2014-04-20 20:40:55 +02:00
Daniel Marjamäki
01d14d0388
Library: Refactoring alloc/dealloc functions. Normally the token should be passed so extra validation can be made
2014-04-20 14:59:16 +02:00
Daniel Marjamäki
5fc43f85b1
ValueFlow: Refactoring. Created utility function isVariableChanged()
2014-04-20 14:21:43 +02:00
Daniel Marjamäki
44a66e6a5a
Fixed #1416 (false negative resource leak when calling fdopen)
2014-04-20 10:50:32 +02:00
Robert Reif
36f4431481
Fixed #4800 (Check unhandled exceptions)
2014-04-20 08:58:36 +02:00
Daniel Marjamäki
0c5707ebf1
Fixed #5512 (library (memory): extending standard free deallocator with allocators in custom cppcheck configuration file)
2014-04-19 13:15:06 +02:00
Alexander Mai
96d2666a6c
Fix crash in SymbolDatabase - errorLogger may be 0
2014-04-18 21:19:49 +02:00
Alexander Mai
aecb072fc6
Merge branch 'master' of https://github.com/danmar/cppcheck
2014-04-18 20:42:46 +02:00
Alexander Mai
7d9ec01bdc
#5593 - hang or --report-progress broken (does not report progress) : add reportProgress() call to SymbolDatabase
2014-04-18 20:42:22 +02:00
Daniel Marjamäki
2d645f57b9
Fixed #5576 (false positive: (POSIX) (error) Resource leak: sockfd)
2014-04-18 18:18:47 +02:00
Daniel Marjamäki
a9943fe6d0
Fixed #5525 (Closing a socket file descriptor gives an error: Mismatching allocation and deallocation)
2014-04-18 17:05:44 +02:00
Daniel Marjamäki
b909aa0e4f
CheckMemoryLeak: moved 'popen' into posix scope
2014-04-18 16:30:16 +02:00
Daniel Marjamäki
56eb717b8a
Fixed #5656 (false positive: (error) Possible null pointer dereference: f)
2014-04-18 16:10:18 +02:00
Daniel Marjamäki
6146c8f5bb
Tokenizer: Fixed bad simplifyComma for code 'return a ? b = c , d : e ;'
2014-04-18 13:38:48 +02:00
Alexander Mai
ccba934cb1
#5684 The scope of the variable 'p' can be reduced - But it can not.
2014-04-17 21:32:56 +02:00
Daniel Marjamäki
064844f8db
Tokenizer: Fixed bad simplifyComma for code 'a ? b = c , d : e ;'
2014-04-17 18:47:55 +02:00
Daniel Marjamäki
8d5a9893d5
Fixed #5682 (False positive: (style) Same expression on both sides of '&&')
2014-04-16 16:04:46 +02:00
Daniel Marjamäki
5c116c622d
AST: Fixed iscast detection in '*((DWORD*)&buf[0])'
2014-04-15 15:46:26 +02:00
orbitcowboy
3d0217b69e
Implemented a slower but shorter version of MathLib::isNullValue() as suggested by PKeuS. Removed not needed test cases. Improved doxygen documentation for MathLib::IsNullValue().
2014-04-14 05:27:38 +02:00
Daniel Marjamäki
28751c8ad0
astyle formatting
...
[ci skip]
2014-04-15 06:32:25 +02:00
Daniel Marjamäki
4b6164087e
Use constant instead of magic number for AST recursion limit
...
[ci skip]
2014-04-15 06:31:09 +02:00
Daniel Marjamäki
cb830cb999
Code cleanup of stack depth tracking. Replaced class with simple POD variable.
2014-04-15 06:18:15 +02:00
PKEuS
076f7a7542
Fixed some coverity findings about dead code, fixed a misleading comment
2014-04-14 22:46:51 +02:00
Alexander Mai
ac24635056
Convert MathLib::toLongNumber() from template member function to toLongNumber() and toULongNumber() to avoid various problems compiling with Visual Studio
2014-04-14 20:30:38 +02:00
Daniel Marjamäki
5ee85ee88a
ValueFlow: Improved handling of bitand against a single-bit integer literal
2014-04-14 06:45:39 +02:00
Alexander Mai
1ef99e2662
Try to avoid compiler warning for unary minus operator inside MathLib::toLongNumber<biguint>()
2014-04-13 19:20:44 +02:00
Mark de Wever
b4b340b7be
Fixed #5677 (Fix overzealous substr() warning)
2014-04-13 19:04:35 +02:00
PKEuS
dbf2c44a81
Simplified check registration:
...
- Use sorted insert instead of calling std::list<Check*>::sort() on each insertion
- Removed DJGPP/__sun hack in check.h (should be obsolete by our compiler requirements for C++11
2014-04-13 13:35:15 +02:00
Alexander Mai
40be775efa
#5592 (fix implementation detail to avoid warnings from cppcheck)
2014-04-13 13:08:38 +02:00
Daniel Marjamäki
79942df842
Fixed #5602 (false positive on std::vector - after unknown macro around the function header)
2014-04-13 13:05:30 +02:00
Alexander Mai
547803f581
#5592 - crash: gcc: testsuit: gcc.c-torture/compile/limits-declparen.c (Limit stack depth below createAst()
2014-04-13 12:47:54 +02:00
PKEuS
9bfc2b618b
Fixed crashes random crashes in multithreading caused by useless creation of CheckUnusedFunctions instance per thread.
2014-04-13 11:56:38 +02:00
Alexander Mai
73fc3d6a13
#5300 - Invalid encoding in XML output (use escape sequence string for non-printable characters)
2014-04-13 09:50:57 +02:00
Philipp Kloke
c1c1ded766
Refactorized CheckStl::pushback():
...
- Use method from CheckNullPointer to find pointer dereference
- Replaced indendation counter by symboldatabase usage
2014-04-12 23:41:58 +02:00
Philipp Kloke
dfd9d32c4b
Refactorization: Removed whitespaces at the end of a token
...
Removed a redundant 'void'
2014-04-12 23:41:46 +02:00
Philipp Kloke
ddf34440b6
Refactorization: Replaced several Token::findmatch calls by symboldatabase usage
2014-04-12 23:41:46 +02:00
Philipp Kloke
776ad32a0b
Refactorized CheckStl::redundantCondition():
...
- Use symboldatabase
- Support erase() method
2014-04-12 23:41:46 +02:00
PKEuS
8cb3b13e56
Support "else if" and do-loop in CheckStl::checkDereferenceInvalidIterator()
2014-04-12 20:03:07 +02:00
PKEuS
e8ac355b39
Refactorized iterator checking:
...
- Fixed false positive #5669
- Use symboldatabase in CheckStl::pushback()
- Improved support for erase on std::vector and find
2014-04-12 20:03:07 +02:00
Martin Ettl
82092e412a
MathLib::isNullValue(): Fixed bug in detecting zero values. Improved test coverage of MathLib::IsNullValue().
2014-04-12 02:14:50 +02:00
Daniel Marjamäki
9d51bfd015
Fixed #5397 (False positive: Same expression on both sides of '&')
2014-04-12 16:06:31 +02:00
PKEuS
7ffc313748
Save "->" in Token::originalName if simplified to "."; Fix false positive #4890 .
2014-04-12 12:04:56 +02:00
PKEuS
9c921ab657
Fixed handling of member function pointers in setVarId and SymbolDatabase ( #4577 )
2014-04-12 12:04:55 +02:00
PKEuS
83f4657e69
Fixed remaining issue in #3503 : Member function taking a function pointer must not be "simplified" to a variable initialization
2014-04-12 12:04:55 +02:00
PKEuS
92839ab4d2
Refactorizations:
...
- Rearranged members of Value to reduce structures size
- Removed redundant ctor of Value
- Fixed VS warning in tokenize.cpp
2014-04-12 12:04:55 +02:00
Alexander Mai
718e42f5ca
Fix some clang warnings about type conversions
2014-04-11 23:35:53 +02:00
Alexander Mai
6da6508913
Extract new function MathLib::isDec() our of isInt()
2014-04-11 22:15:25 +02:00
orbitcowboy
6be53376f4
MathLib:IsNullValue(): removed commented out code.
2014-04-11 01:28:16 +02:00
orbitcowboy
9c08885caf
MathLib:IsNullValue(): using a Finite State Machine to determine a string value contains a numeric NULL value. The NULL value can be Integer, Binary, Hex, Octal. The corresponding unit test cases are also included.
2014-04-11 01:27:05 +02:00
Philipp Kloke
1fafc7f4dc
Refactorization: use MathLib::isNullValue in CheckOther::checkMemsetInvalid2ndParam(); Fixed it to support also float literals like "0.f"
2014-04-11 14:17:36 +02:00
Philipp Kloke
cf30fab413
Refactorized inefficient usage of Token::findmatch in two checks in checkother.cpp
2014-04-11 14:17:35 +02:00
Philipp Kloke
20c3a5baf0
Refactorized switchCaseFallThrough: Removed lots of obsolete code
2014-04-11 14:17:35 +02:00
Robert Reif
7eb3988415
Fixed #5659 (False negative: mismatching allocation / deallocation whith using namespace)
2014-04-11 05:40:37 +02:00
Alexander Mai
ab2f8bfba3
Tidy up MathLib::isInt() - using a state machine approach
2014-04-10 22:46:55 +02:00
PKEuS
b10fce304e
Don't suggestInitializationList for arrays used as initializer ( #5640 )
2014-04-10 22:28:02 +02:00
PKEuS
2aaae741dd
Fixed cppcheck message
2014-04-10 21:58:53 +02:00
PKEuS
c33498fa0b
Fixed false positive redundantAssignment when operator() is called ( #5568 )
2014-04-10 21:56:30 +02:00
Alexander Mai
559a2bc2c8
Avoid FP exceptThrowInNoThrowFunction and exceptThrowInNoexecptFunction
2014-04-10 21:55:49 +02:00
PKEuS
e39b89efc3
Throw more syntaxErrors from SymbolDatabase, fixing #5663
2014-04-10 20:11:03 +02:00
PKEuS
25b1f2f541
Fixed #5643 (crash on address-of-operator& in condition) as suggested by serval2412
2014-04-10 19:49:21 +02:00
Alexander Mai
e19129a409
Fix #4724 (Error in calculation shift operation: wrong sign: 1UL << 63)
2014-04-10 19:22:14 +02:00
Robert Reif
b0af67f369
Fixed #5486 (false positive: (warning) %zd in format string (no. 1) requires 'ssize_t' but the argument type is 'ssize_t {aka long}'.)
2014-04-10 17:25:11 +02:00
Robert Reif
847d28d283
Fixed #5638 (is there any plan to check noexcept correctness?)
2014-04-10 16:17:10 +02:00
Robert Reif
4ae204e46b
Fixed #5659 (False negative: mismatching allocation / deallocation whith using namespace)
2014-04-10 16:11:11 +02:00
Daniel Marjamäki
c8ae1e4751
Fixed #5658 (false positive: (error) Uninitialized variable: s)
2014-04-10 15:59:37 +02:00
Daniel Marjamäki
9b1d058410
Fixed #5660 (false positive: (error) Uninitialized variable: result)
2014-04-10 06:40:53 +02:00
Daniel Marjamäki
59cd1879db
Fixed #5467 (False positive incorrectly claiming use after erase)
2014-04-09 10:32:56 +02:00
Alexander Mai
89dc652af9
#5631 Typo and misleading error message in negativeMemoryAllocationSize
2014-04-08 20:23:00 +02:00
Daniel Marjamäki
d7e2e3bd5e
Fixed #5502 (FP: Dereferencing 'b' after it is deallocated / released)
2014-04-06 18:45:24 +02:00
Daniel Marjamäki
456e33fc7b
Code cleanup
...
[ci skip]
2014-04-05 08:27:52 +02:00
Daniel Marjamäki
049d68ae7d
AST: Fixed bad syntax tree for 'if (x()[0]==1);'
2014-04-05 08:03:24 +02:00
Alexander Mai
173a2e9ea2
#5641 fix crash within CheckClass::initializeVarList()
2014-04-04 22:13:51 +02:00
Daniel Marjamäki
0788e64eb8
Removed unused function expressionsHasSideEffects()
2014-04-04 07:04:19 +02:00
Daniel Marjamäki
8dcb3bae47
Refactoring checks of overlapping conditions in if and else-if
2014-04-03 19:35:50 +02:00
Daniel Marjamäki
1a83338faf
Refactoring. Created utility function isOppositeCond()
2014-04-03 17:08:42 +02:00
Daniel Marjamäki
110f956029
code cleanup for invertOperatorForOperandSwap()
2014-04-03 16:22:07 +02:00
Daniel Marjamäki
ffac614f7e
Fix Cppcheck warning. Use reference to avoid redundant data-copy
2014-04-03 16:16:39 +02:00
PKEuS
d9358de8b4
Refactorization: Use templates and rValue references
...
-> Performance gain of up to 15% on entire checking time (depends on setup; Result was checked with VS12 (x64), matchcompiled version, ran on tinyxml and cppcheck itself)
2014-04-03 15:03:37 +02:00
Daniel Marjamäki
dcc245be9e
Merge pull request #283 from Dmitry-Me/bracemacroparameter
...
Macro parameter was not braced.
2014-04-03 07:22:34 +02:00
Daniel Marjamäki
9f80f3a4e8
Small cleanups in the code
2014-04-03 06:37:02 +02:00
Daniel Marjamäki
a115bbbbb5
Refactoring CheckOther::checkCharVariable() using AST
2014-04-03 06:27:29 +02:00
Daniel Marjamäki
a6557f8c74
Null pointer: Fixed false positive discovered by Travis when self-checking cppcheck
2014-04-02 19:39:42 +02:00
Daniel Marjamäki
189360ae20
ValueFlow: changed back bailout message
2014-04-02 19:22:40 +02:00
Daniel Marjamäki
f13be7fb6c
Travis: Fixed possible null pointer dereference reported by travis
2014-04-02 19:08:44 +02:00
PKEuS
a6e134e811
Removed compatibility code for Borland and Sun compilers which should not be necessary for a compiler supporting C++11 (as required by cppcheck).
2014-04-02 17:26:59 +02:00
Dmitry-Me
3244a61cac
Macro parameter was not braced.
2014-04-02 09:25:13 +04:00
Daniel Marjamäki
3c64c70ce2
ValueFlow: Added utility functions getValueLE and getValueGE to simplify usage
2014-04-02 06:49:28 +02:00
Daniel Marjamäki
bc9bb17025
Refactor CheckOther::oppositeInnerCondition() using AST and isSameExpression()
2014-04-02 16:54:01 +02:00
PKEuS
e9411e05ba
Refactorized inefficient usage of std::string and const char[].
2014-04-02 13:56:34 +02:00
Daniel Marjamäki
f4cdb2c46a
CheckOther::checkCharVariable: Refactoring using AST
2014-04-01 19:16:06 +02:00
PKEuS
5953f02654
Refactorization: Simplifications in symboldatabase
2014-04-01 10:13:00 +02:00
Daniel Marjamäki
830249d72e
Fixed #5510 (FP: nullPointer - variable initialized in function call)
2014-04-01 07:06:20 +02:00
PKEuS
e0574feabd
Fixed problems with unknown macros for inline class methods in SymbolDatabase ( #5621 )
2014-03-31 21:04:01 +02:00
PKEuS
025850d961
Support unknown THROW()-style macros in symboldatabase; Fixed #5056 .
...
Simplified related code.
2014-03-31 20:33:01 +02:00
Daniel Marjamäki
484483bd5d
AST: fixed ast for 'for (*x=0;y;z)'
2014-03-31 17:16:13 +02:00
Daniel Marjamäki
225fb96554
Fixed #5627 (False positive assignBoolToPointer)
2014-03-31 15:55:54 +02:00
Daniel Marjamäki
088664d626
Fixed compiler warning 'conversion from unsigned long to unsigned int, may loose value'
2014-03-31 06:50:59 +02:00
Daniel Marjamäki
640431c569
Fixed #5611 (segfault when checking pcsc-cyberjack. either symboldatabase or checkMemset)
2014-03-30 17:38:07 +02:00
PKEuS
060f9035c9
Fixed crashs on garbage code ( #5604 )
2014-03-30 11:38:01 +02:00
PKEuS
aa527cb408
Refactorization: Store sizes as int, not as string in Tokenizer::simplifySizeof().
2014-03-30 11:21:40 +02:00
PKEuS
345a80f4d5
Fixed #5621 and slightly simplified symboldatabase code.
2014-03-30 11:06:44 +02:00
Alexander Mai
5fc89656c0
Fix some uninitialized variables
2014-03-30 10:22:06 +02:00
Alexander Mai
70885c78e4
Fix endless recursion within CheckClass::isConstMemberFunc() caused by incomplete/missing template declaration
2014-03-30 10:09:57 +02:00
Alexander Mai
bf335217cd
Fix #5605 part 2 - now endless recursion within CheckClass::isMemberFunc()
2014-03-30 08:31:02 +02:00
Daniel Marjamäki
348c26f59c
fixed segmentation fault in case typeStartToken() returns 0
2014-03-29 21:01:21 +01:00