Commit Graph

10591 Commits

Author SHA1 Message Date
Daniel Marjamäki 76e13c45c7 temporarily disable duplicateConditionalAssign 2019-04-25 07:44:19 +02:00
Daniel Marjamäki da46bff1b3 CheckLeakAutoVar: Use Library::isSmartPointer() 2019-04-24 15:35:47 +02:00
Daniel Marjamäki 2513c1499b Library: Added <smart-pointer> element 2019-04-24 13:06:58 +02:00
Nicodemes 272760f9ca Fix explicit constructor with default arguments check bug
Before this fix, the code:
```
class A {
    A(int, int x=3){
        x;
    }
};
```
Was considered OK.
But explicit keyword is still needed

I'm still new to open-source contributions, so I will gladly take advice.
2019-04-23 10:46:22 +02:00
Frank Zingsheim 315a093e18 CMake: Find header in externals, e.g. externals/picojson.h 2019-04-22 18:52:02 +02:00
Daniel Marjamäki 80d7df01cd Fixed #8848 (False positive memory leak if locally defined type returns a new pointer) 2019-04-22 17:37:41 +02:00
Daniel Marjamäki 0edf0b5628 Fixed #8938 (FP identicalInnerCondition) 2019-04-22 16:54:59 +02:00
Gary Leutheuser bca2dfb3f4 Implement #7597 - valueflow: global constant (#1802)
* Implement const global value flow

* Tabs to spaces
2019-04-21 06:54:32 +02:00
IOBYTE e786c6b7d4 partial fix for #8663 (Stack overflow with template disambiguator) (#1801)
This fixes simplifyUsing to remove 'typename' and 'template' from type
aliases of the form: using T3 = typename T1::template T3<T2>;

This lets the template simplifier instantiate the type alias which will
then remove the using type alias.

The crash will still happen if there is no instantiation because the
type alias will not be removed.  The type alias is what cppcheck is
crashing on after the template simplifier and that still needs fixing.
2019-04-21 06:46:16 +02:00
Daniel Marjamäki ece13033b2 dmake: use -isystem for externals to avoid compiler warnings 2019-04-19 14:52:49 +02:00
amai2012 28bc3cad92 #8913 SIGSEGV in CheckUnusedVar::checkFunctionVariableUsage - C++/CLI code 2019-04-19 13:55:25 +02:00
IOBYTE 7799ed4243 Fixed #8889 (varid on function when using trailing return type.) (#1800)
* Fixed #8889 (varid on function when using trailing return type.)

Don't set varid for trailing return type.

* Add a test for #9066 (Tokenizer::setVarId: varid set for trailing return type)
2019-04-18 20:22:39 +02:00
Daniel Marjamäki 648acd1cbf astyle formatting
[ci skip]
2019-04-18 20:21:00 +02:00
Paul Fultz II 103002578d Add check for duplicate condition and assignment (#1799)
* Add check duplicate condition and expression

* Format

* Add assign token

* Add to classInfo

* Change note messages
2019-04-18 20:20:24 +02:00
Daniel Marjamäki f26b15e5b5 astyle formatting
[ci skip]
2019-04-16 19:07:44 +02:00
Daniel Marjamäki 253f2c9e9d Fixed #9043 (false positive & regression: Variable '*s' is reassigned a value before the old one has been used.) 2019-04-16 19:07:26 +02:00
bbennetts 7287ffe781 Handle 'arguments' sections in compile_commands.json (#1797)
* Handle 'arguments' sections in compile_commands.json

Previous code assumes 'commands' exists and ill assert if t does not.

* Correct typo checking for "arguments" rather than "commands"

* Use ostringstring rather than stringstream

* Add test deominstrating graceful degradation

* Add test for parsing "arguments" rather than "commands"
2019-04-15 20:03:42 +02:00
Daniel Marjamäki 83f8d7fab9 test/cli: Improved proj2 testing. fixed bug for relative path when vs-solution is imported with relative path 2019-04-15 19:00:57 +02:00
Daniel Marjamäki 15eba39963 test/cli: better handling of absolute ignored paths 2019-04-15 08:48:58 +02:00
Paul Fultz II a90caa7e5a Fix issue 9006: False positive: Return value of function std::move() is not used.
This is trying to fix the issue by fixing the ast and symbol database. First, the ast nodes will be created for the init list and the symbol database will not mark it as a scope. I am not sure if this is the correct approach as I dont really understand how the AST part works.

It did change the AST for `try {} catch (...) {}` but that is because it incorrectly treats `try {}` as an initializer list.
2019-04-15 06:37:27 +02:00
Daniel Marjamäki a18025c95d test/cli: tweaks for running it in windows 2019-04-14 15:53:32 +02:00
Daniel Marjamäki b94f4176f1 test/cli: execute addon 2019-04-14 15:00:03 +02:00
Daniel Marjamäki 0cc2b5ca14 Fix wrong assignment 2019-04-14 07:27:23 +02:00
Daniel Marjamäki a0dd853642 analyzing one vs config (first debug config that matches platform) 2019-04-13 20:01:40 +02:00
Daniel Marjamäki d3e7d09f5c Refactoring; Reorder Settings members alphabetically. 2019-04-13 15:34:50 +02:00
Daniel Marjamäki b1b5b27b4e addons: write column in error message(s) 2019-04-13 10:22:13 +02:00
Daniel Marjamäki 1393c1c3a0 AST: Try to handle C++17 syntax 'if (init;expr)' 2019-04-12 17:35:06 +02:00
Daniel Marjamäki b04d1815ed Add -std=c++17 and allow semicolon in 'if ()' 2019-04-12 09:10:25 +02:00
Daniel Marjamäki cb06aebdab Removed --std=posix. From now on, if you use --library=posix then the posix checks will be enabled. 2019-04-12 06:47:28 +02:00
Daniel Marjamäki dfe417c369 msvc compatibility: /constexpr/const/ 2019-04-11 21:06:37 +02:00
Daniel Marjamäki c9172b169a Improved handling of paths when importing cppcheck gui project 2019-04-11 21:02:49 +02:00
Daniel Marjamäki 7ede0feb2c Better handling for excluded paths 2019-04-11 18:46:57 +02:00
Daniel Marjamäki f6f8e2c192 Travis: Try to make travis happy by temporary setting checkUnusedTemplates to true 2019-04-10 20:27:24 +02:00
Daniel Marjamäki e27b54664e appveyor: /constexpr/const/ 2019-04-10 19:15:56 +02:00
Daniel Marjamäki 2015f25a84 addon: Fix parsing of addon output 2019-04-10 18:28:46 +02:00
Daniel Marjamäki 42fdb1f826 ImportProject: checkHeaders, checkUnusedTemplates, maxCtuDepth 2019-04-10 17:04:18 +02:00
Daniel Marjamäki f6b410b469 GUI: add setting for 'checkHeaders', 'checkUnusedTemplates' and 'maxCtuDepth' to project 2019-04-10 16:49:24 +02:00
IOBYTE 3094026e59 template simplifier: fix cppcheck warnings (#1793) 2019-04-09 20:07:13 +02:00
orbitcowboy e47b6bf862 Revert quick fix: 0ace50204b (comments) 2019-04-09 08:38:08 +02:00
Daniel Marjamäki cf6f886a68 Addons: try to create dump file in cppcheck build dir 2019-04-09 07:05:41 +02:00
Daniel Marjamäki 1f68e038be Addons: Describe running addons from cppcheck in the manual 2019-04-08 21:31:38 +02:00
Daniel Marjamäki 44dcbda88e Addons: Fixed handling of addon configuration 2019-04-08 19:42:16 +02:00
Daniel Marjamäki 7610513c49 Fixed #9090 (Do not simplify standard functions) 2019-04-08 19:00:46 +02:00
Daniel Marjamäki 4bb06eceeb astyle formatting
[ci skip]
2019-04-08 18:53:14 +02:00
Márton Csordás ca3c59fa6f Add missing line feed to the generated plist output (#1792)
Add missing line feed to the generated plist output because DOS
uses carriage return and line feed as a line ending.
2019-04-08 18:09:18 +02:00
Daniel Marjamäki 50a5763cf5 Addons: Make it possible to configure any addon with json 2019-04-08 18:07:23 +02:00
Daniel Marjamäki a508b2abfd Addons: Add same handling in Windows as in Linux 2019-04-07 19:53:34 +02:00
Daniel Marjamäki bf9006737a Addons: Adding support in Cppcheck CLI to execute addons 2019-04-07 17:01:59 +02:00
orbitcowboy 64f0744242 Merge branch 'master' of https://github.com/danmar/cppcheck 2019-04-07 13:27:47 +02:00
orbitcowboy 0ace50204b Fixed a crash on garbage code. The test input was found by afl_cppcheck (type2). Unforunately, the cppcheck-fuzzer-client was crashing only when executing the binary input from afl-fuzz. Using the translated-input (C-code) did not lead to crash. I tested it with activated address/undefined behaviour sanitizer as well as non-instrumented source code. Since the translated output is too long (164 lines), i will not add it the testgarbage.cpp. 2019-04-07 13:27:33 +02:00