Commit Graph

8203 Commits

Author SHA1 Message Date
Daniel Marjamäki b830f462e6 Added missingOverride checker; Function 'f' overrides function in base class but does not have the 'override' keyword. 2018-04-27 11:12:09 +02:00
Daniel Marjamäki 8304290f06 astyle formatting
[ci skip]
2018-04-27 10:29:27 +02:00
Daniel Marjamäki d15b945c9e SymbolDatabase::isFunction: Fix wrong detection function 2018-04-27 10:24:02 +02:00
Simon Martin 9fade65dbb Ticket #8281, #8417: Properly detect the end of "switch" statements to accept all legitimate uses of "case". (#1112) 2018-04-26 22:26:26 +02:00
Daniel Marjamäki 5384802e16 SymbolDatabase: Look for types in anonymous scopes 2018-04-26 17:55:04 +02:00
amai2012 55983e2a0b #8509 Uniform initialization ignored for iterator 2018-04-26 08:57:25 +02:00
Sebastian 038064436d std.cfg: Fix minsize configuration for vsprintf (#1188)
minsize with argvalue for arg 2 which is a char pointer makes no sense.
Changing it to minsize with strlen for arg 2 results in false positives
(and i think false negatives too).
In std.c a test with a valid vsprintf usage is added that would result
in a FP when minsize with strlen for arg 2 would be used.
2018-04-25 02:52:19 +02:00
IOBYTE fac851192a SymbolDatabase: fix problem where definition coudn't find forward declaration in class (#1190) 2018-04-24 22:43:47 +02:00
Daniel Marjamäki deaafd59d7 CheckClass: Undo the rule of 3 checker to avoid some warnings 2018-04-24 22:42:25 +02:00
Daniel Marjamäki 485d3e0229 CheckClass: Tweak rule of 3 checker 2018-04-24 21:45:30 +02:00
Daniel Marjamäki 6fb25dcaa4 CheckClass: Changed checker for 'copy constructor' and 'operator=' to a 'rule of 3' checker 2018-04-24 16:07:58 +02:00
Daniel Marjamäki 8310198cd5 SymbolDatabase: Refactoring and testing isImplicitlyVirtual 2018-04-24 13:53:58 +02:00
Daniel Marjamäki bb227613bb SymbolDatabase: Better type lookup in methods 2018-04-23 22:27:15 +02:00
Sebastian a61f9abbb7 Visual Studio: testrunner: Add missing testastutils (#1186) 2018-04-23 20:03:06 +02:00
orbitcowboy 92fd0595b1 Merge branch 'master' of https://www.github.com/danmar/cppcheck 2018-04-23 12:55:10 +02:00
orbitcowboy e76f1e70e8 Added tests for invalidFunctionArg. 2018-04-23 12:54:49 +02:00
Daniel Marjamäki 7c5058a42d Refactoring. Rename methods 2018-04-23 12:39:47 +02:00
Daniel Marjamäki f058d9ad08 CLI: Added more fields for --template and added a new --template-location. The gcc predefined template now matches latest gcc better. 2018-04-23 12:21:18 +02:00
Daniel Marjamäki e1db4c0e2c astyle formatting
[ci skip]
2018-04-21 13:28:31 +02:00
Simon Martin a451a5b598 Ticket #8436: Handle C++11 initializations within ternary operator. (#1174) 2018-04-21 11:30:07 +02:00
Paul Fultz II d939c6015a Report opposite expressions (#1182)
* Report opposite expressions

* Skip assignment operator
2018-04-21 11:28:21 +02:00
Paul Fultz II bad66594d6 Fix double free regression with smart pointers (#1184) 2018-04-21 11:24:19 +02:00
Daniel Marjamäki d5fb529d4f Fixed #8492 (Improve message: parameter should be passed by reference) 2018-04-20 17:33:42 +02:00
Sebastian b53c4b2032 std.cfg: Add std::vector function configurations and tests (#1180) 2018-04-19 16:41:25 +02:00
amai2012 e256ce8ea8 Add more tests for Path::isAbsolute 2018-04-19 14:35:26 +02:00
Daniel Marjamäki 7ee636b934 Refactoring: Reuse isLikelyStreamRead in isVariableChanged 2018-04-18 17:46:10 +02:00
Daniel Marjamäki 26e36a1d6b Fix FP uninitvar when stream bool operator is used 2018-04-18 16:13:24 +02:00
Sebastian 3b68c913cb
testrunner: Add testplatform to verify platform loading (#1176) 2018-04-18 16:12:35 +02:00
Daniel Marjamäki 1b4f4d7130 Fixed #8495 (False positive: boolean result used in bitwise operation when & is overloaded) 2018-04-17 22:14:17 +02:00
Daniel Marjamäki c84628c28a Fixed #8494 (False positive: serialization class overloads operator) 2018-04-17 14:23:04 +02:00
Daniel Marjamäki a4f8c44432 astyle formatting
[ci skip]
2018-04-16 12:55:37 +02:00
Paul Fultz II 2a657cfd08 Check for double frees when using smart pointers (#1172)
* Check for double frees when using smart pointers

* Some updates from feedback

* Add test for mismatch allocation

* Constants

* Check smart pointer deleter

* Switch order

* Use next

* Add owned state

* Fix handling of leaks

* Use ast for checking addressof operator

* Remove stray character

* Add a test for mismatch allocator

* Add another test for deallocating with custom function
2018-04-16 11:11:13 +02:00
Sebastian c39a3e3f1c
windows string macros: Handle _T, _TEXT and TEXT internally, add tests (#1163)
Remove TEXT() macro from windows.cfg and handle it internally where it
can be correctly simplified (Ansi vs. Unicode).
Also add handling of _TEXT() macro which is just a synonym for _T().
Add tests to verify correct function and macro simplification.
2018-04-12 08:52:31 +02:00
Sebastian a36dad918a std.cfg: Add std::make_pair() (#1165) 2018-04-11 19:16:55 +02:00
orbitcowboy ef62207ada std.cfg: Added more tests for some std::vector functions. 2018-04-11 17:21:26 +02:00
PKEuS b596b0d549 Refactorization: pass std::string directly to std::*fstream 2018-04-11 09:50:42 +02:00
PKEuS d2146844dd Refactorizations:
- Replace several push_back-calls by emplace_back
- Replace some x = x.substr(0, y) calls by x.erase(y)
2018-04-11 09:44:35 +02:00
Daniel Marjamäki a0c9de0048 Suppressions: Validate inline suppressions 2018-04-11 08:18:00 +02:00
Sebastian 3fc53eb122 std.cfg: Add std::[w]string::compare() with tests (#1162) 2018-04-10 21:07:39 +02:00
Daniel Marjamäki c5923fbdd3 astyle formatting 2018-04-09 22:21:17 +02:00
Daniel Marjamäki 8f84a493f4 remove foreach emulator 2018-04-09 22:09:10 +02:00
Daniel Marjamäki e6114a2321 glob patterns: wildcards also match path separators (like before) 2018-04-09 18:59:18 +02:00
IOBYTE 8734e4dd38 Fix SymbolDatabase bailout to also support struct (#1160) 2018-04-09 18:53:55 +02:00
Paul Fultz II d8b3fa5c70 Fix #8482: Regression with valueflow (#1159)
* Fix regression with valueflow

* Simplify test case
2018-04-09 16:13:17 +02:00
Daniel Marjamäki f677322c69 Suppressions: Allow symbol-based inline suppressions 2018-04-09 11:50:59 +02:00
PKEuS 17b4721bd2 C++17: Support "if constexpr" (by simplifying it to plain if() statement)
This might lead to complaints about constant expressions as if() statement, but should fix syntax errors.
2018-04-09 11:42:59 +02:00
PKEuS bbfcccf078 Refactorization: Replace several push_back-sequences by initializer lists 2018-04-09 09:41:24 +02:00
Daniel Marjamäki a0906140a6 Suppressions: New extensible Suppressions xml format that allow more attributes. To start with it also allows symbolName. 2018-04-09 06:43:48 +02:00
PKEuS e2002db78d Replaced make_container by C++11 initializer lists 2018-04-08 23:03:44 +02:00
Paul Fultz II 95fc84a26b Find duplicate expressions assigned to the same variable (#1129)
* Check for duplicate assignments

* Improve checking of expression

* Add more tests

* Use simple match

* Improve robustness of check

* check for null

* Reduce side effects by checking for side effects

* Improve verbose message

* Reword the error message
2018-04-08 14:43:19 +02:00