IOBYTE
a90c56ad76
Fixed #8880 (Regression: syntax error for valid C++ template code) ( #1509 )
2018-12-06 21:47:48 +01:00
Daniel Marjamäki
01d0199ecf
Fix testrunner
2018-12-04 19:56:22 +01:00
Daniel Marjamäki
bd0a935d8a
Tokenizer: Improved handling of compiler extensions that use @ (see https://sourceforge.net/p/cppcheck/discussion/general/thread/8f618cb0a3 )
2018-12-04 19:33:39 +01:00
Daniel Marjamäki
88c61e8d1e
ValueFlow: Avoid FP when lambda is used
2018-12-04 18:54:26 +01:00
Daniel Marjamäki
f5a94ed300
ValueFlow: Fix FP when lambda is called
2018-12-04 18:46:00 +01:00
Daniel Marjamäki
7c47283e6d
Fix testrunner
2018-12-04 17:17:07 +01:00
Daniel Marjamäki
49413b7d4c
Tokenizer: Add simplifyAt to handle some nonstandard code with @
2018-12-04 16:52:41 +01:00
Igor
61878c5e11
Add null pointer check to fix SEGFAULT ( #1499 )
...
* Add null pointer check to fix segfault
* Add first test case to reproduce problem
2018-12-02 14:36:01 +01:00
Paul Fultz II
3e1b34dd8f
Fix FPs and crashes with byDerefCopy ( #1503 )
...
* Fix FP when inserting a range into a container
* Formatting
* Fix crash
2018-12-02 14:31:31 +01:00
Daniel Marjamäki
ba564076db
Fixed #7907 (FN: redundant assignment inside switchcase, overwritten by assignment outside of switch)
2018-12-02 14:04:59 +01:00
Daniel Marjamäki
8087cfed5d
Fixed #8627 (Tokenizer::setVarIdPass2: constructor parameter)
2018-12-02 09:28:05 +01:00
Daniel Marjamäki
ccbaad32f9
Fix merge conflicts
2018-12-01 19:14:43 +01:00
Paul Fultz II
b841b818d2
Fix 8872: Crash in LifetimeStore when there is no scope for variable
...
This fixes crash in:
```cpp
struct edit_line_paste_over {
void operator()(agi::Context *c) override {
paste_lines(c, true, [&](AssDialogue *new_line) -> AssDialogue * {
AssDialogue *ret = paste_over(c->parent, pasteOverOptions, new_line, static_cast<AssDialogue*>(&*pos));
return ret;
});
}
};
```
2018-12-01 19:11:26 +01:00
Paul Fultz II
67dd822910
Fix FP in lifetime anlaysis: Dont decay std array
...
This will fix FP with:
```cpp
std::array<char, 1> f() {
std::array<char, 1> x;
return x;
}
```
2018-12-01 19:09:19 +01:00
Paul Fultz II
229c45e7f8
Fix issue 8865: FP with dangling lifetime
...
This fixes:
```cpp
void f(uint32_t event, unsigned long op, const xen_ulong_t *args)
{
struct __packed {
uint32_t op;
uint32_t args[6];
} d;
uint32_t *a = d.args;
}
```
2018-12-01 19:07:46 +01:00
Daniel Marjamäki
2c803a1ead
Revert " #6514 Try to support hexadecimal floating numbers in MathLib::toDoubleNumber"
...
This reverts commit a73decf7e4
.
2018-12-01 19:01:51 +01:00
Daniel Marjamäki
501f99ac5a
Revert "astyle formatting"
...
This reverts commit 9289c9a283
.
2018-12-01 19:01:40 +01:00
Daniel Marjamäki
96929c53c0
Fixed #8873 (Add syntaxError when there is no RHS for +-)
2018-12-01 17:29:41 +01:00
Daniel Marjamäki
9289c9a283
astyle formatting
2018-12-01 13:17:16 +01:00
Daniel Marjamäki
f42648fe22
Fixed #8114 (false positive: Address of local auto-variable assigned to a function parameter.)
2018-12-01 10:11:02 +01:00
amai2012
a73decf7e4
#6514 Try to support hexadecimal floating numbers in MathLib::toDoubleNumber
2018-12-01 00:50:26 +01:00
Colomban Wendling
cad4e4ab20
Fix handling of `sizeof &var` ( #1498 )
...
Fixes https://trac.cppcheck.net/ticket/8870
2018-11-30 13:53:58 +01:00
IOBYTE
3d024f3f6d
template simplifier: fix function forward declaration bug for constructor with initializer list. ( #1497 )
2018-11-29 06:24:28 +01:00
Daniel Marjamäki
dd94bfede9
CheckStl: Improving checking of container access out of bounds
2018-11-28 19:27:28 +01:00
Daniel Marjamäki
6493db6ca2
Try to clarify message for container access out of bounds a little more.
2018-11-28 13:58:01 +01:00
Daniel Marjamäki
0f2f807798
Improve the container out of bounds messages. They are still not perfect.
2018-11-28 07:03:56 +01:00
Daniel Marjamäki
13c6489571
Redundant variable assignment: Fix FN for struct members
2018-11-27 18:22:22 +01:00
Paul Fultz II
5a6f9ac82a
Fix FP with strcmp and terminating conditions
2018-11-27 06:39:29 +01:00
IOBYTE
f2660ed203
template simplifier: fix instantiated template names in forward declarations ( #1495 )
...
This now handles the revised example code in #8603 .
2018-11-27 06:17:04 +01:00
Daniel Marjamäki
2887ee10c0
Fixed #8800 (Possible variable assignment ignored in boolean expression)
2018-11-26 14:00:03 +01:00
Daniel Marjamäki
affd03f1d6
Minor tweak for redundantVariableAssignment
2018-11-26 11:16:50 +01:00
IOBYTE
e20079a5d9
template simplifier: fix 3 function forward declaration bugs ( #1493 )
...
* fix support for multi token types
* fix support for const member functions
* fix duplicate template parameters sometimes being inserted
2018-11-26 06:23:12 +01:00
Daniel Marjamäki
86f9fb778b
Fixed #8864 (compile commands: handle define with string value)
2018-11-25 15:09:23 +01:00
Daniel Marjamäki
0160f80ffe
redundantVarAssignment: avoid FPs when loops are used
2018-11-25 10:32:30 +01:00
Daniel Marjamäki
22f736eae2
redundant variable assignments: avoid FPs for initializations
2018-11-25 08:49:09 +01:00
Daniel Marjamäki
2f66b31d43
redundantAssignmentInSwitch: fix false positive when there is goto
2018-11-24 21:39:01 +01:00
Daniel Marjamäki
b7ca9bdc8d
Travis: redundantCopy is not detected at the moment
2018-11-24 12:01:10 +01:00
Daniel Marjamäki
ec89c7b1b8
Travis: redundantCopy is not detected at the moment
2018-11-24 11:27:27 +01:00
Paul Fultz II
a3921ea861
Refactor valueFlowAfterCondition
...
So this unifies the `valueFlowAfterCondition` so it re-uses more code between checking for integers and container sizes. This should make valueFlowContainer more robust.
It also extends valueflow to support container comparisons such as `if (v.size() < 3)` or `if (v.size() > 3)` using the same mechanism that is used for integers.
2018-11-24 10:07:12 +01:00
Daniel Marjamäki
866688c70a
Rewriting redundantAssignment checker
2018-11-24 10:03:54 +01:00
IOBYTE
358f0c473d
Modify template simplifier to add forward declarations of some templa… ( #1489 )
...
* Modify template simplifier to add forward declarations of some template functions so symbol database can make sense of the expanded templates.
* Fix travis.
2018-11-23 11:36:09 +01:00
orbitcowboy
ef05be2600
wxwidgets.cfg: Fixed FP due to overlaoded function wxSizer::Add().
2018-11-23 09:49:08 +01:00
Daniel Marjamäki
c181d28b1a
astyle formatting
...
[ci skip]
2018-11-23 06:47:27 +01:00
orbitcowboy
428d0147bc
wxwidgets.cfg: Added support for wxSizer::Add().
2018-11-22 14:04:22 +01:00
orbitcowboy
d6c85118a7
wxwidgets.cfg: Improved support for some wxStaticText member functions.
2018-11-22 13:47:17 +01:00
orbitcowboy
2b9bdc52d7
wxwidgets.cfg: Added support for wxWindow::Close() and derived classes.
2018-11-22 13:31:09 +01:00
Paul Fultz II
f16d9d7d90
Issue 6175: Check lifetime of a variables stored in containers and member variables
...
Cppcheck will now warn for all cases here:
```cpp
#include <vector>
class CCluster {};
class MyClass
{ public:
std::vector<CCluster*> m_cluster;
void createCluster()
{
CCluster cl;
CCluster* pcl=&cl;
m_cluster.push_back(pcl);
}
void createCluster2()
{
CCluster cl;
m_cluster.push_back(&cl);
}
CCluster* Cluster()
{
CCluster cl;
CCluster* pcl=&cl;
return pcl;
}
CCluster* Cluster2()
{
CCluster cl;
return &cl;
}
};
```
2018-11-21 08:43:57 +01:00
Daniel Marjamäki
081bd7660e
Fix Travis
2018-11-21 08:39:21 +01:00
orbitcowboy
b4aa04db41
std.cfg: Added returnValue calculation for isless(), islessgreater() etc.
2018-11-20 16:58:33 +01:00
orbitcowboy
58b3d75b62
std.cfg: Added invalidFunctionArg cfg for strchr().
2018-11-20 08:32:54 +01:00