Commit Graph

23455 Commits

Author SHA1 Message Date
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
Georgy Komarov 59c189752b
qt.cfg: Add more interfaces (#2889) 2020-11-10 15:58:16 +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 7e8f405c6d Refactoring 2020-11-09 21:14:46 +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 0ac4de2a5e Small refactoring 2020-11-09 19:30:05 +01:00
Lars Even Almaas 9d70926fcd
MISRA rule 15.4 Only one break/goto from iteration statement (#2892) 2020-11-09 15:11:08 +01:00
Daniel Marjamäki 8b52ed590e Clang import: Better handling of const methods 2020-11-09 14:50:34 +01:00
Wolfgang Stöggl a5258a3fb0
Update Qt version for release-windows to 5.15.1 (#2891)
So far, Qt version 5.12.9 has been used, which is the current default
of jurplel/install-qt-action@v2

- The update of Qt to version 5.15.1 enables displaying of
  Contents and Index of the online help, if it is installed in a
  readonly location, typically: C:\Program Files\Cppcheck\
- Qt 5.14 or newer is required to display Contents or Index,
  when the help files are readonly and the timestamp of online-help.qch
  is not correct to the second.
- This is a follow-up to commit 4a057c1
2020-11-09 11:32:33 +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
Wolfgang Stöggl 4a057c1813
Set _q_readonly property for online-help (#2890)
- Setting _q_readonly disables the timestamp check of the registered
  online-help.qch file
- This enables displaying of Contents and Index of the online help,
  even if the timestamp of online-help.qch is slightly different.
  Differences in the timestamp can result from packing online-help.qch
  in a cab file, when building the installer (1 or 2 seconds) or from
  installing the file under a different timezone under Linux etc.
- Remark: Qt 5.14 or newer is required to display Contents or Index,
  when the help files are readonly
2020-11-08 15:06:14 +01:00
Daniel Marjamäki 818e1574ad Fix Cppcheck self check warning 2020-11-08 10:57:48 +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
Daniel Marjamäki 88a35d2253 Fix CodeQL warning, Multiplication result converted to larger type 2020-11-06 19:50:05 +01:00
Daniel Marjamäki 52b88bcee3 Fix CodeQL warning, Multiplication result converted to larger type 2020-11-06 19:44:32 +01:00
amai2012 38a24703c9
Adjust Codeql2 build (#2887)
Update codeql-analysis.yml

Use manual build avoid matchcompiler but also use Z3 and PCRE
2020-11-06 19:44:06 +01:00
Georgy Komarov b75d0665a7
qt.cfg: Add interfaces with new ignoredReturnErrorCode warnings (#2885)
* qt.cfg: Add interfaces with new ignoredReturnErrorCode warnings

* Tweak xmllint configuration
2020-11-06 09:40:44 +01:00
Georgy Komarov 9cbb09076c
misra.py: Fix R7.2 crash on va_args (#2886) 2020-11-05 23:54:12 +01:00
amai2012 308b150351
Add github action for Codeql analysis (#2857)
Create codeql-analysis.yml
2020-11-05 19:41:53 +01:00
Lars Even Almaas c1212f823f
MISRA rule 7.2 Require 'u' prefix when using large unsigned integer constants (#2881) 2020-11-05 13:38:09 +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
Georgy Komarov 6f7f508967
misra.py: Fix 7.4 false positive (#2883)
Fix false positives for the function calls with "const pointer to const
value" arguments: https://trac.cppcheck.net/ticket/9967.

The variable.valueType.constness have same encoding as encoding as
ValueType::constness in Cppcheck.
2020-11-05 08:13:23 +01:00
Rikard Falkeborn c6036f8704
travis: Test htmlreport with python2 and python3 (#2862) 2020-11-04 21:03:46 +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
Lars Even Almaas 05b804d126
MISRA Rule 7.4 Check if variables assigned as string literals are const (#2866) 2020-11-04 13:45:02 +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
Oliver Stöneberg 488813d00f
added validateCFG and checkcfg targets to CMake / some refactorings (#2687) 2020-11-02 20:16:15 +01:00
Wolfgang Stöggl 4a2082e3c5
release-windows.yml: Remove redundant online-help (#2874)
The step "Create online-help" is not needed anymore since fa84b30.
The online-help files are generated now automatically during
qmake HAVE_QCHART=yes
2020-11-02 18:53:09 +01:00
Daniel Marjamäki a2a948a311 Clang Import; Better handling of derived classes 2020-11-01 20:32:42 +01:00
Daniel Marjamäki 70fc2a78e5 Fix Cppcheck warning 2020-11-01 18:04:13 +01:00
Daniel Marjamäki 9dc085c3ec Clang import: Improved handling of overloaded operators 2020-11-01 15:30:51 +01:00
Bernd Buschinski db3d9a79b5
Fix addons for installed cppcheck (#2873)
- getAddonFilePath is used with getDataDir, this works fine
  for a local build cppcheck, but not for a system installed one.
  As getDataDir reports the location relative to the executable (/usr/bin/)
  and the addons are localed in FILESDIR (/usr/share/cppcheck).
  Extend the search path by FILESDIR/addons to also make it work for
  the installed cppcheck version.
2020-11-01 15:11:28 +01:00
vilarion 2c34e660b3
Fix #9805 (False positive; Unused function (template)) (#2871)
* Add test
* Ignore templates with trailing return type as well
2020-11-01 15:10:02 +01:00