IOBYTE
ec8bc785a2
template simplifier: add support for using namespace when instantiating templates ( #1615 )
2019-01-23 08:53:01 +01:00
Paul Fultz II
3975913637
Extend lifetime checking for references
...
This will use the lifetime checker for dangling references. It will find these cases for indirectly assigned reference:
```cpp
int &foo()
{
int s = 0;
int& x = s;
return x;
}
```
This will also fix issue 510 as well:
```cpp
int &f( int k )
{
static int &r = k;
return r;
}
```
2019-01-23 07:29:16 +01:00
Daniel Marjamäki
8c07be136a
Fixed #8949 (False Positive: Variable 'f' is assigned a value that is never used.)
2019-01-22 21:16:27 +01:00
Daniel Marjamäki
149d688e9a
Fix return value from ErrorLogger::reportUnmatchedSuppressions
2019-01-22 06:45:22 +01:00
Daniel Marjamäki
4119cfd3d1
Correct exit code when there are no unmatched suppressions
2019-01-21 20:33:22 +01:00
Paul Fultz II
4b37f276c2
ValueFlow: Set arrays to true when converting to a boolean
...
This sets it by checking the parent. It doesn't handle function parameters yet.
2019-01-21 20:05:35 +01:00
Daniel Marjamäki
91435310cb
Fixed #8925 (compile_commands.json: False positives in .mm (Objective-C++) files, that file type should maybe just be ignored)
2019-01-21 06:36:31 +01:00
Daniel Marjamäki
a26287f491
Fix Token::findExpressionStartEndTokens() regression
2019-01-20 13:23:19 +01:00
Daniel Marjamäki
8da4e31c42
Fixed #8941 (False Positive: Variable 'f' is assigned a value that is never used.)
2019-01-20 13:20:23 +01:00
IOBYTE
1acbdde302
Fixed #7417 ("syntax error" in valid code containing explicitly specialised variable template) ( #1604 )
2019-01-18 21:12:39 +01:00
Sebastian
4b1544d33b
library.cpp: Let tinyxml2 print a helpful error message when XML is bad ( #1609 )
...
In case the XML code of a library configuration is invalid Cppcheck now additionally prints out some helpful error description like this:
"Error=XML_ERROR_MISMATCHED_ELEMENT ErrorID=16 (0x10) Line number=304: XMLElement name=noreturn"
2019-01-18 17:10:41 +01:00
Lauri Nurmi
3bbd9fc9a4
Replace "virtual method" with "virtual function" in messages.
...
The term "method" is not really a part of C++ terminology.
2019-01-15 06:22:14 +01:00
Lauri Nurmi
f267900257
Fix spelling of "overridden" in function names.
...
One 'd' was missing.
2019-01-15 06:22:14 +01:00
Robert Reif
6ef8dad459
template simplifier: improve namespace matching
...
* out of line member functions are a namespace
* template<...> and *_cast<> can't be instantiations
* refactor code to use less function parameters
* fix instantiation scopes
* use full name with namespace when available
* fallback to just matching names when full name doesn't match
2019-01-14 21:32:58 +01:00
IOBYTE
f0cfe03f7b
template simplifier: add cli --debug-template option to print the parsed template information ( #1598 )
2019-01-14 08:29:32 +01:00
Daniel Marjamäki
51afcb2f64
Fix Cppcheck missingOverride warnings
2019-01-13 13:22:36 +01:00
Daniel Marjamäki
0c08503b00
Travis: Enable missingOverride checker
2019-01-13 12:21:01 +01:00
Daniel Marjamäki
5f198662ff
rephraze internal warning
2019-01-13 12:12:07 +01:00
Daniel Marjamäki
c75a2265c0
Fix inline suppression.
2019-01-13 12:10:26 +01:00
Daniel Marjamäki
43035ff186
Remove inline suppression. The Cppcheck warning was a true positive.
2019-01-13 08:42:48 +01:00
Daniel Marjamäki
d50c3de740
Remove inline suppression and fix false positive.
2019-01-13 07:59:41 +01:00
Daniel Marjamäki
e6edd74099
Temporarily suppress Cppcheck false positives
2019-01-12 19:11:44 +01:00
Daniel Marjamäki
d40314b825
Replace Token::Match with Token::simpleMatch for simple patterns
...
[ci skip]
2019-01-12 18:44:48 +01:00
Daniel Marjamäki
2b1b8f8fe9
Fix Cppcheck warnings
...
[ci skip]
2019-01-12 18:29:08 +01:00
Daniel Marjamäki
1cd16cf94f
Suppressions: Handle comment in file that starts with #
2019-01-12 15:21:47 +01:00
Daniel Marjamäki
8b5f36670a
Introduce macro OVERRIDE for gcc-4.6 compatibility.
2019-01-12 07:37:42 +01:00
Daniel Marjamäki
c6b48b67f9
astyle formatting
...
[ci skip]
2019-01-11 16:37:12 +01:00
juremenart
45def06d59
fix trailing / from CMAKE JSON file and update unittests to cover both (w and w/o cases) ( #1592 )
...
* fix for CMake compile_commands.json input - director does not include trailing / which makes include directories wrong - so add it if it doesnt exist
* fix the bugfix for trailing / in the directory name of CMAKE JSON file, add also new test case to see if it works in both cases (with and without trailing /)
* revert adding accidental new line
2019-01-11 16:36:55 +01:00
versat
991191450a
astyle formatting
...
[ci skip]
2019-01-11 12:56:31 +01:00
Paul Fultz II
921f6e4313
Fix issue 8883: False positive: returnDanglingLifetime with local struct or class ( #1585 )
2019-01-11 09:51:02 +01:00
Paul Fultz II
5fa956a597
Fix issue 8932: False positive knownConditionTrueFalse - valueflow ignores operator < ( #1584 )
2019-01-11 08:39:23 +01:00
Daniel Marjamäki
8509159d1a
Uninitialized Member variable: Fixed FP when delegate constructor is used
2019-01-10 20:13:37 +01:00
rikardfalkeborn
a48c8abcda
Fix 8124: False positive va_end missing with lambda ( #1577 )
...
Skip lambdas, to avoid false positives due to possible
return statements in lambdas.
Also, run dmake.
2019-01-10 18:32:17 +01:00
Paul Fultz II
4e147a4c59
Add a check for duplicate if statements
...
This will warn for this:
```cpp
int f(int val)
{
int i = 0;
if( val & 0xff)
i = 1;
if( val & 0xff)
i = 1;
return i;
}
```
2019-01-09 20:41:01 +01:00
Daniel Marjamäki
35e56942d1
Fixed #8116 ([False positive] Invalid memory leak detection when using reference.)
2019-01-09 20:38:32 +01:00
Daniel Marjamäki
75e367c48b
Fixed #8340 (incorrect memleak errors)
2019-01-09 19:50:41 +01:00
ivangalkin
5ddc6c64d7
CheckStl: add missing error ID iterators2 ( #1576 )
...
due to equal arguments...
* iterators1 (`CheckStl::iteratorsError(const Token*, const std::string&, const std::string&)`) and
* iterators2 (`CheckStl::iteratorsError(const Token*, const Token*, const std::string&, const std::string&)`)
... produced equal messages. Equal messages were filtered-out `CppCheck::reportErr(const ErrorLogger::ErrorMessage&)`.
So the error iterators2 disapeared from the error list.
2019-01-09 06:45:38 +01:00
Daniel Marjamäki
0f9ce5edd5
Fixed #8365 (False positive on memory leak when assigned inside if statement)
2019-01-08 20:54:39 +01:00
Daniel Marjamäki
e4525d56a0
Fixed #8111 (performance warning - member variable at constructor)
2019-01-07 21:26:58 +01:00
IOBYTE
07da4b4d37
template simplifier: Add flag variable to cache information about dec… ( #1569 )
...
* template simplifier: Add flag variable to cache information about declarations.
Also fix some cppcheck warnings.
* Make variable const.
2019-01-07 06:55:22 +01:00
practicalswift
0a1b3a9d6f
Fix typos ( #1568 )
2019-01-06 17:15:57 +01:00
Daniel Marjamäki
5636497c0b
Fixed #8863 (false positive: (warning) Accessing an item in container 's'. Either the condition 's.empty()' is redundant or 's' can be empty.)
2019-01-06 12:21:55 +01:00
Daniel Marjamäki
ea0232653f
Fixed #8563 (CPPCheck not able to locate file through compilation database)
2019-01-05 23:11:43 +01:00
IOBYTE
817c748e4d
Fixed #5953 (debug: varid0: Function::addArguments) ( #1567 )
2019-01-05 19:42:04 +01:00
Daniel Marjamäki
36ffa91825
Replace std::set::emplace with std::set::insert to make Cppcheck compilable in Slackware 14.0
2019-01-05 18:18:15 +01:00
Daniel Marjamäki
5f5c33baf2
Json: Use simple json library picojson to read compile databases
2019-01-05 17:45:07 +01:00
Daniel Marjamäki
615903c6be
Improve syntax errors for unmatched (){}[]
2019-01-05 11:56:21 +01:00
IOBYTE
32a5d66e5b
Fixed #8927 (SIGSEGV below TemplateSimplifier::expandTemplate) ( #1564 )
2019-01-05 11:14:09 +01:00
Paul Fultz II
bba6dfb8b2
Fix issue 4744: ValueFlow: known integer result
...
This fixes valueflow to have a value for `||` operator here:
```cpp
bool f()
{
bool a = (4 == 3); // <-- 0
bool b = (3 == 3); // <-- 1
return a || b; // <-- 1
}
```
2019-01-03 07:05:31 +01:00
Daniel Marjamäki
2b63997c2c
Fixed #8928 (false positive: (style) Variable 'x' is assigned a value that is never used.)
2019-01-02 20:23:02 +01:00