IOBYTE
fd403bf7e6
template simplifier: only add recursive instantiation if its arguments are a constant expression ( #2138 )
2019-09-02 06:51:19 +02:00
Ken-Patrick Lehrmann
7a75aa084b
Fix crash in CheckUninitVar ( #2129 )
...
http://cppcheck.osuosl.org:8000/ycmd
```
2019-08-30 23:21
ftp://ftp.se.debian.org/debian/pool/main/y/ycmd/ycmd_0+20181101+git600f54d.orig.tar.gz
cppcheck-options: -j1 --library=posix --library=gnu --library=qt --library=python --library=googletest --library=boost -D__GNUC__ --check-library --inconclusive --enable=style,information --platform=unix64 --template=daca2 -rp=temp temp
platform: Linux-4.15.0-58-generic-x86_64-with-Ubuntu-18.04-bionic
python: 2.7.15+
client-version: 1.1.31
cppcheck: head 1.88
count: Crash! 83
elapsed-time: -11.0 61.2
head results:
Checking temp/ycmd-0+20181101+git600f54d/ycmd/tests/clang/testdata/completion_fixit.cc: __GNUC__=1...
Program received signal SIGSEGV, Segmentation fault.
CheckUninitVar::valueFlowUninit (this=this@entry=0x7fffffffb350) at build/checkuninitvar.cpp:2376
2376 if (!tok->variable())
#0 CheckUninitVar::valueFlowUninit (this=this@entry=0x7fffffffb350) at build/checkuninitvar.cpp:2376
#1 0x00005555556901ac in CheckUninitVar::runChecks (this=<optimized out>, tokenizer=0x7fffffffbcb0, settings=0x7fffffffcd10, errorLogger=<optimized out>) at lib/checkuninitvar.h:68
#2 0x00005555556a2210 in CppCheck::checkNormalTokens (this=this@entry=0x7fffffffcaf0, tokenizer=...) at build/cppcheck.cpp:730
#3 0x00005555556a6ee2 in CppCheck::checkFile (this=this@entry=0x7fffffffcaf0, filename="temp/ycmd-0+20181101+git600f54d/ycmd/tests/clang/testdata/completion_fixit.cc", cfgname="", fileStream=...) at build/cppcheck.cpp:540
#4 0x00005555556aad4c in CppCheck::check (this=this@entry=0x7fffffffcaf0, path="temp/ycmd-0+20181101+git600f54d/ycmd/tests/clang/testdata/completion_fixit.cc") at build/cppcheck.cpp:195
#5 0x00005555557ef167 in CppCheckExecutor::check_internal (this=this@entry=0x7fffffffd880, cppcheck=..., argv=argv@entry=0x7fffffffdc08) at cli/cppcheckexecutor.cpp:884
#6 0x00005555557efa9a in CppCheckExecutor::check (this=0x7fffffffd880, argc=17, argv=0x7fffffffdc08) at cli/cppcheckexecutor.cpp:198
#7 0x00005555555b1d1b in main (argc=17, argv=0x7fffffffdc08) at cli/main.cpp:95
```
2019-09-01 14:51:40 +02:00
Ken-Patrick
2c656d6586
Issue 9255: Prevent infinite recursion in parsedecl ( #2134 )
2019-09-01 11:36:02 +02:00
Paul Fultz II
9ef64eb33e
Add regression test for issue 9264: FP nullPointerRedundantCheck - pointer alias ( #2133 )
2019-09-01 09:58:53 +02:00
IOBYTE
3a1aec8850
template simplifier: ignore friend templates ( #2122 )
...
* template simplifier: ignore friend templates
friend templates were interpreted as variable templates
* fix cppcheck warning
2019-09-01 09:56:33 +02:00
Ken-Patrick
d1c6cb9aa5
Fix issue 9304: boolean type of ternary ( #2131 )
...
* Add test cases for 9304
* Fix 9304
2019-09-01 09:51:53 +02:00
Paul Fultz II
121093658d
Fix issue 9202: False positive: std::array, size is a constant ( #2132 )
2019-09-01 09:44:34 +02:00
Ken-Patrick
717aa826d8
Fix false positive in initializationListUsage ( #2128 )
...
https://sourceforge.net/p/cppcheck/discussion/general/thread/d5b690ef19/
Check that we warn only about using the initializer list when we assign
the object being constructed.
2019-08-31 12:27:07 +02:00
Paul Fultz II
e8435b9ecb
Fix issue 9306: Adjust shiftTooManyBitsSigned for C++14 ( #2127 )
2019-08-31 07:40:57 +02:00
Paul Fultz II
0b9e823fc8
Fix issue 9305: False positive uninitvar - struct initialized via function ( #2123 )
2019-08-30 18:32:45 +02:00
Paul Fultz II
2942be53f7
Add more tests for valueFlowUninit ( #2124 )
2019-08-30 08:41:17 +02:00
Sebastian
a501f65c8c
libcurl.cfg: Add library configuration for libcurl ( #2120 )
...
Add curl_easy_*() functions and deprecated functions with warnings.
Add tests and prepare donate-cpu.py
Reference: https://curl.haxx.se/libcurl/c/
2019-08-29 15:11:59 +02:00
Sebastian
8782a5f5e4
lua.cfg: Add Lua C API library configuration with tests ( #2119 )
2019-08-29 11:38:21 +02:00
Paul Fultz II
03fe6795bf
Fix issue 9302: FP uninitvar - struct accessed via pointer ( #2121 )
2019-08-29 08:38:50 +02:00
orbitcowboy
1994cbbb9c
std.cfg: Improved configuration for mbrlen() and extended test cases.
2019-08-27 08:18:19 +02:00
IOBYTE
28a95802a2
template simplifier: fix syntax error false positive (an expression can't be a template) ( #2115 )
...
https://stackoverflow.com/questions/57590411/cppcheck-syntax-error-with-using-typedef
2019-08-27 06:37:58 +02:00
amai2012
1538248922
Fix syntax in test code example
2019-08-26 20:45:14 +02:00
orbitcowboy
c8b7b40cd7
wxwidgets.cfg: Improved support for wxString member functions.
2019-08-25 15:54:50 +02:00
Daniel Marjamäki
4bd9d76a4c
Try to make Travis happy
2019-08-25 10:24:13 +02:00
Daniel Marjamäki
82eec11898
Created redundantInitialization id
2019-08-25 09:45:39 +02:00
Daniel Marjamäki
324e5e581b
Redundant assignments: Fix false positive when reassignment expression contains assembler
2019-08-24 20:15:52 +02:00
Daniel Marjamäki
996daaee4e
STL: Fixed outOfBounds false positive
2019-08-24 15:40:29 +02:00
Daniel Marjamäki
9d26be8380
Fixed #5259 (Improve check: Uninitialized variable not reported when used in array initialization)
2019-08-24 14:43:35 +02:00
Paul Fultz II
5c488b9519
Fix issue 9190: FP uninitvar for struct member ( #2112 )
...
* Fix issue 9190: FP uninitvar for struct member
* Add more test cases
* Fix false negative
2019-08-24 11:27:47 +02:00
Sebastian
f25dcd5cda
python.cfg: Add Py_CLEAR(), and add initial test file ( #2110 )
2019-08-24 10:17:23 +02:00
Daniel Marjamäki
35fb55d76c
Fixed #5259 (Improve check: Uninitialized variable not reported when used in array initialization)
2019-08-24 08:01:55 +02:00
Sebastian
7f50642090
wxwidgets.cfg: Add container configuration for wxString ( #2109 )
2019-08-23 19:10:49 +02:00
versat
50c6af5e5d
astyle formatting
...
[ci skip]
2019-08-23 10:19:29 +02:00
Daniel Marjamäki
7061cc334b
RedundantAssignment: Don't warn for initialization with {0}
2019-08-23 08:51:16 +02:00
Thomas Niederberger
d122b1c722
Fix issue with __declspec and final ( #2107 )
...
* Add missing Qt macros
Add two Qt macros that were missing
* Fix issue with __declspec and final
This change is a bit naive but it fixes the issues I was having when combining __declspec(dllexport) and final classes. Without the fix I get errors along the line of "The code 'class x final :' is not handled. You can use -I or --include to add handling of this code. "
2019-08-23 06:43:02 +02:00
Rikard Falkeborn
fd3cb24973
leakNoReturnVar: Don't break early ( #2095 )
...
There seems to be no reason for stopping checking the scope if a call to
free() is seen (or fclose() or realloc()), so just continue checking.
Also, if there are multiple arguments, check all, perhaps there are more
memory leaks to warn about.
2019-08-23 06:33:00 +02:00
Paul Fultz II
c0a8d628b9
Fix issue 6010: Uninitialized inner struct ( #2098 )
...
* Fix issue 6010: Uninitialized inner struct
* Show to root variable that is unitialized
* Warn on pointer dereferences
2019-08-23 06:23:20 +02:00
Rikard Falkeborn
5b5d943976
Remove testfiles.pri ( #2106 )
...
qmake is not used to build tests. The only user of testfiles.pri was
removed in 392cda8bce
in december 2015.
2019-08-21 06:51:08 +02:00
Sebastian
2c673bd380
qt.cfg: Add container configuration for QStack (inherits from QVector) ( #2102 )
2019-08-20 20:37:52 +02:00
IOBYTE
4b231c53a4
Fixed #9287 and #9288 (Syntax error on valid C++ code) ( #2104 )
2019-08-20 20:25:18 +02:00
Sebastian
a2a874dbd5
gtk.cfg: Add/enhance function configurations and tests. ( #2101 )
...
Add/enhance:
g_once_init_enter(), g_once_init_leave() and g_signal_emit_by_name()
2019-08-20 15:00:30 +02:00
Daniel Marjamäki
ef47d3d304
Fixed #9286 (FP: syntax error: { .abc.a = 1)
2019-08-20 13:56:38 +02:00
Sebastian
26dfee58f8
qt.cfg: Add QLinkedList container configuration and some tests. ( #2099 )
2019-08-20 07:09:43 +02:00
Paul Fultz II
1f747d0b14
Add regression test for 9281 ( #2097 )
2019-08-19 09:09:07 +02:00
Daniel Marjamäki
a5ba82c2d3
Fixed #9260 (--template=gcc does not work correctly with -j)
2019-08-18 16:33:32 +02:00
Daniel Marjamäki
d95f29b23a
Fixed test/cli
2019-08-18 12:51:32 +02:00
Daniel Marjamäki
2d9a131817
Refactoring: Rename variables. Do not use leading _. Renamed 'col' to 'column'
2019-08-18 12:19:05 +02:00
Daniel Marjamäki
5f2379f3d1
astyle formatting
...
[ci skip]
2019-08-18 09:07:57 +02:00
Daniel Marjamäki
de9b928d98
ErrorLogger: add 'column' in serializer/deserializer
2019-08-18 09:06:40 +02:00
Daniel Marjamäki
016647d1d5
Fix testrunner
2019-08-18 09:02:13 +02:00
Daniel Marjamäki
2471266f12
test/cli: test unmatchedSuppression handling separately
2019-08-17 17:51:48 +02:00
Daniel Marjamäki
1fdae247b3
test/cli: ensure that there is unmatchedSuppression warning
2019-08-17 17:49:22 +02:00
Daniel Marjamäki
530a1a1c68
Remove test/cfg/unmatchedSuppressionTest.c: This testing belongs better in test/cli.
2019-08-17 17:18:44 +02:00
Daniel Marjamäki
eaf7224f6a
testrunner: Fix assertion error
2019-08-17 15:12:49 +02:00
Daniel Marjamäki
a17f2a6f05
Compiling/Installing : The CFGDIR parameter was removed. Use FILESDIR instead.
2019-08-17 10:53:07 +02:00
IOBYTE
04bb6c0d1f
template simplifier: fix new daca crashes ( #2093 )
2019-08-17 07:38:07 +02:00
Paul Fultz II
ee7fe3aaa1
Fix FP: Unitialized variable when using a pointer
...
This fixes the FP in cases like this:
```cpp
void f() {
bool b;
bool * x = &b;
if (x != nullptr)
x = 1;
}
```
It tracks the indirection of the uninit value in valueflow.
2019-08-17 07:36:41 +02:00
Paul Fultz II
3e0d1141d3
Fix issue 9277: FP: Dont warn for knwon conditions in if constexpr ( #2085 )
2019-08-16 07:56:39 +02:00
Paul Fultz II
3aef0c9bd3
Fix issue 8715: regression uninitvar not detected ( #2092 )
2019-08-16 07:48:54 +02:00
Paul Fultz II
ef714225bb
Use library to track container lifetimes
2019-08-15 21:14:54 +02:00
Sebastian
544bedc6ee
qt.cfg: Add QByteArray container configuration (similar to QString) ( #2088 )
...
Reference: https://doc.qt.io/qt-5/qbytearray.html
2019-08-15 16:14:17 +02:00
Paul Fultz II
af214e8212
Fix issue 8825: ValueFlow: uninitialized struct member ( #2087 )
...
* Pass uninit value across pointers
* Add more testing
2019-08-15 10:44:55 +02:00
Sebastian
81edb23c16
qt.cfg: Fix and enhance Qt container configuration ( #2055 )
...
-Add iterator end patterns
-Add/fix size and access functions
-Remove marking QList and QStringList as std-like strings
-QStringList configuration now inherits from QList like it is actually the case
-Add tests
2019-08-15 10:23:05 +02:00
orbitcowboy
4b41f19c87
insecureCmdLineArgs: Added more test cases to ensure 'const'-qualifiers are handled correctly.
2019-08-15 08:45:31 +02:00
Rikard Falkeborn
fc1d5b187f
leakNoVarFunctionCall: Use AST more ( fix #9252 ) ( #2086 )
...
Use the AST a little bit more to improve the check. In order to do so,
rewrite the check to work from the outer function first and then check
the arguments, instead of the other way around.
It also fixes Trac ticket #9252 , no warning is now given for
void* malloc1() {
return(malloc1(1));
}
This FP seems to be common in daca results.
It also makes it possible to improve handling of casts, for example
cppcheck now warns about
void f() {
strcpy(a, (void*) strdup(p));
}
But not for
char* f() {
char* ret = (char*)strcpy(malloc(10), "abc");
return ret;
}
These FP/FN were introduced when the check was switched to use the
simplified token list.
2019-08-14 22:01:40 +02:00
Paul Fultz II
4f76588f98
Fix issue 9275: False positive: Non-local object uses local variable ( #2084 )
2019-08-14 20:09:33 +02:00
Paul Fultz II
0c1dff5c93
Fix issue 9268: false negative: (style) Condition '...' is always true ( #2080 )
...
* Fix issue 9268: false negative: (style) Condition '...' is always true
* Fix copy and paste mistake
2019-08-14 06:34:27 +02:00
Paul Fultz II
13df5b2413
Fix FP with negative index and negated condition ( #2081 )
2019-08-14 06:32:31 +02:00
Daniel Marjamäki
d4549217d0
Renamed safeClassRefMember => unsafeClassRefMember
2019-08-13 20:58:31 +02:00
Daniel Marjamäki
41f8c1b281
Fixed #9271 (Safe classes: Class that store references)
2019-08-13 20:40:48 +02:00
Paul Fultz II
c0c6f92221
Fix issue 8431 and 8776: Size of constant string
...
Fixes these cases:
```cpp
void f(void) {
const std::string msg="xyz";
if(!msg.empty()){} // Always true
}
```
And out of bounds access:
```cpp
#include <string>
char fstr1(){const std::string s = "<a><b>"; return s[42]; }
wchar_t fwstr1(){const std::wstring s = L"<a><b>"; return s[42]; }
```
2019-08-12 20:24:16 +02:00
Paul Fultz II
68e8253920
Fix issue 8313 and 7326: Track values of pointer aliases in valueflow
2019-08-12 12:58:53 +02:00
Rikard Falkeborn
cd36f8ed0a
Fix #9253 : leakNoVarFunctionCall: do not warn if freopen opens standard stream ( #2076 )
...
This fixes false positives from daca@home where freopen is used to
reopen a standard stream. There is no longer a warning for
void f() {
assert(freopen("/dev/null", "r", stdin));
}
2019-08-12 12:53:59 +02:00
Paul Fultz II
aadc404958
Issue 8634: false negative: (style) Condition '...' is always true ( #2075 )
2019-08-12 11:04:01 +02:00
Paul Fultz II
9aa97cbb95
Fix issue 8296: ValueFlow: value not set in conditional scope in subfunction ( #2071 )
...
* Fix issue 8296: ValueFlow: value not set in conditional scope in subfunction
* Refactor condition checkingg
* Make test case TODO
2019-08-11 15:39:37 +02:00
Paul Fultz II
bd02ca5ccb
Fix issue 9207: Not detected 'always true' and unreachable code
2019-08-08 07:46:47 +02:00
Daniel Marjamäki
9fa1a5a540
astyle formatting
...
[ci skip]
2019-08-07 08:05:46 +02:00
IOBYTE
c6c50567cf
Fix #9250 (Regression: crash in gcc testsuite) ( #2067 )
...
* Fix #9250 (Regression: crash in gcc testsuite)
* fix cppcheck warning
2019-08-07 08:05:02 +02:00
Ken-Patrick
cb0b057595
8706 ( #2066 )
...
* 8706
* Add test case for #8706
2019-08-07 08:04:10 +02:00
Paul Fultz II
aaeec462e6
Re-enable valueFlowSubFunction ( #2063 )
...
* Re-enable valueFlowSubFunction
* Formatting
* Skip ternary operators in subfunctions
* Fix test with iostreams
* Fix FP with multiple parameters
2019-08-05 16:26:32 +02:00
Daniel Marjamäki
20278d9c92
Clarify signConversion warning message
2019-08-05 12:41:08 +02:00
Paul Fultz II
ffdd2dc793
Fix issue 8924: Re-enable valueFlowTerminatingCondition
2019-08-05 07:18:06 +02:00
IOBYTE
7ebc9d1b5f
Fix #9249 (Syntax error on valid C++) ( #2062 )
2019-08-04 10:24:44 +02:00
Daniel Marjamäki
510748134f
Fixed #9234 (FP unreadVariable - assignment via iterator)
2019-08-04 10:21:16 +02:00
Daniel Marjamäki
ce53931d00
Fixed #9251 (False positive: unininitialized variable (multi variables))
2019-08-03 21:12:34 +02:00
Daniel Marjamäki
cdc602e1be
Fixed #9137 (Tokenizer: Wrong handling of volatile pointer)
2019-08-03 12:28:50 +02:00
Daniel Marjamäki
c03df8e6b4
SymbolDatabase: Improved matchParameter for containers
2019-08-03 10:10:40 +02:00
IOBYTE
2da83df37b
Fix #9246 (Syntax error on C++ code) ( #2061 )
2019-08-03 08:15:06 +02:00
Daniel Marjamäki
e66e6549ee
SymbolDatabase: Improved ValueType::matchParameter handling of containers
2019-08-02 15:59:22 +02:00
versat
2519a1aed5
gnu.cfg: Add more __builtin_* functions and some tests
...
Most of them were detected by daca@home
2019-08-02 12:27:46 +02:00
Daniel Marjamäki
41549f4801
Try to fix Cppcheck warning to make Cppcheck happy
2019-08-02 07:57:34 +02:00
IOBYTE
0d1685cd29
Fix #9178 example with instantiation ( #2059 )
2019-08-02 07:53:39 +02:00
Sebastian
5390588cda
gnu.cfg: Add xfree() ( #2051 )
...
It is hard to find good references, one that describes it a bit can
be found here:
https://manpages.ubuntu.com/manpages/bionic/man3/xmalloc.3pub.html
xfree() can be used instead of free().
A check, to verify that a memory leak is found if the memory allocated
via xmalloc() is not freed, has also been added.
2019-08-02 07:41:32 +02:00
amai2012
29596baa92
Refactoring: Convert enum Direction to enum class
2019-08-01 20:56:02 +02:00
Rikard Falkeborn
f6726b76ae
Fix 9215 (add tilde for missing destructor override warning) ( #2057 )
2019-08-01 10:43:45 +02:00
amai2012
b0fbbb5aa7
Convert SHOWTIME_MODES to enum class
2019-07-31 22:35:51 +02:00
Daniel Marjamäki
8deb855b41
Fix ValueType::matchParameter for 'const float *' => 'signed long long'
2019-07-31 18:55:55 +02:00
Daniel Marjamäki
c51f44ce4c
SymbolDatabase: extend usage of ValueType::matchParameter for variable parameters
2019-07-31 18:24:15 +02:00
Daniel Marjamäki
1eb5f2266c
ValueType::matchParameter: Fix matching of char** and void*
2019-07-31 16:23:50 +02:00
Sebastian
549452b7b9
qt.cfg: Add container and function configurations for QVector ( #2052 )
...
Reference: https://doc.qt.io/qt-5/qvector.html
2019-07-31 13:58:55 +02:00
Daniel Marjamäki
a3dc2db77a
SymbolDatabase: Use ValueType::matchParameter for variable address parameters
2019-07-31 12:38:36 +02:00
Daniel Marjamäki
039d49bcb1
Improve ValueType::matchParameter for pointers with different types
2019-07-31 12:12:17 +02:00
Daniel Marjamäki
728ac6ae2e
SymbolDatabase: Use ValueType::matchParameter for char literal parameters
2019-07-31 09:35:32 +02:00
IOBYTE
9436f72a94
Fix daca dnsdist crash ( #2053 )
2019-07-31 09:18:43 +02:00
Daniel Marjamäki
e58e51ee14
SymbolDatabase::findFunction: For string literal, a std::string parameter is a better match than a void* parameter
2019-07-30 21:20:01 +02:00
Daniel Marjamäki
d5d50d9b17
ValueType::matchParameter: Improved constness matching
2019-07-30 09:19:51 +02:00
Daniel Marjamäki
3066c0653c
Fixed #8668 (SymbolDatabase: Wrong findFunction match for const pointer argument)
2019-07-29 18:14:23 +02:00
Daniel Marjamäki
607b3daca8
ValueFlow: Improve bailout for structs etc in loops
2019-07-29 15:51:48 +02:00
Daniel Marjamäki
a1214348c0
Fixed #8974 (false negative regression about never used variable)
2019-07-29 08:49:19 +02:00
Daniel Marjamäki
602911cfca
Activate a TODO test case
2019-07-29 08:06:57 +02:00
Daniel Marjamäki
a178d05cc5
Changed TODO test case, I do not see why it should warn.
2019-07-29 07:51:00 +02:00
IOBYTE
07ac6c5f08
Fix ternary operator simplification to accept template parameters. ( #2048 )
...
Also simplify decltype of bool and numeric literals in template
arguments.
2019-07-28 21:52:52 +02:00
IOBYTE
badc573b80
Fix #9224 (Performance regression in template parsing: 250x - 1200x slower) ( #2046 )
2019-07-28 09:25:18 +02:00
Daniel Marjamäki
e8ec6e6f11
Fixed #8349 (Noisy nullPointerRedundantCheck)
2019-07-27 20:03:06 +02:00
Daniel Marjamäki
1c75257212
Token::hasKnownIntValue: Fix when there is one possible int value and one known BUFFER_SIZE value, it should return false.
2019-07-27 08:25:07 +02:00
Rikard Falkeborn
f95d193e22
Fix #8282 (memleak FP when returning std::pair) ( #2039 )
2019-07-26 07:03:58 +02:00
Paul Fultz II
ee28a45db4
Fix issue 9235: new crash in astutils isVariableChanged from endless recursion ( #2040 )
2019-07-26 07:03:21 +02:00
Paul Fultz II
b049fd9303
Improve propogation of lifetimes of function arguments
...
This will now warn for cases like this:
```cpp
int* f(int * x) {
return x;
}
int * g(int x) {
return f(&x);
}
````
2019-07-26 07:02:07 +02:00
Rikard Falkeborn
a69a570505
Fix FP leakVarNotUsed with freopen() and stdin ( #2034 )
...
One usecase for freopen() is to redirect input and output streams to
files. For that, the return value is not needed.
2019-07-25 21:09:23 +02:00
Paul Fultz II
744a94ad5a
Fix issue 9231: FP constParameter - argument passed parent ctor ( #2032 )
2019-07-24 20:59:58 +02:00
IOBYTE
999d2f797c
Fix #9225 (Crash on valid C++14 code) ( #2031 )
...
* Fix #9225 (Crash on valid C++14 code)
This only fixes the crash. Specialization of nested templates is still
broken.
* fix cppcheck warnings
* fixed another cppcheck warning
2019-07-24 19:20:19 +02:00
Daniel Marjamäki
bbcffce529
Fixed #9062 (False positive "condition is always true")
2019-07-24 19:16:35 +02:00
Daniel Marjamäki
e11dcc609b
Fixed #7758 (Function array is seen as Uninitialized)
2019-07-24 18:20:23 +02:00
Daniel Marjamäki
7c0b011c05
Fixed #9230 (Improve check: integer conversion overflow in return)
2019-07-24 16:17:52 +02:00
Daniel Marjamäki
2da75d5af4
Split up Cppcheck attribute. low and high values can be specified separately and they can be used for variables also.
2019-07-24 15:08:26 +02:00
Daniel Marjamäki
cab9f61b79
safe checks: Handle float parameters
2019-07-24 12:09:13 +02:00
Daniel Marjamäki
10be2a1941
Safe checks: container parameters
2019-07-24 11:39:35 +02:00
Daniel Marjamäki
8959c5a9d0
Rename valueFlowAllFunctionParameterValues => valueFlowSafeFunctionParameterValues
2019-07-24 10:57:35 +02:00
Paul Fultz II
bb52a63c4e
Add check for const variables
...
When a local reference is declared, this will check if that local reference can be declared as `const`.
2019-07-24 09:59:01 +02:00
Paul Fultz II
3ec3bd52e0
Fix FP when using a pointer to a container ( #2029 )
2019-07-24 00:04:49 +02:00
Paul Fultz II
ab0fcc7640
Fix issue 9216: reset() method confusion ( #2025 )
...
* Fix issue 9216 with smart pointer reset
* Check for arrow
2019-07-23 22:45:58 +02:00
Paul Fultz II
60b670babd
Fix issue 9219: False positive, returnDanglingLifetime ( #2026 )
...
* Check for pointer deref for container methods
* Formatting
2019-07-23 21:59:05 +02:00
IOBYTE
5ad5cfcc29
Fix #9217 (Regression: Memory explodes in simplifyTemplateAliases) ( #2021 )
...
* Fix #9217 (Regression: Memory explodes in simplifyTemplateAliases)
* fix use after free when nothing was copied
2019-07-23 21:28:24 +02:00
Daniel Marjamäki
4fb6c27276
Modernize: Use enum class
2019-07-23 14:29:02 +02:00
Daniel Marjamäki
c8bc88e7e2
Fix compiler error
2019-07-23 13:14:08 +02:00
Rikard Falkeborn
8cd1d5a47d
Use library for memleak checks ( #2002 )
...
* Use library for memleak checks
Change memleakOnRealloc and leakReturnValNotUsed to use library
configuration instead of hardcoding "realloc".
In order to do so, some care needs to be taken when matching for a
reallocation function, since it can no longer be assumed that the input
to be allocated is the first argument of the function. This complicates
getReallocationType() and checkReallocUsage() but is necessary in order
to handle for example freopen() properly.
Also, refactor memleakOnRealloc check to reduce duplicated code when
checking "a" and "*a". When doing so, extending the check to look for
arbitrary number of "*" can be done for free (just change an if
statement to a while statement). Most likely, this is an unusual case in
real world code.
* Remove redundant whitespace in Token::Match()
* Run on simplified checks
* Fix cppcheck warning
2019-07-22 10:37:36 +02:00
Rikard Falkeborn
06337cedf5
Run more tests on full token list ( #2020 )
...
Since all checks are run on the full token list and not the simplified
one, run the tests on the full token list as well.
2019-07-22 10:26:55 +02:00
Rikard Falkeborn
abea580b78
Fix FP memory leak with unknown function call in condition ( #2012 )
...
* Fix FP memory leak with unknown function call in condition
This was introduced in 8513fb81d2
when
fixing memory leaks for global variables allocated in condition. The
refactored code had an inconsistency where c and c++ code behaved
slightly differently when `var` is NULL. This seemed to not have an
impact as the code was written prior to 8513fb81d2
,
but when the same code was used for conditions, FPs were introduced.
The introduced FPs were memleak warnings when there should have been an
information message about missing configurations for code like
void f() {
char *p = malloc(10);
if (set_data(p)) {}
}
Fix this by always returning true if varTok->Variable() is NULL for
both c and c++ code.
* Improve function name
2019-07-18 15:23:19 +02:00
Paul Fultz II
a08a9c1349
Switch to use lifetime analysis for iterators and pointers to invalid containers
...
This will diagnose more issues such as:
```cpp
void f(std::vector<int> &v) {
auto v0 = v.begin();
v.push_back(123);
std::cout << *v0 << std::endl;
}
```
2019-07-18 10:56:44 +02:00
Daniel Marjamäki
421a8da6a8
Try to clarify signConversion message
2019-07-17 22:41:24 +02:00
Daniel Marjamäki
d11d6f112e
Detect shadowed arguments
2019-07-17 17:08:42 +02:00
Daniel Marjamäki
90a215af0e
Rephraze performance message. /would be faster/could be faster/ to indicate that Cppcheck is not _sure_ that it would be faster
2019-07-17 16:06:10 +02:00
Daniel Marjamäki
64ef879ebf
Fix syntaxError for struct initialization
2019-07-17 15:21:17 +02:00
Daniel Marjamäki
9973db3a71
Modernize: Use enum class for Library::Action and Library::Yield
2019-07-17 11:39:30 +02:00
Daniel Marjamäki
5800692fa1
Move and refactor the CheckMemoryLeak::isclass
2019-07-17 08:59:09 +02:00
Rikard Falkeborn
8513fb81d2
Fix #9206 (FP with global variable allocated in condition) ( #2007 )
2019-07-17 07:43:07 +02:00
Daniel Marjamäki
b3688f22e8
Unknown macro: Detect and warn about unknown macro before throw/return
2019-07-16 20:32:46 +02:00
Daniel Marjamäki
5a6b89100d
Removed casts
2019-07-16 09:14:44 +02:00
Rikard Falkeborn
e19068504d
Configure xrealloc and adjust gnu memory functions ( #2003 )
...
Remove <noreturn> tag, since the functions do not return unless there
was no error.
2019-07-16 08:12:21 +02:00
Rikard Falkeborn
dcc375ca64
Update gtk memory functions ( #2000 )
...
* Improve configuration of g_try_realloc and g_try_realloc_n
* Mark g_realloc and similar functions as realloc functions
* Remove g_new, g_new0, etc as <alloc> functions, these are defined as
macros and handled as the functions they're expanded to.
* Add tests. TODO tests will be resolved by using the library
configuration in the checker.
2019-07-15 14:51:58 +02:00
IOBYTE
6d6bb31926
fix crash in daca gcc-avr from intentional bad instantiation test ( #1994 )
...
* fix crash in daca gcc-avr from intentional bad instantiation test
* fix cppcheck warning
2019-07-15 12:41:06 +02:00
IOBYTE
c2ccfd5f8b
Increase Windows stack size to 8M ( #1998 )
...
* Increase Windows stack size to 8M
* try to add stack size cmake
2019-07-15 12:39:58 +02:00
Daniel Marjamäki
af051a3787
astyle formatting
...
[ci skip]
2019-07-15 09:29:47 +02:00
Denis
68e6a440ff
Fix adding unescaped slash token when splitting gcc case range. ( #1987 )
...
* Fix adding unescaped slash token when splitting gcc case range.
Construction like case '!'...'~' converted to a list of separate case
tokens. When slas '\' symbol appears as a part of this list it was added
"as is", but it should be escaped like '\\' to be valid c++ code.
* Add test for switch-case range with slash
2019-07-15 09:29:31 +02:00
Daniel Marjamäki
d2284ddbcd
Fix false positives in self check: Variable t is assigned a value that is never used. Classes with destructors was not handled properly.
2019-07-14 16:20:45 +02:00
Daniel Marjamäki
1cadd9398a
Fixed #8933 (false negative: (style) Variable is assigned a value that is never used (std::string))
2019-07-14 09:44:30 +02:00
Daniel Marjamäki
cf06acae08
Fixed #5995 (False negative selfAssignment regression from 1.65)
2019-07-13 21:45:54 +02:00
IOBYTE
526a86dc60
Fix recursiveCount in CheckLeakAutoVar to really be recursive count. ( #1988 )
2019-07-13 07:40:24 +02:00
Daniel Marjamäki
f9bd589abb
testrunner: Make a few tests more 'proper'
2019-07-13 07:29:23 +02:00
Daniel Marjamäki
ae933c20c7
Fixed #1765 (Improve check: delete not handled well when there are extra parentheses)
2019-07-12 18:25:20 +02:00
Daniel Marjamäki
8ad3e43f92
Add handling of a simple C++ contract
2019-07-12 16:05:35 +02:00
Daniel Marjamäki
68cc7516a1
Annotations: Add annotation __cppcheck_in_range__(low,high)
2019-07-12 11:09:54 +02:00
IOBYTE
74e3114a64
Fix #9097 (Crash on thousands of "else ifs"s in gcc-avr package) ( #1982 )
...
* Fix #9097 (Crash on thousands of "else ifs"s in gcc-avr package)
* increase recursion count maximum to 512 because cppcheck was hitting the 256 limit
* 512 was too much for windows
2019-07-12 07:56:05 +02:00
Daniel Marjamäki
783f7f1648
Rename safeValues to unknownValues
2019-07-11 16:05:48 +02:00
Daniel Marjamäki
05d35b063d
Function return: Extra check of safe function return values
2019-07-10 20:00:21 +02:00
Daniel Marjamäki
c9906125de
Safe functions: Check more possible function argument values
2019-07-10 16:59:05 +02:00
Daniel Marjamäki
9f548efbd3
Refactoring: enum class
2019-07-10 15:27:07 +02:00
Rikard Falkeborn
a1a14b8465
Fix FP with cast pointer to free() ( #1961 )
...
This fixes false positives when the pointer passed to free() (or similar
deallocation functions) is cast using a c-style cast.
2019-07-10 09:13:59 +02:00
IOBYTE
7ac22677b8
regression test for daca codeblocks crash ( #1974 )
2019-07-10 07:16:16 +02:00
Daniel Marjamäki
58076bc672
SymbolDatabase: Better handling of smart pointers
2019-07-09 17:32:19 +02:00
Daniel Marjamäki
b68f50ea25
appveyor: check that cmake builds work also. run test/cli tests.
2019-07-09 07:46:53 +02:00
Daniel Marjamäki
a0b22410cf
SymbolDatabase: Better handling of smart pointers
2019-07-07 21:52:49 +02:00
IOBYTE
e551057f59
Refactor Tokenizer::simplifyUsing to use continue to reduce indentation ( #1967 )
...
* Refactor Tokenizer::simplifyUsing to use continue to reduce indentation
added function findTemplateDeclarationEnd to skip template declarations
to reduce duplicate code
* fix travis build
2019-07-07 18:33:33 +02:00
Sebastian
db43dcd601
posix.cfg: Add `<use-retval/>` to pthread_mutex_trylock ( #1959 )
...
Ignoring the return value of pthread_mutex_trylock is always a bug.
There is no other way to check if the mutex is locked or not after the
call.
2019-07-07 12:57:02 +02:00
IOBYTE
c902c5f688
Fix #9197 (Template name cache: Assertion `tok && tok->str() == ">"' failed.) ( #1964 )
2019-07-07 10:20:43 +02:00
Paul Fultz II
b0d10273ed
Fix issue 3695: Handle class pointers
...
This switches to use lifetime analysis to check for assigning to non-local variables:
```cpp
class test
{
public:
void f()
{
int x;
this->ptr = &x;
}
protected:
int *ptr;
};
```
2019-07-07 10:16:19 +02:00
IOBYTE
9569fa1374
Partial fix for #9191 (simplifyTypedef: Problem when namespace is used) ( #1952 )
...
* Partial fix for #9191 (simplifyTypedef: Problem when namespace is used)
This fixes simplifyUsing which has the same problem as simplifyTypedef.
simplifyUsing was designed to support using namespace but it was never
implemented. The changes are minor to add it.
simplifyTypedef requires much more work to support using namespace.
* reduce scope of variable
* make idx const
2019-07-06 20:22:13 +02:00
PKEuS
ae86536128
Updated to Visual Studio 2019
2019-07-06 12:11:19 +02:00
Paul Fultz II
65af02f0cf
Fix crash with lambda capture ( #1960 )
2019-07-06 10:46:17 +02:00
Rikard Falkeborn
2bd026dd2a
Add tests of std.cfg buffer size ( #1958 )
...
Includes a testcase for trac ticket #1379 which was fixed in
839fcddd8a
.
2019-07-06 08:55:17 +02:00
Rikard Falkeborn
839fcddd8a
Fix #6115 (Add support to realloc to cfg files) ( #1953 )
...
* Allow to configure realloc like functions
* memleakonrealloc: Bring back tests.
The old memleak checker was removed, and the tests for it was removed in
commit 9765a2dfab
. This also removed the
tests for memleakOnRealloc. Bring back those tests, somewhat modified
since the checker no longer checks for memory leaks.
* Add realloc to mem leak check
* Add tests of realloc buffer size
* Configure realloc functions
* Add test of freopen
* Allow to configure which element is realloc argument
* Fix wrong close in test
cppcheck now warns for this
* Update manual
* Update docs
* Rename alloc/dalloc/realloc functions
Naming the member function realloc caused problems on appveyor. Rename
the alloc and dealloc functions as well for consistency.
* Change comparisson order
* Remove variable and use function call directly
* Create temporary variable to simplify
* Throw mismatchError on mismatching allocation/reallocation
* Refactor to separate function
* Fix potential nullptr dereference
As pointed out by cppcheck.
2019-07-05 12:44:52 +02:00
Paul Fultz II
e0ced1c415
Parse lambdas as functions ( #1955 )
...
* Parse lambdas as functions
* Fix issue with missing paren
* Fix error when parsing non-existent args
* Remove unused function variable
2019-07-05 12:30:42 +02:00
Rikard Falkeborn
2a17e624d9
Overlapping sprintf, improve handling of casts ( #1945 )
...
* Overlapping sprintf, improve handling of casts
If there is a cast of the argument buffer, cppcheck would print out the
expression including the cast, which looks a bit strange to talk about
Variable (char*)buf is used as...
Instead, only print the variable name without the cast.
Also, handle arbitrary many casts (the previous code only handled one).
Multiple casts of the input arguments is probably an unusual case in
real code, but can perhaps occur if macros are used.
* Fix printing of variable
... and add a test.
* Simplify testcase
2019-07-05 12:27:39 +02:00
Paul Fultz II
5801fb26f0
Fix syntax error with lambda captures ( #1954 )
...
* Fix syntax error with lambda captures
* Fix issue when using initializer in lambdas
2019-07-05 12:26:01 +02:00
Sebastian
c45dff1e1d
openmp.cfg: Add library configuration for OpenMP ( #1956 )
...
See https://www.openmp.org/
2019-07-05 03:00:52 +02:00
shaneasd
7e54f989f9
Update symbol database such that the override keyword implies that the function is also virtual ( #1907 )
...
* Update symbol database such that the override keyword implies that the function is also virtual
* Add test case for implicit override
* change isVirtual to hasVirtualSpecifier
* fix method documentation for getVirtualFunctionCalls and getFirstVirtualFunctionCallStack
* Fix isImplicitlyVirtual to consider the override keyword and document logic
* Fix getFirstVirtualFunctionCallStack and getVirtualFunctionCalls to use isImplicitlyVirtual instead of isVirtual so new test case passes
2019-07-04 12:32:32 +02:00
Rikard Falkeborn
60a213e6a5
Fix #9047 (c-style casts before malloc) ( #1930 )
...
* Fix #9047 (c-style casts before malloc)
Note that there are still no warnings for c++-style casts
* Fix memleak check with casts of assignments in if-statements
* Fix possible null pointer dereference
As pointed out by cppcheck.
* Add check of astOperand2 when removing casts
This is similar to how it is done in other checks.
2019-07-03 08:39:44 +02:00
IOBYTE
c4933acb5a
Fixed #9147(SymbolDatabase bailout: unhandled code) ( #1948 )
...
* Fixed #9147(SymbolDatabase bailout: unhandled code)
* add test for #9183
2019-07-03 08:35:48 +02:00
Daniel Marjamäki
f84dcc4738
astyle formatting
...
[ci skip]
2019-07-03 08:29:47 +02:00
Paul Fultz II
8f4cb36e1e
Check for more garbage code ( #1949 )
...
* Check for garbage commas
* Find garbage dot operator
2019-07-03 08:28:24 +02:00
Ken-Patrick
d6f6e68fa2
Fix false positive 9167 ( #1904 )
...
Skip returns from local class/struct definition in FwdAnalysis.
2019-07-03 08:17:06 +02:00
Scott Furry
da213d1534
More Zero/Null as pointer constant corrections ( #1947 )
...
Further to pull request #1938 . Changes were missed in previous commit.
Resolve warnings `warning: zero as null pointer constant` in code by
using C++ 11 recommended `nullptr`.
2019-07-02 20:37:44 +02:00
IOBYTE
5642778206
Fixed #9193 (functionStatic false positive (inconclusive)) ( #1943 )
2019-07-02 11:40:57 +02:00
IOBYTE
bf4e1ef790
template simplifier: consistently handle templates with no arguments ( #1939 )
...
this fixes daca boost1.67 crashes
2019-07-01 07:01:14 +02:00
Daniel Marjamäki
0eedcfc160
Fixed #7464 (warn about opposite if and else-if conditions)
2019-06-30 23:26:49 +02:00
Scott Furry
a195477470
Correct Zero/Null as pointer constant ( #1938 )
...
Building with enhanced clang warnings indicated a large number of
instances with the warning:
`warning: zero as null pointer constant`
Recommended practice in C++11 is to use `nullptr` as value for
a NULL or empty pointer value. All instances where this warning
was encountered were corrected in this commit.
Where warning was encountered in dependency code (i.e. external library)
no chnages were made. Patching will be offered upstream.
2019-06-30 21:39:22 +02:00
Daniel Marjamäki
56df6169fb
Fixed #8356 (ValueFlow: variable is not changed in for loop)
2019-06-30 17:50:35 +02:00
Rikard Falkeborn
d1d622b74c
Valueflow: support global static const variables ( #1861 )
2019-06-29 14:33:55 +02:00
Daniel Marjamäki
84cc09d17c
Update Copyright
2019-06-29 07:49:14 +02:00
Rikard Falkeborn
0d69a86bf8
Remove debug printout ( #1933 )
2019-06-28 22:08:32 +02:00
IOBYTE
8b347aed42
Fixed #8663 (Stack overflow with template disambiguator) ( #1932 )
2019-06-28 22:07:21 +02:00
IOBYTE
16788df055
template simplifier: various small fixes ( #1916 )
...
* fix adding instantiation of first argument to an instantiation
* add support for function pointer template variables
* fix more cases where templates ending in ">>" are changed to end in "> >"
* fix travis build
* standard types can't be a template parameter name
* remove redundant level == 0 checks
* fix lambda in template variable
* fix a test
2019-06-28 11:14:20 +02:00
Ken-Patrick
927d139488
Fix FP #9165 ( #1928 )
...
Properly check the type of the expressions, instead of using the type
of the tokens
2019-06-27 07:48:44 +02:00
Sebastian
d745dcc0eb
gtk.cfg: Add g_error_*() functions ( #1922 )
2019-06-25 19:19:10 +02:00
Paul Fultz II
66e0f06494
Fixx issue 9163: FP returnDanglingLifetime - returning std::string::find ( #1912 )
...
* Fixx issue 9163: FP returnDanglingLifetime - returning std::string::find
* Use simpleMatch
2019-06-24 18:52:17 +02:00
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