Commit Graph

20343 Commits

Author SHA1 Message Date
Daniel Marjamäki 9947774ab7 Removed test case with unused templates 2019-05-05 19:15:42 +02:00
Daniel Marjamäki c997186794 Only check unused templates if that is configured 2019-05-05 14:40:30 +02:00
orbitcowboy 03d7c82019 wxwidgets.cfg: Added support for more interfaces. 2019-05-05 14:37:26 +02:00
orbitcowboy 961f5c173b wxwidgets.cfg: Added support for more interfaces. 2019-05-05 14:28:22 +02:00
Daniel Marjamäki 7efcb3cfe3 astyle formatting
[ci skip]
2019-05-05 11:41:29 +02:00
Paul Fultz II 8c03be3212 Fix issue 9077: False positive: Returning pointer to local variable (#1821)
* Avoid implicit conversion for lifetimes

* Fix issue 9077

* Add more tests

* Rename function

* Fix implicit conversion with containers

* Format

* Fix crash
2019-05-05 11:40:59 +02:00
Daniel Marjamäki 5b07901253 GUI: Add C++20 option 2019-05-05 10:44:09 +02:00
Daniel Marjamäki fe04c15c9e CheckStl: Modernize the recommendations. string::starts_with is more intuitive than string::compare 2019-05-05 10:35:44 +02:00
Paul Fultz II a688df0ea1 Fix issue 9120: crash in valueflow (#1822) 2019-05-05 09:51:36 +02:00
Daniel Marjamäki 0b3342abe5 Fix Cppcheck warning 2019-05-04 20:41:43 +02:00
Daniel Marjamäki 45a343ac2d Fixed #8795 (Syntax Error: AST broken, binary operator '||' doesn't have two operands) 2019-05-04 19:05:03 +02:00
orbitcowboy d0d671761a wxwidgets.cfg: Added support for more interfaces. 2019-05-04 17:46:17 +02:00
Daniel Marjamäki d1bb0465b8 Fixed 2 Cppcheck warnings 2019-05-04 11:58:03 +02:00
Daniel Marjamäki 604a13a22b rename parameter 2019-05-04 10:36:49 +02:00
Daniel Marjamäki 5e9b7a6749 Cleanup AST tests. The best would be if 'operators' in declarations was not included at all in the AST. 2019-05-04 07:31:59 +02:00
orbitcowboy a439b5dcc6 wxwidgets.cfg: Added support for wxArtProvider::GetBitmap() 2019-05-03 23:39:16 +02:00
orbitcowboy de830d90c8 wxwidgets.cfg: Added support for wxMenuItem::SetBitmap() 2019-05-03 23:35:41 +02:00
orbitcowboy 49d1383ff4 wxwidgets.cfg: Added support for wxString::CmpNoCase() 2019-05-03 23:31:15 +02:00
orbitcowboy 456f1c60c4 wxwidgets.cfg: Added support for more interfaces. 2019-05-03 23:29:21 +02:00
orbitcowboy 92be62a6eb gnu.cfg: Ensure the return value of pipe2() is taken into account. 2019-05-03 22:15:46 +02:00
orbitcowboy cda25d7205 posix.cfg: Ensure the return value of pipe() is taken into account. 2019-05-03 22:15:30 +02:00
orbitcowboy 90c6ea53ef posix.cfg: Added support for socketpair(). 2019-05-03 20:52:10 +02:00
Daniel Marjamäki 7900902ad9 Renamed 1-helloworld helloworld 2019-05-03 20:22:35 +02:00
Daniel Marjamäki e8c0345a51 Fixed #7999 (Inline suppressions do not work under weird circumstances) 2019-05-03 20:19:28 +02:00
Daniel Marjamäki bbb5bfd432 Preprocessor: Test case has been moved to simplecpp 2019-05-03 19:27:08 +02:00
Daniel Marjamäki 81b02197e8 bump simplecpp 2019-05-03 18:50:04 +02:00
Sebastian b1cb03b560
posix.c: Add test to avoid regression of already fixed ticket #9118 (#1820)
Trac ticket: https://trac.cppcheck.net/ticket/9118
Commit that likely fixed it already:
1b74bca973
2019-05-03 16:35:15 +02:00
Sebastian 96a7c19b91
qt.cfg: Add smart pointers from Qt (#1819) 2019-05-03 13:21:49 +02:00
orbitcowboy bf358408d9 wxwidgets.cfg: Added support for more interfaces. 2019-05-03 11:57:24 +02:00
orbitcowboy deedd7493c wxwidgets.cfg: Added support for more interfaces. 2019-05-03 11:54:24 +02:00
orbitcowboy 6a281b90b4 wxwidgets.cfg: Added support for more interfaces. 2019-05-03 11:40:49 +02:00
orbitcowboy 8b157a7b9c wxwidgets.cfg: Added support for more interfaces. 2019-05-03 11:31:57 +02:00
orbitcowboy 93e963bac5 wxwidgets.cfg: Added support for more interfaces. 2019-05-03 11:28:30 +02:00
orbitcowboy 1c896fc7f7 wxwidgets.cfg: Added support for more interfaces. 2019-05-03 10:10:58 +02:00
orbitcowboy 0a3fdd3981 wxwidgets.cfg: Added support for more interfaces. 2019-05-03 10:03:06 +02:00
orbitcowboy 2635e7d073 wxwidgets.cfg: Added support for more interfaces. 2019-05-02 16:20:37 +02:00
Daniel Marjamäki 8aa68ee297 Travis: Temporary suppression of some Cppcheck warnings 2019-05-02 12:31:52 +02:00
orbitcowboy 9bd007520b wxwidgets.cfg: Added support for wxStandardPaths::MSWGetShellDir(). 2019-05-02 11:34:15 +02:00
orbitcowboy b81390c098 wxwidgets.cfg: Added support for wxCONCAT(), wxSTRINGIZE_T() and wxSTRINGSIZE() macros. 2019-05-02 11:30:30 +02:00
Paul Fultz II 091f4bcf8d Add check for unnecessary search before insertion
This will warn for cases where searching in an associative container happens before insertion, like this:

```cpp
void f1(std::set<unsigned>& s, unsigned x) {
    if (s.find(x) == s.end()) {
        s.insert(x);
    }
}

void f2(std::map<unsigned, unsigned>& m, unsigned x) {
    if (m.find(x) == m.end()) {
        m.emplace(x, 1);
    } else {
        m[x] = 1;
    }
}
```

In the case of the map it could be written as `m[x] = 1` as it will create the key if it doesnt exist, so the extra search is not necessary.

I have this marked as `performance` as it is mostly concerning performance, but there could be a copy-paste error possibly, although I dont think thats common.
2019-05-02 11:04:23 +02:00
Rikard Falkeborn 4edc248dae Fix 8840: Don't warn when returning a bitmask as bool (#1818)
A common pattern is to have a function like similar to this:

	bool isFlagSet(uint32_t f) {
		return f & 0x4;
	}

Warning that the function returns a non-boolean in this case is too
noisy, it would be better suited for a Misra check, so remove the
warnings in the most obvious cases.
2019-05-02 07:00:27 +02:00
Rikard Falkeborn 68869438be Refactoring: Use range based for loops (#1817) 2019-05-02 06:53:07 +02:00
Daniel Marjamäki 4a8fe3fb23 Revert "bump simplecpp"
This reverts commit 383e1b7cd1.
2019-05-02 06:50:29 +02:00
Daniel Marjamäki 202d38b9eb Revert "Fixed #7999 (Inline suppressions do not work under weird circumstances)"
This reverts commit 0cc41f44b8.
2019-05-02 06:50:08 +02:00
Daniel Marjamäki 0cc41f44b8 Fixed #7999 (Inline suppressions do not work under weird circumstances) 2019-05-01 20:37:36 +02:00
Daniel Marjamäki 383e1b7cd1 bump simplecpp 2019-05-01 20:36:14 +02:00
orbitcowboy 76cc8ccde2 posix.cfg: Added directions for some interfaces. 2019-05-01 19:57:10 +02:00
Daniel Marjamäki c4c847b952 Remove test case, ValueFlow will truncate and sign-extend values 2019-05-01 19:33:47 +02:00
Daniel Marjamäki 6c3c090403 Fixed #6317 (wrong simplification: int i = 1.5; return i; get simplified to: return 1.5;) 2019-05-01 17:05:16 +02:00
Rikard Falkeborn 1cc5f3abe7 Set wchar_t type (#1807)
This is necessary for valueflow to know the size, for example when
calculating sizeof(wchar_t).
2019-05-01 16:34:28 +02:00