Commit Graph

21507 Commits

Author SHA1 Message Date
Rikard Falkeborn 007b5d3e8d Fix #9343 (memleak FP when return with cast) (#2162)
This was most likely introduced when the checks were changed to run on
the full tokenlist instead of the simplified one.

Take care to warn about cases where casts destroy the pointer, such as

	uint8_t f() {
		void* x = malloc(1);
		return (uint8_t)x;
	}
2019-09-20 15:09:27 +02:00
Daniel Marjamäki 049f6475ee astyle formatting
[ci skip]
2019-09-20 15:07:27 +02:00
Paul Fultz II ad8abdb0c3 Add impossible values to ValueFlow (#2186)
* Add impossible category

* Replace values

* Try to adjust known values

* Add ! for impossible values

* Add impossible with possible values

* Remove contradictions

* Add values when the branch is not dead

* Only copy possible values

* Dont bail on while loops

* Load std lib in valueflow

* Check for function calls

* Fix stl errors

* Fix incorrect impossible check

* Fix heap-after-use error

* Remove impossible values when they are lowered

* Show the bound and remove overlaps

* Infer conditions

* Dont push pointer values through dynamic_cast

* Add test for dynamic_cast issue

* Add shifttoomanybits test

* Add test for div by zero

* Add a test for issue 9315

* Dont make impossible value inconclusive

* Fix FP with shift operator

* Improve handleKnownValuesInLoop for impossible values

* Fix cppcheck warning

* Fix impossible values for ctu

* Bailout for streams

* Check equality conditions

* Fix overflows

* Add regression test for 9332

* Remove duplicate conditions

* Skip impossible values for invalid value

* Check for null

* Rename bound to range

* Formatting
2019-09-20 15:06:37 +02:00
versat dc1cdd2b76 addons/test/test-*.py: Improve documentation about running the tests 2019-09-20 13:39:38 +02:00
IOBYTE 8c5cf8c029 Fixed #9046 syntaxError (#2180)
* Fixed #9046 syntaxError

* fix another syntax error

* fix some more syntax errors
2019-09-20 12:35:01 +02:00
Daniel Marjamäki 8fba2af267 Try to make Travis happy 2019-09-20 07:04:58 +02:00
Daniel Marjamäki 6c38b69e11 Rename dataIndex to mDataIndex according to our naming conventions 2019-09-20 06:12:35 +02:00
Sebastian 7d26a694da
.travis.yml: Run addon tests also with Python 3 (#2185)
Python 3 does not search parent directories of the initially executed
script for modules imported by modules in this parent directory by
default. So simply set the PYTHONPATH to the ./addons directory. Thus
all scripts are found. It is similar to running the test-*.py script
from the ./addons directory, but this way all the paths in the test-*.py
scripts do not have to be changed (for example to find the cppcheck
executable.
For more details regarding the parent directory issue see for example:
https://stackoverflow.com/questions/11393492/python-package-import-from-parent-directory
For details about the used PYTHONPATH solution see:
https://stackoverflow.com/questions/4580101/python-add-pythonpath-during-command-line-module-run
2019-09-19 20:46:16 +02:00
Oliver Stöneberg de9f489b08 use range loops / constness (#2181)
* use range loops / constness

* platform.cpp: avoid shadowed variable
2019-09-19 20:29:33 +02:00
Daniel Marjamäki 5f0f8afc27 ExprEngine: Print some 'debug' output 2019-09-19 20:18:55 +02:00
Sebastian bf55e835aa
Windows testrunner: Add testexprengine.cpp (#2184)
Add export of executeAllFunctions() in exprengine.h
2019-09-19 19:40:00 +02:00
versat 28e3e01ff8 lua.cfg: Add some functions/macros, partly found by daca@home 2019-09-19 16:27:37 +02:00
orbitcowboy 06ba93b84a qt.cfg: Added support fore Q_OVERRIDE-macro. 2019-09-19 15:22:36 +02:00
orbitcowboy 1855a44b3b microsoft_atl: Added support fore macros. 2019-09-19 13:09:40 +02:00
versat 7277fe5a2b gnu.cfg: Add support for macro __extension__
The macro does nothing except preventing from warnings when compiling
with "pedantic" or other options.
2019-09-19 12:27:21 +02:00
Sebastian 174badf242
python.cfg: Improve Python C API configuration (#2183)
Add configurations for functions reported by daca@home.
Remove redundantly configured functions.
Add/improve some other function configurations.
2019-09-19 10:34:14 +02:00
Rikard Falkeborn 518bb5195c dmake: Sort header dependencies (#2182)
Makes it simpler to check diffs, and prevents updates to Makefile due to
changes in header includes.
2019-09-19 09:26:59 +02:00
Daniel Marjamäki 745c91106e Removed unused Data::dump 2019-09-19 09:16:18 +02:00
Sebastian 8207fb7b14
cairo.cfg: Add library configuration/tests/... for cairo library (#2176)
Reference: https://www.cairographics.org/
2019-09-19 08:48:04 +02:00
orbitcowboy 3d3f62aefd windows.cfg: Added support for more interfaces. 2019-09-19 08:34:03 +02:00
orbitcowboy f6d3bb8cc8 windows.cfg: Added support for more interfaces and constants. 2019-09-19 08:29:45 +02:00
orbitcowboy b37b0c0f78 Running astyle [ci skip] 2019-09-19 08:03:29 +02:00
orbitcowboy f5d874955c wxwidgets.cfg: Added support for more interfaces. 2019-09-19 08:03:12 +02:00
amai2012 d97c826319 Compile fix for VisualStudio 2019-09-18 22:07:42 +02:00
amai2012 5355df8b6e Add exprengine.cpp to VisualStudio solution 2019-09-18 21:56:31 +02:00
amai2012 5a6084fbec Map #warning to #pragma message for VisualStudio 2019-09-18 21:50:23 +02:00
versat 076c604de8 python.cfg: Improve Python C API configuration
Add configurations for types, macros, alloc/dealloc and functions.
2019-09-18 15:09:13 +02:00
Sebastian 37a5810779
python.cfg: Add some functions found by daca@home (#2178) 2019-09-18 12:19:34 +02:00
versat 2080fbeecf boost.cfg: Add macros found by daca@home 2019-09-18 10:59:54 +02:00
orbitcowboy f2b0dc2e12 Merge branch 'master' of https://www.github.com/danmar/cppcheck 2019-09-18 09:24:48 +02:00
orbitcowboy dd63242233 wxwidgets.cfg: Added support for missing EVT_-macros, found by daca@home. 2019-09-18 09:24:22 +02:00
versat d08539fe17 windows.cfg: Fix PostMessage() configuration
First argument is optional (allowed to be NULL). See also the annotation
"_In_opt_".
Reference:
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-postmessagea
2019-09-18 09:22:57 +02:00
Sebastian 5bf6bd1f5e
windows.cfg: Enhance/fix Windows configuration (#2177)
Add/fix some missing/incorrect function configurations found by
analyzing TortoiseGit project.
Add some macros.
2019-09-18 08:41:37 +02:00
orbitcowboy 96171bfbc4 wxwidgets.cfg: Added support for missing EVT_-macros, found by daca@home. 2019-09-18 08:32:26 +02:00
orbitcowboy 952b017b78 wxwidgets.cfg: Added support for missing EVT_-macros, found by daca@home. 2019-09-18 08:29:15 +02:00
orbitcowboy 38ef649ae5 wxwidgets.cfg: Added support for missing EVT_-macros, found by daca@home. 2019-09-18 08:24:34 +02:00
orbitcowboy e0ad3c4448 wxwidgets.cfg: Added support for missing EVT_-macros, found by daca@home. 2019-09-18 08:15:08 +02:00
Daniel Marjamäki b66d701599 Fix Cppcheck warnings 2019-09-17 22:28:36 +02:00
Daniel Marjamäki 2d651b09fc ExprEngine: Add new experimental path-sensitive data flow analysis. Initially used for 'verification' but could possibly later be used as a complement in the normal analysis. The code is work-in-progress and hacky! 2019-09-17 21:00:59 +02:00
versat a8456b56f3 mfc.cfg: Fix wrong number of arguments for some macros 2019-09-17 15:19:15 +02:00
versat 3c55984af3 wxwidgets.cfg: Fix macro EVT_MENU_HIGHLIGHT_ALL(func)
Reference: https://docs.wxwidgets.org/3.0/classwx_menu_event.html
Found by daca@home (preprocessorErrorDirective)
2019-09-17 08:25:48 +02:00
orbitcowboy 75cd66d6e2 wxwidgets.cfg: Added support for wxEvent::Skip() and wxCommandEvent::Skip(). 2019-09-16 21:08:38 +02:00
orbitcowboy d625ff4ae7 wxwidgets.cfg: Added support for more interfaces. 2019-09-16 21:05:03 +02:00
orbitcowboy 1825c14340 wxwidgets.cfg: Added support for wxString::From8BitData(), found by daca@home. 2019-09-16 21:01:09 +02:00
orbitcowboy de69f18227 wxwidgets.cfg: Added support for wxSizerFlags::Border(), found by daca@home. 2019-09-16 20:53:51 +02:00
orbitcowboy 5ec5623abc wxwidgets.cfg: Added support for more wxGetTextFromUser(), found by daca@home. 2019-09-16 20:47:11 +02:00
orbitcowboy d531bab8be qt.cfg: Added support for more macros, found by daca@home. 2019-09-16 20:37:33 +02:00
orbitcowboy 3acb0f3736 wxwidgets.cfg: Added support for wxScroolWinEvent macros. 2019-09-16 20:29:53 +02:00
orbitcowboy 5839c49509 wxwidgets.cfg: Added support for more EVT_-macros, found by daca@home. 2019-09-16 17:33:20 +02:00
Sebastian fbbaea3cd9
qt.cfg: Add some missing macro definitions (#2175)
Found by daca@home
2019-09-16 15:58:35 +02:00