Paul Fultz II
27ebff7ae4
Add deeper analysis of when a function changes a containers size ( #2149 )
...
* Add deeper analysis of when a function changes a containers size
* Fix issues
* Track addressOf
2019-09-06 21:18:45 +02:00
Sebastian
4531b31a4a
Test for issue 9334: FP resourceLeak for dlopen/dlclose with library posix ( #2151 )
...
Add test to avoid further FP for valid code.
Tests for true positives are already present.
https://trac.cppcheck.net/ticket/9334
2019-09-06 16:37:51 +02:00
Sebastian
32dad3f44a
posix.cfg: Fix vsyslog() configuration ( #2150 )
...
Add tests to make sure no false positives are reported.
Found the issue via daca@home
2019-09-06 10:16:11 +02:00
Paul Fultz II
70cad280ea
Fix issue 9319: FP knownConditionTrueFalse related to aggregate initialization of struct ( #2147 )
2019-09-05 19:36:45 +02:00
Paul Fultz II
9e140831eb
Fix issue 9329: FP knownConditionTrueFalse - vector modified by function calls ( #2145 )
2019-09-05 16:42:26 +02:00
Paul Fultz II
e657cf4073
Fix issue 9320: False positive knownConditionTrueFalse related to truncation ( #2144 )
2019-09-05 15:15:58 +02:00
Daniel Marjamäki
068b0ef648
Make Travis happy
2019-09-04 13:38:19 +02:00
Daniel Marjamäki
a9fda3f488
Clarify redundantVarAssignment warnings
2019-09-04 10:55:41 +02:00
IOBYTE
e5220bdf0c
make ellipsis ... a single token ( #2143 )
...
* make ellipsis ... a single token
Using cppcheck -E to preprocess code with ellipsis produces output that
can't be compiled because ... is split into 3 tokens.
* try to fix addon
2019-09-04 08:07:30 +02:00
Paul Fultz II
1afd56e964
Fix issue 8785: ValueFlow: Track pointer alias
...
This fixes the issue by making `ProgramMemory` keep track of values based on the conditions.
It also removes the `deadpointer` check since it duplicates the `invalidLifetime` check.
2019-09-03 17:16:15 +02:00
Paul Fultz II
55a78f482b
Fix issue 9293: false negative: uninitvar
2019-09-03 06:46:34 +02:00
Paul Fultz II
dc201d110d
Fix issue 9274: false negative: (error) Buffer is accessed out of bounds (std::string, std::wstring)
2019-09-03 06:43:54 +02:00
Paul Fultz II
88d194214f
Fix FP with invalidContainerRef ( #2141 )
2019-09-03 06:41:35 +02:00
Daniel Marjamäki
7d63bdee6f
astyle formatting
...
[ci skip]
2019-09-02 06:59:07 +02:00
Paul Fultz II
cb509f1a8b
Fix issue 4845: alias to vector element invalid after vector is changed ( #2113 )
...
* Try harder to track ref lifetimes
* Dont add lifetimes for references
* Use correct token
* Check for front and back as well
* Improve handling of addresses
* Formatting
* Fix FP
2019-09-02 06:58:09 +02:00
Paul Fultz II
255c1062e4
Run test fixtures as seperate tests so they can run in parallel ( #2126 )
2019-09-02 06:53:35 +02:00
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