Commit Graph

21639 Commits

Author SHA1 Message Date
Sebastian bfbfeefbb3 reduce.py: Allow reducing error messages, print output in case of error (#2179)
* reduce.py: Allow reducing error messages, print output in case of error

Allow reducing code that triggers (false positive) error messages.
Print Cppcheck output in case Cppcheck returns unsuccessfully and no
segfault is expected. This helps fixing messed up command lines (for
example issues with the path).

* Use "else" as suggested
2019-10-04 21:22:59 +02:00
Daniel Marjamäki fcccd5f42e ExprEngine: Small tweaks 2019-10-04 17:58:18 +02:00
IOBYTE c32a568c1f fix #8965 ("(debug) Executable scope 'x' with unknown function." with rvalue parameter in method) (#2237)
I fixed the AST enough to pass testrunner but I don't believe it is
correct.

This code:

void Foo4(int&&b);

has this AST:

( 'void'
|-Foo4
`-&& 'bool'
  |-int
  `-b 'signed int'

but I don't believe && should have `bool`.
2019-10-04 12:30:11 +02:00
Daniel Marjamäki 2a33c3cfec SymbolDatabase: Add test to ensure findFunction looks in current scope first 2019-10-03 21:29:01 +02:00
Conrado Gouvea 40f136ac78 MISRA: add exception to rule 3.1 (#2231)
* misra: add exception to rule 3.1

* misra: add parenthesis for clarity in rule 3.1
2019-10-03 21:15:00 +02:00
IOBYTE 50d82763fc Fix #9385 ("debug: Executable scope 'func' with unknown function" with parameter in member function) (#2235) 2019-10-03 21:13:03 +02:00
Daniel Marjamäki 7e850e3e4b ExprEngine: test pointer 2019-10-03 21:08:42 +02:00
Daniel Marjamäki f80d387374 ExprEngine: Arrays if-then-else 2019-10-03 20:16:06 +02:00
Daniel Marjamäki 555890fdfa ExprEngine: Removed NullPointerDereference checker for now. 2019-10-03 19:24:14 +02:00
IOBYTE 3e17c24dd8 fix syntax error on template operator (#2225) 2019-10-03 12:26:45 +02:00
Conrado Gouvea 67971db58f misra: fix false positive in 11.7 (#2233) 2019-10-03 10:15:50 +02:00
Paul Fultz II 997803869d Forward values after assignment in valueFlowReverse (#2226)
* Forward values after assignment in valueFlowReverse

* Rename variables

* Format
2019-10-03 09:58:57 +02:00
Daniel Marjamäki b79283306f ExprEngine: Rename Data::conditions => Data::constraints 2019-10-03 08:48:05 +02:00
Daniel Marjamäki d916379f9f ExprEngine: Better handling of if/else 2019-10-02 21:47:00 +02:00
Daniel Marjamäki 7ab22c7176 ExprEngine: Use smt solver Z3 2019-10-02 17:59:04 +02:00
IOBYTE 4ba00d0694 Fix #9381 (alias in namespace not replaced in method declaration) (#2232) 2019-10-02 08:11:04 +02:00
Daniel Marjamäki 87ece5856a Fix Cppcheck internal warning 2019-10-01 21:37:43 +02:00
Daniel Marjamäki cf965b72b5 SymbolDatabase: look for functions in anonymous namespaces in the findFunction 2019-10-01 19:09:34 +02:00
Daniel Marjamäki 07b337c580 Removed extra zero division heuristics, they seem redundant as ValueType is used 2019-10-01 17:33:58 +02:00
orbitcowboy e51f75ca40 wxwidgets.cfg: Added support for more interfaces, found by daca@home. 2019-10-01 08:43:17 +02:00
orbitcowboy f05e21efa8 Formatted the code, there are no functional changes [ci skip]. 2019-10-01 08:39:08 +02:00
orbitcowboy 35e0dd9372 wxwidgets.cfg: Added support for functions from <wx/stopwatch.h> 2019-10-01 08:38:16 +02:00
Paul Fultz II 166bd2bafc Fix issue 2153: valueFlowAfterCondition: struct member (#2228)
* Fix issue 2153: valueFlowAfterCondition: struct member

* Fix null pointer dereference

* Formatting

* Check for another null pointer

* Initialize variables

* Remove redundant condition

* Format

* Add missing initialization to copy constructor

* Format
2019-09-30 21:04:43 +02:00
Armin Müller b4af8bdc2e Typos found by running "codespell" (#2227) 2019-09-29 21:23:19 +02:00
Daniel Marjamäki 1ccc303602 ExprEngine: Simplify array value if possible, ensure each array data has a unique name 2019-09-29 21:20:57 +02:00
Daniel Marjamäki 03ff32993e Fixed Cppcheck warning 2019-09-29 17:32:26 +02:00
Daniel Marjamäki 1979b64170 ExprEngine: Bailout when for|while|switch is seen 2019-09-29 17:28:12 +02:00
Daniel Marjamäki eb8908cd3e PodType: Add test 2019-09-29 17:02:14 +02:00
Daniel Marjamäki 69a54b0ee9 Library: added 'stdtype' attribute in <podtype> element so we can configure standard types better 2019-09-29 16:48:25 +02:00
Daniel Marjamäki 40c3e68e07 ExprEngine: Add --debug-verify, fixed handling of global arrays 2019-09-29 15:00:54 +02:00
Daniel Marjamäki 60e1cf8b8d ExprEngine: Fix NULL pointer dereference tests 2019-09-29 08:26:09 +02:00
Sebastian bf8f96255b
donate-cpu.py: Add internal timing information of Cppcheck to output (#2217)
* donate-cpu.py: Add internal timing information of Cppcheck to output

The option "--showtime=top5" is added to the Cppcheck command line.
The timing output is collected and only for HEAD it is shown in the new
category "head-timing-info" in the results output.
The timing output is indented with one white space, so even in the
unlikely case that a function is named "head result:" or "diff:" it does
not break the parser in the server.

* donate-cpu.py: Also print the "old" timing information for comparison
2019-09-28 22:09:58 +02:00
Daniel Marjamäki 2dc477571c Fix gcc compiler warnings 2019-09-28 20:50:56 +02:00
Daniel Marjamäki a09fe763d9 Try to make Travis happy 2019-09-28 20:43:55 +02:00
Oliver Stöneberg 1fa4df419a avoid some unnecessary copies in emplace_back() calls (#2194) 2019-09-28 20:22:46 +02:00
Georgy Komarov 846f356db4 misra.py: Fix Rule 4.1 (#2216)
* misra.py: Use standard string module

* misra.py: Fixup R4.1

References:
* https://trac.cppcheck.net/ticket/9370
* https://sourceforge.net/p/cppcheck/discussion/development/thread/7274ed3842/?limit=25#799a

* Add more examples from @matzeschmid PR

* Add more out-of-bounds tests

* Fix R4.1.

* Compress hex condition

* Add more test cases

* Fix python3 zip import
2019-09-28 20:16:10 +02:00
Daniel Marjamäki 3f587bef65 ExprEngine: Add some CWE476 (Null pointer dereference) checks 2019-09-28 19:28:12 +02:00
Daniel Marjamäki 1acd78a038 ExprEngine: Translate uninitialized values to value ranges 2019-09-28 16:16:36 +02:00
Daniel Marjamäki 2e5d663ae9 ExprEngine: Handle void* -> int* casts better 2019-09-28 15:40:00 +02:00
Daniel Marjamäki 4138bf7fb3 SymbolDatabase: Better handling when return type of function is PodType 2019-09-28 14:57:41 +02:00
orbitcowboy 6a5b590d7f wxwidgets.cfg: Added support for more interfaces, found by daca@home. 2019-09-28 14:55:39 +02:00
Daniel Marjamäki ec7c774a10 ExprEngine: Adjust the command line in test/verify/juliet.py 2019-09-28 12:10:01 +02:00
Daniel Marjamäki 4540846325 ExprEngine: Added a testscript that uses the juliet testsuite 2019-09-28 12:00:41 +02:00
Daniel Marjamäki f6c0550c41 ExprEngine: Do not bailout if function type is not known if the result is not used anyway 2019-09-28 11:55:06 +02:00
Daniel Marjamäki b2239f04ba ExprEngine: Improve 'division by zero' warning 2019-09-28 11:03:20 +02:00
Daniel Marjamäki 0de3e76b2d ExprEngine: Clarify when analysis is aborted 2019-09-28 10:59:28 +02:00
Daniel Marjamäki a3cad7fa51 Fix Coverity warning CID 1405837; negative bit shift 2019-09-28 06:34:51 +02:00
SimonCornell1 6453a85363 Fix the following compilation error on VC142 : (#2224)
Error C2039 'inserter': is not a member of 'std' cppcheck C:\Users\simon\__Si\git_projects\cppcheck\lib\astutils.cpp 1229
2019-09-28 06:24:32 +02:00
Daniel Marjamäki 8b8701d078 ExprEngine: Cleanup output when variable declaration and initialization is separated 2019-09-27 21:03:47 +02:00
Daniel Marjamäki 398cfc1f5a ExprEngine: Create array value in struct 2019-09-27 18:58:49 +02:00