12332 Commits

Author SHA1 Message Date
Oliver Stöneberg
b70e1d5461
avoid some unchecked pointer dereferences (#4811) 2023-03-02 22:05:41 +01:00
chrchr-github
215124461e
Fix #11499 FN functionConst with operator usage (#4722) 2023-03-02 21:51:58 +01:00
Oliver Stöneberg
381361629e
Preprocessor: removed unreachable ConfigurationNotChecked finding (#4790) 2023-03-02 21:50:57 +01:00
Oliver Stöneberg
bd1ae69b00
cleaned up includes based on include-what-you-use (#4599) 2023-03-02 21:50:14 +01:00
Oliver Stöneberg
8f5f06add7
some Tokenizer construction and related other cleanups (#4799) 2023-03-02 21:48:14 +01:00
chrchr-github
491299048b
Amend fix for #11449 Function call not recognized (#4838) 2023-03-02 21:45:15 +01:00
chrchr-github
51c5a79150
Fix #11586 FP ctuArrayIndex with unknown typedef (#4831) 2023-03-02 21:19:53 +01:00
chrchr-github
7f62d8ff98
Fix #11594 internalAstError with immediately instantiated enum (#4841) 2023-03-02 21:17:39 +01:00
Oliver Stöneberg
3ec4da0f8a
improved library loading in tests (#4806) 2023-03-02 21:10:51 +01:00
chrchr-github
072e822020
Set ValueType for free function returning iterator (#4837) 2023-03-02 21:01:20 +01:00
Oliver Stöneberg
514e605598
CI-unixish.yml: fixed and enabled all build steps for macos (#4832) 2023-03-02 20:54:30 +01:00
Oliver Stöneberg
b53bb36798
disallow move/copy of ScopedFile (#4723) 2023-03-02 20:44:29 +01:00
Daniel Marjamäki
cfba046408 Fixed #11593 (function pointer => false negatives (ast? valueflow?)) 2023-03-02 20:08:22 +01:00
chrchr-github
17e776861e
Get type from auto with index operator (#4826) 2023-02-28 15:05:45 +01:00
Daniel Marjamäki
80050b11dd SymbolDatabase: Fix handling of function pointer arguments 2023-02-27 15:10:25 +01:00
Daniel Marjamäki
65fc31cba9 Tokenizer: tweaked simplification of function pointers. Argument types are kept. 2023-02-26 18:03:24 +01:00
chrchr-github
a0cc35e3fa
Remove simplifyQtSignalsSlots(), update qt.cfg (#4807) 2023-02-25 15:58:57 +01:00
chrchr-github
29b651f264
Partial fix for #11543 checkLibraryFunction warning for smartpointer in container (#4781) 2023-02-25 15:47:02 +01:00
Daniel Marjamäki
af44659e06 runformat 2023-02-25 10:23:45 +01:00
Oliver Stöneberg
634881db61
testrunner: moved exception handling to TestFixture::run() and made it unconditional (#4810) 2023-02-24 21:46:07 +01:00
chrchr-github
92b42255da
Fix #11559 FN functionConst (#4795) 2023-02-24 21:44:57 +01:00
Oliver Stöneberg
da09a92b0a
test/cfg: enabled information and --inconclusive in all cases / some cleanups (#4784) 2023-02-24 21:37:56 +01:00
chrchr-github
d65cc696b0
Get type from auto with scope (#4822) 2023-02-24 21:05:26 +01:00
chrchr-github
a030970160
Fix #11531 FP constParameter with const/non-const overload / #8700 FP functionConst (#4802) 2023-02-24 07:05:18 +01:00
chrchr-github
d1e1f951df
Don't show checkLibraryNoReturn for functions with visible declaration (#11523, #11190) (#4809) 2023-02-24 06:49:28 +01:00
chrchr-github
103ff907b6
Fix #11572 Broken AST with brace-init and bitwise and (#4812) 2023-02-24 06:31:20 +01:00
Daniel Marjamäki
e5a22e3436 Revert "improved Path handling of mixed separators (#4808)"
This reverts commit 079786775899c16e1ef96731f3ada9d42b41b544.
2023-02-24 06:21:02 +01:00
chrchr-github
50c8a0dbe1
Fix #11553 pop_back on empty container is UB (#4789) 2023-02-24 01:10:19 +01:00
chrchr-github
96887c8130
Fix #11561 FN nullPointer with unnamed parameter (#4805) 2023-02-23 22:56:03 +01:00
Oliver Stöneberg
edc9cfba94
sped up TestIO a bit by only processing code as C++ if necessary (#4815) 2023-02-23 22:53:39 +01:00
Oliver Stöneberg
0797867758
improved Path handling of mixed separators (#4808) 2023-02-23 22:34:05 +01:00
Paul Fultz II
346ecdb53a
Improve valueflow after pushing to container (#4803) 2023-02-23 18:05:31 +01:00
Paul Fultz II
91d2526c41
Fix reverse analysis when modifying variable with function (#4800) 2023-02-23 18:04:16 +01:00
chrchr-github
fb88883813
Fix #11576 FP comparePointers / FN cstyleCast when taking address (#4817)
* Fix FN cstyleCast when taking address

* Fix #11576 FP comparePointers with member variable

* Use getParentLifetime()

* Fix test case number
2023-02-23 17:27:47 +01:00
Mateusz Michalak
9b62caf0ef
Fix FP#11508 (#4774)
* Add tests to cover the issue

* Set lifetime of pointer to data passed as view to SubFunction

* Move isContainerOfPointers to separate function

* Revert "Set lifetime of pointer to data passed as view to SubFunction"

This reverts commit 30dafe23e40354606776d2573653608025cae754.

* Skip propagating lifetime of iterators/pointers for views

* Add indents to test cases

* Skip all non-local values in container view lifetime
2023-02-18 17:38:51 +01:00
chrchr-github
ff0eee4d77
Fix #11558 FP knownConditionTrueFalse when checking for zero character (#4794)
* Fix #11558 FP knownConditionTrueFalse when checking for zero characte

* Fix test

* Set impossible value only for non-Boolean conditions, rename

* Fix condition
2023-02-18 17:35:12 +01:00
chrchr-github
1c11d3039d
Fix FP returnTempReference (#4793)
* Fix FP returnTempReference

* Fix mismatch between token and variable ValueType

* Format, clang-tidy

* Add test

* Format
2023-02-17 07:17:37 +01:00
chrchr-github
33a03f2c35
Don't throw internalAstError for parameter pack in template argument list (#4773) 2023-02-15 19:43:18 +01:00
chrchr-github
4f8329b2df
Fix #11545 FP unreadVariable with std::span (#4792) 2023-02-14 06:11:24 +01:00
Michael Drake
d651b6baf1
dump: Fix concurrency problem with dump files (#4757)
* dump: Fix concurrency problem with dump files

This adds the process ID for the cppcheck process to the filenames
of the .dump and .ctu-info files that the process generates.

So
  lib/cppcheck.cpp.dump
becomes
  lib/cppcheck.cpp.<PID>.dump

For example:
  lib/cppcheck.cpp.2637871.dump

The reason for this change is that if there is a buildsystem which
supports concurrency, multiple instances of cppcheck may be run for
the same file.  For example, if the same file is compiled in multiple
build variants, or for multiple targets.

If running the MISRA plugin over such a project with concurrency
enabled in the buildsystem, the plugin ends up crashing as multiple
jobs attempt to create/trample/delete the same files while other
jobs are using them.

For more information see:
    https://sourceforge.net/p/cppcheck/discussion/general/thread/02c757b4af/

* dump: Include pid in filename if dump not explicit

Only change the dump and ctu-info filenames to include the PID if
they are being generated due to an addon.

This means that existing scripts that use `--dump` will still work
if they depend on the previous naming behaviour. The more robust
filenames containing the pid will be used when the dump files are
used as an internal implementation detail for passing data to addons.

However this means that anything that does explicitly use `--dump`
will be susceptible to concurrency problems.

* test: Update addon dump file test to account for pid

This test causes a dump file to be created by enabling the misra
addon. Since the dump files now include the cppcheck process pid
this test had to be updated to account for the change.
2023-02-13 20:54:21 +01:00
Oliver Stöneberg
8c527bf132
std.cfg: added support for more container methods (#4780)
* std.cfg: added support for `std::unordered_map::count()`

* std.cfg: added support for `std::multimap::count()`

* std.cfg: added support for `std::unordered_map::insert()`

* std.cfg: added support for `std::unordered_set::insert()`

* std.cfg: added support for `std::unordered_set::emplace()`
2023-02-11 10:48:17 +01:00
chrchr-github
2379239aed
Fix FP ignoredReturnValue (#4783) 2023-02-11 10:46:04 +01:00
Oliver Stöneberg
132a5a31cf
improved setting of platform in tests / also improved platform tests (#4787)
* fixture.h: added TODO

* TestPlatform: improved tests for built-in platforms

* TestPlatform: changed tests to TODO asserts

* testfilelister.cpp: added TODO

* fixture.h: added `PLATFORM` macro to load platform / use `PLATFORM` in tests

* platform.h: corrected capitalization in `Platform::platformString(PlatformType)` and bail on unknown type

* fixture.h: fixed `readability-redundant-string-cstr` clang-tidy warning

* testplatform.cpp: fixed `functionConst` selfcheck warnings
2023-02-11 10:44:56 +01:00
Paul Fultz II
2b9af94b9a
Fix 11548: FP knownConditionTrueFalse with empty() == false (#4788)
* Fix 11548: FP knownConditionTrueFalse with empty() == false

* Format

* Fix test
2023-02-11 10:42:13 +01:00
Oliver Stöneberg
14e78e1800
greatly improved error handling in Cppcheck project file parsing / some cleanups (#4752) 2023-02-08 20:30:43 +01:00
chrchr-github
0dddba3bd6
Fix cfg for std::xstream::write() (#4778) 2023-02-08 08:59:13 +01:00
chrchr-github
271ccbc8f3
Fix FP constVariable with reference to std::array (#4777) 2023-02-08 08:25:43 +01:00
Oliver Stöneberg
66758d65f9
updated precompiled headers based on ClangBuildAnalyzer (#4775) 2023-02-08 08:19:21 +01:00
chrchr-github
1fcea5fb03
Don't crash on C++23 code (#4771) 2023-02-07 22:36:42 +01:00
chrchr-github
55292d476a
Fix #11535 "debug: Executable scope 'x' with unknown function" (#4770) 2023-02-07 22:35:58 +01:00