Daniel Marjamäki
175070ca50
Revert "Fixed #8938 (FP identicalInnerCondition)"
...
This reverts commit 0edf0b5628
.
This bailout seems to cause many false negatives
2019-06-22 21:57:19 +02:00
Daniel Marjamäki
de9c999d79
Better handling of spaces in paths
2019-06-22 19:20:15 +02:00
Daniel Marjamäki
7ceb51a952
Try to improve 'clarifyStatement' warning message
2019-06-22 08:44:41 +02:00
Daniel Marjamäki
16bed07c60
Clarify tests
2019-06-22 07:50:43 +02:00
Daniel Marjamäki
cf79830afd
Revert "Remove bailout. It hides lots of warnings for real code to avoid FP in unused templates."
...
This reverts commit 2a4be5ae1c
.
When I look at daca@home now there are still lots of false negatives. So this bailout did not cause as much false negatives as I thought.
2019-06-19 22:29:00 +02:00
Ken-Patrick
44d6066c6f
FP on assignment through pointer ( #1887 )
...
* Fix FP when assigning through pointers
* Add test case for false positive
cppcheck would faulty warn:
"Condition '*b>0' is always true"
2019-06-17 21:25:15 +02:00
IOBYTE
246576fceb
Fixed #9178 (Assertion `brackets1.empty() == false' failed on valid C++ code) ( #1905 )
...
This fixes a nasty intrinsics related bug causing instantiations that
shouldn't happen.
2019-06-17 21:18:27 +02:00
Rikard Falkeborn
b1c8d81bcc
Refactoring; Use range for loop ( #1900 )
2019-06-17 13:17:45 +02:00
Daniel Marjamäki
2a4be5ae1c
Remove bailout. It hides lots of warnings for real code to avoid FP in unused templates.
2019-06-16 19:01:45 +02:00
Rikard Falkeborn
d909ac8565
Bugfix buffer size for strdup like functions ( #1893 )
...
strdup() allocates the string length plus one for a terminating null
character. Add one to compensate for this.
Fixes false positive buffer out of bounds on code like this:
void f() {
const char *a = "abcd";
char * b = strdup(a);
printf("%c", b[4]); // prints the terminating null character
free(b);
}
Also, add a testcase for valueFlowDynamicBufferSize() and add tests for
strdup(), malloc() and calloc().
2019-06-16 16:02:27 +02:00
Ken-Patrick
66ebc187f6
Cleanup some const_cast of Token* ( #1886 )
...
* Add non const version of some methods of Token
The aim is to reduce the (ab)use of const_cast.
* Cleanup some more const_cast in valueflow
* Remove useless const_cast
* Remove some const_cast from templatesimplifier
* Remove some const_cast from valueflow
2019-06-16 10:09:38 +02:00
Daniel Marjamäki
6d982d4320
Testing: comment/naming
2019-06-15 13:01:34 +02:00
Rikard Falkeborn
b970606c93
Add regression test for #7798 ( #1847 )
...
Trac ticket #7798 was fixed in 3f1e2b4270
(More conservative fallback for function overload matching). Add a test
to avoid regressions.
2019-06-15 11:34:06 +02:00
Paul Fultz II
b466415bb4
Fix syntax error in issue 9155 ( #1885 )
2019-06-15 09:48:22 +02:00
IOBYTE
75720528b0
template simplifier: add 2 new template parameter simplifications ( #1884 )
...
* template simplifier: add 2 new template parameter simplifications
int{} -> 0
decltype(int{}) -> int
This fixes reduced test cases like #9153 . I'm not sure they will help
real world code that much.
It was necessary to increase the pass count to 4 to get #9153 completly
simplified.
* relax decltype(type{}) simplification to any type
2019-06-15 09:46:32 +02:00
IOBYTE
c0d8990e8b
Fix up a few more cases where templates ending in ">>" should be changed to end in "> >". ( #1883 )
2019-06-13 13:37:55 +02:00
IOBYTE
2a4b28c267
Fixed #9155 (Syntax error on valid C++ code) ( #1880 )
...
Refactored simplifyTemplateAliases to iterate over template type aliases
rather than instantiations. This fixed template type aliases that were
not templates.
Don't instantiate templates in template type aliases. They will get
instantiated once the type alias is instantiated. This required
increasing the template simplifier pass count to 3 so one of the
existing tests continued to work.
2019-06-12 07:44:48 +02:00
Paul Fultz II
b863c18e1d
Fix crash in issue 9007 ( #1878 )
2019-06-10 08:24:09 +02:00
Paul Fultz II
169510bd3a
Fix issue 9171: Endless recursion ( #1877 )
2019-06-10 08:22:48 +02:00
IOBYTE
5af8beecf6
template simplifier: specialized member class not recognized causing wrong instantiation ( #1876 )
...
Specialized member classes declared outsize the class were not
recognized. This caused the the member class to be instantiated rather
than the specialized class. We already had a test for this but it was
wrong so it went unnoticed.
2019-06-09 08:11:59 +02:00
Paul Fultz II
1f24aa778b
Fix issue 9156: Analysis failed because square brackets arent linked correctly ( #1871 )
2019-06-09 08:10:57 +02:00
IOBYTE
7a87786cbc
template simplifier: class or typename can't be a name ( #1875 )
...
* template simplifier: class or typename can't be a name
* struct can't be a name
2019-06-08 07:27:53 +02:00
IOBYTE
f02e45bf3d
fix syntax error for std::literals::complex_literals::operator""if ( #1870 )
2019-06-05 10:15:22 +02:00
IOBYTE
41cf865947
template simplifier: add links to expanded return type in function forward declaration ( #1868 )
...
This crash was seen in daca capnproto but I could only get creduce to
generate garbage code so the test is in checkgarbage.
2019-06-03 07:06:04 +02:00
Daniel Marjamäki
7ca35d181b
uninitStructMember: Fixed FP shown in daca@home
2019-06-02 20:19:53 +02:00
Daniel Marjamäki
7a3302b3e3
CheckLeakAutoVar: Fixed FP seen in daca@home
2019-06-02 15:25:54 +02:00
IOBYTE
ce9fdd181d
Add regression test for #9146 (Syntax error on valid C++ code) ( #1867 )
2019-06-02 10:23:47 +02:00
Paul Fultz II
676a241137
Add regression tests for syntax errors ( #1866 )
2019-06-02 10:23:27 +02:00
Paul Fultz II
8a1c0dd017
Fix FP with non-local variable referencing a non-local variable ( #1864 )
2019-06-02 10:21:26 +02:00
Paul Fultz II
6ae7be0f53
Fix FP with lifetime containers ( #1865 )
2019-06-02 10:14:48 +02:00
IOBYTE
bee248b2de
token simplifier: fix namespace, token link and syntax error support for template type aliases ( #1863 )
2019-06-01 10:52:29 +02:00
Daniel Marjamäki
5d10b57b04
Fixed #8997 (False positive redundantAssignment when pointer is updated with +=)
2019-05-31 12:24:31 +02:00
Paul Fultz II
f75c15af56
Fix issue 6821: New check: access heap/stack data using address of variable
...
This fixes errors with:
```cpp
int f() {
int i;
return (&i)[1];
}
```
It uses the lifetime analysis to detect the issues.
2019-05-31 12:24:31 +02:00
Paul Fultz II
108cdaa485
Fix FP with unreadVariable ( #1859 )
2019-05-31 08:06:36 +02:00
Paul Fultz II
33130bdff6
Fix issue 9145: Syntax error on valid C++14 code ( #1860 )
2019-05-31 08:05:01 +02:00
Daniel Marjamäki
66a61fe5e8
SymbolDatabase: Improved findFunction
2019-05-30 20:26:45 +02:00
Daniel Marjamäki
36b6fb9f4d
Fixed #8558 (False portability positive caused by incorrect method resolution)
2019-05-30 19:24:51 +02:00
Daniel Marjamäki
4da50942b0
Fixed #8120 (False positive: Memory pointed to by 'p' is freed twice)
2019-05-30 16:22:41 +02:00
orbitcowboy
55df395a4e
Running astyle [ci skip]
2019-05-30 14:41:14 +02:00
Ken-Patrick
3cdc236e10
Fix false positive with several ! (not) operators ( #1856 )
...
With the following code
int f(int x, int y) {
if (!!(x != 0)) {
return y/x;
}
cppcheck would wrongly warn that there might be a division by zero in
"return y/x;".
2019-05-29 09:45:15 +02:00
IOBYTE
1e7f5010eb
template simplifier: fix expansion of template arguments in default parameter instantiation ( #1857 )
2019-05-28 21:32:37 +02:00
IOBYTE
e8692b012f
template simplifier: partial fix for instantiation of templates with type trait parameters ( #1855 )
2019-05-27 20:51:52 +02:00
Paul Fultz II
312fdf157b
Fix issue 9144: Syntax error with type intrinsics ( #1852 )
...
* Fix issue 9144: Syntax error with type intrinsics
* Only run when using cpp
2019-05-27 06:54:21 +02:00
Paul Fultz II
61935802d1
Fix issue 9141: Syntax error ( #1853 )
2019-05-27 06:50:43 +02:00
orbitcowboy
02d307a231
posix.cfg: Added partial support for scandir() and a TODO comment.
2019-05-25 23:32:28 +02:00
orbitcowboy
4d223a70dc
MathLib: Added robustness tests for 'MathLib::divide()'.
2019-05-25 23:06:50 +02:00
Paul Fultz II
cb7f925f5e
Fix issue 9109: Syntax error for valid C++ code
2019-05-24 10:44:08 +02:00
IOBYTE
5efb23ffff
template simplifier: fix instantiation of variadic template with no arguments ( #1848 )
...
* template simplifier: fix instantiation of variadic template with no arguments
* fix white space change
* add support for <class...>
* add variadic template flag
2019-05-23 20:53:26 +02:00
Daniel Marjamäki
cd05f4eefc
test/cli/test-helloworld: Fix misra warning 17.7
2019-05-23 14:31:55 +02:00
Daniel Marjamäki
de4a33167d
astyle formatting
...
[ci skip]
2019-05-21 10:43:33 +02:00