Commit Graph

19493 Commits

Author SHA1 Message Date
rikardfalkeborn 91de606243 TestOther: Shorter test cases (#1637)
* Remove newlines after check(
* Remove unneeded statements after if-statements

As an example, the previous test case

	check(
	    "bool foo(int x) {\n"
	    "  if (x < 0)"
	    "    return true;\n"
	    "  return false;\n"
	    "}");

is changed to

	check("void foo(int x) {\n"
	      "  if (x < 0) {}\n"
	      "}");
2019-01-31 23:57:05 +01:00
Daniel Marjamäki 53967c83e9 Fixed compile error 2019-01-31 23:52:48 +01:00
Daniel Marjamäki e297e3a505 Update Makefile 2019-01-31 21:31:14 +01:00
rikardfalkeborn 0c9b4fe279 Update Makefile (#1636) 2019-01-31 21:30:32 +01:00
Daniel Marjamäki 961f66baff Fixed #8820 (import GUI project)
This has basic handling of GUI projects. But further work will be needed to handle addons etc, the plan is that we will be able to run addons from the command line soon.
2019-01-31 20:40:21 +01:00
IOBYTE 05a3e6807b Fixed #8950 and #8952 (improve type alias support) (#1633)
* Fixed #8950 and #8952 (improve type alias support)

* fix travis build
2019-01-31 16:53:51 +01:00
orbitcowboy c2bda14376 wxwidgets.cfg: Added support for wxStringTokenize(). 2019-01-31 14:32:21 +01:00
orbitcowboy a427679d21 wxwidgets.cfg: Added missing const configuration. 2019-01-31 14:12:31 +01:00
orbitcowboy 65f7a17f26 wxwidgets.cfg: Added support for wxPropertyGrid::GetVIterator() and wxPropertyGridInterface::GetVIterator(). 2019-01-31 14:01:09 +01:00
orbitcowboy 37727057e3 wxwidgets.cfg: Added more interfaces. 2019-01-31 13:05:23 +01:00
orbitcowboy de8c0ff0e0 wxwidgets.cfg: Improved cfg for wxString::AfterFirst() and wxString::AfterLast() by adding 'const'. 2019-01-31 12:55:47 +01:00
Paul Fultz II c176775afb Avoid infinite recursion in getLifetimeVariable (#1634)
* Fix direct recursion

* Limit depth of getLifetimeVariable
2019-01-31 10:34:41 +01:00
orbitcowboy 0b7414973d wxwidgets.cfg: Do not require to use the return value of wxRect::Deflate()/wxRect::Inflate(). 2019-01-31 09:38:32 +01:00
rikardfalkeborn 7779a9186e Use valueflow in unsigned less than zero checker (#1630)
The unsigned less than zero checker looked for patterns like "<= 0".
Switching to use valueflow improves the checker in a few aspects.

First, it removes false positives where instead of 0, the code is using
0L, 0U, etc. Instead of having to hard code the different variants of 0,
valueflow handles this automatically. This fixes FPs on the form

	uint32_t value = 0xFUL;
	void f() {
  		if (value < 0u)
		{
			value = 0u;
		}
	}

where 0u was previously not recognized by the checker. This fixes #8836.

Morover, it makes it possible to handle templates properly. In commit
fa076598ad, all warnings inside templates
were made inconclusive, since the checker had no idea if "0" came from
a template parameter or not.

This makes it possible to not warn for the following case which was
reported as a FP in #3233

	template<int n> void foo(unsigned int x) {
	if (x <= n);
	}
	foo<0>();

but give a warning for the following case

	template<int n> void foo(unsigned int x) {
	if (x <= 0);
	}

Previously, both these cases gave inconclusive warnings.

Finally, it makes it possible to give warnings for the following code:

	void f(unsigned x) {
		int y = 0;
		if (x <= y) {}
	}

Also, previously, the checker for unsigned variables larger than 0, the
checker used the string of the astoperand. This meant that for code like
the following:

	void f(unsigned x, unsigned y) {
		if (x -y >= 0) {}
	}

cppcheck would output

	[unsigned-expression-positive.c] (style) Unsigned variable '-' can't be negative so it is unnecessary to test it.

using expressionString() instead gives a better error message

        [unsigned-expression-positive.c] (style) Unsigned expression 'x-z' can't be negative so it is unnecessary to test it.
2019-01-31 09:30:29 +01:00
orbitcowboy 77b23a5555 wxwidgets.cfg: Added support for more interfaces. 2019-01-31 09:19:44 +01:00
orbitcowboy 27bbcde2f1 wxwidgets.cfg: Added support for more interfaces. 2019-01-31 08:09:52 +01:00
orbitcowboy 980b42e9f6 wxwidgets.cfg: Added support for more interfaces. 2019-01-31 07:52:06 +01:00
orbitcowboy 7cf20af73a wxwidgets.cfg: Added support for more interfaces. 2019-01-31 07:48:24 +01:00
orbitcowboy ecaeb419ff wxwidgets.cfg: Added support for more functions. 2019-01-30 15:54:13 +01:00
orbitcowboy 70c8200885 wxwidgets.cfg: Added support for wxGridCellRenderer::Draw(). 2019-01-30 15:36:07 +01:00
orbitcowboy 06b155fa5d wxwidgets.cfg: Added support for wxGridCellAttr::GetAlignment() and wxDC::GetTextExtent(). 2019-01-30 14:07:06 +01:00
orbitcowboy e2e3f724b5 wxwidgets.cfg: Improved support for more interfaces. 2019-01-30 11:12:06 +01:00
amai2012 b69b0bf57e Small additions/corrections 2019-01-29 23:20:44 +01:00
Daniel Marjamäki 18e6a09739 astyle formatting
[ci skip]
2019-01-29 09:48:18 +01:00
Paul Fultz II 165a22ed0f Lifetime: Support analysis with functions that do not return a reference (#1632)
* Initial support for function return

* Add test case

* Add support for reference parameters

* Format
2019-01-29 09:47:52 +01:00
amai2012 d6d8a871ca Add/correct some interfaces. Move some standard interfaces from gnu.cfg to posix.cfg. 2019-01-28 23:26:53 +01:00
versat 62b9368b3c gtk.cfg: Add configurations for g_free() and g_malloc() / g_malloc0()
Reference: https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html
daca@home found these missing function configurations among others.
Also add tests for g_malloc() and g_free().
2019-01-28 13:47:46 +01:00
amai2012 ba4a4c3395 Add more Xt/X11 stuff 2019-01-27 23:27:46 +01:00
amai2012 0a491e166d More Additions to the X11 Intrinsics 2019-01-27 20:27:03 +01:00
Daniel Marjamäki 54cebfaf94 Fixed #8392 (false positive: "Memory leak" with malloc in if) 2019-01-27 10:27:44 +01:00
IOBYTE 606ba4fc1a template simplifier: add forward declaration map to debug output (#1629)
* template simplifier: add forward declaration map to debug output

* template simplifier: add partial specialization flag

* template simplifier: add specialization map and partial specialization map to debug output
2019-01-27 07:46:27 +01:00
Daniel Marjamäki 2bba9ac78a Fixed #8948 (False Positive: Variable 'n' is assigned a value that is never used.) 2019-01-26 21:44:07 +01:00
orbitcowboy b1797ee15b wxwidgets.cfg: Added support for SetForegroundColour() and SetBackgroundColour(). 2019-01-26 12:47:41 +01:00
orbitcowboy b33237a0eb wxwidgets.cfg: Added support for wxPropertyGridManager::SetSplitterPosition(). 2019-01-26 12:43:31 +01:00
orbitcowboy 36669d8c72 qt.cfg: Removed redundant semicolons and added support for QVERIFY2()-macro. 2019-01-26 12:26:01 +01:00
Sebastian 4ac1500c9f
Donate CPU: Add scripts under /test for testing (#1624)
Indirectly the scripts (at first the server test script) also document what needs to be done to setup a (local) server.
The productive client script can be used by everyone who wants to support daca@home, not only for testing. But i still think it is good to have it under /test to not lose too much clarity / lucidity in the /tools directory.
2019-01-26 11:40:02 +01:00
Paul Fultz II d6aaf401df Lifetime: Follow functions that return references
This will now warn for cases like this:

```cpp
int& f(int& a) {
    return a;
}
int& hello() {
    int x = 0;
    return f(x);
}
```
2019-01-26 11:03:57 +01:00
IOBYTE 68bbe15116 template simplifier: fix missing instantiation (#1627) 2019-01-26 07:08:54 +01:00
amai2012 8078890b1b Detect X11 and Motif library in daca 2019-01-25 21:47:16 +01:00
Sebastian 1066ef87e5 donate-cpu.py: Enhance library configuration detection (#1625)
Optimize checking of different includes for the same library by using a `list` instead of calling `hasInclude()` several times.
Add includes for gtk and qt library detection that were found missing when looking at several daca@home packages.
2019-01-25 21:41:28 +01:00
amai2012 786ce0ac5c Add more interfaces to posix.cfg 2019-01-25 21:39:23 +01:00
orbitcowboy 0095873528 qt.cfg: Fixed typo in QCOMPARE(a,b). 2019-01-25 20:39:10 +01:00
orbitcowboy 58aea8118a tinyxml2.cfg: Added support for XMLElement::Attribute(). 2019-01-25 20:15:01 +01:00
orbitcowboy 6b48b1610c qt.cfg: Added support for QVERIFY(expr). 2019-01-25 20:05:56 +01:00
orbitcowboy 18bce42205 qt.cfg: Added support for QCOMPARE(a,e). 2019-01-25 20:00:10 +01:00
Sebastian b1f68229f2
Library cfg tests: Enable all tests again, exclude regressions for now (#1626)
Use `--check-library` for all tests as it was done before.
Re-enable all tests in runtests.sh again.
The regressions where runtests.sh would fail are disabled via "FIXME"
comment in the inline suppression comment.
2019-01-25 17:03:16 +01:00
orbitcowboy 775eb06609 wxwidgets.cfg: Added support for some various unconfigured functions from daca@home. 2019-01-25 16:02:29 +01:00
orbitcowboy d56fd9e6fc wxwidgets.cfg: Added support for wxGrid::SetColLabelValue(). 2019-01-25 15:53:57 +01:00
orbitcowboy 662ca8d3aa wxwidgets.cfg: Added support for some various unconfigured functions from daca@home. 2019-01-25 15:51:21 +01:00
orbitcowboy 2268063797 wxwidgets.cfg: Added support for some wxPGProperty::AppendChild(). 2019-01-25 15:19:54 +01:00