Commit Graph

9300 Commits

Author SHA1 Message Date
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