Daniel Marjamäki
fda0f52424
Add --remove-unused-templates flag to remove all unused templates
2019-03-05 14:58:02 +01:00
IOBYTE
5ee6c2138c
Fixed #9016 (tokenizer: wrong simplification for operator ^ (){}) ( #1724 )
2019-03-05 11:35:45 +01:00
Sebastian
0934577dda
Library configuration: function argument direction fixes and enhancements ( #1722 )
...
* std.cfg: Add further argument directions (in, out, inout).
* testlibrary.cpp: Add test for function argument direction configuration.
* std.cfg: runastyle and add some more direction configurations.
* library.h: Add documentation for function argument direction enum.
* Do not use "direction" library information for pointer arguments.
Also fix further unmatched uninitvar messages in std configuration
tests.
* std.cfg: Add more argument direction configurations.
* test/cfg/std.c: Add test for argument direction configuration.
* astutils.cpp: Only ignore pointer arguments for out/inout arguments.
* library.h: Use suggested documentation for argument direction enum.
2019-03-04 22:57:40 +01:00
Daniel Marjamäki
3675318208
Added --remove-unused-included-templates option
2019-03-04 19:10:49 +01:00
Daniel Marjamäki
c5a512338e
--check-headers=no: remove more templates in headers that are not used in the source file
2019-03-03 20:18:54 +01:00
IOBYTE
40d7d5a3d0
template simplifier: fix return type of out of line member function when it is a template parameter ( #1723 )
2019-03-03 19:42:46 +01:00
Daniel Marjamäki
41db8afe87
--check-headers=no: remove templates in headers that are not used in the source file
2019-03-03 12:56:37 +01:00
Daniel Marjamäki
eb109af00f
Replace Token::simpleMatch with Token::Match for complex pattern
2019-03-03 12:40:55 +01:00
Daniel Marjamäki
59ec5f961f
--check-headers=no: remove types in headers that are not used in the source file
2019-03-03 12:36:33 +01:00
Daniel Marjamäki
411a3f09f7
--check-headers=no: Remove unused function declarations
2019-03-03 09:18:12 +01:00
IOBYTE
b222953bae
template simplifier: only constant fold template instantiation arguments ( #1721 )
...
* template simplifier: only constant fold template instantiation arguments
* Fix travis build.
2019-03-03 07:40:55 +01:00
Daniel Marjamäki
f5c274b3b1
Added '--check-headers=no' option.
2019-03-02 19:52:15 +01:00
Daniel Marjamäki
8a3b73ffdb
Do not write extra uninitvar warnings
2019-03-02 13:17:15 +01:00
Sebastian
9a5fcddb5d
Library configuration: Enable configuring the direction of arguments. ( #1717 )
...
This enhances the library configuration so the direction of function
arguments can be specified (in, out, inout).
isVariableChangedByFunctionCall() uses this information now to avoid
guessing.
2019-03-01 15:47:08 +01:00
Daniel Marjamäki
845c407ab7
Fixed pattern matching in isVariableChanged() to handle normal token list better
2019-03-01 13:23:03 +01:00
IOBYTE
b78b3c6ab1
Fixed #9005 (Syntax error on valid C++) ( #1716 )
2019-03-01 08:18:53 +01:00
PKEuS
8af3708aa3
Optimization: Library does not need to store "#define " substring for each define
2019-02-28 22:34:26 +01:00
Daniel Marjamäki
5563fef7bb
Fixed #9008 (new crash in clang test suite)
2019-02-28 20:34:07 +01:00
Daniel Marjamäki
4f5a426fe5
Improved isVariableChangedByFunctionCall, better logic when parameter might be passed by reference
2019-02-28 17:02:46 +01:00
Daniel Marjamäki
494dd2ba3a
Revert "Improved isVariableChangedByFunctionCall, better logic when parameter might be passed by reference"
...
This reverts commit 14a0031e88
.
2019-02-28 15:56:25 +01:00
Daniel Marjamäki
14a0031e88
Improved isVariableChangedByFunctionCall, better logic when parameter might be passed by reference
2019-02-28 10:26:47 +01:00
Daniel Marjamäki
857681a049
Make quick fix for uninitialized variable false positive. Will look more at this soon.
2019-02-28 09:52:52 +01:00
IOBYTE
98bf112352
template simplifier: fix recursive variable templates ( #1711 )
2019-02-28 08:30:04 +01:00
Sebastian
c8a7a4c653
library.cpp: WarnInfo: Fix crash ( #1697 )
...
If no 'alternatives' argument was specified and the `<warn/>` element
did not contain any text Cppcheck crashed because of a null pointer
access.
If there is no 'reason' and no 'alternatives argument and also no text loadFunction() returns with an error.
2019-02-28 06:19:42 +01:00
PKEuS
11daabc1a8
Set version to 1.87.99/1.88 dev
2019-02-27 21:30:54 +01:00
Daniel Marjamäki
e27a7a585f
Fix uninitvar false positive when taking address of variable
2019-02-27 18:44:30 +01:00
Daniel Marjamäki
80143725dd
Fixed #8999 (False positive uninitvar related to casting)
2019-02-27 17:58:25 +01:00
Daniel Marjamäki
226f0c7544
Fixed ValueType for auto variable
2019-02-27 10:28:18 +01:00
Paul Fultz II
032020c40d
Fix issue 9001: FP: Found suspicious operator ',' [constStatement]
2019-02-27 07:09:22 +01:00
Paul Fultz II
e846312fed
Check subtraction of pointers to different objects
2019-02-27 06:55:48 +01:00
rikardfalkeborn
0e988cc755
Fix #8992 : Add originalTypeToken to auto ( #1701 )
2019-02-27 06:44:31 +01:00
rikardfalkeborn
c9efc26578
valueflow: Mark getLifetimeToken() static ( #1703 )
...
Fixes a compiler warning about missing declaration.
2019-02-26 23:35:11 +01:00
Daniel Marjamäki
c44e2ed378
sizeof: write inconclusive warning if calculation in sizeof is done indirectly by macro
2019-02-26 21:06:44 +01:00
Daniel Marjamäki
9e93e89a4d
UninitVar: Fix false positives when there is possible cast
2019-02-26 19:26:46 +01:00
IOBYTE
bf85767829
template simplifier: make sure all instantiations are found and expan… ( #1696 )
...
* template simplifier: make sure all instantiations are found and expanded in #5097
* template simplifier: check output on another test
* template simplifier: add output to another test
2019-02-26 06:41:04 +01:00
IOBYTE
3f257d6310
template simplifier: instantiate template class when something inside… ( #1695 )
...
* template simplifier: instantiate template class when something inside class instantiated.
* template simplifier: add output to another test that now works
2019-02-25 21:01:34 +01:00
Daniel Marjamäki
ef6fc67da4
Move CheckString::checkAlwaysTrueOrFalseStringCompare() from runSimplifiedChecks() to runChecks()
2019-02-25 18:11:33 +01:00
Daniel Marjamäki
f1146e398a
Moved CheckString::sprintfOverlappingData from runSimplifiedChecks to runChecks
2019-02-25 09:23:03 +01:00
Daniel Marjamäki
4218698fb1
Moved CheckString::checkIncorrectStringCompare from runSimplifiedChecks to runChecks
2019-02-25 09:08:16 +01:00
Daniel Marjamäki
d84d8885f7
SymbolDatabase: Fix TODO assertions
2019-02-24 19:11:18 +01:00
Daniel Marjamäki
ef731064bd
Fixed #8964 (ValueType: auto constness)
2019-02-24 08:16:08 +01:00
Daniel Marjamäki
c855cf8682
ValueType: Better constness for auto variable
2019-02-23 18:16:18 +01:00
Daniel Marjamäki
b43572d75e
Fixed #8969 (C++ functional cast not handled correctly)
2019-02-23 17:29:53 +01:00
Daniel Marjamäki
68062e3702
Fixed #8954 (false positive: Local variable x shadows outer variable)
2019-02-23 16:22:22 +01:00
Paul Fultz II
fd3c1fd040
Fix issue 1777: Undefined Behavior: Comparing pointers to different objects
...
This uses the lifetime analysis to check when comparing pointer that point to different objects:
```cpp
int main(void)
{
int foo[10];
int bar[10];
int diff;
if(foo > bar) // Undefined Behavior
{
diff = 1;
}
return 0;
}
```
2019-02-23 08:32:08 +01:00
ivangalkin
1b703ce58e
7772 Add uninitMemberVarPrivate to errorlist (really) #1557 ( #1686 )
...
Previous attempt 70527a78f7
doesn't work because equal error messages are filtered.
2019-02-23 08:07:46 +01:00
Paul Fultz II
941dd79f0d
Fix FP issue 8986: constArgument check warns for elements of const array ( #1683 )
2019-02-22 06:39:59 +01:00
Paul Fultz II
507c7a4388
Improvement to lifetime tracking of addressof and derefencing
...
This will now warn for cases like this:
```cpp
auto& f() {
std::vector<int> x;
return x[0];
}
```
It also improves the handling of address of operator, so it can now warn across some function calls, like this:
```cpp
int& f(int& a) {
return a;
}
int* hello() {
int x = 0;
return &f(x);
}
```
2019-02-22 06:38:56 +01:00
Paul Fultz II
715714f4de
Forward lifetimes in "for" loops ( #1682 )
...
* Forward lifetimes in for loops
* Format
2019-02-22 06:37:02 +01:00
Paul Fultz II
0ee3f678b5
Fix issue 8987: False positive knownConditionTrueFalse ( #1678 )
2019-02-20 15:28:31 +01:00