Commit Graph

26461 Commits

Author SHA1 Message Date
Paul Fultz II 436c5c8efc
Update version check in ccache.cmake so ccache can work on older cmake versions (#4567)
* Remove ccache.cmake so ccache can work on older cmake versions

* Revert "Remove ccache.cmake so ccache can work on older cmake versions"

This reverts commit 22301d41d31e72f7d1bbb68dfa601b0e3bf79b22.

* Update version
2022-11-14 12:11:31 +01:00
chrchr-github e3939d32d0
Fix crash on nullptr (#4582)
* Update tokenlist.cpp

* Update testincompletestatement.cpp

* Fix #11370 FP constStatement with lambda

* Format

* Fix crash on nullptr

* Emit syntax error

* Fix test

* Use strAt()

* Fix another crash on nullptr

* Update testconstructors.cpp

* Fix crash on nullptr

* Fix test
2022-11-13 23:04:51 +01:00
chrchr-github 701d381895
Fix #11383 FP selfAssignment: lambda capture / #11380 FP operatorEqRetRefThis (#4581)
* Fix  #11383 FP selfAssignment: lambda capture /  #11380
FP operatorEqRetRefThis

* Format
2022-11-13 21:20:44 +01:00
Daniel Marjamäki 8aec886450 runformat 2022-11-12 22:36:26 +01:00
chrchr-github e8b37235d6
Fix #11378 internalAstError regressions (iscpp11init) (#4580) 2022-11-12 22:25:05 +01:00
Daniel Marjamäki 8fb8e06003 SymbolDatabase: Set valuetype for this 2022-11-12 22:23:42 +01:00
Daniel Marjamäki 15d3e510e1 ValueFlow: throw TerminateException in valueFlowGenericForward in case analysis is terminated 2022-11-12 12:47:54 +01:00
chrchr-github 4e75c08f58
Respect [[maybe_unused]] in unusedPrivateFunction (#4579) 2022-11-10 20:58:39 +01:00
Armin Müller 7f74aad8e2
Typos found by running "codespell" (#4578) 2022-11-09 22:52:03 +01:00
chrchr-github ffc0c57562
Fix crashes on nullptr (#4575) 2022-11-09 21:56:16 +01:00
Daniel Marjamäki 0d2993408a GUI: Install link when new version is available 2022-11-08 13:33:57 +01:00
gerboengels bd95efc987
Fix internal error "Unexpected tokens in initializer" with anonymous namespace (#4577)
Co-authored-by: Gerbo Engels <gerbo.engels@ortec-finance.com>
2022-11-05 22:41:13 +01:00
Daniel Marjamäki e45e5f9f15 SymbolDatabase: fix ValueType for '&array[x]' 2022-11-05 21:22:08 +01:00
Daniel Marjamäki ecb2938e7e SymbolDatabase: Set correct ValueType when there is array-to-pointer decay 2022-11-05 17:38:31 +01:00
gerboengels d7a8f7f297
Fix couple issues with missing operatorEqVarError (#4576) 2022-11-05 10:48:34 +01:00
omarandlorraine 6488650d24
use python3 on debians too (#3812)
* use python3 on debians too

in Debian 11 which is Bullseye, /usr/bin/python is a Python2
interpreter, which means that cppcheck-htmlreport fails to run here.
So I've chenged the shebang to use python3

* change all shebangs from python to python3

Co-authored-by: Sam M W <smw@alertergroup.co.uk>
2022-11-03 22:14:30 +01:00
Daniel Marjamäki 2c53b73e1b GUI: only run misra addon in premium version. remove misra rule texts configuration that is not needed in premium. 2022-11-03 18:20:13 +01:00
Rikard Falkeborn 3c21b9cc53
Fix #11038, FP memory leak in if-statement in realloc with cast (#4572) 2022-11-03 10:37:43 +01:00
chrchr-github e4c5f36af0
Fix #11373 typedef: not simplified after inline keyword (#4574) 2022-11-02 15:15:33 +01:00
Daniel Marjamäki d19bb758bd win_installer: copy openssl from Qt tools folder 2022-11-02 12:11:13 +01:00
chrchr-github ccf2176664
Fix #11370 FP constStatement with lambda (#4570)
* Update tokenlist.cpp

* Update testincompletestatement.cpp

* Fix #11370 FP constStatement with lambda

* Format
2022-11-01 11:50:08 +01:00
chrchr-github d717e62ec3
Fix #11371 Detect assignment to temporary (#4571)
* Fix #11371 Detect assignment to temporary

* Use AST

* Warn if type definition is not seen
2022-11-01 11:46:42 +01:00
chrchr-github cf8051b7e2
Fix #11368 FP "Same value in both branches of ternary operator" on plus and minus zero (#4569)
Fix #11368 FP "Same value in both branches of ternary operator" on plus and minus zero
2022-10-31 15:18:25 +01:00
Daniel Marjamäki e8606a5e5a let --premium=misra-c-2012 also set --addon=misra. changed addons container to a set 2022-10-31 15:04:16 +01:00
Daniel Marjamäki 5c10cfd59e GUI: fix path issue with backslashes. hide non-premium setting in premium settings dialog. 2022-10-30 10:59:43 +01:00
chrchr-github 6df8573e15
Fix #11369 Syntax error. Unexpected tokens in initializer. (#4568) 2022-10-29 21:24:50 +02:00
Oliver Stöneberg 8672e12a7a
added/updated to Python 3.11 in CI (#4565)
* added/updated to Python 3.11 in CI

* specify `check-latest: true` for `actions/setup-python` so we always use the latest version

* scriptcheck.yml: added note about `shellcheck`
2022-10-25 21:53:02 +02:00
chrchr-github b4e78e8ac5
Fix #11357 new internalAstError (#4564)
* Fix #11357 new internalAstError

* Format

* Handle scope operator

* Format

* Format
2022-10-25 21:50:37 +02:00
chrchr-github 3b5601dbea
Add tests for #9327, #10597 (#4566)
* Add test for #9327

* Add test for #10597
2022-10-25 19:41:48 +02:00
Daniel Marjamäki 4634a72fe0 GUI: some more tweaks for 'check for updates' 2022-10-24 15:17:36 +02:00
Daniel Marjamäki fba70683bc GUI: Add setting 'Check for updates' 2022-10-22 20:27:24 +02:00
chrchr-github 13d81cdd58
#11351 follow-up: Handle more variadic template arguments (#4554)
* Update templatesimplifier.cpp

* Add tests
2022-10-22 00:28:33 +02:00
chrchr-github ae16aab997
Handle simple typedefs (#4558) 2022-10-22 00:28:05 +02:00
Oliver Stöneberg 0fc142c18f
CI-unixish-docker.yml: added `ubuntu:22.10` (#4562)
* CI-unixish-docker.yml: added `ubuntu:22.10`

* CI-unixish-docker.yml: adjusted name of step
2022-10-22 00:27:42 +02:00
chrchr-github e046232535
Fix #11362 FP returnDanglingLifetime for pointer to struct member in static array (#4563)
* Fix  #11362 FP returnDanglingLifetime for pointer to struct member in static array

* Undo
2022-10-22 00:27:30 +02:00
chrchr-github 515369739c
Fix #11359 FP constStatement for function-local struct definition+initialization statement (#4561) 2022-10-22 00:27:19 +02:00
Razvan Ioan Alexe 1da37461e3
Typo found in Summary of CWE: 758 (#4553) 2022-10-20 19:11:15 +02:00
chrchr-github 7b9c99003b
Improve unreachableCodeError: handle library functions (#4560)
* Update templatesimplifier.cpp

* Add tests

* Improve unreachableCodeError message

* Update templatesimplifier.cpp

* Add tests

* Improve unreachableCodeError message

* Revert "Update templatesimplifier.cpp"

This reverts commit 3fd152ed4063772a5f162bd985c3d91bcc65eb55.

* Revert "Add tests"

This reverts commit e760ab51e66a0a2c3a0250caf4cf3b745db44d10.

* Improve unreachableCodeError: handle library functions

* Fix merge
2022-10-20 07:00:36 +02:00
chrchr-github 9c7b4c9540
Improve unreachableCodeError message (#4559)
* Update templatesimplifier.cpp

* Add tests

* Improve unreachableCodeError message

* Update templatesimplifier.cpp

* Add tests

* Improve unreachableCodeError message

* Revert "Update templatesimplifier.cpp"

This reverts commit 3fd152ed4063772a5f162bd985c3d91bcc65eb55.

* Revert "Add tests"

This reverts commit e760ab51e66a0a2c3a0250caf4cf3b745db44d10.
2022-10-19 19:19:31 +02:00
chrchr-github 192c30ab1d
Fix crash in arraySize() (#4556)
* Fix  #11355 FN: arrayIndexOutOfBounds

* Fix

* Fix crash in arraySize()
2022-10-19 19:19:01 +02:00
Daniel Marjamäki 49f1282ce1 win_installer: install network dlls needed by the GUI 2022-10-19 18:23:32 +02:00
gerboengels 6a01fa9b70
#11134 Fix broken AST with (designated) initializers (#4550)
* Make control flow a bit easier, and more similar to previous code

Made similar to around line 790

* In a cpp11init, always parse only the corresponding } (#11134)

- _always_, because in some cases this was omitted (around line 790) or too strict (around line 860)
- _only_, and not following tokens which happen to be } as well (around line 1030)

* Fix unit tests: AST was incorrect, now is fixed

auto var{ {{},{}}, {} };

Old AST:
```
{
|-var
`-{
  `-,
    |-,
    | |-{
    | `-{
    `-{
```
New AST:
```
{
|-var
`-,
  |-{
  | `-,
  | | |-{
  | | `-{
  `-{
```
Compare the same example, but with `X{}` instead of just `{}`:
`auto var{ a{b{},c{}}, d{} };`
```
{
|-var
`-,
  |-{
  | |-a
  | `-,
  | | |-{
  | | | `-b
  | | `-{
  | | | `-c
  `-{
    `-d
```
This structure is similar to that of the new AST, not the old AST

* Fix unit tests: another AST was incorrect, now is fixed

Code: `auto var{{1,a::b{2,3}}, {4,a::b{5,6}}};`

Old AST:
```
{
|-var
`-{
  `-,
    |-,
    | |-1 'signed int'
    | `-{
    | | |-::
    | | | |-a
    | | | `-b
    | | `-,
    | | | |-2 'signed int'
    | | | `-3 'signed int'
    `-{
      `-,
        |-4 'signed int'
        `-{
          |-::
          | |-a
          | `-b
          `-,
            |-5 'signed int'
            `-6 'signed int'
```
New AST:
```
{
|-var
`-,
  |-{
  | `-,
  | | |-1 'signed int'
  | | `-{
  | | | |-::
  | | | | |-a
  | | | | `-b
  | | | `-,
  | | | | |-2 'signed int'
  | | | | `-3 'signed int'
  `-{
    `-,
      |-4 'signed int'
      `-{
        |-::
        | |-a
        | `-b
        `-,
          |-5 'signed int'
          `-6 'signed int'
```

* Fix unit tests: missing ; after class, resulting in incorrectly being marked as cpp11init

Because of the missing `;` after the class declaration, it was marked as a cpp11init block.
Which it isn't, and which now throws an exception

* Fix cpp11init to let unit tests pass again

The following unit tests failed on the newly introduced throws, because the code for these tests incorrectly marked some tokens as cpp11init:
TestVarID::varid_cpp11initialization
TestTokenizer::checkRefQualifiers

* Fix typo

* Improve check for void trailing return type

Observation: the only function body _not_ containing a semicolon, is a void function: something like
   auto make_zero(ini& i) -> void {
     while(--i > 0) {}
   }
Non-void function? Then it must return a value, and thus contain a semicolon, which is checked for a few lines later.

* Fix cpp11init with templated trailing return type

In the following example, vector was marked as cpp11init due to the mismatch of `%any% {`
auto f() -> std::vector<int> { return {}; }

I made the assumption that whenever "%any% {" matches, endtok must be set too.
If this assumtion doesn't hold (so "%any% {" matches, but endtok == nullptr), then the for-loop would search all the way to the end of stream. Which I guess was not the intention.

* Remove comments

Co-authored-by: Gerbo Engels <gerbo.engels@ortec-finance.com>
2022-10-19 07:25:15 +02:00
chrchr-github 5a8e55c083
Fix #11355 FN: arrayIndexOutOfBounds (#4555)
* Fix  #11355 FN: arrayIndexOutOfBounds

* Fix
2022-10-18 07:24:24 +02:00
Daniel Marjamäki 60d9a8fb54 GUI: Write better text for label, the original text might be seen a short moment. Require c++17 for building the GUI with the gui.pro. 2022-10-17 21:40:35 +02:00
chrchr-github c6c339a3e7
Fix #11351 Assert failure in templatesimplifier.cpp (#4552) 2022-10-16 19:34:25 +02:00
gerboengels 221873e69f
Fix #11319 (#4549)
In this example:
```
//template<std::same_as<int> T> // <= works
template<same_as<int> T>        // <= didn't work
void f()
{}
```
the changed line used to match to `< same_as <`, therefore skip creating links.
The `%op% %name% <` already feels a bit like a workaround. So adding the condition that $op$ shouldn't be a comparison operator, but part of the template, seemed reasonable to me

Co-authored-by: Gerbo Engels <gerbo.engels@ortec-finance.com>
2022-10-16 19:33:44 +02:00
Oliver Stöneberg 2ac9fbc1bf
include all (internal non-generated) headers in clang-tidy checks (#4100) 2022-10-16 13:51:17 +02:00
chrchr-github 3273e51fd5
Fix #10412 FN useStlAlgorithm with iterators (#4157) 2022-10-16 13:46:26 +02:00
jalegido 5628a39b82
Update mfc.cfg with more MFC macros (#4548)
* Update mfc.cfg

MFC macros

* Update mfc.cfg

Remove RUNTIME_CLASS beacuse produce this error:
Syntax Error: AST broken, binary operator '=' doesn't have two operands.

Co-authored-by: jjll <jjll@gmv.com>
2022-10-15 08:23:28 +02:00
chrchr-github 6c24d2b865
Fix #11321 FP uninitvar for in-class member initialization (#4547) 2022-10-14 19:48:27 +02:00