Daniel Marjamäki
b5e023a46c
Fixed #5472 (sizeof not handled as operator with respect to null pointer dereference)
2014-04-29 20:09:11 +02:00
Daniel Marjamäki
fc24d491cc
Fixed #5560 (false positive: C-style pointer casting)
2014-04-29 06:21:30 +02:00
Daniel Marjamäki
648479d909
AST: Fixed tree for 'a.b[5]'
2014-04-29 06:09:26 +02:00
Daniel Marjamäki
36895674ce
Refactoring. Simplified condition using Token::Match.
2014-04-29 04:45:45 +02:00
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
Daniel Marjamäki
efc84ac310
Fix segmentation fault when checking build/tokenize.cpp
2014-03-29 20:41:17 +01:00
Daniel Marjamäki
deef4642d4
Buffer overrun: removed some old code that is not based on valueflow
2014-03-29 20:22:35 +01:00
Daniel Marjamäki
e5301b2b7a
ValueFlow: Improved valueflow of for loop 'for (i=a; i<10; i++)' => unknown start value but end value is known
2014-03-29 20:20:22 +01:00
Daniel Marjamäki
407c9fdf9d
Refactored checkNegativeBitwiseShift() so it uses ast and valueflow
2014-03-29 13:01:30 +01:00
Alexander Mai
d1b1699bb0
Fix #5606 - Endless recursion in CheckClass::isMemberVar(). New function Type::hasCircularDependencies() is supposed to detect loops within the class hierarchy which was causing the problem
2014-03-29 12:21:35 +01:00
Alexander Mai
34d1f885a3
Ticket #4296 : Improve message text for operatorEq
2014-03-28 20:29:33 +01:00
PKEuS
4ad7ef69c6
Updated german translation
...
ran lupdate gui.pro
Reverted accidential change in checkio.cpp
2014-03-28 19:06:48 +01:00
PKEuS
a01bfcb62d
Fixed a few cppcheck messages
2014-03-28 18:55:16 +01:00
PKEuS
4e19645d62
Added C++11 keywords / C11 types 'char16_t' and 'char32_t' ( #3301 )
2014-03-28 18:24:39 +01:00
Daniel Marjamäki
502ba95383
Simplification. Code 'else if ..' is simplified to 'else { if ..'
2014-03-28 18:21:56 +01:00
PKEuS
a16d631813
Further improvements to setVarId and function/array pointer detection in SymbolDatabase ( #2872 )
2014-03-28 17:43:40 +01:00
PKEuS
1c58628223
Handle pointer/reference to array in setVarId ( #2645 )
2014-03-28 16:10:27 +01:00
PKEuS
50a94885ce
Fixed oppositeInnerCondition check:
...
- Resolved false positives #4170 and #4186 , as well as numerous other potential false positives
- Improved message to point to both locations
- Inner condition could also be a while loop; Outer if could also be 'else if'
- Made the check non-experimental again (#3645 )
2014-03-28 14:55:17 +01:00
PKEuS
a6ca3cf2cf
Throw syntaxError when encounter one in symboldatabase ( fixes #5572 )
2014-03-27 19:06:13 +01:00
PKEuS
efe3f834be
Refactorized handling of syntaxError: Print debug output, removed a few return values that are no longer required
2014-03-27 18:41:52 +01:00
Daniel Marjamäki
ab25741fee
Merge pull request #277 from Dmitry-Me/getridofassertinisdigit
...
Get rid of assert in isdigit
2014-03-27 17:18:06 +01:00
Daniel Marjamäki
581886636d
CheckBool::checkComparisonOfBoolExpressionWithInt: Rewrite the check using AST instead of token list
2014-03-27 16:10:43 +01:00
PKEuS
9b307cf8e0
Improved readability of testsuite output when ASSERT_EQUALS_MSG fails.
...
Fixed another true positive in checkbufferoverrun.cpp
AStyle
2014-03-27 16:06:30 +01:00
PKEuS
e8c7a723f5
Fixed five new true positives in cppcheck, silenced one new false positive (see #5618 )
2014-03-27 15:50:30 +01:00
PKEuS
7e4081f7f5
Treat syntaxError and cppcheckError as InternalErrors (throw as exception, #4268 )
2014-03-27 13:15:21 +01:00
PKEuS
b23aebf2f0
Show redundantCopyLocalConst for STL types ( #4331 )
2014-03-27 11:15:17 +01:00
PKEuS
379807a8ea
Fixed TODO_ASSERT_EQUAL and #5614 caused by bad simplification of return values.
2014-03-27 11:04:31 +01:00
Dmitry-Me
d0b3728328
Get rid of assert in isdigit() when processing cyrillic characters.
2014-03-27 10:23:47 +04:00
Daniel Marjamäki
2248cdfea0
CheckBool::checkAssignBoolToPointer: Refactor to use AST.
2014-03-27 05:39:48 +01:00
Dmitry-Me
d0e51fb5f0
Make use of Visual C++ runtime memory leak tracing
2014-03-26 19:43:12 +04:00
PKEuS
f71a4ad216
Improved information message on missing headers when included with <> ( #4772 )
2014-03-26 15:22:22 +01:00
PKEuS
6c4e8761c8
Fixed false positive "unused function" #5113 .
2014-03-26 12:34:21 +01:00
PKEuS
848d079c71
Refactorized detection of function usage in CheckUnusedFunction, fixed #5358
2014-03-26 09:12:41 +01:00
PKEuS
02f38772cc
Refactorization: Use SymbolDatabase to find functions in CheckUnusedFunctions
2014-03-26 08:54:56 +01:00
Daniel Marjamäki
d22da5e683
astyle formatting
...
[ci skip]
2014-03-26 06:56:13 +01:00
Daniel Marjamäki
fa7ae1ae5b
Fixed segfault when checking libusbx (daca2)
2014-03-26 06:51:56 +01:00
Daniel Marjamäki
8eeda150cf
ValueFlow: Improved simplification inside for-loops
2014-03-25 21:40:36 +01:00
Daniel Marjamäki
87daf5783e
buffer overflow: clean up old checking for negative index
2014-03-25 20:37:32 +01:00
Troshin V.S
840fba7672
CLI: Add -l command line option
2014-03-25 18:35:59 +01:00
Daniel Marjamäki
c8004a8d31
Buffer overruns: Use ValueFlow to detect negative index
2014-03-25 18:22:22 +01:00
PKEuS
5083dd4273
Fixed two visual studio warnings
2014-03-24 18:14:23 +01:00
Daniel Marjamäki
aa05bf0f16
ValueFlow: Improved abstract interpretation
2014-03-24 06:48:06 +01:00
Daniel Marjamäki
2a0716449f
Fixed #5498 (C++0x11 default values for class fields and missing constructor)
2014-03-24 06:15:51 +01:00
Daniel Marjamäki
dbc8273cb7
ValueFlow: improved abstract interpretation of for loops
2014-03-24 00:16:02 +01:00
Daniel Marjamäki
c14a3d67bb
ValueFlow: Handle division by zero better in abstract interpretation
2014-03-23 20:37:56 +01:00
PKEuS
1be7bfa7fe
Fixed crash on invalid code ( #5603 )
2014-03-23 20:08:16 +01:00
Daniel Marjamäki
30fa187b30
Fixed #5549 (ValueFlow: Handle static variables better in valueFlowAfterAssign)
2014-03-23 17:57:27 +01:00
PKEuS
5f2067e401
Refactorized dead code elimination:
...
- Use library to get noreturn functions
- Fixed do-while simplification (#4940 )
2014-03-23 10:59:41 +01:00
PKEuS
77c17100ec
Bailout in private function usage checking for operators ( #5059 ).
2014-03-23 10:06:14 +01:00
PKEuS
8d5be8c4a4
Fixed related issues to #5601
2014-03-22 22:35:20 +01:00
PKEuS
58c2f372b9
Fixed false positive when noreturn function is defined ( #5601 , second attempt)
2014-03-22 19:55:13 +01:00
PKEuS
6395cb9b95
Syntax error on invalid enum ( #5600 )
2014-03-22 19:31:01 +01:00
Daniel Marjamäki
b6276058da
Value Flow: Improved abstract interpretation of arithmetical expressions
2014-03-22 19:02:33 +01:00
PKEuS
77c871035b
Fixed false positive when noreturn function is defined ( #5601 )
2014-03-22 18:57:19 +01:00
Daniel Marjamäki
7d2357de8d
Refactoring. Use astIsFloat()
2014-03-22 18:42:29 +01:00
PKEuS
560cf397d3
Fixed C++11 right angle bracket issue #5150
2014-03-22 13:34:15 +01:00
Alexander Mai
6a08c27183
Fix segfault in variableIsUsedInScope() - loop variable not check against NULL
2014-03-22 11:14:11 +01:00
Alexander Mai
e1c565357a
Invalid code cause SIGSEGV since loop variable tok2 was not checked properly
2014-03-22 10:32:24 +01:00
Alexander Mai
cdd6d4df27
Removing a useless variable to fix cppcheck warning in its own code
2014-03-21 22:11:10 +01:00
Alexander Mai
37befc75ef
In case of a loop within the class hierarchie Function::isImplicitlyVirtual_rec() was entering an endless loop. Tracking the previously analyzed types shall prevent this.
2014-03-22 08:49:28 +01:00
PKEuS
49b25b05d9
Fixed crash in CheckBufferOverrun on garbage code ( #5595 )
2014-03-21 13:20:44 +01:00
Daniel Marjamäki
045e9e692b
ValueFlow: restricted bailouts in for loops
2014-03-21 08:48:49 +01:00
Daniel Marjamäki
fc014f055f
ValueFlow: Removed wrong bailout
2014-03-21 08:33:45 +01:00
Daniel Marjamäki
54e7f34f4a
Fixed #5584 (FP: Division by zero when function not declared)
2014-03-20 16:12:58 +01:00
XhmikosR
be0fcefe1d
Tabs to spaces.
...
[ci skip]
2014-03-20 09:02:14 +02:00
Daniel Marjamäki
22a5881bee
Uninitialized variables: Experimental checking for passing const pointer to partially initialized struct to function. Ticket: #5586
2014-03-20 07:19:35 +01:00
Daniel Marjamäki
8de4246713
Uninitialized variables: Improved handling of function calls when struct members are checked
2014-03-20 06:48:17 +01:00
Daniel Marjamäki
e48dfb0e6a
cygwin: apply cygwin compilation tweaks. thanks ir0nh34d.
2014-03-19 21:20:30 +01:00
Robert Reif
5c88934431
CheckIo: Fixed FIXME
2014-03-19 20:57:33 +01:00
Robert Reif
806ef44509
Fixed #5328 (Does not handle __attribute((xxx)) in typedefs)
2014-03-19 05:38:23 +01:00
PKEuS
b564986d5d
Added missing casts causing assertion failures on Windows ( #5391 )
...
-> Changed much more occurences, especially in preprocessor.cpp.
2014-03-18 21:41:47 +01:00
Daniel Marjamäki
ebb0c50aac
Tokenizer: Fix crash in Token::previous() method ('this' is NULL)
2014-03-18 20:29:37 +01:00
Daniel Marjamäki
01c29ed15f
Fixed #5518 (FP regression in 1.64: Array accessed out of bounds)
2014-03-18 17:04:33 +01:00
PKEuS
a3f5beb75d
Fixed problems with code "enum class { };" (which is valid C)
2014-03-18 16:23:30 +01:00
PKEuS
3a4b7e5c07
Fixed false positive #5578
2014-03-18 13:44:27 +01:00
PKEuS
af161fc361
Rewrote CheckStl::readingEmptyStlContainer(), resolving all its false positives shown on CppChecks own code
2014-03-18 12:38:22 +01:00
Daniel Marjamäki
177bf6fcb3
Fixed #5244 (FP: (error) Uninitialized variable: ptr - initialization within if-clause)
2014-03-18 06:37:19 +01:00
Daniel Marjamäki
e240282443
Value Flow: Another try with the abstract interpretation of for loops
2014-03-17 18:43:47 +01:00
PKEuS
2568baa473
#5528 : Raise duplicateExpressionError on operators /, % and -.
2014-03-17 18:35:36 +01:00
PKEuS
fab6b56360
Improved check ( #5553 ): Detect stricmp(var.c_str(), var.c_str())
2014-03-17 17:41:45 +01:00
PKEuS
5f67bc1b0a
Fixed varId problem #5293 (and its duplicate #5577 ): Classes inside functions are non-executable scopes.
2014-03-17 16:15:42 +01:00
Daniel Marjamäki
06618b31bb
Fixed #5574 (False positive: mismatchAllocDealloc using realloc() and free)
2014-03-17 16:10:54 +01:00
PKEuS
521734faa2
Fixed setVarId-Bugs #5294 and #5295 .
2014-03-17 14:19:46 +01:00
PKEuS
b6b374cf3d
Added verbose message for "memsetClass" error. ( #5183 )
2014-03-17 13:23:23 +01:00
PKEuS
e0b34de090
Implemented #5262 : VS solution copies cfg files to output folder.
2014-03-17 12:58:46 +01:00
PKEuS
ebd0b43c4f
Fixed #5382 : False positive "scope can be reduced" when initializing two-dimensional array.
2014-03-17 12:34:39 +01:00
PKEuS
d325d14b11
Fixed false positive #5535 : Reference named like its type.
2014-03-17 12:01:39 +01:00
PKEuS
50f6bb5d36
Fixed crash #5511 .
2014-03-17 11:50:45 +01:00
PKEuS
86e6bb430a
New check: Warning, if positioning operation (fseek) is performed on a file opened in "a" mode
2014-03-17 11:02:03 +01:00
PKEuS
1e57f54917
Fixed #5481 : std::array is POD, so using memcpy (etc.) is allowed on it.
2014-03-16 19:55:32 +01:00
Lucas Manuel Rodriguez
47ecdf58b2
Fixed #4804 (Improve check for 'std::string::data()' - identical to 'std::string::c_str()')
2014-03-16 15:04:44 -03:00
Lucas Manuel Rodriguez
9a08da17be
Fixed #4928 (C++ operator aliases result in false 'assigned a value that is never used' warning)
2014-03-16 14:51:05 -03:00
PKEuS
e05fb847df
Fixed #3852 : Support simplification of C++11 "enum class", fixed existing simplifications
2014-03-16 18:24:46 +01:00
PKEuS
6b16b519a2
Fixed crash on wrong __attribute__((constructor)) syntax
2014-03-16 16:39:07 +01:00
Alexander Mai
825bb0f027
Fixed #5286 (Add signal/exception handling to cppcheck and cppcheck-gui)
2014-03-16 12:04:13 +01:00
Alexander Mai
cba1879fee
Fixed #5571 (Clean up MathLib::isInt())
2014-03-16 11:55:44 +01:00
Daniel Marjamäki
8c3f2c2ad9
Revert 894a65b0
. abstract interpretation of for loops. there was some crashes and performance problems. I will fix those problems when I have time and recommit.
2014-03-16 08:38:52 +01:00
Alexander Mai
40ddcabab6
Fixed #4461 (Warn about memset/memcpy on class with references as members)
2014-03-15 18:22:29 +01:00
Daniel Marjamäki
894a65b0b1
ValueFlow: Refactor the for-loop handling. Use abstract interpretation.
2014-03-15 11:29:33 +01:00
Daniel Marjamäki
ce1aa1e011
Library: I had misunderstood const/pure a little so I corrected cfg and code
2014-03-14 20:08:34 +01:00
Robert Reif
2ba3a36f2c
Partial fix for #5555 . Improved pure/const attributes handling
2014-03-14 19:06:05 +01:00
Robert Reif
e26bd5b99c
Fixed #5563 (add __attribute__((destructor)) and improve __attribute__((constructor)) support)
2014-03-14 18:17:21 +01:00
Daniel Marjamäki
b2708987c3
Merge pull request #264 from thomasjfox/simplematch
...
Use simple match where possible
2014-03-14 17:51:45 +01:00
Alexander Mai
ff5fc82704
Fixed #4722 (Debugging enhancement: Tokenizer::simplifyTokenList() shall continue)
2014-03-14 17:48:20 +01:00
Daniel Marjamäki
a929b2146e
Improved checking of const functions in checkIncorrectLogicOperator
2014-03-14 17:37:53 +01:00
Thomas Jarosch
93341f4449
Use simple match where possible
...
Fixes these warnings found by "--enable=internal":
[lib/checkclass.cpp:972]: (warning) Found simple pattern inside Token::Match() call: "* *"
[lib/checkbufferoverrun.cpp:635]: (warning) Found simple pattern inside Token::Match() call: "."
[lib/checkbufferoverrun.cpp:1397]: (warning) Found simple pattern inside Token::Match() call: ";"
[lib/checksizeof.cpp:299]: (warning) Found simple pattern inside Token::Match() call: "."
[lib/checksizeof.cpp:301]: (warning) Found simple pattern inside Token::Match() call: ")"
[lib/checksizeof.cpp:303]: (warning) Found simple pattern inside Token::Match() call: "]"
[lib/checksizeof.cpp:318]: (warning) Found simple pattern inside Token::Match() call: ")"
[lib/checknullpointer.cpp:413]: (warning) Found simple pattern inside Token::Match() call: "delete"
[lib/checkio.cpp:1336]: (warning) Found simple pattern inside Token::Match() call: "> ("
[lib/checkstl.cpp:1509]: (warning) Found simple pattern inside Token::findmatch() call: ";"
[lib/checkstl.cpp:1512]: (warning) Found simple pattern inside Token::findmatch() call: ";"
[lib/checkstl.cpp:1594]: (warning) Found simple pattern inside Token::Match() call: "="
[lib/checkstl.cpp:1598]: (warning) Found simple pattern inside Token::Match() call: "] ="
[lib/checkunusedvar.cpp:755]: (warning) Found simple pattern inside Token::Match() call: "goto"
[lib/checkunusedvar.cpp:793]: (warning) Found simple pattern inside Token::Match() call: "="
[lib/checkuninitvar.cpp:376]: (warning) Found simple pattern inside Token::Match() call: "> ("
[lib/checkother.cpp:86]: (warning) Found simple pattern inside Token::Match() call: "> ("
[lib/checkother.cpp:2181]: (warning) Found simple pattern inside Token::Match() call: "> {"
[lib/valueflow.cpp:54]: (warning) Found simple pattern inside Token::Match() call: "&"
[lib/valueflow.cpp:409]: (warning) Found simple pattern inside Token::Match() call: "do"
[lib/valueflow.cpp:425]: (warning) Found simple pattern inside Token::Match() call: ") {"
[lib/valueflow.cpp:487]: (warning) Found simple pattern inside Token::Match() call: ") {"
[lib/valueflow.cpp:511]: (warning) Found simple pattern inside Token::Match() call: "} else {"
[lib/valueflow.cpp:615]: (warning) Found simple pattern inside Token::Match() call: "for ("
[lib/symboldatabase.cpp:80]: (warning) Found simple pattern inside Token::Match() call: "= {"
[lib/symboldatabase.cpp:1069]: (warning) Found simple pattern inside Token::Match() call: "std ::"
[lib/tokenize.cpp:2207]: (warning) Found simple pattern inside Token::Match() call: "< >"
[lib/tokenize.cpp:2730]: (warning) Found simple pattern inside Token::Match() call: ";"
[lib/tokenize.cpp:4234]: (warning) Found simple pattern inside Token::Match() call: "try {"
[lib/tokenize.cpp:4235]: (warning) Found simple pattern inside Token::Match() call: "} catch ("
[lib/tokenize.cpp:5500]: (warning) Found simple pattern inside Token::Match() call: "INT8"
[lib/tokenize.cpp:5752]: (warning) Found simple pattern inside Token::Match() call: "}"
[lib/tokenize.cpp:5752]: (warning) Found simple pattern inside Token::Match() call: "do"
2014-03-14 16:27:47 +01:00
Thomas Jarosch
c625606f45
Remove redundant code
2014-03-14 15:56:40 +01:00
Thomas Jarosch
c80f272176
Run astyle
2014-03-14 15:51:15 +01:00
Daniel Marjamäki
8c7cf090c4
Merge pull request #261 from orbitcowboy/master
...
MathLib:isHex(): fix detection of missing suffixes (U,L).
2014-03-14 13:00:35 +01:00
orbitcowboy
74d10cd6d9
Added function MathLib::isValidSuffix()
2014-03-14 11:46:41 +01:00
orbitcowboy
71ee625aab
MathLib: replaced isHexDigit function by isxdigit.
2014-03-14 09:33:20 +01:00
Daniel Marjamäki
401b43c36a
Merge pull request #263 from trulabs/master
...
Fix the detection of methods called from Qt's invokeMethod
2014-03-14 08:21:53 +01:00
Daniel Marjamäki
8d8913a168
Partial fix for #5555 . Add const,pure attributes to library.
2014-03-14 06:38:45 +01:00
Robert Reif
8c993c1363
Partial fix for #5555 . Remember function attributes: pure, const, constructor, destructor
2014-03-14 05:40:17 +01:00
Daniel Marjamäki
5698f7b337
astyle formatting
2014-03-14 05:36:44 +01:00
Sam Truscott
5dc13f3538
Tidy up the code for cppcheck style.
2014-03-13 16:47:00 +00:00
Sam Truscott
3d0524ecc6
Update the detection of the arguments in Qt's invokeMethod.
...
invokeMethod can invoke functions by name (string) rather than a
direct function call (i.e. reflection). The old code wasn't
correctly parsing out the argument which contained the name
of the function to call.
This resulted in that function being reported as unused when it is.
2014-03-13 16:43:25 +00:00
Daniel Marjamäki
61eb262244
Fixed #5215 (segmentation fault (invalid code) in TemplateSimplifier::useDefaultArgumentValues)
2014-03-12 19:36:22 +01:00
Robert Reif
cb1fc06a80
Fixed #5079 (CheckIO::checkFileUsage doesn't support wide char and microsoft functions)
2014-03-12 19:22:44 +01:00
Frank Zingsheim
b1dc51ba9c
Fixed #4796 (Missing semicolon after simplified template class)
2014-03-12 06:09:45 +01:00
Robert Reif
d1eb04c539
Fixed #4302 (Member variable not initialized in public delegate constructor)
2014-03-12 05:48:13 +01:00
Daniel Marjamäki
618c26f6bf
Merge pull request #260 from orbitcowboy/master
...
MathLib::isOct() fix missing detection of U and L suffix combinations an...
2014-03-12 05:30:35 +01:00
Daniel Marjamäki
3b4d024e06
Reverted info message that only applies to CLI
2014-03-11 20:55:02 +01:00
orbitcowboy
ed793793db
MathLib:isHex(): fix detection of missing suffixes (U,L).
2014-03-11 20:02:04 +01:00
Daniel Marjamäki
94454df14f
Fixed #2732 (Make it easier for users to tell 'How to supply header files')
2014-03-11 16:05:19 +01:00
Sam Truscott
385478d89e
Reflection no longer part of markup. Some tokeniser not done on markup.
2014-03-11 15:57:28 +01:00
Daniel Marjamäki
af0cf9bbc1
Merge pull request #258 from orbitcowboy/master
...
MathLib::isBin(): fix missing detection of U and L suffix combinations. ...
2014-03-11 06:36:31 +01:00
orbitcowboy
5b4ece4f9c
MathLib::isBin(): fix missing detection of U and L suffix combinations. Added missing test cases.
2014-03-10 17:23:07 +01:00
Julian Santander
fae8ef48b8
Fixed #5529 (Further control in selecting what configurations to consider)
2014-03-10 15:49:02 +01:00
Martin Ettl
0360840753
MathLib::isOct() fix missing detection of U and L suffix combinations and unittests.
2014-03-09 21:14:14 +01:00
Frank Zingsheim
5e0a575091
Optimization: tokenlist::addtoken
2014-03-09 17:54:49 +01:00
Frank Zingsheim
bc1ab4c48a
Optimization preprocessor.cpp use string::compare for charT
2014-03-09 14:26:16 +01:00
Frank Zingsheim
6e9e20d5b1
Optimization Tokenizer::simplifyMathFunctions. Make an a priori check whether the token combination can be a function call at all.
2014-03-09 13:22:58 +01:00
Daniel Marjamäki
4d06bc086d
astyle formatting
2014-03-09 08:49:32 +01:00
Daniel Marjamäki
7fa73c0d64
Merge pull request #256 from xypron/5505
...
5505: FP: Array accessed out of bounds
2014-03-09 08:47:18 +01:00
Daniel Marjamäki
c7f09d4350
Merge pull request #257 from simartin/ticket_5373_2
...
Ticket #5373 : delete can match %type% in C (take #2 )
2014-03-09 08:26:06 +01:00
Alexander Mai
3f30753122
Fixed #5537 (crash: clang ./lib/Basic/FileManager.cpp , since 354e84e7c8
, /lib/symboldatabase.h:288)
2014-03-09 08:17:24 +01:00
Simon Martin
a3d1cac79c
Ticket #5373 : Keep track whether tokens come from a C or C++ file to properly handle %type% in Token::Match with "delete"
2014-03-08 21:26:06 +01:00
Heinrich Schuchardt
bd67db96f1
5505: FP: Array accessed out of bounds
...
CheckBufferOverrun::checkFunctionParameter alreacy considered usage of a
function parameter inside an if block as a special case.
With the patch the same is done for switch statements.
A test is added.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2014-03-07 19:51:13 +01:00
Daniel Marjamäki
569db24756
astyle formatting
2014-03-06 16:21:57 +01:00
Alexander Mai
354e84e7c8
Fixed #2298 (new check: passing stack-address to free())
2014-03-06 06:32:30 +01:00
Daniel Marjamäki
ca0509e20b
Library: Fixed bug I caused when I cleaned up patch
2014-03-06 06:27:01 +01:00
Alexander Mai
1d4839b8a6
Fixed #1374 (false negative: using uninitialized variable in printf)
2014-03-06 06:16:14 +01:00
Daniel Marjamäki
bcd230d90d
Merge pull request #251 from matthiaskrgr/copyright
...
man, htdocs, gui, test, tools: bump a few more copyrights to 2014
2014-03-04 05:44:50 +01:00
Daniel Marjamäki
dbfe7e0b6b
Fixed cppcheck warnings
2014-03-03 19:00:32 +01:00
Pranav Khanna
f8a4fb91fe
Fixed #3796 (new check: redundant initialization with empty string)
2014-03-03 18:27:45 +01:00
PKEuS
470f1579c1
Incremented version to 1.65dev/1.64.99
2014-03-03 15:07:54 +01:00
Matthias Krüger
a9df4a3288
man, htdocs, gui, test, tools: bump a few more copyrights to 2014
2014-03-03 11:03:17 +01:00
Simon Martin
8baf8dbebb
Ticket #5425 : Avoid infinite recursion in checkMemsetType for invalid input
2014-03-03 07:19:32 +01:00
Daniel Marjamäki
4dee3da1bd
Merge pull request #245 from simartin/ticket_5478
...
Ticket #5478 : Only functions and equal operators might return a temporary
2014-03-02 14:53:25 +01:00
Daniel Marjamäki
4842115a56
1.64 : Update versions
2014-03-02 09:55:39 +01:00
Simon Martin
875a3f47e7
Ticket #5478 : Only functions and equal operators might return a temporary.
2014-03-02 09:39:10 +01:00
Daniel Marjamäki
aec3f18d77
Merge pull request #244 from simartin/ticket_5506
...
Ticket #5506 : Don't crash upon invalid template declaration
2014-03-02 08:54:07 +01:00
Simon Martin
3518e02d23
Ticket #5506 : Skip template parameters when determining whether a template is a declaration or a definition.
2014-03-01 14:58:47 +01:00
Daniel Marjamäki
bef4739853
Library: the bug in tinyxml has been fixed so the workaround can be removed now
2014-03-01 14:09:03 +01:00
PKEuS
357f5076db
Updated tinyxml
2014-03-01 11:15:08 +01:00
Daniel Marjamäki
a41a32ba8a
Fixed #5469 (CheckBufferOverrun: Use nullptr)
2014-02-28 17:02:03 +01:00
Alexander Mai
50a184c3e9
Fixed #5166 (segmentation fault (invalid code) in lib/checkother.cpp:329 ( void * f { } void b ( ) { * f } ))
2014-02-27 18:24:51 +01:00
Daniel Marjamäki
87c4508954
Spell fix: dont => do not
2014-02-27 16:40:42 +01:00
Alexander Mai
a02bbfa47e
Fixed #5492 (Fix small bug in MathLib::isFloat())
2014-02-27 16:08:49 +01:00
Daniel Marjamäki
dea4107245
Fix Cppcheck warning
2014-02-26 06:38:48 +01:00
Daniel Marjamäki
7dbfd67da3
Fixed #5493 (False positive: Found a statement that begins with numeric constant / string constant - in the presence of initialization list.)
2014-02-26 06:18:52 +01:00
Daniel Marjamäki
8550289722
Fixed #5452 (AST: wrong handling of unary ::)
2014-02-25 06:36:10 +01:00
Alexander Mai
0747b55485
Fixed #5304 (Wrong simplification of numbers like 001E+07 to 1.0)
2014-02-24 18:52:31 +01:00
Daniel Marjamäki
acf5723bdd
AST: improved AST printout when --verbose is used
2014-02-24 17:22:29 +01:00
Daniel Marjamäki
8dd7f02e45
Fixed #5381 (Some false positives that came up when using --enable=performance file.c)
2014-02-23 11:02:39 +01:00
Daniel Marjamäki
f6b42633e8
Fixed #5434 (FP: Out-of-bounds access with ternary operator in loop)
2014-02-22 17:59:12 +01:00
Daniel Marjamäki
34730f623a
Fixed #5301 (False positive: (error) Division by zero - variables read from input stream)
2014-02-22 12:09:54 +01:00
Daniel Marjamäki
910a90e4c1
Revert "cxx11.h: removed the 'evil workaround'"
...
This reverts commit 2cb9032d76
.
2014-02-21 20:06:55 +01:00
Alexander Mai
82a2279425
Fixed #5304 (Wrong simplification of numbers like 001E+07 to 1.0)
2014-02-20 16:56:49 +01:00
Daniel Marjamäki
ed9153ee80
Symbol database: added simple mismatch check in Scope::findFunction when passing address to function that expects a reference
2014-02-19 06:35:51 +01:00
Daniel Marjamäki
690c37633b
ValueFlow: Fixed bad values after break/continue
2014-02-17 20:07:38 +01:00
Daniel Marjamäki
c050a92bae
Fixed #5468 (crash: freebsd: llvm/RegionPrinter.cpp - AST failure)
2014-02-17 17:37:39 +01:00
Daniel Marjamäki
d37359217c
Merge pull request #241 from lanurmi/more-nullptr
...
Change some more 0 literals into nullptr.
2014-02-16 23:29:23 +01:00
Lauri Nurmi
70a67eaf85
Change some more 0 literals into nullptr.
2014-02-16 13:38:50 +02:00
Daniel Marjamäki
fdcb325d70
DuplicateBranch: Made warning inconclusive since it's in most cases noise
2014-02-16 11:04:27 +01:00
Daniel Marjamäki
23efc68dd7
use nullptr
2014-02-16 10:32:10 +01:00
Lucas Manuel Rodriguez
052840f8f5
Fixed #4818 (New check: Check memset() 2nd parameter)
2014-02-15 15:06:00 -03:00
Daniel Marjamäki
2cb9032d76
cxx11.h: removed the 'evil workaround'
2014-02-15 16:19:50 +01:00
Daniel Marjamäki
f0220c5340
astyle formatting
2014-02-15 16:18:13 +01:00
Daniel Marjamäki
209dffbe1b
use nullptr in lib/checkmemoryleak.cpp
2014-02-15 16:17:56 +01:00
Daniel Marjamäki
68119f0230
use nullptr in lib/checknullpointer.cpp
2014-02-15 16:12:37 +01:00
Daniel Marjamäki
fb5c2d4b48
use nullptr in lib/checkother.cpp
2014-02-15 08:46:28 +01:00
Daniel Marjamäki
720bd48a98
use nullptr in lib/library.cpp
2014-02-15 08:41:17 +01:00
Daniel Marjamäki
9eb789bdb2
use nullptr in lib/preprocessor.cpp
2014-02-15 08:37:57 +01:00
Daniel Marjamäki
5fe78d1534
use nullptr in lib/token.cpp
2014-02-15 08:05:54 +01:00
Daniel Marjamäki
384ffb4173
use nullptr in lib/tokenize.cpp
2014-02-15 08:04:54 +01:00
Lauri Nurmi
91340d4043
Emulate the C++11 'nullptr' and 'static_assert'
2014-02-15 07:52:17 +01:00
Daniel Marjamäki
fd3a8a2a18
Update copyright
2014-02-15 07:45:39 +01:00
Daniel Marjamäki
a1d9873558
Fixed #5465 (crash: AST doesnt produce good output for 'class C:public : 🅰️ :b<c>{..};')
2014-02-14 06:30:51 +01:00
Lucas Manuel Rodriguez
828609bb11
Fixed two doxygen errors - http://cppcheck.sourceforge.net/devinfo/doxygen-errors.txt
2014-02-09 16:46:49 -03:00
Daniel Marjamäki
8305015dea
astyle formatting
2014-02-08 08:51:38 +01:00
Pavel Roschin
19a8cfd960
Library: add new "define" tag
...
This tag will allow to add some preprocessor defs into library.
It would be useful to provide more information about libraries
implementation details. As example GLib's library include tag
was added that helps to detect more memory leaks.
2014-02-07 10:13:36 +04:00
Daniel Marjamäki
3c6bfac89c
Merge pull request #234 from scriptum/rpg-use-whitelist-from-library
...
CheckMemoryLeak: use library while checking whitelist functions
2014-02-05 11:41:47 +01:00
Daniel Marjamäki
ec80068cd9
Merge pull request #228 from simartin/osx_build_restore
...
RFC: Restore build on OSX
2014-02-05 11:30:34 +01:00
Pavel Roschin
0dd227419d
CheckMemoryLeak: use library while checking whitelist functions
2014-02-05 12:16:50 +04:00
Daniel Marjamäki
6ac9e180e0
ast: fixed hang when checking beid
2014-02-05 06:05:48 +01:00
Daniel Marjamäki
2ed3b40937
ast: fixed hang when checking bin-prot
2014-02-04 19:33:26 +01:00
Daniel Marjamäki
486a3192c0
Fixed #5246 (false positive: (warning) Logical conjunction always evaluates to false: t > 0 && t < 1.)
2014-02-04 06:50:29 +01:00
Daniel Marjamäki
ec61143623
Merge pull request #233 from orbitcowboy/master
...
Fixed #389 : Providing negative value to memory allocation function.
2014-02-02 10:47:37 -08:00
Heinrich Schuchardt
6bfd4af5f7
5355: False postive var not assigned
...
Avoid false positive "variable not assigned" for
struct Fred{
};
void foo () {
Fred fred;
throw fred;
}
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2014-02-01 22:40:35 +01:00
Martin Ettl
6ca7daec10
Fixed #389 : Providing negative value to memory allocation function.
2014-02-01 22:38:29 +01:00
Simon Martin
8ff9696374
OSX's compiler supports C++11 but one needs to use GNU's STL to build cppcheck, that does not have cbegin/end.
2014-02-01 07:40:08 +01:00
Daniel Marjamäki
b3bfd5014d
Fixed #5433 (FP:Possible null pointer dereference)
2014-01-31 15:43:34 +01:00
Daniel Marjamäki
9aa9530e0d
Fixed #5426 (crash: btrfs-progs cmds-inspect.c)
2014-01-31 06:19:36 +01:00
Lucas Manuel Rodriguez
a34d2eb7b3
Fixed #4938 : (.empty() method false positive for non-STL classes)
2014-01-30 18:09:24 -03:00
Daniel Marjamäki
d6e3b3d3f3
ast: fixed syntax tree for 'a=(b)?1:0'. The parentheses should not be in the syntax tree
2014-01-30 17:31:06 +01:00
Lucas Manuel Rodriguez
ad0269eeeb
Refactor checks using Variable::isStlType()
2014-01-30 01:26:48 -03:00
Daniel Marjamäki
30b56437c1
Merge pull request #226 from scriptum/rpg-fix-function-parameter
...
CheckMemoryLeak: improve leak checking in function parameters
2014-01-28 20:32:56 -08:00
Lucas Manuel Rodriguez
b69fedf70b
Fix '-Wshadow' warning (from 'Fixed #5423 ' commit)
2014-01-28 23:16:29 -03:00
Lucas Manuel Rodriguez
7fdc4ab6cc
Refactor isContainerSizeSlow() to use Variable::isStlType()
2014-01-28 13:31:23 -03:00
Kamil Dudka
dee18d10a8
Fixed #5423 (fix parsing of #line NNNN "file.c")
2014-01-28 17:15:07 +01:00
Daniel Marjamäki
abe8439917
Fixed #5416 (False positive: Array accessed at index, which is out of bounds.)
2014-01-28 16:55:10 +01:00
Lucas Manuel Rodriguez
2048313915
Add Variable::isStlType function
2014-01-28 11:44:56 -03:00
Pavel Roschin
2396073262
CheckMemoryLeak: improve leak checking in function parameters
2014-01-28 17:30:36 +04:00
Daniel Marjamäki
2108251851
Fixed #5417 (ast: avoid hang when '({})' is used)
2014-01-28 06:11:53 +01:00
Daniel Marjamäki
c8a1424e10
Fixed #5406 (crash inside valueFlowBeforeCondition() on files from kernel-git)
2014-01-27 06:18:42 +01:00
Daniel Marjamäki
2b8cf462c9
CheckMemoryLeak: Move posix-opendir/closedir to library
2014-01-26 17:02:36 +01:00
Daniel Marjamäki
0c47555423
CheckNullPointer: use library instead of hard coded info
2014-01-26 16:19:49 +01:00
Daniel Marjamäki
be082a8e4a
value flow: added bailout for conditional return/continue/break when number_of_if is bigger than 0
2014-01-26 15:50:25 +01:00
Daniel Marjamäki
c5971b7137
value flow: fix fp when conditional value is assigned
2014-01-25 20:14:49 +01:00
Daniel Marjamäki
c1e35e1df1
value flow: fixed multivariable problem in condition
2014-01-25 19:13:33 +01:00
Daniel Marjamäki
d227ed245f
cleanup
2014-01-25 18:51:55 +01:00
Daniel Marjamäki
df0995edf5
Fixed #5403 (Value flow: FP because post increment/decrement is not handled correctly)
2014-01-25 18:31:02 +01:00
Daniel Marjamäki
bc9ad08831
Fixed #5245 (false positive: Uninitialized variable (assignment inside ternary operator))
2014-01-25 10:12:50 +01:00
Daniel Marjamäki
35b51468cb
value flow: Fixed FP for division then check in for loop: 'for (a=b/x;x>0;x--)'
2014-01-25 09:22:32 +01:00
Daniel Marjamäki
4647a9fc93
Fixed #5401 (value flow: fp when there are increment/decrement)
2014-01-24 18:22:38 +01:00
Daniel Marjamäki
1cac7e1686
value flow: better handling in function call bailout of casting address of variable
2014-01-24 17:47:49 +01:00
Daniel Marjamäki
135998abba
value flow: use const when possible
2014-01-24 06:16:23 +01:00
Heinrich Schuchardt
de20ba6763
[PATCH] Types in isRecordTypeWithoutSideEffects
...
The type definition of the iterator should match the type definition of the map <const Type *, bool>.
2014-01-24 06:10:19 +01:00
Daniel Marjamäki
85b6495cce
value flow: fixed comments
2014-01-23 19:40:47 +01:00
Daniel Marjamäki
ec034c1d59
Fixed #5386 (ast: hang when code is 'for (T a : b)')
2014-01-23 06:13:24 +01:00
Daniel Marjamäki
0dbb86f0cb
Cleanup ExecutionPath from CheckBufferOverrun
2014-01-22 21:25:37 +01:00
Daniel Marjamäki
1d7bb05faf
Remove ExecutionPath from CheckNullPointer
2014-01-22 20:24:51 +01:00
Daniel Marjamäki
f3f7e6d302
value flow: replacing executionpath checking of null pointers
2014-01-22 20:16:31 +01:00
Daniel Marjamäki
43db1ee797
value flow: use more specific bailouts when analysing value flow after assignment
2014-01-22 06:38:25 +01:00
Daniel Marjamäki
cc38dec3ad
value flow: a bit better handling of assigned variable
2014-01-22 06:10:17 +01:00
Daniel Marjamäki
2b7a991c1a
temporarily hide gcc warnings
2014-01-21 21:17:03 +01:00
Daniel Marjamäki
a27ccbd0f8
value flow: start implementing value flow analysis of assigned value
2014-01-21 21:13:49 +01:00
Daniel Marjamäki
a84fdf98cc
Null pointer: remove old checking that is replaced by value flow checking
2014-01-21 19:50:52 +01:00
Daniel Marjamäki
20b73747e0
value flow: refactor. added Token::getMaxValue()
2014-01-21 16:58:23 +01:00
Daniel Marjamäki
b91f42453b
value flow: improved handling of cast
2014-01-20 22:26:55 +01:00
Daniel Marjamäki
bb3cc67aaa
value flow: improved calculations that depends on variable
2014-01-20 21:45:30 +01:00
Daniel Marjamäki
69109784e8
value flow: cleanup usage of valueflow. utility function Token::getValue was added.
2014-01-20 06:49:45 +01:00
Daniel Marjamäki
add84187cc
CheckOther: Removed old zero division check
2014-01-20 06:31:13 +01:00
Daniel Marjamäki
7ff7bc1c2e
Fixed #5376 (false positive: zerodivcond (style) Either the condition 'B>0' is useless or there is division by zero)
2014-01-19 20:16:55 +01:00
Daniel Marjamäki
84c5f47eb1
value flow: bailout for class variables that are non-const
2014-01-19 11:55:02 +01:00
Daniel Marjamäki
ccda78f347
value flow: fixed todo assertion for handling of conditions
2014-01-19 09:31:40 +01:00
Daniel Marjamäki
cdaa7abf7e
value flow: better handling of conditional code below || && ?: operators
2014-01-19 09:05:48 +01:00
Daniel Marjamäki
2d0a68cac2
cleanup redundant variable inconclusive
2014-01-18 19:51:57 +01:00
Daniel Marjamäki
77f3f6c21a
valueflow: added setTokenValue that perform calculations using set value
2014-01-18 19:30:44 +01:00
Daniel Marjamäki
6a3a9ee8e7
ast: fixed tree for 'sizeof(struct S)'
2014-01-18 13:18:11 +01:00
Daniel Marjamäki
c7032a8867
value flow: improved handling of loops
2014-01-18 11:54:00 +01:00
Daniel Marjamäki
498cdb8610
added debug output for the value flow
2014-01-18 09:58:32 +01:00
Ryan Pavlik
32bf275447
Fix case-insensitive string compare function on MinGW
2014-01-17 15:29:53 -06:00
Daniel Marjamäki
3e23e243f6
BufferOverflow: Updated message for out of bounds array index or redundant condition
2014-01-17 19:44:45 +01:00
Daniel Marjamäki
57d318b2e5
valueflow: better handling of increment/decrement
2014-01-17 19:28:28 +01:00
Daniel Marjamäki
18d6285ad2
BufferOverrun: Improved error message when array index is used before checking that its in limits
2014-01-17 18:56:46 +01:00
Daniel Marjamäki
b2b5590f2b
Refactoring: Moved astStringify to the Token class and renamed it to expressionString. This can often be useful when reporting error messages that contains source code.
2014-01-17 18:37:49 +01:00
Daniel Marjamäki
30cae358d8
Removed the --value-flow flag. ValueFlow analysis will always be enabled from now on.
2014-01-17 18:07:05 +01:00
Daniel Marjamäki
5721e1d745
CheckNullPointer: Removed some of the old checking that doesn't use ValueFlow
2014-01-17 17:47:59 +01:00
Daniel Marjamäki
311059f603
Tokenizer: Removed commented-out simplification
2014-01-17 17:44:33 +01:00
Daniel Marjamäki
3facc06cb7
CheckOther: Removed non-valueflow check for division by possible zero before condition
2014-01-17 17:42:54 +01:00
Daniel Marjamäki
0203a4a6f5
Tokenizer: Removed simplifyGoto as it's the cause of various FPs I see
2014-01-17 17:36:45 +01:00
Daniel Marjamäki
4eb746d7cc
Tokenizer: Removed simplifyComparisonOrder
2014-01-17 17:25:56 +01:00
Daniel Marjamäki
0b4de97e2b
value flow: Use ValueFlow in CheckBufferOverrun
2014-01-16 19:23:14 +01:00
Daniel Marjamäki
85b73f7c24
ast: fixed hang for weird loop: 'for (each_window(list,p))'
2014-01-16 16:58:50 +01:00
Daniel Marjamäki
e72ec830ef
ast: fixed hang in for-loop handling
2014-01-16 06:45:35 +01:00
Daniel Marjamäki
141e089329
ast: different handling of for loops. create a syntax tree for whole 'f(a;b;c)'.
2014-01-15 17:32:14 +01:00
Daniel Marjamäki
c547c9a108
value flow: fixed fp when variable is used in for-loop condition
2014-01-14 17:57:50 +01:00
Daniel Marjamäki
e45a2e2c61
Fixed #5347 (False positive: uninitialized variable (try catch))
2014-01-14 06:24:09 +01:00
Robert Reif
d679a4c1f7
Fixed #5248 (False positive: Invalid argument in scanf for %zd)
2014-01-14 06:09:13 +01:00
Daniel Marjamäki
c1c2f4bbc6
value flow: fixed crash reported in #5343 when typeStartToken and typeEndToken are misplaced.
2014-01-13 20:54:09 +01:00
Daniel Marjamäki
7981e3d38f
value flow: fix fp when gotos are used
2014-01-13 16:07:25 +01:00
Daniel Marjamäki
bfc67a536a
value flow: fixed fp when self-checking checkbool.cpp. added some comments.
2014-01-13 06:15:21 +01:00
Daniel Marjamäki
b1bbb23225
value flow: fixed fp when checking symboldatabase
2014-01-13 05:52:28 +01:00
Daniel Marjamäki
f6c7be91a9
Fixed cppcheck warning
2014-01-12 21:19:20 +01:00
Daniel Marjamäki
8b6f001f94
value flow: inconclusive handling of unknown functions
2014-01-12 19:48:20 +01:00
Daniel Marjamäki
5d2a39b580
CheckNullPointer: improved function call checking when new value flow analysis is used
2014-01-12 19:27:26 +01:00
Daniel Marjamäki
2e67ca06c0
value flow: some simplifications in unknown functions when there is library configuration
2014-01-12 18:19:00 +01:00
Daniel Marjamäki
ab866be03a
Tokenizer: Move 'else if' simplification to tokenize
2014-01-12 17:47:02 +01:00
Daniel Marjamäki
d700114edf
value flow: bailout if condition is defined by macro
2014-01-12 17:16:51 +01:00
Heinrich Schuchardt
f6510a6b45
Fixed #5339 (Tokenizer::setVarId : function-pointer function argument not getting variable id, causing FP)
2014-01-12 15:15:09 +01:00
Daniel Marjamäki
3d79613f2b
value flow: more bailouts when return/break/continue/goto is reached. TODO: handle these better.
2014-01-12 15:07:58 +01:00
Daniel Marjamäki
155990cb0e
value flow: improved checking of do-while loops for non-local variables
2014-01-12 15:02:58 +01:00
Daniel Marjamäki
5b679fc732
value flow: fixed fp for data member
2014-01-12 14:37:26 +01:00
Alexander Mai
86763b401c
Fixed #5340 (Preprocessor: not using errorLogger when reporting syntax errors)
2014-01-12 13:15:54 +01:00
PKEuS
b775714e3d
Moved several hardcoded function names in format string checking into libraries (std.cfg and windows.cfg).
...
Added support for loading a library in test suite.
2014-01-12 03:44:24 -08:00
Daniel Marjamäki
21d317b7d6
value flow: fixed redundant null pointer check
2014-01-12 12:38:41 +01:00
Daniel Marjamäki
d8262963d9
value flow: condition in loop, bailout valueflow analysis before loop if there is assignment inside the loop
2014-01-12 11:58:10 +01:00
Daniel Marjamäki
e3496080c8
Fixed #5334 (False positive: same expression on both sides of '||')
2014-01-12 07:40:56 +01:00
Daniel Marjamäki
f58e1ab80e
value flow: fixed fp in switch
2014-01-11 21:21:00 +01:00
Daniel Marjamäki
3625d179e5
value flow: don't perform value flow analysis in sizeof/typeof expressions
2014-01-11 21:10:01 +01:00
Daniel Marjamäki
680d3f1312
value flow: fixed fp for nested assignments
2014-01-11 20:53:23 +01:00
Daniel Marjamäki
4d045879aa
value flow: fixed fp when while condition contains variable that is changed in loop body
2014-01-11 20:25:49 +01:00
Daniel Marjamäki
75f9111775
value flow: bailout when variable is used in assignment to itself
2014-01-11 15:36:09 +01:00
Daniel Marjamäki
1fc2c9fe79
ast: fixed syntax tree for statement enclosed in parentheses ';(expr);'
2014-01-11 15:18:39 +01:00
Daniel Marjamäki
ceca6be22b
Fixed #5334 (False positive: same expression on both sides of '||')
2014-01-11 15:15:01 +01:00
Daniel Marjamäki
eaf8c83db5
value flow: refactoring. broke out function for skipping value simplifications in expressions.
2014-01-11 14:54:10 +01:00
Daniel Marjamäki
85dcb14813
value flow: bailout in valueFlowBeforeCondition if variable can be assigned by subfunction
2014-01-11 14:31:51 +01:00
Daniel Marjamäki
225001a45c
value flow: changed astparent lookup
2014-01-11 12:47:47 +01:00
Daniel Marjamäki
02b92efd1a
value flow: improved analysis of expressions below ?, && and || operators
2014-01-11 12:44:55 +01:00
Daniel Marjamäki
60348da1b5
value flow: fixed fp for rhs in && and || expressions
2014-01-11 11:30:34 +01:00
Daniel Marjamäki
1ad94a8be5
value flow: loosen up bailouts in valueFlowSubFunction
2014-01-11 07:52:25 +01:00
Daniel Marjamäki
57d241793f
value flow: fix segfault if var is null
2014-01-10 18:30:41 +01:00
Daniel Marjamäki
c687933e9f
value flow: improved handling of for loops
2014-01-10 18:19:24 +01:00
Daniel Marjamäki
3eebc8a9f1
test1
2014-01-10 16:51:58 +01:00
Daniel Marjamäki
3e7f692d4d
value flow: stop checking global variable when going out of function scope
2014-01-10 16:17:19 +01:00
Daniel Marjamäki
acb103e214
value flow: skip scopes that don't contain variable
2014-01-10 16:13:39 +01:00
Daniel Marjamäki
81513b4346
value flow: Readded safety check that tok->astOperand1() is not NULL
2014-01-10 05:54:03 +01:00
Daniel Marjamäki
d085705e8f
value flow: assume that value of global const variable is not changed
2014-01-10 05:47:56 +01:00
Daniel Marjamäki
a26c5736da
Library: Allow loading xml data from memory
2014-01-09 21:58:56 +01:00
Daniel Marjamäki
752e9d0fb7
Tokenizer::varId: Fixed wrong varid for shadow types with same names as class members
2014-01-09 21:44:29 +01:00
Daniel Marjamäki
1be30bf022
ast: fixed handling of templates
2014-01-09 17:14:16 +01:00
XhmikosR
f9dd9676be
Fix the C4099 warning.
2014-01-09 16:58:42 +02:00
Daniel Marjamäki
04cb56e070
ast: fixed trouble with 'ab=a+(b/(c))+d;' where the '(c)' could be mistaken for a cast
2014-01-08 21:49:42 +01:00
Daniel Marjamäki
4f11086505
Tokenizer: Don't remove parentheses in 'a?b:(c>0?d:e)'
2014-01-08 20:53:33 +01:00
Daniel Marjamäki
32f2ee422f
value flow: fixed segfault and added more handling of unsigned values
2014-01-08 20:10:38 +01:00
Daniel Marjamäki
644004573b
Preprocessor: fixed 8.0E+007 in macros
2014-01-08 18:05:14 +01:00
Daniel Marjamäki
7c4a7ac3d5
value flow: starting to refactor CheckNullPointer::nullPointerDeRefThenCheck
2014-01-08 17:37:39 +01:00
Daniel Marjamäki
26a72d73fe
value flow: improved subfunction handling when using && or || in function argument
2014-01-08 16:49:15 +01:00
Daniel Marjamäki
a2fe1ebe92
value flow: pass result of bool operator to function
2014-01-08 16:17:47 +01:00
Daniel Marjamäki
6d22c9deaa
value flow: if unsigned variable is compared against 1 with either >= or <= then assume it can have the value 0
2014-01-08 06:53:17 +01:00
Daniel Marjamäki
1e3c43e708
value flow: improved bailouts in ?:
2014-01-08 06:39:15 +01:00
Daniel Marjamäki
dfee044925
value flow: Fixed wrong value in subfunction after conditional return
2014-01-08 06:04:51 +01:00
Daniel Marjamäki
1fb0b1750c
value flow: Fixed FP in ?:
2014-01-07 19:46:13 +01:00
Daniel Marjamäki
740f72fdbd
value flow: simple handling of for loops
2014-01-07 19:20:56 +01:00
Martin Ettl
fa04273473
Merge branch 'master' of https://github.com/danmar/cppcheck
2014-01-06 18:51:15 +01:00
Daniel Marjamäki
126f2ed423
Fixed Visual Studio compiler error
2014-01-06 18:14:29 +01:00
Daniel Marjamäki
a6320a35e0
value flow: added experimental subfunction handling
2014-01-06 16:37:52 +01:00
Daniel Marjamäki
58fb2e756b
Value flow: added bailout on }
2014-01-06 11:27:56 +01:00
Daniel Marjamäki
39b47cc1e7
value flow: improved error message output for conditional division by zero
2014-01-06 10:51:17 +01:00
Daniel Marjamäki
a5b79bc968
value flow: fixed bailout so it really bails out
2014-01-06 10:23:17 +01:00
Zachary Blair
4a2da09491
minor cleanups. initialize members in initialization list
2014-01-06 08:02:04 +01:00
Daniel Marjamäki
c4fa3bb137
value flow: added bailouts for global variables and assignments
2014-01-06 07:44:58 +01:00
Daniel Marjamäki
c32d0f1992
CheckInternal: Improved checking of multiCompare patterns. The multiCompare pattern can contain any %cmd% until there is non-%cmd% used. For instance %var%|%num% is handled ok.
2014-01-05 23:03:36 +01:00
Daniel Marjamäki
a98c66b048
Fixed Token::Match pattern. See also #5310
2014-01-05 23:02:07 +01:00
Daniel Marjamäki
4620284cbf
astyle formatting
2014-01-05 22:06:11 +01:00
Daniel Marjamäki
62c608141d
CheckInternal: Improved checking of multiCompare patterns
2014-01-05 21:15:41 +01:00
Daniel Marjamäki
0877adb542
astyle formatting
2014-01-05 21:12:32 +01:00
Daniel Marjamäki
afaf1473a8
Value flow: refactorings, write debug warning if iterating too far
2014-01-05 20:06:46 +01:00
Graham Whitted
86201c13cb
Fixed #5097 (TemplateSimplifier::expandTemplate assertion failure)
2014-01-05 19:19:52 +01:00
Alexander Mai
77362fd671
Fixed #5289 (Crash: Stack overflow in isImplicitlyVirtual_rec when checking SVN)
2014-01-05 19:10:16 +01:00
Daniel Marjamäki
29c64cc34c
Merge pull request #209 from simartin/ticket_5266
...
Ticket #5266 : Properly tokenize "complex" static variable declarations.
2014-01-05 04:44:22 -08:00
Daniel Marjamäki
deb3699bd8
value flow: Updated Visual Studio files
2014-01-05 09:52:37 +01:00
Daniel Marjamäki
9fabc7991a
value flow: fixed segfault when checking lib/mathlib.cpp
2014-01-04 21:28:15 +01:00
Daniel Marjamäki
45278eadc7
value flow: fixed bugs
2014-01-04 21:23:17 +01:00
Daniel Marjamäki
d8270c710a
Add new experimental value flow analysis
2014-01-04 20:57:02 +01:00
Daniel Marjamäki
f1054a50f6
Merge pull request #208 from simartin/ticket_5201
...
Ticket #5201 : Get rid of internal error when checking valid C input for leaks
2014-01-04 05:18:44 -08:00
Daniel Marjamäki
93a9cb40df
Fixed #5310 (Internal error: match compiler returned different result than parsed match)
2014-01-04 13:53:54 +01:00
Simon Martin
d2cf9fd77c
Ticket #5266 : Properly tokenize "complex" static variable declarations.
2014-01-04 10:49:27 +01:00
PKEuS
55f68535b2
Set version to "1.64 dev"/1.63.99. Use version.h in cppcheck.cpp.
2014-01-04 10:41:13 +01:00
Daniel Marjamäki
6515691a47
1.63: Set version numbers
2014-01-04 09:32:37 +01:00
Simon Martin
6019f45249
Ticket #5201 : Get rid of internal error when checking valid C input for memory leaks.
2014-01-03 23:27:56 +01:00
Daniel Marjamäki
7125682d1a
Fixed #5274 (TokenList: macro handling)
2014-01-03 18:53:37 +01:00
Robert Reif
cbe3862599
Fixed #5264 (Size specifier in printf functions is wrong for some types)
2014-01-03 15:58:45 +01:00
Alexander Mai
10ff45b54a
Fixed #5306 (Implement --showtime=top5)
2014-01-03 10:45:14 +01:00
Alexander Mai
ea10a722fc
Fixed #5306 (Implement --showtime=top5)
2014-01-03 10:24:57 +01:00
Zachary Blair
7a6386bc4b
Fixed #4867 (Memory Leak: Return value of malloc)
2014-01-03 10:12:32 +01:00
Alexander Mai
f93d21c8df
Fixed #5303 (Possible NULL pointer dereference in checkassert.cpp)
2014-01-03 09:32:05 +01:00
Daniel Marjamäki
a94fccf51a
astyle formatting
2014-01-02 21:47:35 +01:00
Sam Truscott
4333dd3c75
Update Qt to support Markup structure
2014-01-02 18:18:24 +01:00
Daniel Marjamäki
b08880f20f
Library: Changed ignorefunction to a set
2014-01-02 17:28:24 +01:00
Daniel Marjamäki
372c29c24e
Fixed #5284 (duplicateExpression falsely reported by members of a union in some circumstances)
2014-01-02 16:58:07 +01:00
Daniel Marjamäki
2f91539d1d
Preprocessor: don't insert macroChar inside .1 and 1. tokens
2014-01-02 11:21:23 +01:00
Daniel Marjamäki
a1b0d190df
Fixed #3688 (false positive: (inconclusive, posix) (warning) The buffer 'cBuffer' is not zero-terminated after the call to readlink().)
2014-01-02 10:46:19 +01:00
Alexander Mai
12df5300ba
Fixed #5290 (Doxygen fixes ( 32be409
))
2014-01-01 20:46:00 +01:00
Martin Ettl
5a5277f2fa
Tokenizer::simplifyVarDecl: Fixed crash when checking garbage code.
2014-01-01 19:15:32 +01:00
Martin Ettl
0dccd3a632
Tokenizer:simplifyFlowControl(): Fixed crash on garbage code.
2014-01-01 19:04:02 +01:00
Daniel Marjamäki
d62055277d
Fixed #4787 (False Positive: Unused private function)
2014-01-01 18:36:51 +01:00
Alexander Mai
5539e9ea0f
Fixed #5279 (False positive: warning (uninitMemberVar): Member variable 'ToDoubleArray::mfNaN' is not initialized in the constructor. (modified #5170 example))
2014-01-01 18:34:39 +01:00
Daniel Marjamäki
cd65d8e54f
Fixed #5169 (Preprocessor::removeComments : Bad handling of __asm)
2014-01-01 12:44:59 +01:00
Daniel Marjamäki
32be4094e7
Symbol database: only put variables in variable list
2013-12-31 17:51:56 +01:00
PKEuS
621cf6e777
Support arrays as template parameters in TemplateSimplifier::templateParameters
2013-12-31 13:59:32 +01:00
PKEuS
6f76dfcb22
Forward declare tinyxml type used in library.h to avoid problems with dynamic linked configuration.
2013-12-31 12:30:17 +01:00
Daniel Marjamäki
803182bf45
Reverted 'GUI: Added CFGDIR qmake flag' there are various installation problems and this only fixes one of them.
2013-12-31 10:35:34 +01:00
Daniel Marjamäki
7e71c41ba7
Preprocessor: Don't insert macroChar inside 1.f and 1.e+7 as that mess it up later. Thanks ettlmartin for telling me about this.
2013-12-31 10:24:14 +01:00
Daniel Marjamäki
8da0d84905
Library: fixed crash in Library::load if exename is NULL
2013-12-30 18:35:27 +01:00
Daniel Marjamäki
99703e1a3f
Preprocessor: make sure 1E-7, 1E+7, 1e+7 in macros is output as a single token. Putting a macroChar before the 7 mess it up later.
2013-12-30 18:03:24 +01:00
PKEuS
4f0121ee2f
Splitted simplification out of tokenize()
2013-12-30 17:45:28 +01:00
Daniel Marjamäki
c143b02e67
GUI: Added CFGDIR qmake flag
2013-12-30 09:01:44 +01:00
Daniel Marjamäki
582baa5648
Preprocessor: make sure 1e-7 is output as a single token. puttin a macroChar before the 7 mess it up later.
2013-12-29 21:51:01 +01:00
Daniel Marjamäki
41e4194573
Tokenizer: set links for <> in 'a=new b<c>;' code
2013-12-29 15:37:27 +01:00
Daniel Marjamäki
f2661dae4c
astyle formatting
2013-12-29 13:44:13 +01:00
Daniel Marjamäki
e13aa0dbc3
Fixed #5275 (FP mismatchAllocDealloc: user defined opendir()/closedir() on non-POSIX system)
2013-12-29 09:51:29 +01:00
Daniel Marjamäki
ef3d3f2d40
Temporary fix for #5263 until tinyxml2 handle folders better. When https://github.com/leethomason/tinyxml2/issues/147 is fixed this should be reverted.
2013-12-28 21:57:13 +01:00
Daniel Marjamäki
4b72f01e99
clarify calculation: Fixed FP for 'a = (*p ? 1 : 2)'
2013-12-28 11:02:39 +01:00
Daniel Marjamäki
e0eb000ac3
AST: Fixed problem with decrement
2013-12-27 14:40:59 +01:00
Daniel Marjamäki
d3a848f2e6
Makefile: Added optional CFGDIR parameter that allows user to specify where Cppcheck will look for cfg files.
2013-12-26 18:41:51 +01:00
Daniel Marjamäki
742a6935ea
Calculation in sizeof: Fixed FP for sizeof(Fred**)
2013-12-26 13:52:58 +01:00
Daniel Marjamäki
29e74222fb
Sizeof calculation: Fixed FP for sizeof(int*[2])
2013-12-26 13:41:21 +01:00
Daniel Marjamäki
5d5e347418
AST: better handling of 'sizeof(void*)'
2013-12-25 22:08:53 +01:00
Daniel Marjamäki
915cb6c757
Fixed #5261 (AST: cast not handled well (a::b&)x)
2013-12-25 21:19:28 +01:00
Daniel Marjamäki
aa65799c19
pointerArithBool: Updated error message
2013-12-25 19:56:00 +01:00
Daniel Marjamäki
6182394966
Uninitialized variables: Fixed false positive taking value of pointer that is allocated but not initialized
2013-12-25 14:00:27 +01:00
Daniel Marjamäki
eb2ea1c28f
AST: refactored CheckSizeof::sizeofCalculation()
2013-12-25 12:35:41 +01:00
Daniel Marjamäki
26dfddac6b
UninitVar: Fixed false positive when checking if allocated pointer is null
2013-12-24 12:48:17 +01:00
Daniel Marjamäki
4c44e62159
AST: Refactored CheckOther::clarifyCalculation
2013-12-24 10:07:20 +01:00
Daniel Marjamäki
753559fff3
Uninitialized variables: Don't warn about try/catch exception variables
2013-12-24 07:39:15 +01:00
Daniel Marjamäki
042d3afb80
CheckOther::checkDuplicateExpression: Readded warnings when there is a expression between the duplicate expressions 'X || Y || X'
2013-12-24 07:21:46 +01:00
Daniel Marjamäki
ac30a84c3a
Refactoring: Replaced CheckOther::checkCCTypeFunctions with configuration
2013-12-23 19:58:33 +01:00
Daniel Marjamäki
a3dd65caee
Fixed #5126 (new check: missing pointer dereference or pointer overflow 'if (p+1)')
2013-12-23 18:39:05 +01:00
Daniel Marjamäki
661784a170
Fixed #5255 (False positive (error) Uninitialized variable: ptr2 - calling a static member function)
2013-12-23 16:50:27 +01:00
Daniel Marjamäki
e2fa6a291c
Uninitialized variables: Fixed false negatives for loop variables / pointer dereference
2013-12-23 12:27:00 +01:00
Daniel Marjamäki
596b4bd405
astyle formatting
2013-12-23 12:26:12 +01:00
Daniel Marjamäki
e747b6c49b
Merge pull request #202 from simartin/ticket_5214
...
Ticket #5214 : Added test case (ticket already fixed in mainline).
2013-12-23 02:49:25 -08:00
Daniel Marjamäki
76b907fe65
Fixed #5252 (Improve check: use Library to validate function arguments in invalidFunctionUsage)
2013-12-23 10:06:45 +01:00
Daniel Marjamäki
be03d4718a
Library: Added <valid> element that is used to define valid input values for functions
2013-12-22 19:10:14 +01:00
Daniel Marjamäki
85c62f98d7
Library: added <markup> element
2013-12-22 18:44:31 +01:00
Simon Martin
02dc49624d
Ticket #5214 : Don't read out of bounds upon invalid ternary operator.
2013-12-22 18:13:52 +01:00
Daniel Marjamäki
4769838b80
Library: Refactoring of markup code
2013-12-22 17:03:46 +01:00
Daniel Marjamäki
e2bc99aa24
Fixed #5154 (Tokenizer: wrong handling of msvc 'for each')
2013-12-17 06:34:27 +01:00
Daniel Marjamäki
762806499f
Fixed #5182 (Tokenizer::simplifyEnum: template function call as enum value)
2013-12-16 07:07:00 +01:00
Daniel Marjamäki
92305ed1f9
Fixed #5170 (False positive: warning (uninitMemberVar): Member variable 'ToDoubleArray::mfNaN' is not initialized in the constructor.)
2013-12-15 14:07:29 +01:00
Daniel Marjamäki
a948b4f4b0
Revert "Preprocessor:removeParentheses: fixed potential buffer access out of bounds, if find returns std::string::npos."
...
This reverts commit 4fbe15c866
.
As far as I see there can't be buffer access out of bounds. line always contain a '('.
2013-12-15 13:41:07 +01:00
Daniel Marjamäki
7938692b01
Fixed #5212 (Tokenizer::simplifyEnum bad simplification of enum value (1<<0)|(1<<1))
2013-12-15 07:47:04 +01:00
Daniel Marjamäki
f599e3184c
Fixed #5174 (Tokenizer: member function 'abort' returns)
2013-12-14 11:12:48 +01:00
Daniel Marjamäki
fdcb6634df
Fixed #5190 (FP Use const reference to avoid data copying)
2013-12-14 08:46:18 +01:00
Daniel Marjamäki
98b6fa2eaf
SymbolDatabase: Use std::size_t for Function::getArgument() argument since Function::argCount() returns a std::size_t
2013-12-14 08:35:46 +01:00
Daniel Marjamäki
57ecdd693c
Fixed #5149 (false positive: (error) Dereferencing 'memory' after it is deallocated / released)
2013-12-14 07:37:24 +01:00
Daniel Marjamäki
80dec5a976
Uninitialized variables: Fixed FP when taking address of uninitialized variable
2013-12-13 20:10:22 +01:00
Daniel Marjamäki
7fe923bfc5
Uninitialized variables: Fixed FP when the variable is initialized in do-while condition
2013-12-13 13:27:01 +01:00
Daniel Marjamäki
abdd29fce3
fixed FP when passing uninitialized buffer as 2nd argument to itoa
2013-12-13 07:51:33 +01:00
Daniel Marjamäki
3e6fbc6517
Fixed uninitialized variable FP after realloc if it fails. Related with ticket: #5240
2013-12-13 07:15:59 +01:00
Daniel Marjamäki
08cd0cd0f7
CheckOther::checkDuplicateExpression: Added TODO comment to readd checking for duplicate separated expressions
2013-12-13 06:40:35 +01:00
Daniel Marjamäki
d2493fa3cb
CheckMemoryLeak: Report OtherRes leaks as resource leak
2013-12-12 18:23:42 +01:00
Daniel Marjamäki
35189e80f2
Uninitialized variables: Fixed false positive for '*p=..'
2013-12-12 15:33:31 +01:00
Daniel Marjamäki
7321f92eff
CheckUninitVar: Fix Coverity warning about possible null pointer.
2013-12-12 12:36:49 +01:00
Daniel Marjamäki
1b86615a69
Uninitialized variables: Fixed false positive for 'p=malloc; if (p) {}'
2013-12-12 11:44:07 +01:00
orbitcowboy
4fbe15c866
Preprocessor:removeParentheses: fixed potential buffer access out of bounds, if find returns std::string::npos.
2013-12-09 01:40:51 -08:00
Daniel Marjamäki
4e7594748d
Uninitialized variables: Fixed false positive for 'p=malloc; if (python tools/daca2.py b)'
2013-12-12 09:17:41 +01:00
Daniel Marjamäki
9f62740e1d
Fixed #5236 (varid 0: vlc: src/misc/objects.c:126)
2013-12-12 08:44:00 +01:00
Daniel Marjamäki
a4f9cb78d5
Uninitialized variables: Fixed false positives when passing allocated pointer to function
2013-12-11 05:54:42 +01:00
Daniel Marjamäki
ef15e40de5
Uninitialized variables: error when passing uninit pointer to function
2013-12-10 18:36:16 +01:00
Daniel Marjamäki
83066edec0
Code cleanup
2013-12-10 06:29:06 +01:00
Daniel Marjamäki
5ba02d2fdd
AST: Always use AST
2013-12-09 18:06:19 +01:00
Daniel Marjamäki
be5c00d215
Uninitialized variables: check function arguments
2013-12-09 15:58:42 +01:00
Daniel Marjamäki
14a00046a3
Fixed #5207 (Struct uninitialized members useage is not giving error (malloc).)
2013-12-04 20:32:20 +01:00
Simon Martin
fe75686595
Ticket #5203 : Don't crash when checking buffer overrun for invalid code.
2013-11-30 07:40:32 +01:00
Daniel Marjamäki
0c5282b1af
Fixed #5081 (False positive: (error) Uninitialized variable: f (handling of C-cast not correct))
2013-11-28 16:04:47 +01:00
Daniel Marjamäki
771dc2e1ad
AST: Improved handling when calling function through function pointer hidden within parantheses '(a.f)(1,2)'
2013-11-27 06:17:00 +01:00
Daniel Marjamäki
3b11ee9e0e
AST: Improved handling of brackets
2013-11-25 20:58:40 +01:00
Daniel Marjamäki
d8b25da73c
Fixed #4740 (False Positive: Uninitialised variable 'int *a[2][19]; int **b = a[0];')
2013-11-25 06:38:23 +01:00
Daniel Marjamäki
da540a3bb3
AST: Improved astIsFloat handling of expressions
2013-11-25 04:26:15 +01:00
Daniel Marjamäki
abdf2bb9d4
AST: fixed isSameExpressions handling of ({..})
2013-11-25 04:08:28 +01:00
Daniel Marjamäki
94e2bf7a11
AST: Handle ({..})
2013-11-25 04:07:44 +01:00
Robert Reif
43f00942dd
Fixed #5197 (SymbolDatabase: bad handling of unknown macros in function declaration)
2013-11-25 03:43:39 +01:00
Daniel Marjamäki
13cd0f41f6
AST: Fixed FP in isSameExpression when there are different casts
2013-11-24 15:17:08 +01:00
Alexander Mai
38b2f6b9b0
Fixed #5168 (segmentation fault (invalid code) in Tokenizer::simplifyVarDecl)
2013-11-24 11:07:11 +01:00
Daniel Marjamäki
8b77b7711c
Merge pull request #199 from simartin/ticket_5168
...
Ticket #5168 : Don't crash when simplifying bit-fields for invalid code.
2013-11-24 01:55:02 -08:00
Simon Martin
9817da00ec
Ticket #5168 : Don't crash when simplifying bit-fields for invalid code.
2013-11-23 20:33:03 +01:00
Daniel Marjamäki
4fe6951b4c
Library: Fixed loading of 'resource'
2013-11-23 18:16:40 +01:00
Daniel Marjamäki
7fc07989a7
UninitVar: Fixed false positive 'data is allocated but not initialized' when there is assignment
2013-11-23 10:24:29 +01:00
Robert Reif
0afdbc73da
Fixed #5195 (Crash below CheckIO::checkWrongPrintfScanfArguments())
2013-11-23 08:40:35 +01:00
Daniel Marjamäki
8cca41774d
Fixed #4446 (Crash on complex C++ template)
2013-11-21 20:27:24 +01:00
Daniel Marjamäki
2c1f579b3b
Library: Fixed formatstr handling
2013-11-21 16:32:53 +01:00
orbitcowboy
b74db1b791
Tokenize:simplifyFloatCast(): added corresponding suffix, incase of type 'float'.
2013-11-20 23:58:43 -08:00
Alexander Mai
7d45e9be73
Fixed #5122 (duplInheritedMember on private variables)
2013-11-21 05:39:23 +01:00
Daniel Marjamäki
ef108c49ec
Tokenizer: simplify enums better. add parentheses to enforce operator precedence.
2013-11-20 18:04:28 +01:00
Daniel Marjamäki
e8eeb90adb
AST: Fixed 'same expression' false positives (git merge --squash s, <<, >>)
2013-11-20 16:18:09 +01:00
Daniel Marjamäki
27a40b10e1
AST/incorrectLogicOperator: Better handling of large doubles where x+1=>x
2013-11-20 06:33:34 +01:00
Daniel Marjamäki
6869d0de30
AST: Handle L'x'
2013-11-20 05:57:56 +01:00
Daniel Marjamäki
47b98470eb
Tokenizer: Simplify float casts of integer constants
2013-11-19 18:07:12 +01:00
Daniel Marjamäki
f8cf64afef
Fixed #4710 (Template parser bug: const in constructor changes template names)
2013-11-19 06:07:25 +01:00
Daniel Marjamäki
4e003c392e
AST: code cleanup. Remove unreachable 'break' after 'return'
2013-11-18 23:24:58 +01:00
Daniel Marjamäki
45ee3b0fba
AST: Refactoring new checkIncorrectLogic checking
2013-11-18 23:09:14 +01:00
Daniel Marjamäki
ff5f223a1d
Fixed #5116 (false positive: memset on class (nested struct))
2013-11-18 16:56:00 +01:00
Daniel Marjamäki
033cb19656
Same expression: Don't write warnings for same expression on both sides of arithmetical operators
2013-11-17 17:21:39 +01:00
Daniel Marjamäki
71e61fb1ed
Uninitialized variables: Fixed false positive when using ?:
2013-11-17 12:42:53 +01:00
Daniel Marjamäki
77e09d72a1
Uninitialized variables: Fixed false negatives when using ({})
2013-11-17 12:11:18 +01:00
Daniel Marjamäki
d342387b95
Uninitialized var: Fixed false negatives for self assignment
2013-11-16 18:07:33 +01:00
Daniel Marjamäki
2a640a59c2
Tokenizer: Improved handling of pointer aliases. This fixes some false negatives.
2013-11-16 17:30:04 +01:00
Martin Ettl
feb54a46fb
Merge branch 'master' of https://github.com/danmar/cppcheck
2013-11-10 05:06:00 +01:00
Daniel Marjamäki
cfd6b0c384
UninitVar: fixed false negatives for function calls
2013-11-16 12:02:21 +01:00
Daniel Marjamäki
8c7e3d14aa
Fixed #5119 (Preprocessor: Using -D suppresses __cplusplus for C++ files)
2013-11-15 19:21:21 +01:00
Daniel Marjamäki
30720affd6
Tokenizer::setVarId: Fixed hang when checking libgc
2013-11-15 16:16:22 +01:00
Daniel Marjamäki
5af2fe6e5b
AST: improved 'incorrect logic' checking when there are nested expressions
2013-11-15 06:51:35 +01:00
Daniel Marjamäki
d1721b9d1b
AST: Improved 'same expression on both sides of operator' checking for nested operators
2013-11-15 06:35:46 +01:00
Daniel Marjamäki
203d3e916b
Fixed #5173 (false positive Variable XX is reassigned a value before the old one has been used)
2013-11-14 16:10:00 +01:00
Daniel Marjamäki
673400920d
AST: Fixed 'a[1][2]'
2013-11-13 17:52:56 +01:00
Daniel Marjamäki
7fe51eb58b
Fixed #4989 (False positive: Wrong processing of __asm block)
2013-11-13 06:04:00 +01:00
Daniel Marjamäki
1ecade2657
AST: don't warn about duplicate expressions around '+' operator. It might be more efficient than using for instance '*2'
2013-11-11 20:03:59 +01:00
Daniel Marjamäki
58d7caded1
AST: improved handling of casts
2013-11-11 16:39:34 +01:00
Martin Ettl
3bf415fa2b
checkbufferoverrun: improved constness of local variables. checkbufferoverrun:array_index(): added a bailout if the function is called with tok=NULL and added a NULL pointer check after a dynamic_cast.
2013-11-10 05:05:31 +01:00
Martin Ettl
347e1eae20
Fixed #5162 : Tokenizer:simplifyInitVar: Unused pointer value (UNUSED_VALUE) returned_pointer: Pointer tok2 returned by tok2->next() is never used (CID 1124084).
2013-11-10 00:40:42 +01:00
Daniel Marjamäki
4027848761
incorrectLogicOperator: fixed FP when comparing char values. improved handling of float comparisons.
2013-11-10 18:06:51 +01:00
Daniel Marjamäki
807f62520c
Fixed crash caused by endless recursion in redundant assignments check
2013-11-10 17:20:40 +01:00
Alexander Mai
687aeb4f5f
Fixed #5158 (segmentation fault (valid code))
2013-11-10 16:22:52 +01:00
Daniel Marjamäki
bb746261d3
AST: Fixed crash
2013-11-10 15:51:33 +01:00
Daniel Marjamäki
85b41059c5
astyle formatting
2013-11-10 15:49:53 +01:00
Daniel Marjamäki
4ed4d71b3c
CheckOther::checkIncorrectLogicOperator(): cleanup
2013-11-10 14:24:09 +01:00
Daniel Marjamäki
0dd17f9fad
Merge pull request #198 from simartin/ticket_5073
...
Ticket #5073 : Don't crash upon invalid do-while loop.
2013-11-10 03:09:16 -08:00
Daniel Marjamäki
cadb284a3d
Refactored the AST checking of CheckOther::checkIncorrectLogicOperator()
2013-11-10 11:59:18 +01:00
Martin Ettl
babbee4e73
Fixed typos in comments, no functional changes.
2013-11-09 16:07:28 +01:00
Simon Martin
185b88c6e3
Ticket #5073 : Don't crash upon invalid do-while loop.
2013-11-08 23:13:21 +01:00
Daniel Marjamäki
20b84fcdee
Null pointers: Don't warn when first argument to freopen() is NULL
2013-11-08 13:22:07 +01:00
Robert Reif
52df31b501
Fixed #5153 ((debug) Scope::checkVariable found variable ')')
2013-11-08 12:56:32 +01:00
Robert Reif
a6ef3a224a
Fixed #5151 (false negative: improper formatstring - vector::at())
2013-11-08 12:44:05 +01:00
Daniel Marjamäki
b0ce42565e
AST: Added experimental new implementations for CheckAssignIf::comparison, CheckOther::checkIncorrectLogicOperator and CheckOther::checkDuplicateExpression
2013-11-07 14:38:08 +01:00
orbitcowboy
43103c84d8
Checkother:memsetZeroBytes: removed not needed '\n' from verbose message.
2013-11-07 05:15:36 -08:00
orbitcowboy
3d47ae9463
checkother:memsetZeroBytes: improved verbose message.
2013-11-06 06:42:27 -08:00
orbitcowboy
86aa2a27ab
checkother: improved constness of local variables, no functional change.
2013-11-06 06:15:32 -08:00
Daniel Marjamäki
a572c0b728
AST : cleanup unused functions
2013-11-06 12:38:58 +01:00
Martin Ettl
4eba02d901
Checkbufferoverrun: improved constness of local variables, no functional changes.
2013-11-03 04:48:41 +01:00
Daniel Marjamäki
fb04c8ff84
Fixed #5107 (redundantAssignment when pointer changes)
2013-11-04 23:46:07 +01:00
Daniel Marjamäki
7996d609be
Fixed #5108 (false positive: uninitialized variable (assignment in function parameter))
2013-11-04 23:09:15 +01:00
orbitcowboy
929cda6696
fixed #5141 : Tokenizer: Dereference before null check (Scan.coverity id 1061759)
2013-11-04 03:53:23 -08:00
Daniel Marjamäki
8ff412fcee
Fixed #5142 (False positive with floating-point special cases in conditions)
2013-11-04 11:56:43 +01:00
Daniel Marjamäki
dde46527f3
AST: Handle ternary operators
2013-11-04 11:44:54 +01:00
Daniel Marjamäki
de29991c11
AST: Rewrite using standard approach
2013-11-04 11:26:16 +01:00
Daniel Marjamki
9959c2866c
AST: fixed hang for ',&x..'
2013-11-03 15:05:58 +01:00
Daniel Marjamki
bcc8384a95
Fixed #5145 (False Positive: Variable 'A' hides enumerator with same name)
2013-11-03 09:34:48 +01:00
Daniel Marjamäki
5f0cfa0ee4
Fixed #4983 (False positive warning 'Possible null pointer dereference: lblList - otherwise it is redundant to check it against null.' with sizeof lblList[0])
2013-11-02 23:56:10 +01:00
Daniel Marjamäki
769b4617c3
Fixed #5142 (False positive with floating-point special cases in conditions)
2013-11-02 22:58:23 +01:00
Daniel Marjamäki
a50e5c2c23
Merge pull request #195 from simartin/ticket_5139
...
Ticket #5139 : Properly handle recursive macro definitions
2013-11-02 11:21:13 -07:00
Daniel Marjamäki
c505f5ea23
Fixed AST problem for 'if ((a.b&c)==d){}'
2013-11-02 19:18:58 +01:00
Daniel Marjamäki
bbdfd8b5c7
Make it possible to create AST, by using the --ast flag
2013-11-02 18:37:35 +01:00
Daniel Marjamäki
f0a621a952
Tokenizer: Added MAXTIME so cppcheck can be compiled with a hard max time. Will be used for the daca2.
2013-11-02 17:31:14 +01:00
Simon Martin
95c08d5613
Ticket #5139 : Properly simplify recursive macro definitions
2013-11-01 16:47:22 +01:00
Robert Reif
ac3b1c0611
Fixed #5134 (Memory leak below CheckIO::checkWrongPrintfScanfArguments())
2013-11-01 05:42:37 +01:00
Martin Ettl
083af88801
Checkio: removed redundant NULL-pointer check, introduced by me.
2013-11-01 00:18:13 +01:00
Martin Ettl
3e13408da2
Merge branch 'master' of https://github.com/danmar/cppcheck
2013-10-31 20:03:13 +01:00
Martin Ettl
897533ab93
Checkio: fixed potential NULL-pointer dereference (Coverity-ScanId: CID 1113428).
2013-10-31 20:03:05 +01:00
XhmikosR
a60252ce7b
Fix compilation error with VS after e446a28b3d
.
2013-10-31 20:56:47 +02:00
Martin Ettl
5156481db4
Library: return false from load() when tinyxml::FirstChildElement() return a NULL pointer.
2013-10-31 19:49:36 +01:00
Daniel Marjamäki
e446a28b3d
Refactoring FileLister and Path so they don't depend on Library
2013-10-31 19:09:01 +01:00
Martin Ettl
c529de6e07
Library: tinyxml2::FirstChildElement() is capable of returning 0. This fixes a waring of scan.coverity(): CID 1113430 ( #1 of 1): Dereference null return value (NULL_RETURNS)
2013-10-29 00:36:27 +01:00
Daniel Marjamäki
d3bd373798
Fixed #5131 (False Positive: %u in format string requires 'unsigned int' but the argument type is 'int'.)
2013-10-31 17:20:00 +01:00
Daniel Marjamäki
352c459e28
Merge pull request #194 from simartin/ticket_5121
...
Ticket #5121 : Handle static variable declarations depending on one another
2013-10-30 22:09:44 -07:00
Alexander Mai
14787cde99
Fixed #5129 (FP:arithOperationsOnVoidPointer on void**)
2013-10-31 06:04:51 +01:00
Daniel Marjamäki
06c5bd0daa
Fixed #5128 (False positive zerodivcond 'a ? 1 / a : 0')
2013-10-30 16:51:00 +01:00
Simon Martin
d67722ebdf
Ticket #5121 : Handle comma separated static variable declarations depending on one another
2013-10-30 15:48:00 +01:00
Simon Martin
463ef2e71e
Ticket #5120 : New test case, that works now that #5125 is fixed
2013-10-30 10:15:03 +01:00
Simon Martin
052be76635
Ticket #5125 : Avoid infinite recursion for recursive class definitions
2013-10-29 21:41:47 +01:00
Daniel Marjamäki
5c072993e3
CheckBool: Fixed false negative when assigning bool to pointer '; s.p = true; '
2013-10-29 16:16:52 +01:00
orbitcowboy
30984ff649
Tokenize: improved const correctness of local variables, no functional change.
2013-10-25 01:34:53 -07:00
orbitcowboy
76e092428a
Tokenize: improved const correctness of local variables, no functional change.
2013-10-25 01:31:55 -07:00
Daniel Marjamäki
514277e91b
Library: Fixed bug. Continue if there is no errors.
2013-10-27 17:38:39 +01:00
PKEuS
bd752cabcf
Let TinyXML2 handle fopen/fclose. Added testlibrary.cpp to VS10 solution
2013-10-27 17:32:38 +01:00
Daniel Marjamäki
e0244d343d
Library: Fixed resource leak
2013-10-27 17:17:54 +01:00
Daniel Marjamäki
569a29bc4a
Library: Added simple testing
2013-10-27 17:10:43 +01:00
PKEuS
c95b153700
Refactorizations:
...
- Removed some redundant operator=, copy-ctor and dtor implementations
- use operator[] instead of at() in library loading code
2013-10-27 13:55:13 +01:00
Robert Reif
94187c41c2
Fixed #5104 (False positive: Invalid argument in printf and scanf for vector template)
2013-10-27 10:48:49 +01:00
Daniel Marjamäki
4a6274dcc0
Merge pull request #183 from felipensp/null_ptr_typeof
...
- Fixed false positive when passing pointer to typeof()
2013-10-27 02:37:31 -07:00
Daniel Marjamäki
ec3ab74631
Preprocessor: Use set instead of list to track '#pragma once' usage
2013-10-27 10:33:37 +01:00
Daniel Marjamäki
86358694fb
Uninitvar: Added comment to clarify that the old logic for function calls has been removed because it had FP and the 'same' checking in the new checker will be used to catch these errors instead.
2013-10-26 18:46:06 +02:00
Daniel Marjamäki
51ad9ab6ac
Fixed #4896 (FP Uninitialized variable on template function)
2013-10-26 18:39:40 +02:00
Daniel Marjamäki
8687e85e56
Fixed #4850 (False positive: invalidIterator1 detected when iterator container is member of some struct)
2013-10-26 17:48:20 +02:00
Daniel Marjamäki
853d9dd7a9
Fixed #4956 (false positive: Variable 'myIsFirst' is assigned a value that is never used.)
2013-10-26 15:22:28 +02:00
Daniel Marjamäki
22351a73b1
doxygen: escape #pragma in comment to make doxygen happy. Thanks XhmikosR for the suggestion!
2013-10-25 16:08:19 +02:00
Daniel Marjamäki
c6702db9ab
Code cleanups
2013-10-23 15:03:31 +02:00
XhmikosR
c11ee0a1ed
Remove unused variables.
2013-10-23 09:19:23 +03:00
XhmikosR
93bdf45313
Fix typo in error message.
2013-10-23 09:05:39 +03:00
Daniel Marjamäki
364757e1e1
Fixed #5089 ('inconclusive' output printed although --inconclusive not specified)
2013-10-23 06:42:52 +02:00
Daniel Marjamäki
d1b03d9c31
Fixed false positive for 'object is destroyed immediately' when there is no code after the object
2013-10-22 19:37:11 +02:00
Daniel Marjamäki
a55056c770
Fixed #5105 (false positive: (warning) Either the condition 'b!=0' is useless or there is division by zero)
2013-10-22 16:18:42 +02:00
Daniel Marjamäki
fd0f2d7900
Fixed #4929 (False positive: possible null pointer deref (checks dont handle && and || well))
2013-10-22 10:47:48 +02:00
Sam Truscott
6806fd8135
Extended Qt support through Library
2013-10-20 14:09:10 +02:00
Daniel Marjamäki
fc26de89a9
Fixed #5082 (False positive: (error) Possible null pointer dereference: p2)
2013-10-20 13:37:36 +02:00
Daniel Marjamäki
5d7e0aebf4
Fixed #5084 (False positive: (style) Same expression on both sides of '&&')
2013-10-19 18:04:53 +02:00
Daniel Marjamäki
6aa03efa2f
Fixed #5103 (Don't show 'The scope of the variable can be reduced' if there is no explicit block with { })
2013-10-19 17:27:02 +02:00
Daniel Marjamäki
e3a12de057
astyle formatting
2013-10-19 09:52:19 +02:00
Daniel Marjamäki
f8710cb984
Fixed #5102 (Crash if -D is used when scanning simple preprocessor code.)
2013-10-18 06:47:55 +02:00
Robert Reif
b41ab8a4d5
Fixed #5088 (Token::Match called with varid 0. in libreoffice sd/source/ui/table/TableDesignPane.cxx)
2013-10-14 21:05:54 +02:00
Felipe Pena
ecb0e70250
- Fixed false positive when passing pointer to typeof()
2013-10-12 10:19:15 -03:00
Daniel Marjamäki
b70d9196cb
1.62: Update version
2013-10-12 12:30:17 +02:00
Daniel Marjamäki
21c537e8d7
1.62: Set versions
2013-10-12 12:22:52 +02:00
Robert Reif
1fccfd50eb
Fixed #5080 ((error) Internal error. Token::Match called with varid 0. Please report this to Cppcheck developers)
2013-10-12 10:50:59 +02:00
orbitcowboy
9debeab47c
Tokenizer:simplifyMathExpressions: fixed false negative patterns for simplification.
2013-10-11 11:58:37 -07:00
Daniel Marjamäki
bb0385321f
Fixed #5074 (False positive: Duplicate expression (macro))
2013-10-13 17:42:06 +02:00
Martin Ettl
a674ed1aa9
Tokenizer:simplifyMathFunction: added simplifcation for fma[f|l]() functions.
2013-10-13 16:28:02 +02:00
Martin Ettl
e18ebf313f
Tokenizer:simplifyMathFunctions: added support for more math functions.
2013-10-13 15:41:47 +02:00
Martin Ettl
cdb47813d5
Tokenizer:simplifyMathFunctions: added support for cosh[f|l], cos[f|l] and erfc[f|l] functions.
2013-10-13 14:23:10 +02:00
Daniel Marjamäki
9e12bdf9cb
Merge pull request #184 from felipensp/uninitialized_var_typeof
...
- Fixed false positive when using typeof/__alignof__
2013-10-13 01:43:18 -07:00
PKEuS
4cd2fad2bf
Set version to 1.63 dev
2013-10-13 09:53:56 +02:00
Felipe Pena
ed565f1ab1
- Fix comment
2013-10-12 13:49:35 -03:00
Felipe Pena
c37ba4cbcf
- Fixed false positive when using typeof/__alignof__
2013-10-12 13:46:14 -03:00
orbitcowboy
6eaa2f2444
Tokenizer:simplifyMathFunctions: added support for acos[f|l] functions.
2013-10-09 07:59:32 -07:00
Daniel Marjamäki
682e68b1b6
Fixed #5077 (False positive: Comparison of boolean result with relational operator ((X + (Y < 0)) <= b))
2013-10-09 05:43:50 +02:00
Martin Ettl
f08325284c
Tokenizer:simplifyMathFunctions: added support for acosh[f|l]() functions.
2013-10-07 22:10:58 +02:00
Daniel Marjamäki
9ce7efc6e4
commaSeparatedReturn: made checking experimental for now because there are false positives ( #5076 )
2013-10-08 18:05:07 +02:00
Daniel Marjamäki
4f88fdcf4a
Check64Bit: Fixed false positive about returning integer for 'p+(n*80)'
2013-10-08 06:36:45 +02:00
Robert Reif
41b3ed788d
CheckIO: fix crash
2013-10-08 05:33:37 +02:00
Daniel Marjamäki
f9cf148012
CheckBool: Skip 'bool' type checking in C code
2013-10-07 18:41:07 +02:00
Daniel Marjamäki
b81de5494e
CheckBool: Fixed false positive for calculation using bool result in rhs
2013-10-07 18:01:08 +02:00
Daniel Marjamäki
d2025363d0
CheckBool: Fix false positive for '(a != boolexpr || c)' if a is a int
2013-10-07 17:44:19 +02:00
Daniel Marjamäki
83f9503839
CheckBool: Fixed false positives for non-bool expressions that contain ! operator
2013-10-07 16:37:51 +02:00
Daniel Marjamäki
023d0e7cb8
Fixed #5072 (False positive: comparisonOfBoolWithInvalidComparator even without explicit bool type)
2013-10-07 16:16:07 +02:00
Daniel Marjamäki
4cd0108b93
Fixed #4976 (False positive: (style) A pointer can not be negative (git/sha1_file.c))
2013-10-06 16:52:27 +02:00
Daniel Marjamäki
0ef1529ba5
Fixed #5005 (false positive: (warning) Assignment of function parameter has no effect outside the function.)
2013-10-06 16:07:27 +02:00
Daniel Marjamäki
1234ec95f0
Fixed #4998 (False positive: Address of local auto-variable assigned to a function parameter)
2013-10-06 14:23:26 +02:00
Daniel Marjamäki
9f23b7a1b4
Fixed #5063 (False positive for comparisonOfBoolWithInvalidComparator)
2013-10-06 10:39:08 +02:00
Daniel Marjamäki
c234cace6d
Fixed #5064 (Tokenizer::simplifySizeof: Doesn't simplify 'sizeof !! (a==1);' properly)
2013-10-06 08:20:10 +02:00
Daniel Marjamäki
9cfc1030cd
Tokenizer: Optimised loop
2013-10-06 07:46:35 +02:00
Daniel Marjamäki
946722faf0
Fixed #4968 (False positive: Structure with 'read' member is confused with read() function.)
2013-10-05 18:25:44 +02:00
Robert Reif
7098fc6039
CheckIO: fixed handling of unknown types. Ticket #5051
2013-10-05 16:47:06 +02:00
Daniel Marjamäki
6830d5f7a4
Fixed #5042 (false positive: Redundant code (set filled in initialization list))
2013-10-05 12:26:09 +02:00
Daniel Marjamäki
db4ca13184
CheckBool: refactoring isBoolExpr
2013-10-05 11:31:55 +02:00
Daniel Marjamäki
f2fdd967f5
Fixed #5046 (False positive: Boolean value assigned to pointer)
2013-10-05 08:53:37 +02:00
Daniel Marjamäki
348f3fa97f
Fixed #5058 (False positive: (warning) Comparison of a boolean expression with an integer.)
2013-10-05 08:33:33 +02:00
Robert Reif
5dbc02250f
This patch adds pointer to format string support to printf. Ticket: #5051
2013-10-05 07:47:52 +02:00
Robert Reif
44559a1fb2
Fixed #5069 (sizeof(void) when variable name is override)
2013-10-05 07:40:59 +02:00
Robert Reif
6c06cdd24d
CheckIO fixes. Ticket: #5051
2013-10-04 17:30:55 +02:00
Martin Ettl
a8cf8f0984
Tokenizer:simplifyMathFunctions: fixed false positives when simplifying special pow() cases.
2013-10-03 22:54:45 +02:00
Martin Ettl
f8bd33f2bc
Tokenizer:simplifyMathFunctions: added support for log()-functions. Improved testcases and documentation. The function simplifyMathFunctions() returns now true in case a simplifcation is made. This function is called within a while loop to guarantee all simplifications are made.
2013-10-03 20:52:07 +02:00
Martin Ettl
548e2f3fbf
Tokenizer:simplifyMathExpression: fixed false negatives in simplifying Pythagorean and Hyperbolic identities.
2013-10-03 15:41:12 +02:00
Robert Reif
59de30823e
CheckIO: This patch adds support for fprintf_s, fscanf_s and %I. Ticket: #5051
2013-10-03 06:37:40 +02:00
Robert Reif
022e7a0f0f
CheckIO: Fix INT_PTR false positive found while checking mpc-hc. Ticket: #5057
2013-10-02 04:19:04 +02:00
Robert Reif
5aba841499
CheckIO: Handling of casts ( #4964 )
2013-10-02 04:12:46 +02:00
PKEuS
17810e4eb5
Fixed linker problems in mathlib
2013-10-01 20:40:55 +02:00
Martin Ettl
fa5ee8fd13
Tokenizer: simplifyMathFunctions: added more simplifications for exp(), exp2() and log2() functions.
2013-10-01 20:30:59 +02:00
orbitcowboy
677257f569
Fixed clang warning: lib/checkother.h:360:80: warning: implicit conversion turns string literal into.
2013-09-30 10:43:21 -07:00
XhmikosR
2762a30e48
Prefer prefix operator.
2013-10-01 09:20:19 +03:00
Robert Reif
cc6745fef6
CheckIO: Fixed false positives when using _snprintf_s and _snwprintf_s. Ticket: #5057
2013-10-01 05:49:44 +02:00
Martin Ettl
f0cbeb5233
simplifyMathFunctions: added support for exp(),sqrt(),cbrt() functions.
2013-09-29 18:11:17 +02:00
Robert Reif
c37c6617d3
Fixed #5057 (Microsoft secure printf/scanf support.)
2013-09-30 19:55:21 +02:00
Daniel Marjamäki
e3b7bce72b
Fixed #4907 (False positive 'uninitStructMember' on structs with unions)
2013-09-30 06:35:31 +02:00
Lucas Manuel Rodriguez
cb4abd6f16
Add doc. to typeStartToken and typeEndToken functions
2013-09-29 16:09:19 -03:00
Daniel Marjamäki
1c513f330a
Fixed #5055 (False negatives when using -I (external source code))
2013-09-29 18:59:27 +02:00
Martin Ettl
00987eb120
MathLib: improved constness of local variables. No functional change.
2013-09-29 15:49:02 +02:00
Daniel Marjamäki
f96a88ec57
Fixed #5054 (debug warnings when Variable::typeStartToken() or Variable::typeEndTypen() is not set correctly)
2013-09-29 16:01:22 +02:00
Robert Reif
d3798958f4
CheckIO: Fixed false positive when using wchar_t ( #5051 )
2013-09-29 15:25:18 +02:00
Martin Ettl
0527aefb11
Improved simplifyMathFunctions when simplifying special cases of pow(x,y)-function.
2013-09-29 15:11:09 +02:00
Martin Ettl
ee9b7283ec
checkother:checkComparisonFunctionIsAlwaysTrueOrFalse: Removed redudant varid != 0 check. No functional changes.
2013-09-29 13:33:46 +02:00
Daniel Marjamäki
973bdcc6d8
Fixed #4929 (false positive: Division by zero (standard function div()))
2013-09-29 11:13:49 +02:00
Robert Reif
c5723ab46a
CheckIO: Clarify format check warnings
2013-09-29 10:42:47 +02:00
Daniel Marjamäki
c05a80d314
zero division or useless condition: dont crash when variable declaration is not parsed correctly
2013-09-28 16:51:38 +02:00
Martin Ettl
5aaaff46ee
Fixed #5049 : new check: (warning) Comparison of two identical variables with isgreater(result,result) evaluates always to false.
2013-09-26 07:07:48 +02:00
Martin Ettl
805d082cd1
Tokenizer:simplifyMathFunction: added support for [ll]div() functions and corresponding unittests. The simplifcation is only performed, if a division by 1 is detected.
2013-09-26 07:01:08 +02:00
Steve Duan
cf0c666d79
Fixed #5041 (Improve check: support 'auto' for 'Iterator used after element has been erased')
2013-09-28 11:50:45 +02:00
Daniel Marjamäki
4a02ca8202
SymbolDatabase: handle method with unknown macro 'void f() MACRO {..}'
2013-09-28 11:44:26 +02:00
Daniel Marjamäki
c2a8f6f59a
astyle formatting
2013-09-28 09:32:41 +02:00
Simon Martin
d67a0add47
Ticket #5024 : Don't crash upon invalid code when checking auto variables.
2013-09-28 00:14:12 +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
Martin Ettl
ea5bcfaa35
Fixed #5040 - simplify more math functions.
2013-09-26 00:44:16 +02:00
Frank Zingsheim
445d08d082
Fixed #4723 (False positive: Pure virtual call within conditional clause)
2013-09-26 17:25:16 +02:00
Robert Reif
44d86e97c0
Fixed #4920 (Microsoft ATL/MFC CString::Format argument checking)
2013-09-26 16:20:01 +02:00
Robert Reif
2de3ebcb1e
CheckIO: fixed some more false negatives. Ticket: #4964
2013-09-24 06:43:03 +02:00
Daniel Marjamäki
17c0bb3cab
revert 027e5cc8
. the div() standard function should not be reimplemented. create a different fix. Ticket: #4929
2013-09-23 18:01:15 +02:00
Daniel Marjamäki
698e9e2b59
reverted ee14ea4f
. I think this fix was too generic. If there is a union in the struct then only the union members should be skipped.
2013-09-23 17:52:42 +02:00
Daniel Marjamäki
ee14ea4fc2
Fixed #4907 (False positive "uninitStructMember" on structs with unions)
2013-09-23 07:20:20 +02:00
Daniel Marjamäki
64454068ec
Fixed #4934 (false positive: Uninitialized variable (loop with inner condition '(x=1)'))
2013-09-23 06:07:01 +02:00
Daniel Marjamäki
1feabd0f0a
astyle formatting
2013-09-23 06:03:44 +02:00
Daniel Marjamäki
d1c9cac155
Merge pull request #170 from simartin/clang_warnings_2
...
Remove warnings emitted by clang's -Wsign-conversion
2013-09-22 20:42:10 -07:00
Simon Martin
894f537eba
Remove warnings emitted by clang's -Wsign-conversion
2013-09-22 13:22:52 +02:00
Daniel Marjamäki
027e5cc860
Fixed #4929 (false positive: Division by zero (standard function div()))
2013-09-22 09:52:12 +02:00
Robert Reif
5c4c397372
CheckIO: add scanf argument type checking. Floating point and integer checking is complete but string checking is incomplete and character checking is missing. Ticket #4099
2013-09-22 06:56:31 +02:00
Alexander Mai
6eab4abaf2
Fixed #5030 (Segmentation fault below CheckMemoryLeakStructMember::isMalloc())
2013-09-21 18:10:29 +02:00
Daniel Marjamäki
965d8f0ecc
Fixed #5033 (segmentation fault (valid code) in CheckOther::checkZeroDivisionOrUselessCondition)
2013-09-21 17:44:25 +02:00
Lucas Manuel Rodriguez
2fce3e6104
Fixed #5037 (Add missing C++ std objects and types)
2013-09-21 12:13:35 -03:00
Martin Ettl
d5f514c820
Fixed #5031 : simplify labs|fabs|abs(-1) to 1.
2013-09-21 16:59:06 +02:00
Daniel Marjamki
3de9431507
Fixed #5022 (Improve check: Division by zero or useless condition, function call)
2013-09-15 17:46:52 +02:00
Robert Reif
19745bbb7d
Fixed #5021 (Confusing message about %lf format in printf())
2013-09-15 16:38:45 +02:00
Ettl Martin
5a671f8914
Fixed #5023 (Add support for asinf,acosf,asinl,acosl (...) functions)
2013-09-13 19:49:25 +02:00
Daniel Marjamäki
bcbcee87d5
Library: Changed 'rt' to 'rb' when open files. TinyXml won't choke on CRLF in Windows then. Thanks sam-truscott for telling me this.
2013-09-13 07:26:52 +02:00
Robert Reif
4d82e37078
Fixed #5021 (Confusing message about %lf format in printf())
2013-09-12 05:54:05 +02:00
Daniel Marjamäki
ddefe62c12
astyle formatting
2013-09-11 15:49:40 +02:00
Daniel Marjamäki
418a3d8399
spelling fix: desctructor => destructor
2013-09-09 06:14:41 +02:00
flashm
f56a85358b
preprocessor optimization, unnecessary map creation removed
...
it used to be O(n^2), now it's only O(n)
2013-09-09 05:48:07 +02:00
Robert Reif
9be2f6b5d4
Fixed #4964 (printf format argument check only supports simple variables)
2013-09-08 20:21:00 +02:00
Daniel Marjamäki
4b1254bc8d
Merge pull request #168 from simartin/ticket_4994
...
Ticket #4994 : Don't crash when checking variable scope for invalid input
2013-09-08 06:57:42 -07:00
Simon Martin
843833f907
Ticket #4994 : Don't crash when checking variable scope for invalid input.
2013-09-07 21:16:25 +02:00
Daniel Marjamäki
51ad747317
Fixed false positive in new 'x>-1<5' check when using templates
2013-09-07 18:24:35 +02:00
Daniel Marjamäki
0d246f84ca
checkZeroDivisionOrUselessCondition: Refactoring
2013-09-07 17:54:34 +02:00
Daniel Marjamäki
6bb6506ce2
checkZeroDivisionOrUselessCondition: Fixed false positive when function is called and variable is passed to it
2013-09-07 16:18:11 +02:00
Daniel Marjamäki
08556d071e
Fixed #5016 (false negative: condition is always true / comparing boolean result with '<' (x > -1 < 5))
2013-09-07 11:32:11 +02:00
Daniel Marjamäki
83c460fc56
Fixed #5017 (New check: division by zero, otherwise condition is redundant)
2013-09-07 07:40:10 +02:00
Daniel Marjamäki
40c5924292
CheckIO: Handle classes derived from STL
2013-09-07 07:20:06 +02:00
Robert Reif
489a3a6e53
Fixed #5015 (strings not being concatinated properly)
2013-09-06 05:36:33 +02:00
Daniel Marjamäki
9000c233fa
Fixed #5012 (Hang when there is syntax error 'else }')
2013-09-05 06:38:07 +02:00
Robert Reif
2fe91e290c
CheckIo: Improved %d handling
2013-09-05 06:04:41 +02:00
Daniel Marjamäki
0ba7e4d5ed
astyle formatting
2013-09-05 01:47:22 +02:00
Robert Reif
921a1aaa4f
CheckIO: Improved handling of %u
2013-09-05 01:46:58 +02:00
Ettl Martin
9ab6655d85
Fixed #5007 (Same include guard naming)
2013-09-04 20:59:49 +02:00
Daniel Marjamäki
3b8e9f5a2a
Fixed #4899 (False positive on unused variable)
2013-09-03 17:02:46 +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
PKEuS
6b47ed414a
Fixed Function::retDef initialization:
...
- Move/Copy Constructors and Destructors do not have a return type neither
- Fixed crash in SymbolDatabase::printOut
- Added testing
2013-09-03 10:48:01 +02:00
Daniel Marjamäki
5d7518aa57
simplifyCalculations: Improved handling of casts ( #4899 )
2013-09-03 06:27:11 +02:00
Robert Reif
0dddd424a4
CheckIO: Improved handling of function return type
2013-09-03 05:50:19 +02:00
Daniel Marjamäki
6819f5ed18
Fixed #4860 (Segfault with another Clucene file)
2013-09-02 05:58:55 +02:00
Daniel Marjamäki
a781a83822
Preprocessor: Quicker response for --check-config. No 'normal' code is needed so skip it.
2013-09-01 07:13:48 +02:00
Robert Reif
8790f6d73f
Fixed #4999 (Crash with simple code snipped in rev ab30fa3
)
2013-08-31 18:58:55 +02:00
Daniel Marjamäki
6b260c481c
CppCheck: Don't run preprocessor rules when --check-config is used
2013-08-31 18:38:52 +02:00
Daniel Marjamäki
ab30fa34e4
Refactoring Preprocessor. Use ternary operator instead of if-else.
2013-08-31 16:13:52 +02:00
Daniel Marjamäki
ed58b63712
Preprocessor: improved handling when file starts with 0xff or 0xfe that is not part of a BOM
2013-08-31 13:17:57 +02:00
Daniel Marjamäki
5e7791d847
astyle formatting
2013-08-31 13:17:15 +02:00
Daniel Marjamäki
997c9ce100
Refactor CppCheck::_fileContents to a function parameter
2013-08-31 10:28:21 +02:00
Daniel Marjamäki
e6686dfb5b
Cleanup CppCheck::dependencies()
2013-08-31 10:13:47 +02:00
Robert Reif
05f2f0e419
CheckIO: improved type info - keep track of original typename.
2013-08-31 06:26:39 +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
Daniel Marjamäki
4a1d1ce1a1
Fixed #3471 (Unused functions: take __attribute__((constructor)) in to consideration)
2013-08-30 06:27:46 +02:00
Robert Reif
fc435ae9aa
CheckIO: fix false negative for a function in a base class not being found, fix false positives and negatives for std::vector operator []
2013-08-30 05:41:59 +02:00
Lucas Manuel Rodriguez
acd65a6829
Fixed #4991 : False Positive - Dangerous usage of 'arr' (not null-terminated)
2013-08-29 08:12:05 -03:00
Robert Reif
2950eb08cb
CheckIO: fix some %I64 related false positives. Ticket: #4964
2013-08-29 05:49:16 +02:00
Daniel Marjamäki
3bd1d53c75
Fixed #4941 (segmentation fault (invalid code) in Tokenizer::setVarId)
2013-08-28 19:52:41 +02:00
Daniel Marjamäki
2eca0a93a7
Fixed #4733 (defective unusedStructMember warning)
2013-08-28 06:46:32 +02:00
Robert Reif
5c3315db7a
CheckIO: improved handling of functions returning pointers. Ticket: #4964
2013-08-28 05:57:40 +02:00
Ettl Martin
e223e13747
Fixed #4987 (spellfix for verbose message in CheckClass::noConstructorError)
2013-08-28 05:48:31 +02:00
Daniel Marjamäki
65d99feddf
fix
2013-08-27 15:46:51 +02:00
Robert Reif
228f6b1a87
Fixed #4984 (False positive: (warning) %f in format string (no. 1) requires a floating point number given in the argument list.)
2013-08-27 05:46:09 +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
Robert Reif
a1b9bb0688
CheckIO: Fix false positives for functions returning unknown types and false negatives for functions returning record types
2013-08-26 06:03:26 +02:00
Alexander Mai
450442287c
Fixed #4974 (CheckBufferOverrun::writeOutsideBufferSize() too strict)
2013-08-25 18:46:07 +02:00
Daniel Marjamäki
acdbbeee44
Fixed #4913 (Tokenizer::simplifyKnownVariables: wrong handling of *--p=0;)
2013-08-25 08:54:33 +02:00
Robert Reif
3d9383aabb
Fixed #4975 (False positive: (warning) %s in format string (no. 3) requires a char* given in the argument list. (git/column.c))
2013-08-25 08:32:10 +02:00
Robert Reif
3c6ca35e09
Fixed #4977 (improve platform type tokenize performance)
2013-08-25 08:29:24 +02:00
Daniel Marjamäki
b20f44cf6a
Merge pull request #167 from simartin/ticket_4450
...
Fix Ticket #4450
2013-08-24 14:12:44 -07:00
Robert Reif
26de3646e9
CheckIo: Revised patch that fixes bug in class function return type. Ticket: #4964
2013-08-24 22:34:52 +02:00
Simon Martin
b713a69b30
Ticket #4450 : Handle comma separated static variable declarations with initializers in brackets.
2013-08-24 22:27:54 +02:00
Lucas Manuel Rodriguez
a70b0cd0f3
Fixed FP: Null pointer dereference
2013-08-24 16:50:19 -03:00
Daniel Marjamäki
f8f3f0d384
astyle formatting
2013-08-24 07:37:21 +02:00
Daniel Marjamäki
5ce7189bc0
Merge pull request #166 from last5bits/ticket4213
...
Fixing #4213 arrayIndexThenCheck and adding tests
2013-08-23 22:36:30 -07:00
Robert Reif
01fd156852
CheckIO: Start to add checking of function return types. Ticket: #4964
2013-08-24 07:25:50 +02:00
Alexey Zhikhartsev
d24a321ba2
Fixing #4213 arrayIndexThenCheck and adding tests
2013-08-23 19:04:01 +04:00
Daniel Marjamäki
9b4f6a6b3d
Fixed #4701 (false positive unusedFunction when using templates)
2013-08-23 06:47:52 +02:00
Robert Reif
5ce1933687
CheckIo: handle more complex variables
2013-08-23 05:35:57 +02:00
Alexander Mai
986ec42d79
Fixed #4937 (false positive: Assert calls a function which may have desired side effects)
2013-08-22 06:38:54 +02:00
Daniel Marjamäki
c96586b2a9
"automatic conversion from iso-8859-1 formatting to utf-8"
2013-08-21 19:31:01 +00:00
Daniel Marjamäki
b61c4b24b4
Fixed syntax error
2013-08-21 16:32:10 +02:00
Daniel Marjamäki
2995b5c3d7
Merge pull request #165 from stefanbeller/stack
...
symboldatabase: Remove unneeded check
2013-08-21 07:30:12 -07:00
Daniel Marjamäki
f257c62858
Fixed #4846 (false positive: (warning) Comparison of a boolean with an integer.)
2013-08-21 16:17:19 +02:00
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
Lucas Manuel Rodriguez
006b8055e5
Fixed #4676 (Duplicated inherited member check)
2013-08-20 06:29:19 +02:00
Lucas Manuel Rodriguez
14d3886e19
Fixed #4965 (sizeof(void) check - error in message)
2013-08-20 06:20:52 +02:00
Robert Reif
707dfb4eea
Fixed #4964 (printf format argument check only supports simple variables)
2013-08-20 06:16:31 +02:00
Robert Reif
bf8a786265
reduce: add more settings from cppcheck cli
2013-08-19 06:06:53 +02:00
Daniel Marjamäki
342142b783
Fixed #4256 (Preprocessor: '#pragma once' doesn't work properly when using -D)
2013-08-18 18:04:06 +02:00
Daniel Marjamäki
ed890a23a8
Token::printOut(): don't write title if it's empty
2013-08-18 09:01:03 +02:00
Robert Reif
914893013e
Symbol Database: improved type handling. Ticket: #4952
2013-08-17 18:43:15 +02:00
Daniel Marjamäki
13f85ea345
astyle formatting
2013-08-17 13:06:19 +02:00
Daniel Marjamäki
fd545f90db
Merge pull request #163 from simartin/ticket_4959
...
Ticket #4959 : Simplify {in,de}crements of known variables.
2013-08-17 03:35:30 -07:00
Simon Martin
5743416d3e
Ticket #4959 : Simplify {in,de}crements of known variables.
2013-08-16 23:51:00 +02:00
Daniel Marjamäki
67c77a31aa
Fixed #4942 (1.61 is very slow (compared to 1.60.1))
2013-08-16 18:39:56 +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
Daniel Marjamäki
33a948f816
Merge pull request #162 from simartin/ticket_4708
...
Fixed #4708 : prefix {in,de}crement too eagerly computed.
2013-08-15 20:35:38 -07:00
Daniel Marjamäki
5d7f30b88f
reassign var: better handling of struct members
2013-08-15 16:13:58 +02:00
Simon Martin
bf09191b78
Fixed #4708 : prefix {in,de}crement too eagerly computed.
2013-08-15 15:53:08 +02:00
Daniel Marjamäki
f95b29db06
Improved handling of the __FILE__ macro
2013-08-14 06:36:03 +02:00
Daniel Marjamäki
fd26bad6fa
AssignIf: Improved handling of function calls
2013-08-13 14:08:54 +02:00
Robert Reif
f420de24ef
SymbolDatabase: Optimisation of previous fix for #4952
2013-08-13 06:36:54 +02:00
Daniel Marjamäki
ff71c94f6e
Fixed #4949 (define symbol used in code => 'Analysis failed' message is written.)
2013-08-12 18:12:49 +02:00
Robert Reif
d6ce072dc9
Fixed #4950 (Tokenizer: order of int modifiers)
2013-08-12 06:23:01 +02:00
Robert Reif
cd3044c808
Fixed #4952 (SymbolDatabase: unknown types in log file)
2013-08-12 06:21:03 +02:00
Alexander Mai
4cc2e3ef54
Enable more doxygen features (include JS search engine) and one doxygen annotation fix
2013-08-11 17:04:13 +02:00
Simon Martin
40887ca99c
Ticket #4703 : Trim macro parameters.
2013-08-11 09:41:03 +02:00
Robert Reif
56d8073d0f
Fixed #4902 (printf and scanf format checks don't support microsoft %I, %I32 and %I64 extensions)
2013-08-10 12:37:31 +02:00
Robert Reif
5aa79198e6
Fixed #4948 (check printf %l and %ll arguments for long and long long)
2013-08-10 12:33:55 +02:00
Daniel Marjamäki
64733d9e63
astyle formatting
2013-08-10 12:32:59 +02:00
Daniel Marjamäki
3ac21ab1db
Merge pull request #158 from simartin/ticket_4764
...
Ticket #4764 : Handle template instantiations with only default parameters
2013-08-10 03:22:41 -07:00