Robert Reif
f8dd6ee014
Fix test code so it compiles.
2017-03-23 19:16:15 -04:00
PKEuS
97fa9e9d1b
ValueFlow: Stop on inline assembly
2017-03-23 20:01:16 +01:00
PKEuS
9225bff31d
Added (back) support for enums to CheckCondition::checkIncorrectLogicOperator() ( #7794 )
2017-03-23 18:57:48 +01:00
PKEuS
996501a449
Fixed false positive #7953 : Support type conversion operators returning pointers
2017-03-23 18:12:46 +01:00
Daniel Marjamäki
c280bcedb4
Merge pull request #880 from IOBYTE/master
...
Update symbol database with new auto type and variable information for assignment to auto.
2017-03-23 08:51:06 +01:00
Robert Reif
662bc6f846
Add variable or type information to auto and auto variable tokens. Changing the auto variable type requires rerunning the variable pointer pass to correct the symbol database for the new type.
2017-03-22 22:09:40 -04:00
Daniel Marjamäki
865588950a
Preprocessor: quick fix for #7939
2017-03-22 10:53:21 +01:00
orbitcowboy
a7f1188151
Astyle run.
2017-03-21 14:22:28 +01:00
Simon Martin
fb2b29dc7d
Update TemplateSimplifier::getTemplateNamePosition to handle out-of-line template methods.
...
Add an optional extended description…
2017-03-19 20:44:20 +01:00
Daniel Marjamäki
c18fe8262b
Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))')
2017-03-19 07:26:11 +01:00
PKEuS
8a3fb4dd6c
SymbolDatabase: Fixed return type token detection for template member functions ( #7945 )
2017-03-16 20:47:24 +01:00
PKEuS
ca3e3b3cdb
Fixed false positive multiCondition when & is used in both conditions ( #7827 )
2017-03-15 19:37:14 +01:00
PKEuS
816106560a
More conservative check for non-commutative operator+ in isSameExpression() ( #7938 )
2017-03-15 19:17:40 +01:00
PKEuS
bcba27fbb9
SymbolDatabase: Removed unnecessary bailout in function matching for pointers in function overload matching
2017-03-15 18:45:33 +01:00
PKEuS
b27ba72fdd
SymbolDatabase: Support function overload matching for member variables ( #7932 )
2017-03-15 18:37:22 +01:00
PKEuS
92414b923a
Library: Support variadic functions which are not a formatstr-function
2017-03-14 17:41:34 +01:00
Daniel Marjamäki
263c3596d5
known conditions: dont warn about 0 or 1 conditions as those look intentional
2017-03-08 18:39:19 +01:00
PKEuS
0073a633b0
Refactorized test suite
2017-03-08 15:16:19 +01:00
PKEuS
a447d2c6a8
Refactorized testio.cpp
2017-03-08 14:24:14 +01:00
Daniel Marjamäki
8c707876ed
Tokenizer: Don't simplify '({..})' wrongly
2017-03-08 11:41:18 +01:00
PKEuS
00904ba32a
Fixed false negatives in CheckOther::checkPassByReference() when assignment operator is used.
2017-03-07 21:49:28 +01:00
Matthias Krüger
65846efb6b
test/cfg/std.cpp fix 'make checkcfg', std::vector needs to have <vector> #included
2017-03-06 16:59:17 +01:00
orbitcowboy
e3d879e43d
std.cfg: Improved support for some std::wstring functions.
2017-03-06 16:40:49 +01:00
Daniel Marjamäki
302bf925df
Remove test/cfg/std.cpp test that fails
2017-03-06 12:39:08 +01:00
Daniel Marjamäki
d535f17489
testing std::string and std::vector configuration a little
2017-03-05 22:23:45 +01:00
Daniel Marjamäki
5ea9519586
UseRetVal: Fix FN for methods
2017-03-05 22:23:16 +01:00
Simon Martin
43e4364675
Ticket #7912 : Properly preprocess files with decreasing line numbers, due to #line directives.
2017-03-05 16:46:43 +01:00
Daniel Marjamäki
f3c0461001
ValueType: handling scoped types in 'new ...'
2017-03-05 10:24:51 +01:00
Daniel Marjamäki
e0dd0a82ed
ValueType: refactor and improve handling of 'new ...'
2017-03-05 10:02:47 +01:00
Robert Reif
e02b2c4483
ValueType: handle new nothrow
2017-03-05 02:13:00 +01:00
Daniel Marjamäki
920398615d
ValueType: handle scoped types in parsedecl
2017-03-05 01:21:02 +01:00
Daniel Marjamäki
12fe4a8b3e
Fixed #7885 (ValueType: Wrong type for large hexvalue (platform=win32A))
2017-03-04 14:19:14 +01:00
Daniel Marjamäki
ecc59859e1
Don't simplify _Bool in TokenList
2017-03-04 11:13:28 +01:00
Daniel Marjamäki
a8424bcb54
Test get/getline/read/readsome configuration in std.cfg
2017-03-04 08:56:37 +01:00
Daniel Marjamäki
f0c353abcb
TokenList: append 'U' if needed on hexvalues
2017-03-04 08:47:53 +01:00
Daniel Marjamäki
1c6c209353
Fixed #7890 (1.77 false positive from knownConditionTrueFalse with function-like macros)
2017-03-03 19:53:16 +01:00
Daniel Marjamäki
59c1c76a97
Fixed #7466 (Reference variable does not count side-effects (FP variableScope))
2017-03-03 19:07:00 +01:00
Daniel Marjamäki
b5f2fd3c55
Fixed #7738 (False positive deallocret - delete and return NULL pointer)
2017-03-03 18:36:06 +01:00
Daniel Marjamäki
d1c66edb03
ValueFlow: Known values in conditional code
2017-03-03 01:29:34 +01:00
Daniel Marjamäki
45c5860ca4
Fixed #7926 (Memory Leak with auto not detected)
2017-03-02 22:24:26 +01:00
Daniel Marjamäki
9dc219f1ba
CheckIO: Use ValueType more
2017-03-01 22:33:31 +01:00
Daniel Marjamäki
51b5f1c286
Fixed #7931 (crash: SymbolDatabase: Variable::setFlag)
2017-03-01 17:13:22 +01:00
Daniel Marjamäki
279425499e
Fixed #7930 (Improve check: Missing stlcstr warning for reference variable)
2017-03-01 02:03:08 +01:00
PKEuS
85768f1829
SymbolDatabase: Overload matching with boolean literals as argument and with arbitrary null-pointers
2017-02-28 22:43:47 +01:00
PKEuS
942644fde6
SymbolDatabase: Overload matching with character literals as argument
2017-02-28 22:08:41 +01:00
Daniel Marjamäki
841e0c2921
Fixed #7546 (Assignment to array element not detected if pointer addition is used)
2017-02-28 22:04:05 +01:00
Daniel Marjamäki
16c06e5714
Fixed #7588 (Opposite conditions in nested 'if' blocks lead to a dead code block.)
2017-02-28 18:46:28 +01:00
Daniel Marjamäki
beaf29c158
SymbolDatabase: Update some properties for auto variables
2017-02-27 23:04:25 +01:00
Daniel Marjamäki
994f6b684d
ValueType: initial handling of new
2017-02-27 20:57:28 +01:00
Daniel Marjamäki
7ecd5db8fb
ValueType: Handle auto in range for loop
2017-02-27 02:09:33 +01:00
Daniel Marjamäki
2da360eec5
ValueType: Handle 'auto *p = ..'
2017-02-26 22:43:10 +01:00
Matthias Krüger
1e5e32c4a2
testrunner: remove non-gcc-style output format
2017-02-26 21:39:06 +01:00
Daniel Marjamäki
dad455c0dd
ValueType: Handle 'auto'. First fix for #4345
2017-02-26 20:02:57 +01:00
Daniel Marjamäki
d840005f06
Fixed #7656 (stlcstr - false positive)
2017-02-26 17:25:32 +01:00
Daniel Marjamäki
f68fa72095
Fixed #7583 (Defect: False positive '(error) Reference to temporary returned')
2017-02-26 13:41:49 +01:00
PKEuS
c1d8fd7f13
SymbolDatabase: Better handling of pointers in findFunction(), supporting const pointers and std::string overloads
2017-02-26 11:36:04 +01:00
PKEuS
4a27376694
SymbolDatabase: Implement two-stage fallback mechanism for matching function overloads, increasing matching accuracy
2017-02-25 23:12:00 +01:00
Daniel Marjamäki
adc659f58b
Fixed #7897 (MathLib::toDoubleValue: Does not handle character literal)
2017-02-25 21:58:09 +01:00
Daniel Marjamäki
26fc7abfac
Fixed #7837 (Field dereference triggers format string type warning)
2017-02-25 18:22:14 +01:00
Daniel Marjamäki
55d7ab65b9
Fixed #7918 (::exit() not recognized as noreturn)
2017-02-25 12:12:39 +01:00
Daniel Marjamäki
99544069d1
CheckLeakAutoVar: better handling of noreturn functions. Partial fix for #7918 .
2017-02-25 11:36:48 +01:00
PKEuS
3f1e2b4270
More conservative fallback for function overload matching
2017-02-24 20:56:47 +01:00
PKEuS
4e28d40bf0
Fixed matching long long overload to function call f(0)
2017-02-24 20:33:52 +01:00
PKEuS
de86d40c97
Fixed handling of NULL and nullptr in CheckNullPointer
2017-02-24 19:44:28 +01:00
PKEuS
b08f99a082
Fixed false negative: nullpointer passed as std::string argument ( #7927 )
...
Refactorization: Removed dead code from CheckNullPointer::parseFunctionCall()
2017-02-24 19:10:34 +01:00
Daniel Marjamäki
a53f14da25
Fixed #7925 (False Positive identical condition)
2017-02-22 21:13:36 +01:00
Robert Reif
8e0f1ec788
Fixed #7909 (Crash in CheckMemoryLeakInClass)
2017-02-20 23:09:35 +01:00
Simon Martin
487f76cdd1
Ticket #7916 : Don't incorrectly simplify return statements involving template instantiations.
2017-02-18 21:14:50 +01:00
Daniel Marjamäki
774a8979a3
Fixed #7095 (False positive: (warning) Return value of function to_string() is not used.)
2017-02-12 16:50:45 +01:00
Daniel Marjamäki
7c800d6ed7
Fixed #7447 (FP: ignoredReturnValue on C++11 uniform initialization)
2017-02-12 16:33:28 +01:00
Simon Martin
0c0fe4605a
Ticket #7465 : Added test case highlighting the issue has been fixed since it's been reported.
2017-02-11 17:55:51 +01:00
Simon Martin
326d152aa2
Ticket #7914 : Properly recognize template parameters that contains operators. ( #870 )
2017-02-11 10:13:41 +01:00
Simon Martin
0943b2145b
Ticket #7891 : Do not remove spaces in the internal representation for template instantiations.
2017-02-05 17:35:29 +01:00
orbitcowboy
beb72c2583
Revert changes from 9cb0941df2
.
2017-02-02 15:53:52 +01:00
orbitcowboy
9cb0941df2
std.cfg: Take the return value from fread() into account.
2017-02-02 13:33:06 +01:00
Matthias Krüger
f80e888b7e
run astyle
...
[ci-skip]
2017-01-31 16:22:31 +01:00
Simon Martin
5262ed018e
Ticket #7440 : Function calls should not abort pointer alias analysis for local variables.
2017-01-27 22:56:28 +01:00
umanamente
a012e5b5fb
( Fixed #7846 ) Syntax error when using C++11 braced-initializer in function last argument
...
Add an optional extended description…
2017-01-23 12:50:36 +01:00
umanamente
0c1ba8e8b4
( Fixed #7895 ) C++11 brace initialization. Added test. ( #862 )
...
Add an optional extended description…
2017-01-22 10:16:40 +01:00
PKEuS
3022d74801
Do not suggest pass by reference for std::initializer_list
2017-01-19 11:14:55 +01:00
amai2012
722fac391d
Merge pull request #858 from simartin/ticket_7820
...
Ticket #7820 : Properly report leaks with conditional deallocations followed by a return.
2017-01-18 09:31:49 +01:00
Simon Martin
9e76b21d7f
Ticket #7820 : Properly report leaks with conditional deallocations followed by a return.
2017-01-17 23:02:39 +01:00
Simon Martin
ae939b1385
Teach CheckMemoryLeak about "alloc ; loop alloc ;" kinds of patterns. ( #861 )
...
Add an optional extended description…
2017-01-15 22:16:23 +01:00
Simon Martin
c82d8a0d06
Ticket #7745 : Simplify "alloc ; dealloc ;" blocks that we don't have any value for CheckMemoryLeak's analysis. ( #860 )
...
Add an optional extended description…
2017-01-15 22:14:37 +01:00
Daniel Marjamäki
47d39d0a14
Revert "Fixed #7888 (1.77 false positive from knownConditionTrueFalse with sizeof(int) == sizeof(long))"
...
This reverts commit a762511067
.
2017-01-10 13:22:48 +01:00
Daniel Marjamäki
a762511067
Fixed #7888 (1.77 false positive from knownConditionTrueFalse with sizeof(int) == sizeof(long))
2017-01-09 22:28:55 +01:00
Daniel Marjamäki
b1f7e46491
Fixed #7323 (valueflow: global variables)
2017-01-09 15:53:08 +01:00
Simon Martin
417c7e36c0
Ticket #7548 : Properly detect the end of template parameter default values during instantiation.
2017-01-08 09:38:29 +01:00
Matthias Krüger
d4dcef4a30
add testcase for #6011 (crash in libreoffice, failure to create AST for comparison) which I still had in some branch.
2017-01-08 02:36:21 +01:00
Matthias Krüger
064a4aa4cc
improve constness of functions as per cppchecks suggestions.
2017-01-07 14:31:03 +01:00
Simon Martin
bd92ddd386
Ticket #7850 : Properly handle C functions called "class".
2017-01-06 21:16:28 +01:00
Robert Reif
4123b457d7
Fixed #7441 (SymbolDatabase: No scope when function return type not specified)
2017-01-06 11:53:17 +01:00
Robert Reif
139071d88b
Fixed #7875 (New check: function declaration and definition argument names don't match)
2017-01-05 08:52:11 +01:00
Robert Reif
4c25e798b1
Fixed #7865 (Tokenizer::createLinks2(): does does set links for <> in struct template)
2016-12-31 22:05:29 +01:00
Simon Martin
f43431408b
Ticket #7685 : Properly handle function calls as argument to a dealloc function. ( #853 )
...
Add an optional extended description…
2016-12-29 13:17:46 +01:00
Daniel Marjamäki
85ae3adeb2
Fixed #5144 (FP old memleak - tree structure)
2016-12-27 08:12:37 +01:00
Daniel Marjamäki
1b21767954
Fixed #5666 (False positive when modifiying std::string by pointer)
2016-12-26 17:13:35 +01:00
Daniel Marjamäki
770abcf453
Fixed #5398 (False positive: Scope of variable can be reduced does not account for other variables not reduceable)
2016-12-26 14:14:40 +01:00
Daniel Marjamäki
c8a450c9be
uninitvar: Fixed a FP seen in daca2
2016-12-25 22:43:29 +01:00
Matthias Krüger
ecc91ba914
fix a couple of issues in shell scripts found by codacy.
2016-12-25 00:43:47 +01:00
PKEuS
ea53bd22b7
Fixed false positive returnTempReference with operator++ ( #7874 )
2016-12-22 11:49:59 +01:00
Daniel Marjamäki
df6ae9f3b4
Fixed #7847 (Can't detect shift negative values when some op is executed)
2016-12-22 09:40:19 +01:00
Daniel Marjamäki
d79688c40b
Fixed #7822 (False positive for uninitialized variable if array type is used)
2016-12-21 23:11:11 +01:00
Daniel Marjamäki
28af5c0379
Integer Overflow: Don't warn about left-shift expressions with negative result like '1<<31'. That is common practice.
2016-12-21 18:19:59 +01:00
Daniel Marjamäki
426d1b4196
Merge pull request #846 from simartin/ticket_7805
...
Ticket #7805 : Ignore enumerators when simplifying known variables.
2016-12-21 17:58:48 +01:00
Daniel Marjamäki
f40bdddbab
ValueFlow: Better handling when casting calculation result
2016-12-20 23:09:50 +01:00
Daniel Marjamäki
f0d91fb74b
Fixed #7869 (False positive: Array index out of bounds)
2016-12-20 22:01:19 +01:00
Daniel Marjamäki
44ccbdedec
ValueFlow: Improved value for cast
2016-12-20 21:37:25 +01:00
Daniel Marjamäki
606bb78297
ValueFlow: Better handling of casts
2016-12-20 19:32:21 +01:00
Daniel Marjamäki
e14e86c103
ValueFlow: only set values in conditional code in subfunctions when sure
2016-12-20 11:06:20 +01:00
Daniel Marjamäki
807b653739
ValueFlow: Fix FP in for loops when 2nd expression is 0
2016-12-20 07:54:38 +01:00
Daniel Marjamäki
f1ad7368f6
ValueFlow: bool values
2016-12-19 21:21:18 +01:00
Daniel Marjamäki
aaf19c1e4f
Fixed #7839 (Prefix increment triggers parameter modification warning)
2016-12-19 15:25:36 +01:00
Daniel Marjamäki
f5ad7482a8
CheckBufferOverrun: Skip warnings about array index out of bounds in unions. Theoretically, the array is at least as large as the biggest union member.
2016-12-18 22:10:30 +01:00
Daniel Marjamäki
4558701c08
varid: don't generate varid and symboldatabase variable for function call parameter
2016-12-18 20:16:38 +01:00
Daniel Marjamäki
17aaecbd6b
ValueFlow: Improved handling of sizeof
2016-12-18 14:03:48 +01:00
Daniel Marjamäki
461e5cc5c9
CheckBufferOverrun: Moved check from simplified to normal. This fixes a FP in asterisk.
2016-12-18 11:14:05 +01:00
Daniel Marjamäki
72e4bc9d88
ValueFlow: skip values that cause false assertion condition
2016-12-17 21:23:14 +01:00
Frank Zingsheim
cb5a5e6a25
Improve Fix #6180 (Access of moved variable still allowed until function is called)
2016-12-17 16:42:46 +01:00
Frank Zingsheim
9a871d33f7
Improve Fix #6180 ("reset" and "clear" clears the move status)
2016-12-17 16:39:30 +01:00
Frank Zingsheim
f4ab45f13b
Improve Fix #6180 (Do not warn about move if it is part of a reassignment of the variable)
2016-12-17 16:39:30 +01:00
Simon Martin
5119ae84b8
Ticket #7805 : Ignore enumerators when simplifying known variables.
2016-12-17 14:05:26 +01:00
Daniel Marjamäki
8cba02dc66
Readd test case I removed in b098d5fbd6
2016-12-11 21:24:12 +01:00
Daniel Marjamäki
31337dda27
ValueFlow: Better handling of && and || in for loop to avoid FP
2016-12-11 21:19:24 +01:00
Daniel Marjamäki
d4f2512421
Tokenizer::simplifyKnownVariables: Added bailout when pointer alias is simplified and loop is encountered
2016-12-11 19:12:23 +01:00
Frank Zingsheim
e0d4720e19
Fix #7829 (false-positive: knownConditionTrueFalse linked to virtual method)
...
Return values of virtual functions in valueflow are only possible values
since function might be overloaded.
2016-12-11 10:44:05 +01:00
Daniel Marjamäki
87abe1174f
floatConversionOverflow: Avoid warnings when 255.5 is converted to unsigned char etc.
2016-12-10 23:14:40 +01:00
Daniel Marjamäki
b098d5fbd6
ValueFlow: We need better handling of casts
2016-12-10 22:09:01 +01:00
PKEuS
120fe2e4d6
Fixed false positive: The function 'operatorstd::string' is never used. ( #7853 )
2016-12-08 13:54:54 +01:00
PKEuS
cfac3b457d
Several small refactorizations
2016-12-06 22:12:02 +01:00
Daniel Marjamäki
7fc9fbc746
synthetic: reduce controlflow testcases
2016-12-06 21:45:51 +01:00
PKEuS
40401534d7
Refactorized Library
2016-12-06 14:50:27 +01:00
PKEuS
2f6350a0d0
Refactorized Library
2016-12-06 14:09:28 +01:00
PKEuS
d665641a76
Refactorizations:
...
- use std::string::pop_back() and std::string::back()
- pass argument as const std::string&
- Moved iterator into for loop head
2016-12-05 14:50:01 +01:00
Daniel Marjamäki
5df8e7f50c
Fixed #7596 (ValueFlow: better handling for 'x*(1-x-1)')
2016-12-04 22:39:59 +01:00
Daniel Marjamäki
c12cb69cc2
ValueType: Handle function pointers
2016-12-04 16:02:50 +01:00
Daniel Marjamäki
9c69546d72
Fixed #7842 (Preprocessor::getConfigs: #error in #ifndef not handled well)
2016-12-03 11:59:48 +01:00
orbitcowboy
8a45c3192b
There is not need to clear a string directly after its creation.
2016-11-30 10:39:14 +01:00
PKEuS
36d12d7866
SymbolDatabase: Function::retDef should not point at "static" or "extern"
2016-11-28 17:23:39 +01:00
Stefan Weil
57b57428c2
Fix some typos in comments (found by codespell)
...
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2016-11-27 11:40:42 +01:00
Daniel Marjamäki
b6cba4a55c
Fixed #7784 (Token: can't be both type and variable)
2016-11-26 22:39:47 +01:00
orbitcowboy
55ae961ac2
std.cfg and windows.cfg: Improved support for <use-retval/> for functions like ftell(), [f]get[w]c().
2016-11-26 21:31:15 +01:00
orbitcowboy
8a0f856e95
Fixed regression in test/cfg/std.c introduced by b0d09926fb
.
2016-11-26 21:14:31 +01:00
Matthias Krüger
213589ee68
ValueFlow: don't perform UB when a function returns shifts of/by negative values. Fixes #7814 .
2016-11-24 23:23:47 +01:00
Daniel Marjamäki
a61f4e9c94
Fixed #7831 (false-positive: terminateStrncpy)
2016-11-24 07:04:58 +01:00
Matthias Krüger
cf24ea5221
fix #7783 : false positive knownConditionTrueFalse on assert(0 && "message").
2016-11-23 21:54:38 +01:00
Daniel Marjamäki
e1a3c0955a
synthetic tests: Added run-clang.sh
2016-11-23 14:49:46 +01:00
Matthias Krüger
01e5f14bf8
CheckClass::virtualDestructorError and a variation of CheckNullPointer::nullPointerError would print inconclusive,warning messages altough no --enable=warning was given. Fix.
2016-11-23 00:13:09 +01:00
Daniel Marjamäki
0b3751520b
Add a check for float conversion overflows
2016-11-22 22:37:13 +01:00
Daniel Marjamäki
8870195794
Synthetic: Add run-lint.bat script
2016-11-22 19:25:05 +01:00
PKEuS
02d8f691f8
Fixed false positive: Do not show useInitializationList message for enums
2016-11-22 12:09:30 +01:00
Daniel Marjamäki
aff84daff3
synthetic tests: renamed functions
2016-11-22 11:37:15 +01:00
Daniel Marjamäki
d40f4e4a55
Fixed #7778 (valueFlowAfterAssign: alias)
2016-11-21 17:26:36 +01:00
Daniel Marjamäki
21364b4401
Refactoring fix for #7816
2016-11-21 13:54:59 +01:00
amai2012
933815ee54
#7816 Segmentation fault at Tokenizer::simplifyAttribute() for stand-alone void. Throw syntax error on incomplete code
2016-11-21 12:19:47 +01:00
Daniel Marjamäki
74fa69fe5e
Fixed #7821 (syntax error, first token is &)
2016-11-20 17:59:50 +01:00
Frank Zingsheim
c8ff96fe8f
Fixed #6180 (Usage of variable after std::move or std::forward)
2016-11-20 15:14:49 +01:00
PKEuS
e23dc5c1e2
Fixed wrong message shown if unused label appears directly after a switch() scope
2016-11-20 14:43:54 +01:00
Matthias Krüger
d3919b23fa
testrunner: testgarbage: test-function was not called, fix.
2016-11-20 14:36:36 +01:00
Daniel Marjamäki
5b377ea2e4
Fixed #7821 (segmentation fault, invalid last token)
2016-11-20 14:15:51 +01:00
Daniel Marjamäki
79fc332511
Fixed #7810 (SymbolDatabase: method with redundant scope info)
2016-11-17 22:45:50 +01:00
Daniel Marjamäki
e1e9eacccc
ValueFlow: Added float type
2016-11-13 22:59:56 +01:00
Daniel Marjamäki
7ebfb10edd
Fixed #7806 (ValueFlow: better handling of subfunction with early return)
2016-11-13 18:19:51 +01:00
Daniel Marjamäki
621c1e59c6
--project: handle SolutionDir and ProjectDir. This is a partial fix for #7791 . custom build macros are still not handled.
2016-11-11 16:22:14 +01:00
Daniel Marjamäki
b04f6fb359
bump simplecpp to rev d1c995c03515d289c7aa7246a74d666fd012c4eb
2016-11-10 20:04:05 +01:00
Daniel Marjamäki
4de5dc75aa
Fixed #7807 (false positive: (error) Signed integer overflow for expression 'int32_max-1'.)
2016-11-07 22:29:40 +01:00
Daniel Marjamäki
684e78f54e
synthetic test: fix compiler errors
2016-11-07 09:30:17 +01:00
Daniel Marjamäki
ea087e6188
synthetic test: renamed tests. tweak report.
2016-11-07 08:48:38 +01:00
Daniel Marjamäki
ac7b351d1e
ValueFlow: Don't calculate x<<64 and x>>64
2016-11-06 20:40:58 +01:00
Daniel Marjamäki
dd69d5eabe
ValueFlow: Don't calculate result when there is UB
2016-11-06 17:42:01 +01:00
Alexander Mai
ee11f0974a
#7769 segmentation fault at setTokenValue() on invalid code.
2016-11-06 14:20:58 +01:00
Daniel Marjamäki
0ddd82d1d5
test/synthetic: added pointer alias test case. renamed functions.
2016-11-05 16:56:30 +01:00
Daniel Marjamäki
f280061ff8
signed int overflow: warn about intmax+1
2016-11-05 09:29:52 +01:00
Daniel Marjamäki
2885a75ea6
ValueFlow: handle ~ in setTokenValue
2016-11-05 09:29:22 +01:00
Daniel Marjamäki
40bf269ea0
Add report.py that generates report for synthetic tests
2016-11-04 22:16:46 +01:00
Daniel Marjamäki
f5046959b3
minor updates in synthetic tests
2016-11-04 22:15:41 +01:00
Daniel Marjamäki
8e8194ee0f
try to make synthetic tests more explicit
2016-11-04 19:32:42 +01:00
orbitcowboy
919f8ac323
Fixed typos. There are no real changes.
2016-11-04 15:01:05 +01:00
orbitcowboy
ed453d24da
std.cfg: Added returnValue support for iswdigit().
2016-11-04 14:20:59 +01:00
orbitcowboy
75124317e9
std.cfg: Added returnValue support for iswblank().
2016-11-04 14:03:48 +01:00
Daniel Marjamäki
469ca6af1b
Add synthetic ub tests
2016-11-03 21:45:33 +01:00
Daniel Marjamäki
6e9346323c
tweak synthetic tests
2016-11-03 20:16:49 +01:00
Daniel Marjamäki
506d1ed68d
synthetic tests: add ub.c
2016-11-03 14:51:18 +01:00
Daniel Marjamäki
0836b999cf
update synthetic tests. removed uninit.c because there was not enough diversity. my goal is to have few tests with much diversity.
2016-11-03 09:40:22 +01:00
Matthias Krüger
c6c17c89c9
synthetic tests: add "make clean", make CC settable via env flags.
2016-11-02 19:02:10 +01:00
Daniel Marjamäki
ad6c82b2ca
Added Makefile to compile synthetic tests
2016-11-02 13:57:29 +01:00
Daniel Marjamäki
50d6a23f93
test/synthetic/uninit.c : add more tests
2016-11-02 12:35:08 +01:00
Daniel Marjamäki
ca19861aaa
Add some synthetic tests
2016-11-02 11:07:04 +01:00
Daniel Marjamäki
18f466a880
Test std::for_each
2016-11-02 10:01:56 +01:00
Daniel Marjamäki
fd67bbf2d3
Test std::count and std::count_if
2016-11-02 09:57:35 +01:00
Daniel Marjamäki
12319d705e
Try to fix 'make checkcfg'
2016-11-02 09:50:37 +01:00
Daniel Marjamäki
b90a17f64f
Test std::all_of, std::any_of, std::none_of
2016-11-02 09:29:15 +01:00
Daniel Marjamäki
6e762659c0
Test std::find_if and std::find_if_not
2016-11-02 09:13:54 +01:00
Daniel Marjamäki
223ce04986
Merge pull request #841 from zingsheim/FunctionParameter
...
Function parameter
2016-11-01 21:58:52 +01:00
Daniel Marjamäki
0e9810b7f6
CheckStl: validation of iterators returned from functions
2016-11-01 14:08:42 +01:00
Frank Zingsheim
d4f01583b6
Fixed TODO (check if function parameter is non-const reference etc..) by common function
2016-11-01 14:06:30 +01:00
Daniel Marjamäki
476789c1a7
Remove unused variable in test
2016-11-01 12:44:31 +01:00
Daniel Marjamäki
7f71ad8360
Test std::find()
2016-11-01 12:25:23 +01:00
Daniel Marjamäki
ea545e63c8
astyle formatting
...
[ci skip]
2016-10-27 17:11:32 +02:00
Daniel Marjamäki
f6a5f6bb61
CheckStl::mismatchingContainers: Refactoring, use Library instead of hardcoding
2016-10-27 10:25:45 +02:00
Harald Scheidl
0de47f709e
Fixed #7755 (false positive: member variable is not initialized in the constructor)
2016-10-26 10:39:53 +02:00
Robert Reif
4216b26b8c
Fixed #7775 (crash at valueFlowSetConstantValue)
2016-10-26 10:36:02 +02:00
Frank Zingsheim
0162f76c63
TestIO: Refactoring. Use functions instead of macros.
2016-10-24 21:43:58 +02:00
Robert Reif
f25d205999
Fixed #7767 (SymbolDatabase: function not analysed when unknown macros are in front of function definition)
2016-10-22 22:29:18 +02:00
Daniel Marjamäki
8a0f3009ff
ValueFlow: inner and outer function return values
2016-10-22 17:22:57 +02:00
Daniel Marjamäki
77cd6c194f
ValueFlow: Set 'known' property for function return values
2016-10-22 12:24:15 +02:00
Daniel Marjamäki
213f9c1fc8
Fix testrunner
2016-10-21 02:20:51 +02:00
Daniel Marjamäki
86a620a3b4
ValueFlow: Better handling of function return value when there are 0 parameters
2016-10-20 16:10:55 +02:00
Daniel Marjamäki
7242e661ef
checkcfg: add missing inline suppression for ignoredReturnValue of abs()
2016-10-18 22:35:54 +02:00
Matthias Krüger
0b6db67de2
checkcfg: add missing inline suppression for ignoredReturnValue of abs()
2016-10-18 22:20:06 +02:00
Daniel Marjamäki
efa3aba32a
Remove Tokenizer::simplifyNull()
2016-10-18 21:44:02 +02:00
Daniel Marjamäki
9cea2d6dfa
Tokenizer: Removed simplifications of standard functions that should be handled through configuration.
2016-10-18 19:25:58 +02:00
Dmitry-Me
d2e667ae7b
Put apostrophes consistent with other similar messages
2016-10-18 15:45:08 +03:00
orbitcowboy
d5a145f288
std.cfg: Added <returnValue> information to isblank().
2016-10-18 11:00:12 +02:00
Daniel Marjamäki
4587dfffd8
Fix -Wshadow warnings
2016-10-17 15:45:16 +02:00
Daniel Marjamäki
57c5e0be3a
test that abs,isdigit,strlen are calculated properly
2016-10-17 14:16:08 +02:00
Daniel Marjamäki
90ed7634b8
MathLib: fix for octal char literal '\200'
2016-10-16 13:42:20 +02:00
Daniel Marjamäki
5175bf88d6
Platform: Fix type limits calculations. sizeof=>bit
2016-10-16 12:00:33 +02:00
Daniel Marjamäki
c70987b727
ValueType: fix type of integer literals
2016-10-16 11:36:22 +02:00
Daniel Marjamäki
7fb812f415
Fixed #7752 (ValueFlow: no conditional value, probably because condition is in ternary operator and/or in function call.)
2016-10-16 07:15:28 +02:00
Daniel Marjamäki
ad74421526
Fixed #7756 (ValueFlow: fix bug in valueAfterAssign, same variable in lhs and rhs)
2016-10-15 19:09:50 +02:00
Daniel Marjamäki
d09a8dde57
Improved char literal handling. In the 'normal' tokenlist these should not be simplified to integer literals.
2016-10-12 10:20:24 +02:00
Miika-Petteri Matikainen
26816ed954
Fixes preprocessor regression causing hang
...
Cppcheck 1.76 introduced a regression in preprocessor which causes
the following code to hang:
$ cat > test.c << EOF
#ifndef Y
#else
#endif
EOF
$ cppcheck -D BAR --force test.c
Checking test.c ...
^C
This used to work with version 1.75. Git bisect reveals that this
regression was caused by commit:
ff036c8742
This commit fixes the regression by avoiding infinite loop in
hasDefine(). If cfg is empty string "", we can skip the whole loop
and exit early.
2016-10-11 19:56:13 +03:00
PKEuS
1715969f6f
Support prefix-increment/decrement in CheckAutoVariables::assignFunctionArg() ( #3177 )
2016-10-10 21:34:40 +02:00
PKEuS
1227a3f596
Improved check: Complain if a variable is modified but not used again
2016-10-10 21:27:40 +02:00
Daniel Marjamäki
af5dd2c29e
New check: Pointer overflow (null pointer subtracted)
2016-10-09 15:15:29 +02:00
Harald Scheidl
58eb644003
Improved Check: Warn about number and char literals in boolean expressions ( #7750 )
2016-10-09 13:21:00 +02:00
Daniel Marjamäki
0e785e435e
charLiteralWithCharPtrCompare: Improved warning to catch any char literal
2016-10-09 11:39:20 +02:00
PKEuS
54959d1932
CheckLeakAutoVar: Distinguish between new and new[] ( #888 )
2016-10-09 10:28:19 +02:00
Harald Scheidl
9f1b70fa04
new can initialize memory, don't warn in this case ( #7623 )
2016-10-08 10:03:09 +02:00
Daniel Marjamäki
bcbc8ef017
Fixed #7747 (Syntax error when setting the bitcount of an enum defined inside a struct)
2016-10-04 15:57:43 +02:00
Boris Egorov
a32f61ae4a
Fixed #7139 (ValueFlow: Missed shift operation in for expression)
2016-10-04 13:09:33 +07:00
Harald Scheidl
ba6cda9c86
Fixed #7740 (Tokenizer::setVarId: Function declaration does not start with 'return')
2016-10-03 10:02:18 +02:00
PKEuS
29e1fe136a
Fixed Visual Studio build after pathmatch.h/cpp was moved to lib, fixed compiler errors about getcwd
2016-10-02 15:48:03 +02:00
Daniel Marjamäki
91d97c556d
Path: Add methods Path::isAbsolute() and Path::getCurrentPath()
2016-10-02 12:06:55 +02:00
Simon Martin
d3c6fb4ccf
Ticket #7557 : Test case added since the fix for #7541 also fixed this.
2016-10-01 21:21:07 +02:00
Simon Martin
3f415673e4
Ticket #7541 : Properly keep track of namespace definition end markers when there are multiple of them.
2016-10-01 20:46:33 +02:00
Simon Martin
dc61b6342d
Ticket #7068 : Treat "memset(&this->member, ..." as member initialization.
2016-10-01 13:46:58 +02:00
Boris Egorov
0154d39bf6
Show struct member in unsignedLessThanZeroError warning
...
Before:
[/tmp/test.c:8]: (style) Checking if unsigned variable '.' is less than zero.
[/tmp/test.c:12]: (style) Checking if unsigned variable '.' is less than zero.
After:
[/tmp/test.c:8]: (style) Checking if unsigned variable 'd.n' is less than zero.
[/tmp/test.c:12]: (style) Checking if unsigned variable 'd.n' is less than zero.
2016-09-22 08:03:30 +07:00
Matthias Krüger
2f39ed6f88
redundantPointerOpError: put pointer name into single quotes in the error message.
2016-09-16 22:18:24 +02:00
Daniel Marjamäki
6b55acd7af
CheckIO: Changed severity for '.. aka' warnings to portability. If type is compatible then it's just a possible portability issue.
2016-09-11 17:05:01 +02:00
Simon Martin
f816fb811e
Ticket #7680 : Properly handle ::delete during memory leak checks.
2016-09-10 14:55:50 +02:00
Daniel Marjamäki
ac1a869d60
unused struct members: don't warn about packed structs ( #3088 )
2016-09-05 17:27:12 +02:00
Daniel Marjamäki
4d22ada078
Fixed #5839 (False positive: Function can be const, if this is passed to functor)
2016-09-04 16:36:04 +02:00
Daniel Marjamäki
03a6282ab3
Fixed #7338 (Library: method in base class)
2016-09-04 14:14:21 +02:00
Daniel Marjamäki
60f22bd4ee
Fixed #7477 (False positive 'Assigned value is never used' in multithreaded context)
2016-09-03 20:38:36 +02:00
Daniel Marjamäki
b97bdb5300
bump simplecpp to rev b50ced8ac14f8debab9e85e78036f881ff2b3965
2016-09-03 12:29:45 +02:00
Daniel Marjamäki
9417425829
Fix testrunner
2016-08-29 04:26:27 +02:00
Daniel Marjamäki
939b42df06
Fixed #7134 (False positive redundantAssignment - assignment to local variable of unknown type)
2016-08-29 03:48:08 +02:00
Daniel Marjamäki
fee0e4edfa
Fixed #7177 (MathLib: Does not handle '\xF6' properly)
2016-08-28 11:37:05 +02:00
Robert Reif
bf7ef56ef5
Fixed #7713 (False positive: %hhu in format string (no. 1) requires 'unsigned char' but the argument type is 'signed int'.)
2016-08-26 19:47:36 +02:00
orbitcowboy
87409ea6b3
Running astyle; Improved testing of std::find; std.cfg: Added support for istream::read and ifstream::read.
2016-08-25 19:17:07 +02:00
Matthias Krüger
56525cba60
testinternal: add testcase for TP warning for "previous()->next()"
2016-08-25 16:09:06 +02:00
Robert Reif
6043a27065
Fixed #7710 (%h and %hh printf type size specifiers not supported)
2016-08-24 12:47:11 +02:00
Robert Reif
28e14f0b94
Fixed #7711 (QString::asprintf format string checking.)
2016-08-24 12:44:57 +02:00
Frank Zingsheim
7c9a69357e
Fixed #7696 (cppcheck 1.75 runs very slowly with style and/or performance checks)
2016-08-21 16:07:05 +02:00
Daniel Marjamäki
d9ebdc6a10
Preprocessor: fix handling of -U in Preprocessor::getConfigs()
2016-08-21 15:01:04 +02:00
Daniel Marjamäki
ff036c8742
Fixed #7700 (Using -D to force a configuration still checks the configuration as well as configurations that are not relevant)
2016-08-21 13:53:44 +02:00
PKEuS
e0838ff194
Fixed crash on garbage code ( #7699 )
2016-08-21 11:06:48 +02:00
Daniel Marjamäki
d982dc5ffe
TestPreprocessor: Refactoring
2016-08-21 08:06:20 +02:00
Daniel Marjamäki
363605906f
Fixed #7695 (Running with -U_WIN32 still checks related configurations)
2016-08-21 07:45:15 +02:00
Robert Reif
62ac40fc5e
Fixed #7706 ((debug) Executable scope 'foo' with unknown function.)
2016-08-20 22:43:27 +02:00
Robert Reif
1dd1f6dd6a
Fixed #7673 ((debug) Executable scope 'foo' with unknown function.)
2016-08-20 17:56:48 +02:00
Robert Reif
4d157af61f
Fixed #7704 (QString::sprintf format string checking)
2016-08-20 08:47:52 +02:00
Daniel Marjamäki
8a66535399
Fixed #7694 (ValueType: 1.23L)
2016-08-20 08:44:53 +02:00
Robert Reif
b56c765a45
Fixed #7703 ((debug) Executable scope 'foo' with unknown function.)
2016-08-20 07:43:15 +02:00
Robert Reif
f1b5ac30a7
Fixed 7698 (FP syntaxError with enum (1.75 regression))
2016-08-19 19:09:52 +02:00
Robert Reif
1e999e0cfe
Fixed #7697 ((debug) Executable scope 'B' with unknown function.)
2016-08-19 19:06:15 +02:00
Daniel Marjamäki
789aef7fde
Fixed #4920 (Microsoft ATL/MFC CString::Format argument checking)
2016-08-19 17:36:27 +02:00
Daniel Marjamäki
497b3c38e2
astyle formatting
...
[ci skip]
2016-08-19 17:34:30 +02:00
Daniel Marjamäki
e7c1e8b82e
TestLibrary: Added tests for method calls
2016-08-19 10:47:44 +02:00
Daniel Marjamäki
305609f4fb
Fixed #7688 (setTokenValue: crash when there is no 2nd operand for ternary operator)
2016-08-17 18:44:41 +02:00
Daniel Marjamäki
1f98af654a
ValueFlow: better handling of ? when condition result is known
2016-08-15 14:19:35 +02:00
Daniel Marjamäki
62362cd06d
ValueFlow: improve handling of unary minus
2016-08-14 22:19:06 +02:00
Daniel Marjamäki
f2e49b4db4
Fixed #7178 (Defect: False positive due to mistake in return type of function pointer.)
2016-08-14 17:19:14 +02:00
Daniel Marjamäki
c8667096e0
Fixed #7658 (False positive: Same iterator is used with different containers)
2016-08-14 10:49:48 +02:00
Robert Reif
73e1378af8
Fixed #7661 (False positive: Function parameter 'e' should be passed by reference.)
2016-08-13 21:25:57 +02:00
Daniel Marjamäki
606e31602c
Fixed #7177 (Support compile_commands.json)
2016-08-13 10:50:03 +02:00
Daniel Marjamäki
5cc4e1118c
Added TODO testcases for Path::simplifyPath()
2016-08-09 22:59:36 +02:00
Robert Reif
fc1a755100
Fixed #7666 (Executable scope with unknown function.)
2016-08-09 14:02:06 +02:00
Daniel Marjamäki
bd21cd7c85
Fixed #6309 (FP: checkRedundantAssignment should not warn for pointer alias)
2016-08-08 21:43:00 +02:00
Bartlomiej Grzeskowiak
09a83f2cc8
Fixed #7567 ("(a | 7) > 6U" is always true)
2016-08-07 16:58:39 +02:00
Frank Zingsheim
47c063e13f
Fixed #7660 (cmake build does not handle simplecpp)
2016-08-06 18:21:54 +02:00
Daniel Marjamäki
a8df08f22b
Fixed #7659 (crash: Token::varId() : vxl: brdb_selection.cxx)
2016-08-06 18:07:41 +02:00
Daniel Marjamäki
b86c2689b3
TestPreprocessor: Fix output
2016-08-06 13:28:24 +02:00
Robert Reif
cdfe92b753
Fixed #7657 (False positive: Function parameter 'c' should be passed by reference.)
2016-08-06 10:27:00 +02:00
Daniel Marjamäki
cbfeae0ff7
bump simplecpp
2016-08-04 22:53:10 +02:00
Daniel Marjamäki
7d6c587580
Fixed #6113 (Tokenizer::simplifyFunctionPointer: wrong simplification of usage 'return (*f)();')
2016-08-04 19:10:08 +02:00
PKEuS
084fcc936c
Rephrased syntaxError message for empty configurations to improve readability:
...
Old: Invalid number of character 'c' when these macros are defined: ''.
New: Invalid number of character 'c' when no macros are defined.
2016-08-04 16:28:11 +02:00
Daniel Marjamäki
9711064b74
Fixed #6646 (False positive uninitvar - loopvariable initialized inside loop)
2016-08-04 14:39:54 +02:00
Daniel Marjamäki
fe3abd678f
Revert "Fix potential null pointer dereference"
...
This reverts commit 6ca76ff965
.
2016-08-04 10:40:07 +02:00
Daniel Marjamäki
2566fd09da
Fixed #5803 (False positive: Same iterator is used with different containers - insert() from range of different container)
2016-08-04 09:35:16 +02:00
Robert Reif
55b3f0bf38
Fixed #752 (SymbolDatabase: Does not match function if redundant keywords mismatch (C++))
2016-08-04 09:06:32 +02:00
Dmitry-Me
6ca76ff965
Fix potential null pointer dereference
...
This was CID 1360399
2016-08-03 18:44:15 +03:00
Robert Reif
b40edca62f
Fixed #7387 (SymbolDatabase: Wrong overloaded function is picked)
2016-08-02 23:34:11 +02:00
Robert Reif
b9030bcfcd
Fixed #7650 (SymbolDatabase: Wrong Token::type(), enum and class with same name)
2016-08-02 23:30:46 +02:00
Daniel Marjamäki
5e78dae143
Use TODO_ASSERT_EQUALS instead of TODO comments
2016-08-02 19:38:36 +02:00
Robert Reif
b44f448acc
Fixed #7649 (SymbolDatabase: Wrong overloaded function is picked for char and wchar_t)
2016-08-02 18:54:01 +02:00
Daniel Marjamäki
f23287544a
Fixed #7196 (Improve check: deem sizeof(thing) as using the thing's members)
2016-08-02 18:50:04 +02:00
Daniel Marjamäki
cc62259103
Tokenizer: don't set varid on c++11 'template using' type.
2016-08-02 15:04:07 +02:00
Daniel Marjamäki
2187e8ba02
CheckUninitVar: Fixed FP when dereferencing multidimensional arrays. Refactoring of testing. The FP was spotted when looking at #7092
2016-08-02 14:27:51 +02:00
Daniel Marjamäki
864cef2fd2
astyle formatting
...
[ci skip]
2016-08-02 09:03:03 +02:00
Robert Reif
891e21b478
Fixed #7458 (SymbolDatabase: Wrong overloaded function is picked)
2016-08-02 08:58:11 +02:00
Daniel Marjamäki
41526ef3a8
Fixed #6147 (FP unreadVariable: variable assignment in function call argument list)
2016-08-02 08:50:04 +02:00
Daniel Marjamäki
31484133c0
Fixed #7158 (Tokenizer::createLinks2(): does not set links for < > in 'enum { value = boost::mpl::at_c<B,C> };')
2016-08-01 22:26:11 +02:00
Daniel Marjamäki
e784901303
Fixed #6971 (False positive duplicateExpressionTernary - cast ignored)
2016-08-01 21:53:43 +02:00
Daniel Marjamäki
695b1f0ef3
Fixed #5692 (Preprocessor: ifdef symbol used indirectly in code leads to 'analysis failed')
2016-08-01 20:09:41 +02:00
Daniel Marjamäki
09b6568ea2
Fixed #7646 (podtypes do not get proper valuetype)
2016-07-31 19:47:34 +02:00
Daniel Marjamäki
d89a646ed9
TestPreprocessor refactorings
2016-07-30 20:22:07 +02:00
Daniel Marjamäki
66d0d7a0ad
Fixed #7553 (False positive with 1.74 'returning an integer in a function with pointer return type' when no integer is used)
2016-07-29 21:53:58 +02:00
Daniel Marjamäki
5611a71820
Fixed #7543 (False positive boolean result used in bitwise operation)
2016-07-29 18:46:43 +02:00
Daniel Marjamäki
89be630156
Fixed #7543 (False positive boolean result used in bitwise operation)
2016-07-29 17:24:22 +02:00
Daniel Marjamäki
a65ae3ce2e
Token: Allow dollar sign in identifiers
2016-07-29 13:42:11 +02:00
PKEuS
92e3e802fb
Attempt to fix travis build and testrunner failure
2016-07-28 20:59:09 +02:00
PKEuS
452ecc7ceb
Improved check: Detect passedByValue even for arguments that are not declared as "const"
2016-07-28 19:37:10 +02:00
Daniel Marjamäki
0777ecd071
Fixed #7640 (Preprocessor::getConfigs: -U is not honored)
2016-07-28 19:22:59 +02:00
PKEuS
3f4fe8f578
Refactorized CheckBufferOverrun:
...
- Removed redundant code
- Apply non-simplified checking in test suite
2016-07-27 17:28:43 +02:00
PKEuS
9a6569fde1
Always set ErrorMessage::file0 to ensure that the source file that cppcheck is checking when an error occurs can be identified
...
Removed unused function and unused includes from preprocessor.h/cpp
2016-07-26 16:28:40 +02:00
Daniel Marjamäki
71f62950ed
Tokenizer::findGarbageCode: Make it less picky about 'UNKNOWN_MACRO if ..'
2016-07-26 14:35:11 +02:00
PKEuS
fc1603eb9b
MathLib, ValueType: Support integer suffix "i64"
2016-07-26 13:19:53 +02:00
Daniel Marjamäki
7ff9545b10
Fixed #7637 (FP syntax error assignment in switch)
2016-07-26 12:15:55 +02:00
PKEuS
5c92c231b8
windows.cfg: SendMessage must not be <leak-ignore/>
2016-07-26 11:57:46 +02:00
Daniel Marjamäki
9082c097c8
Fixed testing of #7615 . The code is not garbage so move it from TestGarbage to TestSymbolDatabase
2016-07-26 09:10:10 +02:00
Daniel Marjamäki
fd19ab4ed1
fix garbage code handling
2016-07-26 08:50:00 +02:00
Matthias Krüger
6fd8edd6e5
Symboldatabase::sizeOfType: fix crash; fixes #7615
2016-07-26 01:18:47 +02:00
Daniel Marjamäki
2feb86a6af
Preprocessor: set platform info
2016-07-25 14:52:23 +02:00
Daniel Marjamäki
90faa80590
Preprocessor: Cleanup unused functions
2016-07-25 14:29:02 +02:00
Daniel Marjamäki
7ef02a7469
Cleanup Tokenizer
2016-07-25 12:12:11 +02:00
Daniel Marjamäki
adf16fae8b
Remove handling of ##, __FILE__, __LINE__ from tokenizer
2016-07-25 07:58:03 +02:00
Daniel Marjamäki
0767284ca1
Fixed #7630 (FP: dead store, modifying array, index var modified)
2016-07-25 07:35:33 +02:00
Daniel Marjamäki
e9fef003ac
Preprocessor: refactoring directives, they are now only set once for each file
2016-07-24 14:02:21 +02:00
PKEuS
2e2800f5bd
Fixed several MSVC warnings
2016-07-24 12:36:36 +02:00
Daniel Marjamäki
ed4a47de45
Tokenizer: Improve syntax checking of switch,if,while
2016-07-22 16:54:24 +02:00
PKEuS
12e3cf584c
Visual Studio solution:
...
- Fixed include paths
- Export simplecpp to cppcheck-core.dll
- Added /Zc:rvalueCast
2016-07-21 20:38:58 +02:00
Daniel Marjamäki
99307846cf
Preprocessor: simplecpp optimisations
2016-07-21 19:42:26 +02:00
Dmitry-Me
0aac71efd1
Unify and simplify addresses computation
2016-07-21 15:48:48 +03:00
Daniel Marjamäki
f50f024873
Revert "Resolve CID 1357639"
...
This reverts commit e3b0c3a974
.
It's not a proper fix. I want that Cppcheck detects this bug also. I want to keep the CID open until Cppcheck can detect it.
2016-07-21 09:52:51 +02:00
Dmitry-Me
e3b0c3a974
Resolve CID 1357639
2016-07-21 10:34:07 +03:00
Daniel Marjamäki
e16f0e500c
Preprocessor: Parse comments and then remove them
2016-07-21 07:48:17 +02:00
Daniel Marjamäki
8a1936d5c9
update AdditionalIncludeDirectories in vcxproj files
2016-07-20 22:17:23 +02:00
Daniel Marjamäki
03d2829fb9
Merge simplecpp branch
2016-07-20 12:21:00 +02:00
Daniel Marjamäki
a68da1a725
ValueType: Set valuetype for sizeof argument
2016-07-20 09:39:48 +02:00
Daniel Marjamäki
3eef225b36
Revert preprocessor fix for struct tag macros. There are performance problems.
2016-07-19 18:59:58 +02:00
Daniel Marjamäki
4cc4ebd5cd
Travis: run slow unit test on travis that is too slow to run on development machines
2016-07-19 17:10:49 +02:00
Mavik
3e86c7b637
Fixed #5700 (Defect: False positives due to failure to expand struct tag macros)
2016-07-19 16:52:53 +02:00
Daniel Marjamäki
ca929f0f1b
Try to fix #7608 (Assertion failed in test/testvarid.cpp at line 1988)
2016-07-19 11:59:37 +02:00
Daniel Marjamäki
83b982064d
Fixed #7579 (varid not set properly in 'int b[] = { m * a[0] };')
2016-07-18 15:27:08 +02:00
Daniel Marjamäki
0ddeac0429
refactor (use ast) and improve CheckOther::checkRedundantAssignment (warn about global variables unless they are volatile, handle arrays in lhs better)
2016-07-18 12:43:23 +02:00
Daniel Marjamäki
72ead10d93
cleanup tests
2016-07-18 10:52:38 +02:00
Daniel Marjamäki
b9443771fb
cleanup tests
2016-07-18 10:42:03 +02:00
Daniel Marjamäki
4f051bf9dd
Fixed #7599 (valueFlowAST: handle && and || better)
2016-07-17 21:51:20 +02:00
Daniel Marjamäki
45ee29d5dc
Fixed #7604 (simplifyCalculation: expression '0 && x[2]' is not simplified properly)
2016-07-17 15:52:53 +02:00
PKEuS
801fd8f96a
Support trailing return types (C++11)
2016-07-17 15:47:50 +02:00
Daniel Marjamäki
91e38f3eb9
Fixed #7582 (false positive: Division by result of sizeof(). strncpy() expects a size in bytes)
2016-07-17 15:22:14 +02:00
Daniel Marjamäki
6e3d5dc0d1
Fixed #7580 (False positive when using logical operator keywords 'and', 'or')
2016-07-16 20:21:31 +02:00
PKEuS
0afecd8fee
Do not simplify name "CALLBACK" away on non-windows platforms ( #7554 )
2016-07-16 10:43:28 +02:00
Robert Reif
768c26805c
Fixed false positive: %Ld in format string (no. 1) requires 'long long' but the argument type is 'long long' ( #7601 ).
2016-07-16 10:33:46 +02:00
PKEuS
f869f7ebde
Fixed false positive reademptycontainer when end() is called ( #7560 )
2016-07-10 10:48:21 +02:00
PKEuS
ded8d80b23
Library: Support arguments with default value. Fixed default value handling for <container> tags broken in last commit.
2016-07-09 12:44:17 +02:00
Robert Reif
c1594bedbb
Fixed creation of SymbolDatabase for some template code ( #7594 )
2016-07-09 09:22:52 +02:00
PKEuS
44a19b527e
Use ValueFlow and SymbolDatabase to detect buffer overflows with new and malloc, improving support for enums ( #7576 )
2016-07-08 20:53:08 +02:00
Robert Reif
eca805ba3b
ValueFlow: Fixed constant folding of sizeof(enum) and sizeof(enumerator) ( #7564 )
2016-07-08 20:39:34 +02:00
PKEuS
a808549af0
Support lambdas in simplifyCompoundAssignment ( #7571 )
2016-07-08 20:10:33 +02:00
Daniel Marjamäki
a87b4368cb
Revert "Preprocessor: Start replacing our Preprocessor code with simplecpp"
...
This reverts commit 9820783b60
.
There was Travis errors I'll need to look more at.
2016-07-07 23:45:42 +02:00
Daniel Marjamäki
9820783b60
Preprocessor: Start replacing our Preprocessor code with simplecpp
2016-07-07 22:58:56 +02:00
PKEuS
644a216394
Fixed two false positives related to char arrays initialized by a literal:
...
- Run check for writing to string literals on non-simplified token list (#7283 )
- Run buffer overrun checking for string literals on non-simplified token list (https://sourceforge.net/p/cppcheck/discussion/general/thread/2c33dfc5/ )
2016-07-07 19:38:15 +02:00
PKEuS
3bdcf68990
Fixed false positive in CheckUnusedVar::checkFunctionVariableUsage(): Bailout when break; is encountered
...
See also: https://sourceforge.net/p/cppcheck/discussion/general/thread/1c169dc5/
2016-07-07 18:27:31 +02:00
Simon Martin
40eacb19b1
Ticket #7565 : Handle numbers with several C++14 integer separators.
2016-07-01 23:24:28 +02:00
umanamente
0f11007c19
Fixed #7083 (false positive: typedef and initialization with strings)
2016-06-21 22:42:46 +02:00
PKEuS
dde6f5eaea
Do not warn about alloca() in C89 mode ( #7558 )
2016-06-20 09:30:41 +02:00
PKEuS
721bc32b2d
Fixed crash in CheckVaarg::va_list_usage() ( #7559 )
2016-06-20 09:24:23 +02:00
Bartlomiej Grzeskowiak
a5cfa2b12c
- #7522 and #7428 revisited. ((a&7)>7U) is always false and ((X|7)>=6) is correct (X can be negative).
2016-06-17 12:12:53 +02:00
Daniel Marjamäki
d1f06ff47c
Fixed #7175 (False positive performance warning (buffer overwritten before its old content has been used))
2016-06-13 15:46:43 +02:00
PKEuS
53e2cabdbb
Properly support "break" in CheckVaarg::va_list_usage() ( #7533 )
...
Ran AStyle
2016-06-07 19:28:32 +02:00
Simon Martin
3c10b25b3e
Ticket #7117 : Properly detect if a const ternary operator is in a template parameter list.
2016-06-05 14:13:32 +02:00
Robert Reif
583b340034
enum: set the return type of derived class functions returning enums defined in a base class.
2016-06-05 14:08:33 +02:00
Simon Martin
3095f47a7b
Ticket #7137 : Properly detect C++14 digit separators. ( #802 )
...
Add an optional extended description…
2016-06-04 22:55:55 +02:00
PKEuS
3916cd628e
windows.cfg: Fixed configuration of _tfopen_s/_wfopen_s (
2016-06-02 09:41:01 +02:00
PKEuS
9a61559eca
Fixed false positive va_list_usedBeforeStarted ( #7527 )
2016-06-02 09:32:45 +02:00
Daniel Marjamäki
c24a4b9189
Removed enum mismatch checker. Ticket #6960 .
2016-05-29 18:00:37 +02:00
Robert Reif
f4dd43a71a
Fixed #7523 (Scope::findEnumerator(): does not find enum constant from other enum type)
2016-05-29 14:45:45 +02:00
Simon Martin
12a298b9cd
Ticket #7445 : Properly represent integer types smaller than int in CheckIO::ArgumentInfo.
2016-05-28 15:36:13 +02:00
Daniel Marjamäki
2b2f12bcd5
Fixed #6758 (Preprocessor: handle #__VA_ARGS__)
2016-05-28 11:27:45 +02:00
Daniel Marjamäki
cee67730b1
Fixed #5746 (Cppcheck returns error-exitcode when globally suppressed error is encounted when running with multiple jobs.)
2016-05-27 20:13:51 +02:00
PKEuS
00e4f70fe3
Fixed false positives in CheckSizeof::checkSizeofForPointerSize() ( #7518 )
2016-05-26 21:25:29 +02:00
PKEuS
373ac52480
Mention exact function name in invalidscanf message ( #5649 )
2016-05-26 21:11:33 +02:00
Daniel Marjamäki
4b903a838f
Fixed #5522 (CheckLeakAutoVar: Don't treat 'x==p' as dereference of p)
2016-05-26 19:22:38 +02:00
Daniel Marjamäki
be755af762
Removed todo testcase for #5783
2016-05-26 18:47:36 +02:00
Daniel Marjamäki
2a42f245a9
Fixed #7130 (Wrong assignmentInAssert when using lambda in predicate function)
2016-05-26 18:29:29 +02:00
Daniel Marjamäki
54be403f64
Fixed #7026 (Cppcheck does not recognizes the use of a variabile inside lambda function)
2016-05-26 18:07:56 +02:00
Daniel Marjamäki
38741868b5
Fixed #3989 (false positive: memory leak (inline function))
2016-05-26 17:42:27 +02:00
Robert Reif
66cacde3db
Fixed #7513 (value flow of array dimension with enum doesn't always work)
2016-05-26 11:25:50 +02:00
Daniel Marjamäki
50352c8d69
Fixed #3552 (Don't warn about missing ctor for class inside union)
2016-05-25 19:05:16 +02:00
PKEuS
c7b3836379
Small refactorizations:
...
- Optimized performance of several functions by adding pre-checks
- Simplified some code
- Fixed VS warning in testsymboldatabase.cpp
2016-05-25 15:30:49 +02:00
PKEuS
8c0eab3eb3
Optimization: Improved performance of CheckBufferOverrun::checkScope() when dealing with a large number of arrays ( #5975 )
...
-> checking time decreases from 1010s to 50s on the code snippet in #5975
-> Dropped a garbage code unit test
2016-05-25 14:42:00 +02:00
Daniel Marjamäki
ae97f53244
Fixed #6184 (ValueType: overloaded < operator)
2016-05-25 13:56:36 +02:00
Matthias Krüger
0556edd151
fix #7505 (crash on invalid code)
2016-05-25 13:14:34 +02:00
PKEuS
f2ae295f1e
Support char literals in CheckCondition::checkIncorrectLogicOperator() ( #5912 )
2016-05-24 15:08:48 +02:00
Daniel Marjamäki
06a594a9e0
Fixed #6207 ('not' misinterpreted as alternative C token)
2016-05-24 13:33:21 +02:00
Daniel Marjamäki
397480f929
Fixed #7376 (ValueType: wrong type for container element)
2016-05-23 18:53:59 +02:00
Daniel Marjamäki
37afc57a2a
Fixed #7455 (Suppressions: not working well with windows path separators)
2016-05-23 15:38:47 +02:00
PKEuS
4bb99a7887
Improved CheckSizeof::checkSizeofForPointerSize():
...
- Support cast in front of malloc() call
- Support sizeof(type) pattern (#4428 )
2016-05-22 22:29:52 +02:00
Daniel Marjamäki
710e066a9a
Fixed #6406 (VarId: struct member initialization)
2016-05-22 21:18:52 +02:00
PKEuS
64d2fd2f57
Added new attribute "arg" to <alloc> and <dealloc> to specify the argument that is allocated/deallocated.
...
This fixes several issues with allocation functions in windows.cfg, such as HeapAlloc() and VirtualAllocEx() (#7503 )
2016-05-22 17:19:14 +02:00
PKEuS
851c6e0ed5
Improved buffer overflow checking for scanf: %c with a width ( #3494 )
2016-05-22 14:00:26 +02:00
Daniel Marjamäki
06d5e73e88
Fixed #7471 (Tokenizer::prepareTernaryOpForAST: typedef with comma inside ?:)
2016-05-22 11:33:21 +02:00
Daniel Marjamäki
b7b92b2140
Fixed #6674 (false positive 'unusedPrivateFunction' - calling virtual function in subclass)
2016-05-21 20:07:35 +02:00
Daniel Marjamäki
c23c1f245c
Fixed #6989 (incorrect memleak error)
2016-05-21 14:03:28 +02:00
Alexander Mai
d492500f34
#5844 False positive: returnReference fp for inner lambda function
2016-05-20 23:46:56 +02:00
orbitcowboy
b1b0c920e3
Removed sprintf_s from windows.cfg.
2016-05-19 08:22:40 +02:00
orbitcowboy
46adf180d7
cfg: Added support for fopen_s and sprintf_s functions. Fixed a wrong tests.
2016-05-18 09:31:26 +02:00
Alexander Mai
303a85a930
#4195 segmentation fault of cppcheck (invalid code). Fix segfault which turned up after refactoring the enum handling code.
2016-05-17 22:19:23 +02:00
Alexander Mai
4f77a2b044
#7500 buffer overflow: encodeMultiChar lib/mathlib.cpp:343. Improve errors handling
2016-05-17 20:43:32 +02:00
Daniel Marjamäki
7453b641bd
Fixed #4839 (Variable (in array) is assigned a value that is never used)
2016-05-17 16:03:55 +02:00
Daniel Marjamäki
99fc13ee70
Fixed #6968 (unusedPrivateFunction not correct, called by inner class)
2016-05-16 20:52:50 +02:00
Daniel Marjamäki
65998f1d7c
CheckClass: previous change introduced false positives when Token::function() is wrong. Avoid those false positives.
2016-05-16 10:55:22 +02:00
Daniel Marjamäki
bce15b1ade
CheckClass: refactored the code, use symboldatabase instead of name comparisons when possible, fixed a FN.
2016-05-16 09:36:26 +02:00
amai2012
22542e7547
Merge pull request #794 from simartin/ticket_7452
...
Ticket #7452 : Properly interpret escape sequences in character literals.
2016-05-15 20:35:50 +02:00
Daniel Marjamäki
2668cee3cf
Fixed #6397 (FP deallocuse - conditional deallocation and conditional return)
2016-05-15 20:27:44 +02:00
Simon Martin
3af30e728c
Ticket #7452 : Properly interpret escape sequences in character literals.
2016-05-15 15:48:24 +02:00
Alexander Mai
9d1302d523
#7490 sizeof('a') should be sizeof(int) in C mode. Previous fix was hardcoding 4 for C.
2016-05-14 22:52:43 +02:00
Alexander Mai
4816394511
#5970 false positive in Uninitialized variable: d - casting struct var to char*. It got fixed since 1.72, add regression test
2016-05-14 22:36:54 +02:00
Daniel Marjamäki
2cb03b3fd0
Fixed #7409 (Tokenizer: Links not set properly 'Data<T&&>')
2016-05-14 20:40:30 +02:00
Daniel Marjamäki
5a1bea2a09
Fixed #7244 (False memory leak when POD is allocated with value initialization and pushed onto container)
2016-05-14 14:56:51 +02:00
Alexander Mai
251fc022fa
#7490 sizeof('a') should be 4 in C mode
2016-05-14 13:05:44 +02:00
Kamil Dudka
efe98883ab
checkleakautovar: do not miss 'throw' followed by ::
2016-05-13 21:37:49 +02:00
Daniel Marjamäki
df6a66deed
SymbolDatabase: Add test that makes sure enum constant values are calculated properly. Related with ticket #7493 .
2016-05-12 12:07:40 +02:00
Daniel Marjamäki
613311cc57
Fixed #7493 (enumMismatch on Enum declaration)
2016-05-12 11:46:08 +02:00
Daniel Marjamäki
b965cf5491
Fixed #7444 (Tokenizer::varId: Wrong varid when there is anonumous union in class)
2016-05-11 20:43:23 +02:00
Daniel Marjamäki
bf8471e109
Fixed #7491 (Questionable enumMismatch)
2016-05-11 15:33:59 +02:00
Daniel Marjamäki
fb5e6d8a7d
Fixed #6960 (New check: enum variable is assigned mismatching value)
2016-05-10 20:22:35 +02:00
Daniel Marjamäki
a167a2d242
TestSymbolDatabase: Add some tests for the new enum handling
2016-05-09 18:34:24 +02:00
Daniel Marjamäki
eac3660f46
ValueType: Changed type info for enums to 'signed int', that is what checks wants to see mostly.
2016-05-09 11:11:13 +02:00
Daniel Marjamäki
1caa79c45f
Tokenizer::simplifyPointerConst: Remove simplification. Its purpose was to avoid crash for garbage code ( #6900 ). This fixes #7485 .
2016-05-08 21:32:34 +02:00
Daniel Marjamäki
803b4d4cf8
ValueType: Better handling of nested types
2016-05-08 14:55:10 +02:00
Daniel Marjamäki
636e97c272
ValueType: Improved debug output for nested types
2016-05-08 13:15:20 +02:00
Daniel Marjamäki
f0953c6916
ValueType: better handling of nonstandard types
2016-05-08 11:55:25 +02:00
Daniel Marjamäki
b26dd1ccab
ValueFlow: Handle enums
2016-05-07 20:18:07 +02:00
Daniel Marjamäki
be90080976
Fixed #7481 (False positive AssignmentAddressToInteger - pointer to enum)
2016-05-07 19:51:37 +02:00
PKEuS
5d5886b464
Properly detect binary & in CheckCondition::clarifyCondition() (fixes false positives when self-checking cppcheck)
2016-05-06 17:39:41 +02:00
PKEuS
896582ce56
Fixes for CheckStl::string_c_str():
...
- Fixed false positive #7480
- Fixed false negative: Show performance message also for non-local objects
2016-05-06 17:25:00 +02:00
PKEuS
3366a74bb0
Refactorized CheckCondition::clarifyCondition():
...
- Reimplemented parts of the check based on ValueType
- Merged two loops
Fixed some type conversion messages
2016-05-06 15:22:45 +02:00
PKEuS
0bf85f9aa5
ValueType: Support integers defined in libraries ( #7394 )
2016-05-04 15:39:56 +02:00
PKEuS
6c3f0a7bb8
SymbolDatabase: Properly detect lambdas with return type ( #7473 )
2016-05-04 14:10:09 +02:00
PKEuS
f0fb7a8245
Simplify __attribute__ earlier ( #7462 )
2016-05-04 13:51:34 +02:00
PKEuS
17ccb0fbe6
CheckClass::checkMemsetType(): Skip arrays of pointers ( #7456 )
2016-05-04 13:38:36 +02:00
PKEuS
21b51dd235
Check64BitPortability::pointerassignment(): Skip over lambdas ( #7451 )
2016-05-04 13:23:50 +02:00
PKEuS
b65cacf4b1
Tokenizer::simplifyStaticConst(): Support "struct" and operator:: ( #7403 )
2016-05-04 12:33:19 +02:00
PKEuS
f23668dfcc
Fixed false positive doubleFree ( #7401 )
2016-05-04 12:14:42 +02:00
PKEuS
b7d8cd69f6
Fixed false negatives in CheckStl::string_c_str():
...
- Support more complex patterns (#7385 )
- Use same logic for string_c_strReturn() as for string_c_strError()
2016-05-04 11:10:12 +02:00
amai2012
a54ec615f3
Run astyle
2016-04-25 11:12:35 +02:00
amai2012
7a8a6695a4
Merge pull request #786 from prozak/master
...
- fix for #5749 defect: internal error
2016-04-24 22:19:02 +02:00
PKEuS
949f1379c2
Reverted accidential changes to testrunner.vcxproj
2016-04-22 16:52:32 +02:00
prozak
6592638022
- fix for #5749 defect: internal error
...
typedef expansion in cast operator was not processed correctly
2016-04-22 21:39:03 +08:00
Daniel Marjamäki
dc2a92263a
Fixed #7426 (RFC: time to replace simplifyEnum?)
2016-04-22 06:02:54 +02:00
Bartlomiej Grzeskowiak
7e020e1d92
- fix for #7428 false negative: Statement is always false
2016-04-14 14:50:08 +02:00
Matthias Krüger
b42feb7b88
fix testrunner (sample was not updated in f5e8a72dc2
).
2016-04-08 12:09:16 +02:00
amai2012
9f4d4bdde7
#6167 Refactoring: rename test functions. Rename TestTokenizer::removeCast*. TestTokenizer::varid* doesn't exist (anymore?).
2016-03-27 17:36:07 +02:00
Robert Reif
47634a0ada
Fixed #7420 ((debug) Executable scope 'foo' with unknown function.)
2016-03-22 14:10:20 +01:00
Daniel Marjamäki
ac8341e3de
keep type suffixes after constant folding using bit operations
2016-03-21 21:20:02 +01:00
Daniel Marjamäki
4e4873772d
Fixed #7395 (ValueType: Result type of assignment operators)
2016-03-21 19:51:09 +01:00
Daniel Marjamäki
072120d19f
TemplateSimplifier::templateParameters: Handling r-value arguments
2016-03-18 11:09:41 +01:00
Robert Reif
100c4276ea
Fixed #7424 (value type: wrong sign)
2016-03-18 10:30:57 +01:00
amai2012
9700dfead0
Testcase succeeds on Win32-VC-32bit, only 64bit needs to be fixed.
2016-03-01 22:32:27 +01:00
Daniel Marjamäki
253bfe432c
Fixed #7410 (Tokenizer: function pointer with throw())
2016-02-29 08:02:02 +01:00
Daniel Marjamäki
c5c376513b
Fixed #7102 (Preprocessor: skip __cplusplus sections in headers when .c file is checked)
2016-02-29 07:34:06 +01:00
Alexander Mai
41dee7f970
#7399 CMake error: Cannot specify link libraries for target 'testrunner' (reported by user dbuchholz). Add comment to mathlib.h
2016-02-19 21:40:31 +01:00
Alexander Mai
5c2960713f
Correct false positives compareBoolExpressionWithInt (0U)
2016-02-19 21:38:54 +01:00
Robert Reif
0fc59d0228
#7069 False positive invalidPrintfArgType_uint - %lu with 0ul
2016-02-19 10:12:47 +01:00
Daniel Marjamäki
1c5eaf8cf9
TestSimplifyTemplate: fix syntax /classname/class/
2016-02-14 13:32:58 +01:00
Dmitry-Me
1f27c4b76b
Merge pull request #771 from Dmitry-Me/charUsedAsArrayIndex
...
Portability warning when 'char' type is used as array index
2016-02-10 20:11:38 +03:00
Daniel Marjamäki
1ab5805d98
Fixed #6616 (valueFlowForward: for loop, variable in 3rd expression is changed in loop body)
2016-02-08 10:43:41 +01:00
Dmitry-Me
c3399493ef
Portability warning when 'char' type is used as array index
2016-02-08 10:08:35 +03:00
Daniel Marjamäki
34b5e0ce99
Fixed #6873 (False positive uninitvar - variable initialized via pointer)
2016-02-07 18:48:57 +01:00
Daniel Marjamäki
5fef7cc050
Fixed #4973 (wrong enum simplification of shadow struct variable)
2016-02-07 15:15:20 +01:00
Daniel Marjamäki
6c1012a8d6
Fixed #4625 (wrong enum simplification in shadowed enum declaration)
2016-02-07 13:51:03 +01:00
Daniel Marjamäki
f781f13997
Fixed #6806 (wrong enum simplification in initialization list)
2016-02-07 13:34:03 +01:00
PKEuS
f8bf2b5776
Removed rest of variableHidingTypedef and variableHidingEnum checking
2016-02-06 20:55:41 +01:00
amai2012
d25258359a
#7251 Remove checks variableHidingTypedef and variableHidingEnum
2016-02-06 15:37:58 +01:00
Daniel Marjamäki
7bd034c009
Fixed #7369 (False positive knownConditionTrueFalse - assertions)
2016-02-06 14:37:44 +01:00
PKEuS
0847d3d19a
ValueType related bugfixes:
...
- ptrdiff_t is SIGNED
- Detect pointers to unknown types as pointers
- Do not identify bool* as boolean (#7381 )
2016-02-05 20:29:17 +01:00
PKEuS
b4b38fb7ce
Use ValueType in CheckOther::invalidPointerCast()
...
False negative: operator new is currently not supported by ValueType.
2016-02-05 20:28:43 +01:00
PKEuS
6215a48dc9
Support member variables in CheckBool::checkAssignBoolToFloat()
2016-02-05 20:28:42 +01:00
PKEuS
e71e9bd538
CheckBool: Rely on ValueType, removed a redundant check
2016-02-05 15:48:51 +01:00
PKEuS
618ea498e9
ValueType: Support logical operators
2016-02-05 15:15:13 +01:00
PKEuS
35317695d4
ValueType: Fixed handling of constness
2016-02-05 13:31:31 +01:00
PKEuS
792835cd9a
ValueType: Support ++/--.
2016-02-05 12:06:44 +01:00
PKEuS
2b179dc836
ValueType: Properly support ternary operator with pointers ( #7378 )
2016-02-05 09:59:48 +01:00
PKEuS
3b7948fb4e
ValueType: Support ternary operator
2016-02-04 21:20:05 +01:00
PKEuS
a9f52aec04
ValueType: Support unary arithmetical/bit operators
2016-02-04 21:03:54 +01:00
PKEuS
cae19cadd3
ValueType: Added support for static member variables and simplified code
2016-02-04 20:49:13 +01:00
PKEuS
b801386ac8
Fixed bug in Token::findClosingBracket() and broken unit test ( #7277 )
2016-02-04 10:00:54 +01:00
PKEuS
cc8c498ebb
Moved a few tests to testgarbage.cpp
2016-02-04 09:10:20 +01:00
Alexander Mai
d3546ea410
#7321 segmentation fault in valueFlowSwitchVariableScope::isVariableDeclaration
2016-02-03 22:49:57 +01:00
Alexander Mai
cfe9c01bf8
#7257 segmentation fault in valueFlowSwitchVariable (invalid code). Correct SymbolDatabase::validateVariables() so it does not complain about function arguments for function without body
2016-02-03 21:52:02 +01:00
Alexander Mai
ca2e3b9abb
#7370 False positive uselessCallsCompare on unknown type. Ensure related warnings are only issued on STL types
2016-02-02 20:26:02 +01:00
PKEuS
841f17776b
Set ValueType for assignment operators, detect division by zero for %= and /= again ( #7322 )
2016-02-02 17:17:55 +01:00
PKEuS
4b9241f643
Removed support for patterns like |a|b and a||b (equal to a|b|)
...
-> Improved performance by 1,3% (non-matchcompiled build)
2016-02-02 11:46:42 +01:00
Alexander Mai
468a130447
Fix compiler warnings introduced by refactoring
2016-02-02 09:18:58 +01:00
Alexander Mai
a288d5eb16
#7027 TokenList::validateAst() did not detect broken AST with endless recursion
2016-01-31 22:16:58 +01:00
Daniel Marjamäki
988918c9bc
ValueType: Use signed as default sign for short/int/long/longlong
2016-01-31 14:34:26 +01:00
Daniel Marjamäki
e660c55d39
TestIO: Refactoring macros
2016-01-31 13:49:17 +01:00
Daniel Marjamäki
b54613a942
Fixed #7046 (constexpr value used as template parameter reported as not used)
2016-01-31 12:39:43 +01:00
PKEuS
9d2258677d
Improved CheckOther::checkUnusedLabel(): Write a warning instead of a style message if it happens inside a switch()
2016-01-31 12:07:24 +01:00
Dmitry-Me
cdf68353ae
Merge pull request #769 from Dmitry-Me/testNoWarningWhenCharIndexInRange
...
Test for signed char index in positive values range
2016-01-31 13:43:18 +03:00
Daniel Marjamäki
c7f5ca74bd
VarId: Set varid for template parameters ( #7046 )
2016-01-31 11:07:30 +01:00
PKEuS
6d0c2f7253
Fixed false positive useClosedFile when noreturn function is called ( #7359 )
2016-01-31 10:39:35 +01:00
PKEuS
0e8777ec99
Fixed crash on garbage code ( #7356 )
2016-01-31 10:25:09 +01:00
PKEuS
4d01af3fe1
Fixed false positive in CheckMemoryLeakStructMember when returning a member that has been allocated ( #7302 ).
2016-01-31 10:10:48 +01:00
Daniel Marjamäki
d5884692df
Fixed #7363 (valueflowOppositeCondition - if (size1 > size2) ... else if (size1 < size2) ...)
2016-01-30 22:13:03 +01:00
PKEuS
3b046b42a6
Support function pointers in CheckUnusedVar::checkFunctionVariableUsage_iterateScopes() ( #7194 )
2016-01-30 20:59:55 +01:00
Daniel Marjamäki
b908bb18a9
Fixed #5503 (FP: Uninitialized variable - initialize in in if and else branch)
2016-01-30 20:48:28 +01:00
PKEuS
923f7f843d
Better distinguishing between possible and known null pointer dereferenciations ( #7157 )
2016-01-30 20:43:40 +01:00
PKEuS
5d9f275ff8
Fixed false positive uninitMemberVar with member function of template ( #7205 )
2016-01-30 20:18:13 +01:00
PKEuS
23ad881c64
Fixed false positive returnLocalVariable ( #7180 )
2016-01-30 20:18:12 +01:00
Daniel Marjamäki
30f2bb7796
ValueFlow: set known value for opposite condition in else if ( #5503 )
2016-01-30 20:03:55 +01:00
Matthias Krüger
112b35a49e
testrunner: add testcode for #6781 (TemplateSimplifier::simplifyTemplateInstantiations causes heap corruption on invalid code)
2016-01-30 18:20:45 +01:00
Daniel Marjamäki
fd67ca146d
Fixed #4955 (false positive: Variable 'i' is assigned a value that is never used (only used in template instantiation))
2016-01-30 16:49:39 +01:00
Daniel Marjamäki
0e89620212
Fixed #4698 (False positive: Uninitialized member variable warning with confusing namespaces)
2016-01-30 14:04:48 +01:00
Daniel Marjamäki
f3f9ea2d09
TemplateSimplifier: One more fix for #3130 . Restored max recursion count to 100 and improve pattern for reference template instantiations instead.
2016-01-30 11:22:44 +01:00
Daniel Marjamäki
f116de678e
Fixed #3130 (Tokenizer: Doesn't instantiate recursive template correctly)
2016-01-30 10:33:25 +01:00
Dmitry-Me
c74282c258
Test for signed char index in positive values range
2016-01-29 11:09:25 +03:00
Daniel Marjamäki
fa31ebf88e
Fixed #7349 (checker 'inefficient find()' unintentionally used for find_first_of())
2016-01-29 08:55:46 +01:00
Daniel Marjamäki
b5986f6ad2
Fixed #7358 (valueflow: value is not known after conditional assignment)
2016-01-27 19:20:00 +01:00
Alexander Mai
1dac1664be
7357 segmentation fault in TokenList::insertTokens
2016-01-26 19:12:57 +01:00
Daniel Marjamäki
462b98afbc
Fixed #7310 (ValueFlow: Value of NULL in function call)
2016-01-26 16:53:01 +01:00
Daniel Marjamäki
5c9be4a0df
Fixed #7216 (ValueFlow: known value in condition)
2016-01-26 16:10:15 +01:00
Daniel Marjamäki
c0056d2455
Fixed #7347 (AST: wrong ast when template variable is declared and initiailized in if 'if (A::B<C> abc = 123)')
2016-01-26 10:40:44 +01:00
Daniel Marjamäki
40e14f401f
CheckCondition::alwaysTrueFalse: Move to normal checking to catch more problems
2016-01-26 10:08:21 +01:00
Daniel Marjamäki
a391bca060
Fixed #7350 (ValueFlow: Result of 'x & 0' is always 0)
2016-01-26 10:07:42 +01:00
Daniel Marjamäki
0fb9ab7b4a
Refactoring CheckMemoryLeakNoVar::checkForUnusedReturnValue(). use continue
2016-01-25 10:33:11 +01:00
Daniel Marjamäki
7663b6ee75
Fixed #7348 (AST: wrong ast for cast that starts with :: '(::X*)x;')
2016-01-25 10:29:24 +01:00
Daniel Marjamäki
659cd96b03
Fixed #7209 (False positive: Array index used before limits check reported in sizeof)
2016-01-24 14:06:02 +01:00
Daniel Marjamäki
6faa637fc7
Fixed #6537 (False positive badBitmaskCheck - error in valueflow)
2016-01-24 13:45:44 +01:00
Daniel Marjamäki
a8416bfb16
Fixed #6000 (ValueFlow: conditional code in for loops)
2016-01-24 13:11:51 +01:00
Daniel Marjamäki
76cdfbf487
Fixed #6330 (valueflow: condition is always false first iteration in dowhile loop)
2016-01-24 08:57:57 +01:00
Daniel Marjamäki
26612ab846
Fixed #5332 (Tokenizer: if braces not added properly 'if (x==123) label: {}')
2016-01-23 11:43:48 +01:00
Daniel Marjamäki
3d0338e9f9
Fixed #7212 (incorrectly adding function argument with no name)
2016-01-23 09:48:21 +01:00
Daniel Marjamäki
2627aada07
Fixed #7346 (Tokenizer::setVarId: No varId for member in initialization list)
2016-01-23 08:28:04 +01:00
Daniel Marjamäki
f64930b7f5
Fixed #7343 (SymbolDatabase: handling of override)
2016-01-22 19:22:24 +01:00
Daniel Marjamäki
8568a80208
Fixed #6883 (Template parsing error)
2016-01-20 16:10:58 +01:00
Daniel Marjamäki
642cc57428
CheckMemoryLeak: Fix FP when overloaded new is used
2016-01-20 10:34:03 +01:00
Daniel Marjamäki
4a3ece5847
CheckNullPointer: Fix FP for 'buf[p]' when p is NULL
2016-01-20 08:42:58 +01:00
Daniel Marjamäki
ab441f3fb1
Tokenizer:vardecl: split up reference variables declared in class better
2016-01-19 15:27:11 +01:00
Daniel Marjamäki
a434e0fb1a
Fixed #7272 (Tokenizer:setVarId: handle namespaces better)
2016-01-19 14:32:27 +01:00
Daniel Marjamäki
79aec559d5
Fixed #7243 (False positive unknownEvaluationOrder - comma operator inside while-clause)
2016-01-18 16:10:51 +01:00
Daniel Marjamäki
b9a4a950a2
Fixed #7144 (Tokenizer::isScopeNoReturn: handling '{ { throw new string(..); } }')
2016-01-18 15:39:20 +01:00
Daniel Marjamäki
d656e3a056
Fixed #7103 (isReturnScope: handling 'return (bstr){0};')
2016-01-17 12:38:49 +01:00
Daniel Marjamäki
d54f4f9c65
Fix TestAstUtils
2016-01-16 19:08:51 +01:00
Daniel Marjamäki
522de81cc7
Refactoring: Move isReturn() to astutils and rename it to isReturnScope()
2016-01-16 18:52:34 +01:00