Daniel Marjamäki
2c43075ece
AST: weird clang syntax
2017-04-10 23:05:41 +02:00
Daniel Marjamäki
df90ff9f5e
Merge pull request #888 from simartin/ticket_7942
...
Don't generate invalid syntax for out of line template class constructors during instantiation
2017-04-10 22:18:20 +02:00
Daniel Marjamäki
5e1b6aee8c
AST: Fix hang for weird VLA code
2017-04-10 22:17:34 +02:00
Daniel Marjamäki
ffeadbdde4
AST: improved handling for struct initialization 's = { [0] = 123 }'
2017-04-10 07:25:18 +02:00
Daniel Marjamäki
d92c529aa6
AST: Fix wrong handling of struct initialization, caused hang
2017-04-09 22:06:13 +02:00
Daniel Marjamäki
e6005dfa3c
AST: Fix AST for lambda '[&]{..}'
2017-04-09 17:49:55 +02:00
Matthias Krüger
494f64cb88
tests: fix some self-check findings about functions that can be static.
...
Was:
[test/testtype.cpp:223]: (performance, inconclusive) Technically the member function 'TestType::removeFloat' can be static.
[test/testsymboldatabase.cpp:61]: (performance, inconclusive) Technically the member function 'TestSymbolDatabase::getSymbolDB_inner' can be static.
[test/teststl.cpp:1437]: (performance, inconclusive) Technically the member function 'TestStl::getArraylength' can be static.
2017-04-09 17:28:00 +02:00
Simon Martin
ee05fe7d77
Ticket #7942 : Don't generate invalid syntax for out of line template class constructors during instantiation.
2017-04-09 16:12:59 +02:00
Daniel Marjamäki
8ffed6862d
Tokenizer: Add --check-config warning for macro with semicolon in argument
2017-04-07 19:19:10 +02:00
Daniel Marjamäki
7d8af7bdca
Fixed #7979 (crash (nr 2): CheckFunctions::checkIgnoredReturnValue())
2017-04-07 13:18:53 +02:00
Daniel Marjamäki
392a06a44b
AST: better handling of '(struct X){...}'
2017-04-06 21:28:13 +02:00
Daniel Marjamäki
50da7d4919
Tokenizer: Write syntax error if there is C++ code in C file.
2017-04-06 08:50:35 +02:00
Daniel Marjamäki
fd2651909c
Fixed #7978 (ValueType: container type not set properly)
2017-04-06 07:07:20 +02:00
Daniel Marjamäki
fee86b9684
ValueType: Better handling of 'new Container'
2017-04-05 22:05:29 +02:00
Daniel Marjamäki
e6ed08c4d8
Fixed #7976 (Internal error. Token::astOperand1() cyclic dependency. (ticket nr 2, new regression))
2017-04-05 11:00:02 +02:00
Daniel Marjamäki
9c5a136f04
Fixed #7975 (crash: Tokenizer::createLinks2 problem with enable_if<x&&y,C*>)
2017-04-03 21:48:22 +02:00
Daniel Marjamäki
abb43b6a81
Fixed #7934 (Wrong AST for 'for (i=0;cond;({min(x,10);}))')
2017-04-02 19:44:33 +02:00
Daniel Marjamäki
92fe210217
tweaked TestSymbolDatabase test case for unknown type.
2017-04-02 15:38:06 +02:00
Daniel Marjamäki
d403a6a883
Preprocessor::getConfigs: Remove bad configurations when #error is seen
2017-04-02 12:15:53 +02:00
Daniel Marjamäki
7eb95aac2a
Preprocessor::getConfigs: Handle #error in '#if !A' better
2017-04-02 10:06:39 +02:00
Daniel Marjamäki
edd1c32e5b
Preprocessor::getConfigs: Better handling of ! in #if
2017-04-02 09:03:43 +02:00
Daniel Marjamäki
b7dcdc00d0
Fixed #7970 (ValueType: no types set below 'new std::string')
2017-04-01 22:22:37 +02:00
PKEuS
ea215c3b7b
Fixed false positives in CheckClass::checkConst() due to unmatched function overloads
...
Fixed function matching if constness mismatches
2017-04-01 10:19:32 +02:00
Daniel Marjamäki
164df2aa7b
Fixed #7966 (ValueType: wrong type for gcc initialization {[1]=..})
2017-03-31 09:41:38 +02:00
Daniel Marjamäki
8fe7ee1012
Fixed #7886 (ValueFlow: endless forloop 'for (i = 0, j = 0; i < sz && j < 9; i++)')
2017-03-30 22:02:36 +02:00
Daniel Marjamäki
2da3123db2
Fix ValueType. The '[' in variable declaration is not a dereference.
2017-03-30 11:01:29 +02:00
IOBYTE
7cae057615
Add missing varid or variable for member variables.
...
Add an optional extended description…
2017-03-30 10:07:58 +02:00
PKEuS
3c8f5b85ae
Refactorization: Allocate Token::_values (ValueFlow information) dynamically, reducing size of each token by around 10%
2017-03-27 18:48:34 +02:00
PKEuS
2938278f00
Refactorization: Store minsizes in vector instead of list which has less overhead
2017-03-27 17:53:43 +02:00
PKEuS
680828788b
Fixed false negative in CheckBufferOverrun::checkInsecureCmdLineArgs(), removed redundant tests
2017-03-27 11:30:07 +02:00
PKEuS
171e1b8244
Fixed false negatives in CheckBufferOverrun::arrayIndexThenCheck()
2017-03-27 11:07:49 +02:00
Robert Reif
3dba1b1739
Tests for git pull request #882 .
2017-03-25 15:46:25 -04:00
Robert Reif
c96e8daebc
Don't change varid of member variables.
2017-03-25 10:59:35 -04:00
PKEuS
f4c0ab5dd5
SymbolDatabase: Match function overloads by using ValueType information by running a second pass of the function pointer assignment routine.
2017-03-24 12:19:29 +01:00
Alexander Alekseev
abba762d42
New check: checking for copy ctor and eq operator co-existence
2017-03-24 12:00:20 +01:00
Robert Reif
bc87e874e9
Add variable and type information for auto and auto variables in range based for loops of containers.
2017-03-23 20:14:49 -04:00
Robert Reif
7adfb6e0e4
Add variable and type information to tokens for C array range based for loops.
2017-03-23 19:48:20 -04:00
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