Commit Graph

20433 Commits

Author SHA1 Message Date
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
orbitcowboy 953895278b posix.cfg: Improved configuration fo fileno(). 2019-05-01 13:58:54 +02:00
orbitcowboy d36fcbd945 posix.cfg: Added support for dirfd(). 2019-05-01 13:54:23 +02:00
Daniel Marjamäki 6da42a3d63 Fixed #9112 (false positive: (error) Array index out of bounds; buffer 'x' is accessed at offset n.) 2019-05-01 13:00:14 +02:00
Daniel Marjamäki b3a46e72dc Fix and test syntaxError suppression 2019-05-01 11:54:13 +02:00
Daniel Marjamäki f3167865ef Travis: Remove suppression for unsignedLessThanZero warnings 2019-05-01 07:54:30 +02:00
Paul Fultz II 71bd7f68d4 Fix bug in lifetime constructors (#1816) 2019-05-01 07:52:52 +02:00
Daniel Marjamäki 7260bdd6d8 Fixed Cppcheck shadowVar warnings 2019-04-30 21:01:18 +02:00
Daniel Marjamäki 66064fb2bb Disable valueFlowGlobalConstVar until #9099 is fixed 2019-04-30 20:51:59 +02:00
Daniel Marjamäki 1d12136b59 Fixed Cppcheck uninitStructMember warnings 2019-04-30 20:45:48 +02:00
Daniel Marjamäki 41cf13bb7e Fixed #error in self check when __CPPCHECK__ is defined 2019-04-30 20:31:46 +02:00