Commit Graph

12597 Commits

Author SHA1 Message Date
chrchr-github c6b3c56174
Improve findEnumerator() (refs #10045) (#5459) 2023-09-19 11:45:59 +02:00
Tomasz Edward Posluszny b6f60ad952
Support importing projects with project-name (#5456) 2023-09-18 13:54:20 +02:00
chrchr-github 10c1ac977c
Fix findEnumerator() with nested enum (refs #10045) (#5454) 2023-09-18 12:09:59 +02:00
chrchr-github 640b561633
Fix #11995 FP passedByValue when variable is moved from (#5455) 2023-09-17 22:32:35 +02:00
chrchr-github 0c51977f86
Fix valueFlowBailoutIncompleteVar for cast and template args (refs #10045) (#5452) 2023-09-16 13:03:14 +02:00
chrchr-github 50ba5061c7
Fix #11438 MathLib error on user defined literals (#5448)
Based on #4701, #5418

A helper function for the `isdigit()` test should be introduced on the
simplecpp side.

Co-authored-by: gerboengels <github@gerbo.org>
2023-09-15 10:00:00 +02:00
chrchr-github 5a21851bb7
Fix #11981 internalAstError with using declaration (#5446) 2023-09-14 12:14:08 +02:00
chrchr-github 775af5ec70
Add test for simplecpp#314 (#5438) 2023-09-14 09:41:39 +02:00
Paul Fultz II e6632d93e3
Fix 11983: False positive: uninitialized variable (#5443) 2023-09-13 23:27:08 +02:00
Paul Fultz II a1078f446a
Fix 11980: False positive returnDanglingLifetime returning pointer to stack array as std::string (by way of struct return value constructor) (#5445) 2023-09-13 21:26:37 +02:00
chrchr-github 844ed2bf22
Fix #11421 FP shiftTooManyBits with 64bit enum (#5406) 2023-09-13 17:59:47 +02:00
Daniel Marjamäki 7d1423c5fb
Fix #11975 (SymbolDatabase: findFunction does not find the correct function) (#5440) 2023-09-13 13:37:57 +02:00
chrchr-github 523c41a60b
Fix #11978 debug: Executable scope 'x' with unknown function. (#5437) 2023-09-13 11:39:09 +02:00
Oliver Stöneberg 98ce46a3e5
fixed #11919 - Removed deprecated command-line options `--template <template>` and `--template-format=<template>` (#5439) 2023-09-12 22:46:40 +02:00
chrchr-github 18ee859737
Fix #11976 FP incorrectStringBooleanError in assert (#5415) 2023-09-12 10:05:51 +02:00
Oliver Stöneberg e7dd490fed
adjusted tests to reduce the amount of `friend` declarations necessary (#5435)
We were calling several interface functions through their inherited
classes instead of using the base classes requiring us to add `friend`
declarations to make the implementations accessible. This adjusts
several of those cases.
2023-09-11 20:26:22 +02:00
chrchr-github 1b5b74d1f3
Fix FP knownArgument (f'up to #11927) (#5434) 2023-09-11 20:02:00 +02:00
chrchr-github c6721688e2
Fix #11929 FP knownPointerToBool with dynamic_cast (#5416) 2023-09-11 18:04:36 +02:00
chrchr-github cbbf500cd4
Fix valueFlowBailoutIncompleteVar for init list (refs #10045) (#5433) 2023-09-11 16:49:39 +02:00
chrchr-github aa281501c9
Fix #11923 FN unreadVariable (regression) (#5409) 2023-09-11 11:36:03 +02:00
Oliver Stöneberg 64cd09ab62
fixed #11917 (Default to `native` platform in Windows builds) (#5428) 2023-09-11 11:08:23 +02:00
Daniel Marjamäki 87719121bd
Fixed #11908 (SymbolDatabase: array not parsed properly 'int (**rs)[32]') (#5430) 2023-09-10 20:58:30 +02:00
chrchr-github f9b18bc9d8
Fix FP (regression): Resource handle 'fd' freed twice. [doubleFree] (#5424) 2023-09-10 20:32:55 +02:00
Oliver Stöneberg 91070ca794
utils.h: added `startsWith()` and started using it (#5381)
This makes the code much more readable. It also makes it less prone to
errors because we do not need to specify the length of the string to
match and the returnvalue is clear.

The code with the bad returnvalue check was never executed and I added a
test to show that.
2023-09-08 19:30:25 +02:00
Oliver Stöneberg 3cbbb77335
fixed #11926 (Treat MacOS filesystem as case insensitive) / TestPath: added more tests (#5412) 2023-09-08 17:33:37 +02:00
chrchr-github 4d5e84aa5f
Partial fix for #11927 FP knownArgument with unknown function type (#5413) 2023-09-08 16:41:07 +02:00
chrchr-github e4f92f6979
Fix #10837 crash/hang in expandTemplate (#5410) 2023-09-08 14:59:42 +02:00
chrchr-github 7a79366ba0
Fix #11914 Crash when checking widelands (#5404) 2023-09-05 11:12:04 +02:00
chrchr-github 03026c7304
Fix #11915 Assert failure in getTemplateNamePosition() (#5403) 2023-09-05 00:35:33 +02:00
Oliver Stöneberg ce780177b2
fixed #11910 - removed Visual Studio x86 targets from project files and builds from CI (#5397)
Windows XP Pro x64 was released on April 25, 2005 and consumer
processors supporting x86-64 have been around almost as long. Although
there are still 32-bit Windows images available there is not much of a
point maintaining support for these. We also never did any x86 builds
for non-Windows platforms in CI so we don't even know if we work on
those. You might still be able to build 32-bit binaries via CMake.
2023-09-04 19:40:13 +02:00
Oliver Stöneberg c068c74e86
CI-mingw.yml: use pre-installed MinGW / also use `lld` and `ccache` for faster builds (#4400)
This used to be one of the longest running jobs because of the slow
setup and linking. Now it will take only ~2 minutes if everything is
cached with half the time taken up by the tests.
2023-09-04 13:56:18 +02:00
Paul Fultz II fd12baaf89
Fix 11898: FP knownEmptyContainer (#5394) 2023-09-02 14:30:35 +02:00
Paul Fultz II ffbcfae988
Fix 11889: FP knownArgument with array element (#5395) 2023-09-02 14:29:38 +02:00
Paul Fultz II 6c0a5a5859
Fix 11894: FPs knownArgument with sizeof and function pointer (#5396) 2023-09-02 14:28:54 +02:00
Daniel Marjamäki 88a9119f88
Fixed #11907 (False positive: uninitialized member (mutable member, const method call)) (#5384) 2023-09-01 18:10:21 +02:00
Daniel Marjamäki c3136dbc2a
Refactor: The code to generate id string from pointer can be simplified (#5382) 2023-08-31 23:14:28 +02:00
Daniel Marjamäki 85332b2af6
Fixed #11904 (One more related fix for Scope::findFunction) (#5383) 2023-08-31 23:12:54 +02:00
Daniel Marjamäki 44c149e51b
Fix #11897 (Safety: show what checks are enabled/disabled) (#5378)
This primarily adds the corresponding report in the GUI that we have in
the command line already
2023-08-31 18:28:47 +02:00
Daniel Marjamäki 22547beaaf
CI: Add test for #11649 (#5380) 2023-08-31 16:46:20 +02:00
Daniel Marjamäki 1b061564d9
Fix #11904 (Scope::findFunction: better handling when non-virtual method with same name and arguments exists both in base class and derived class) (#5379) 2023-08-31 14:44:44 +02:00
Oliver Stöneberg ad1caa8100
report `internalError` when command execution returns errorcode / also some related cleanups and tests (#5037)
Encountered while investigating https://trac.cppcheck.net/ticket/11708.

This has been like this since the introduction of `internalError` in
b6bcdf2936 (almost ten years ago to the
day). Logging internal errors which bail out(!) of the analysis simply
to `std::cout` for them possibly never to be seen (and also not affected
the exitcode) is pretty bad IMO. They should always be visible.

I also removed the filename from the message as it is already available
(and thus redundant) and its existence should be defined by the
template.
2023-08-31 13:33:29 +02:00
Oliver Stöneberg 0fadf9ed25
sped up `Tokenizer::dump()` (#5009)
Scanning the `cli` folder with `DISABLE_VALUEFLOW=1` `Tokenizer::dump()`
will consume almost 25% of the total Ir count when an addon is
specified. This is mainly caused by the usage of `std::ostream`.

Encountered while profiling #4958.
2023-08-31 11:54:46 +02:00
Daniel Marjamäki 7c992ced4c
Fixed #11901 (Performance regression: large array with strings) (#5375)
Analysis has slowed down a lot when there are many strings in an array.
2023-08-30 19:35:43 +02:00
Daniel Marjamäki 276f017fbe
Partial fix for #11897 (Safety: show what checks are enabled/disabled) (#5372)
Example output on stdout:
```
$ ./cppcheck m1.cpp 
Checking m1.cpp ...
Active checkers: 59/177
```
2023-08-29 12:00:52 +02:00
chrchr-github 4d18f3e68b
Fix use-after-free crash when using --clang (#5367)
Still ran into an assert failure in `Tokenizer::hasIfdef()`, since some
checks assume that the tokenizer is always present. Seems like
clangimport is yet another rogue under-tested feature...
2023-08-28 09:28:47 +02:00
chrchr-github f6340c02da
Partial fix for #11894 FP knownArgument with function pointer (#5366) 2023-08-26 00:37:10 +02:00
Valentin Batz 078e967ab2
qt library: Make Q_PROPERTY a variadic macro to avoid preprocessorErrorDirective (#5370)
Treat Q_PROPERTY as variadic macro to avoid preprocessorErrorDirective
with associative container templates itroducing a "," like for example
`QHash<QString, int>`. Using templates is totally fine in the context of
a moc compiler.

The macro Q_PROPERTY is defined as variadic in
qobjectdefs.h/qtmetaobject.h when not compiling using the moc compiler.

See following references:
* For Qt 5.15
https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/kernel/qobjectdefs.h?h=5.15#n104
* For Qt 6.6
https://code.qt.io/cgit/qt/qtbase.git/tree/src/corelib/kernel/qtmetamacros.h?h=6.6#n5
2023-08-26 00:36:47 +02:00
chrchr-github 394996581e
Fix FP incorrectCharBooleanError with known condition (#5365) 2023-08-24 10:36:01 +02:00
chrchr-github 4654b6561b
Fix #11890 FP uninitvar for address taken in init list (#5360) 2023-08-24 10:35:33 +02:00
chrchr-github 5a7c7b9b5a
Fix FP incorrectStringBooleanError with unknown macro (#5364) 2023-08-23 18:06:41 +02:00