Commit Graph

10364 Commits

Author SHA1 Message Date
Daniel Marjamäki f6e7a66f42 TestConstructors: Unremove a test case 2020-11-22 18:17:40 +01:00
Daniel Marjamäki 2cd8ea83a7 Fixed #9860 (unused template not removed properly by default) 2020-11-22 16:43:36 +01:00
Wolfgang Stöggl 8ac55a8534
Add find_package(tinyxml2) to CMake builds (#2691)
So far, the cmake files of Cppcheck needed to be patched in order to
use installed tinyxml2 instead of the bundled version of tinyxml2.
- Introduce the CMake option USE_BUNDLED_TINYXML2 with a default value
  of ON. This preserves the behavior as in the past and uses the
  bundled version under externals/tinyxml2 by default.
- Usage of the installed tinyxml2 version of a system can be enabled
  now using -DUSE_BUNDLED_TINYXML2=OFF as a cmake parameter.
- Some Linux distros do not install tinyxml2*.cmake files, which are
  required to find tinyxml2 using find_package().
  Try first using find_package(tinyxml2 QUIET) and if this fails, try
  again using find_library(tinyxml2_LIBRARY tinyxml2)
2020-11-22 08:57:07 +01:00
Paul Fultz II 4a8a78a925
Fix issue 10002: False positive: constParameter with reference to pointer (#2918) 2020-11-22 08:47:24 +01:00
Paul Fultz II f6399c4cba
Fix issue 9980: FP nullPointerRedundantCheck - condition after while loop (#2912) 2020-11-20 09:36:09 +01:00
Daniel Marjamäki 9c27ba835d astyle formatting 2020-11-19 21:25:49 +01:00
Paul Fultz II e8c1c792a5
Fix issue 9987: false positive: danglingTempReference with && variable and assignment (#2907) 2020-11-17 06:52:12 +01:00
IOBYTE c4b3d4cd77
fix #9983 (TemplateSimplifier: template not simplified : f(0,0);) (#2905)
Currently template type deduction for functions only works for single
template argument single function argument functions with a literal
argument.

This patch starts to add support for single template argument multiple
function argument functions.  It correctly handles functions with
multiple arguments of the same type. It also handles a mix of template
and non-template arguments.

It does not add support for overloading non-template arguments.
It does not add support for multiple parameter template functions.
It does not add support for type deduction from variable arguments.

Co-authored-by: Robert Reif <reif@FX6840>
2020-11-17 06:51:32 +01:00
Daniel Marjamäki 22d6160624 Improve handling of decltype 2020-11-16 20:11:26 +01:00
Daniel Marjamäki c7cbe7f2d3 rename externals/tinyxml to externals/tinyxml2 2020-11-16 09:11:53 +01:00
Daniel Marjamäki 8b0699cd6a Revert "improved decltype() handling"
This reverts commit 6e8f77c519.
2020-11-15 21:32:05 +01:00
Daniel Marjamäki 6e8f77c519 improved decltype() handling 2020-11-15 20:58:17 +01:00
Daniel Marjamäki 7878eb2512 AST: Do not generate AST for decltype 2020-11-15 16:47:36 +01:00
Daniel Marjamäki 54a93c4374 Fixed #9452 (FP syntaxError - _Pragma before struct with two constructors) 2020-11-15 15:03:47 +01:00
Daniel Marjamäki 6236beeb3f Fixed #9950 (Wrong severity for redundantAssignInSwitch) 2020-11-15 13:09:28 +01:00
Ken-Patrick Lehrmann 7c3afa0b36
9955: Fix ast when throwing a cast (#2900)
```
throw (std::string)"Error: " + strerror(errnum);
```
would result in a broken ast:
```
throw
`-::
  |-std
  `-string
```
instead of
```
throw
`-+ 'signed char *'
  |-( 'container(std :: string|wstring|u16string|u32string)'
  | `-"Error: " 'const char *'
  `-( 'signed char *'
    |-strerror
    `-errnum 'signed int'
```
2020-11-15 10:37:29 +01:00
Falital 2e2d4a0055
Added Hash to plist file names (#2898) 2020-11-13 15:52:24 +01:00
Rikard Falkeborn 324e267559
getSizeOf: Handle long double (#2888) 2020-11-11 22:51:17 +01:00
Daniel Marjamäki 4330a43acb Fixed #9933 (FP: uninitvar when reading to struct) 2020-11-11 22:47:23 +01:00
Daniel Marjamäki bfa8c6fb98 Fixed cppcheck warning and corrected checkHeaders test 2020-11-11 15:28:32 +01:00
Daniel Marjamäki c95b0d2a51 Fixed #9977 (Template simplifier does not simplify in header) 2020-11-11 09:50:51 +01:00
Daniel Marjamäki 7182da5c8e astyle formatting 2020-11-11 09:17:54 +01:00
Rikard Falkeborn 829c543331
TestCondition: Don't warn when sizeof is involved (#2896) 2020-11-11 08:01:11 +01:00
IOBYTE e785885b4d
fix #9975 (Template method not simplified) (#2894) 2020-11-10 21:19:04 +01:00
Paul Fultz II bd7e915c20
Add generic reverse valueflow (#2878) 2020-11-10 16:00:55 +01:00
Ken-Patrick Lehrmann 79bdd64689
Fix false positive memoryleak (#2882)
```
int *f() {
  int *p = static_cast<int *>(realloc(nullptr, 10));
  if (!!(!p)) {
    return nullptr;
  }
  return p;
}

```
would give
```
memleak2.cpp:4:5: error: Memory leak: p [memleak]
    return nullptr;
    ^
```
Because of the additional `!!̀ .
2020-11-10 15:59:51 +01:00
Paul Fultz II ae6f611df0
Fix issue 9973: False positive: mismatching iterator container, reference (#2893) 2020-11-10 09:38:05 +01:00
Daniel Marjamäki bd5fc4b579 Clang import: Fixed variable type for pointers 2020-11-10 09:35:41 +01:00
Daniel Marjamäki bd5b2133ab Clang import: Variable::isReference() should return true for r-value references also 2020-11-09 21:00:48 +01:00
Daniel Marjamäki 5cfe2e319c Clang import: Fix Variable::isRValueReference 2020-11-09 20:44:46 +01:00
Daniel Marjamäki 970beaa79a Clang import: Fix Variable::isReference 2020-11-09 20:35:00 +01:00
Daniel Marjamäki 8b52ed590e Clang import: Better handling of const methods 2020-11-09 14:50:34 +01:00
Daniel Marjamäki 06909df8f5 Clang import: better handling of ArrayToPointerDecay implicit casts 2020-11-08 19:53:28 +01:00
Daniel Marjamäki 1c742b7995 Clang import: Handle AccessSpecDecl 2020-11-08 17:02:19 +01:00
Daniel Marjamäki 1078855029 Clang import: Full name for methods 2020-11-08 10:31:48 +01:00
Daniel Marjamäki 87323b33bd Clang import: Fixed problems when handling CXXConstructorDecl 2020-11-08 01:17:34 +01:00
Daniel Marjamäki 565e67d373 Clang import: Ignore VisibilityAttr 2020-11-07 22:27:11 +01:00
Daniel Marjamäki 1c2e480449 Proper fix for test-clang-import.py failure 2020-11-07 18:12:47 +01:00
Daniel Marjamäki b8e0cdcdb4 Travis: temporary hack to make test-clang-import.py happy 2020-11-07 17:23:56 +01:00
Daniel Marjamäki ff17d3e7c6 Clang import: Better handling of scope types 2020-11-07 15:02:36 +01:00
Georgy Komarov 80dee36e68
library: Add new warning: ignoredReturnErrorCode (#2877)
* library: Add optional "type" attribute to "use-retval"

Added an optional "type" attribute to "use-retval" nodes in the
configuration. When the return type of a function configured with
`<use-retval type="error-code"\>` node does not used, the new style
error "ignoredReturnErrorCode" will be generated.

* Fix and improve patch after the initial review

* Fixed severity level and [[nodiscard]] attribute

* Fix incorrect condition

* Remove redundant condition
2020-11-05 13:35:52 +01:00
Jesse Boswell f70e8de315
Fix #9567 (Inline suppression of unusedFunction errors not working when using compile database) (#2870) 2020-11-04 21:01:48 +01:00
uhziel aad29ddb9a
fix an error in Tokenizer::simplifyTypedef() (#2880) 2020-11-04 13:32:31 +01:00
Rikard Falkeborn a7f6621fc0
cfg: cppunit: Fix FP with compareBoolExpressionWithInt within CPPUNIT_ASSERT_EQUAL (#2879) 2020-11-04 07:48:53 +01:00
Daniel Marjamäki ae1b9cb14e SymbolDatabase: Improved function matching in C code 2020-11-04 07:17:17 +01:00
Daniel Marjamäki 198bbc8a5a Clang import: Better type handling 2020-11-03 21:37:28 +01:00
Daniel Marjamäki eece8ee66b astyle formatting 2020-11-03 21:08:21 +01:00
Daniel Marjamäki 8956ecb5fc Clang import: Fixed data for inline static functions 2020-11-03 17:52:53 +01:00
Oliver Stöneberg 98946143f6
Fix #9964 (false positive: compareBoolExpressionWithInt with ASSERT_FALSE() and --library=googletest) (#2876) 2020-11-03 10:20:25 +01:00
Daniel Marjamäki e053066d8b Clang import: Fixed Variable::mTypeStartToken and Variable::mTypeEndToken for unnamed parameters 2020-11-02 20:58:43 +01:00