Commit Graph

27701 Commits

Author SHA1 Message Date
Leila F. Rahman 70c844ddfb
Fix the release function in the ValuePtr class (#4490) 2022-09-24 13:25:06 +02:00
chrchr-github 2808fc615e
Fix #10057 "statement without effect" / #4779 FN unusedScopedObject does not work for classes in different namespace (#4500)
* Partial fix for #10057 unused variable without assignment not detected

* Add test for #9672

* Fix #4779 FN unusedScopedObject does not work for classes in different namespace

* Merge

* Fix #10057 "statement without effect" (unused variable without assignment) not detected

* Format
2022-09-24 12:49:37 +02:00
Oliver Stöneberg dc03a50414
some small cleanups and refactorings (#4488)
* moved `plistFile` from `ErrorLogger` to `CppCheck`

* got rid of global CWE objects

* lib/CMakeLists.txt: suppress some `-Wfloat-equal` clang warning in matchcompiled builds as well

* lib/CMakeLists.txt: moved a loop into proper block

* test/CMakeLists.txt: simplified `add_fixture`

* test/CMakeLists.txt: moved `fixture_cost`

* fixed `naming-privateMemberVariable` selfcheck warning
2022-09-24 11:59:13 +02:00
Oliver Stöneberg 872be6564b
coverage.yml: updated `codecov/codecov-action` to `v3` (#4501) 2022-09-24 08:21:51 +02:00
Oliver Stöneberg e8b9cd64fc
refs #10663 - only match start pattern in `Library::detectContainerInternal()` if necessary (#4499) 2022-09-23 20:19:56 +02:00
chrchr-github d608bec414
Fix FP with std::array (#4497)
* Fix #1655 wrong usage of std::string in memcpy

* Fix memsetClass FP

* Fix #8619 FN memset on container containing structs with containers

* Token::Match

* Use AST

* simpleMatch

* Fix FP with std::array

* simpleMatch
2022-09-23 20:18:49 +02:00
chrchr-github 0bb82b70d9
Fix #11328 FN functionStatic, functionConst with this (#4496)
* Fix #11328 FN functionStatic, functionConst with this

* Fix FP
2022-09-23 08:46:31 +02:00
Oliver Stöneberg 1a464ec5ab
donate-cpu-server.py: some minor improvements and cleanups (#4492)
* donate-cpu-server.py: bumped version

* donate-cpu-server.py: adjusted some variables names

* donate-cpu-server.py: small date string parsing improvement

* donate-cpu-server.py: added timestamp to all messages

* donate-cpu-server.py: bail out if `donated-results` folder is missing

* donate-cpu-server.py: use more detailed timestamp in logging

* donate-cpu-server.py: use `with` scopes
2022-09-22 21:20:38 +02:00
chrchr-github bb2ba53bf5
Add tests for #6504, #11177 (#4494)
* Add test for #11177

* Add test for #6504
2022-09-22 19:41:29 +02:00
Jim Kuhn f27fbdd8ab
Fix sense of test (.analyzerinfo files get placed in wrong directory) (#4486)
* Fix sense of test (.analyzerinfo files get placed in wrong directory)

* Update testanalyzerinformation.cpp

style (tabs -> spaces)
2022-09-21 17:38:23 +02:00
chrchr-github 3b07661fd3
Fix #11293 debug: CheckClass::isMemberVar found used member variable 'x' with varid 0 (#4489) 2022-09-21 17:35:10 +02:00
chrchr-github 2aca275e0c
Fix #8619 FN memset on container containing structs with containers (#4491)
* Fix #1655 wrong usage of std::string in memcpy

* Fix memsetClass FP

* Fix #8619 FN memset on container containing structs with containers

* Token::Match

* Use AST

* simpleMatch
2022-09-21 17:33:48 +02:00
chrchr-github 3644d79162
Fix duplicateConditionalAssign FP (#4484)
* Fix #9406 FN redundant assignment of Boolean variable

* Fix warning, refactor

* Update testcondition.cpp

* Fix duplicateConditionalAssign FP

* Format
2022-09-20 21:57:27 +02:00
chrchr-github 48999cf1d1
Add support for std::ofstream::precision() (#4485)
* Add support for std::copy_n/merge/stable_sort

* Format

* Add support for std::unordered_set::count(), std::push_heap

* Missing include

* Add support for std::iota

* Missing include

* Add support for std::ofstream::precision()

* Typo

* Typo
2022-09-20 17:23:18 +02:00
chrchr-github 2ce25abd81
Add support for std::iota (#4481)
* Add support for std::copy_n/merge/stable_sort

* Format

* Add support for std::unordered_set::count(), std::push_heap

* Missing include

* Add support for std::iota

* Missing include
2022-09-20 07:30:24 +02:00
chrchr-github dcb332acb0
Fix #9406 FN redundant assignment of Boolean variable (#4482)
* Fix #9406 FN redundant assignment of Boolean variable

* Fix warning, refactor

* Update testcondition.cpp
2022-09-20 07:30:12 +02:00
chrchr-github f274d499a1
Fix #11171 FP missing return statement when std::enable_if_t is used (#4480)
* Fix #11171 FP missing return statement when std::enable_if_t is used

* Add check
2022-09-19 12:47:58 +02:00
Daniel Marjamäki 8275f07692 dump: Add Token::isCast attribute 2022-09-18 12:42:58 +02:00
Paul Fultz II 09944c0b7e
Fix 11298: FP danglingTemporaryLifetime when constructing from const char* (#4479)
* Fix 11298: FP danglingTemporaryLifetime when constructing from const char*

* Format
2022-09-18 08:30:58 +02:00
Paul Fultz II de7d02293f
Fix 11308: FP accessMoved with virtual function (#4478)
* Fix 11308: FP accessMoved with virtual function

* Format
2022-09-18 08:30:06 +02:00
Paul Fultz II d34de745c0
Fix 11306: FP knownConditionTrueFalse with strlen() (#4477)
* Fix 11306: FP knownConditionTrueFalse with strlen()

* Add another test
2022-09-18 08:29:10 +02:00
Oliver Stöneberg 8126d5c1a6
improved `TestCmdlineParser` (#4475) 2022-09-17 18:50:25 +02:00
chrchr-github cb6f04a16c
Fix #11315 FP zerodivcond from enum definition / #11310 FP unassignedVariable with static variable (#4476)
* Fix #11315 FP zerodivcond from enum definition

* Simplify Boolean expression

* Fix #11310 FP unassignedVariable with static variable
2022-09-17 18:50:07 +02:00
Sergei Trofimovich 3b840e7ff1
lib/sourcelocation.h: add missing <cstdint> include (#4474)
Without the change build on upcoming gcc-13 fails as:

    In file included from lib/symboldatabase.h:28,
                     from lib/astutils.h:36,
                     from test/testastutils.cpp:20:
    lib/sourcelocation.h:52:10: error: 'uint_least32_t' in namespace 'std' does not name a type
       52 |     std::uint_least32_t m_line = 0;
          |          ^~~~~~~~~~~~~~
2022-09-16 21:36:37 +02:00
Oliver Stöneberg 21db0b98a6
donate-cpu: small `LibraryIncludes` regular expression improvements / fixed/improved tests (#4473)
* test_donate_cpu_lib.py: added more tests

* test_donate_cpu_lib.py: fixed non-working assert

* donate_cpu_lib.py: use `\t` in `LibraryIncludes` regular expressions instead of an actual TAB character

* donate_cpu_lib.py: bumped version

* donate_cpu_lib.py: use non-capturing group in `LibraryIncludes` regular expressions
2022-09-16 18:59:53 +02:00
Oliver Stöneberg 897826006e
mitigated some clang-tidy warnings in headers (#4472)
* erroritem.h: avoid `performance-no-int-to-ptr` clang-tidy warning

* suppress `readability-inconsistent-declaration-parameter-name` clang-tidy warnings for Qt signals

* tokenlist.h: mitigated `readability-make-member-function-const` clang-tidy warnings

* fixed `modernize-use-override` clang-tidy warnings in headers

* fixed `modernize-pass-by-value` clang-tidy warnings in headers

* tokenize.cpp: avoid unnecessary copy
2022-09-16 18:59:15 +02:00
Oliver Stöneberg 339484d2a1
mitigated and enabled more clang-tidy warnings (#4470)
* fixed some `performance-inefficient-string-concatenation` clang-tidy warnings

* fixed and enabled `modernize-replace-random-shuffle` clang-tidy warning

* fixed and enabled `bugprone-suspicious-string-compare` clang-tidy warning

* mitigated and enabled `readability-non-const-parameter` clang-tidy warnings

* clang-tidy.md: documented some disabled checks

* mitigated and enabled `performance-unnecessary-value-param` clang-tidy warnings
2022-09-16 18:58:59 +02:00
chrchr-github 45ccc9ba1e
Fix ctunullpointer FP (#4471) 2022-09-16 12:11:34 +02:00
Oliver Stöneberg 888721ea12
disabled some clang-tidy checks which are not necessary and slow down the analysis / documented disabled checks (#4468)
* added `clang-tidy.md` to document our `.clang-tidy` configuration

* disabled some clang-tidy checks which are not necessary and slow down the analysis
2022-09-16 07:16:35 +02:00
Oliver Stöneberg b3ec225480
iwyu.yml: use `debian:unstable` to always get latest include-what-you-use / cleaned up includes (#4466)
* iwyu.yml: use debian:unstable to always get latest include-what-you-use

* cleaned up includes based on include-what-you-use

* mitigated include-what-you-use false positives
2022-09-16 07:15:49 +02:00
chrchr-github d6aab96734
Add support for std::unordered_set::count(), std::push_heap (#4469)
* Add support for std::copy_n/merge/stable_sort

* Format

* Add support for std::unordered_set::count(), std::push_heap

* Missing include
2022-09-16 07:12:36 +02:00
Oliver Stöneberg a536d53d62
CI-unixish.yml: actually perform qmake build on macos (#4418) 2022-09-15 20:26:21 +02:00
Oliver Stöneberg 76244de640
daca: add checkLibraryCheckType report / bumped client version (#4457) 2022-09-15 20:21:40 +02:00
chrchr-github c9ade33298
Fix memsetClass FP (#4465) 2022-09-15 20:20:49 +02:00
Daniel Marjamäki f1aa9eb48f dump: add externLang attribute for tokens 2022-09-15 19:57:42 +02:00
chrchr-github 7111270d5f
Add support for std::copy_n/merge/stable_sort (#4467)
* Add support for std::copy_n/merge/stable_sort

* Format
2022-09-15 19:56:45 +02:00
chrchr-github d1386a842a
Fix #11301 debug: constStatementError not handled. (#4463)
* Fix #11301 debug: constStatementError not handled.

* Use function
2022-09-14 23:57:02 +02:00
chrchr-github 266174ddc4
Fix #10993 danglingTemporaryLifetime reported in two different locati… (#4462)
* Fix #10993 danglingTemporaryLifetime reported in two different locations for std::string_view usage

* Missing include

* Add test
2022-09-14 07:28:04 +02:00
chrchr-github 07caf17eb3
Fix #1655 wrong usage of std::string in memcpy (#4460) 2022-09-13 15:14:25 +02:00
chrchr-github e904f7341e
Fix ValueFlow crash (#4461) 2022-09-13 12:25:15 +02:00
dzid26 3887d6dde1
Missing rule-text-file to not stop the analysis (#4458) 2022-09-12 12:55:07 +02:00
Paul Fultz II 43caa32abf
Fix 9755: false negative: access of moved variable in conditional code (#4459)
* Fix 9755: false negative: access of moved variable in conditional code

* Format
2022-09-11 12:32:01 +02:00
Oliver Stöneberg 76d1b9f31a
avoid unnecessary copies with `emplace_back()` (#4450)
* avoid unnecessary copies with `emplace_back()`

* cmdlineparser.cpp: suppress `accessMoved` selfcheck false positives
2022-09-10 11:25:15 +02:00
Paul Fultz II 53820515c9
Set valueflow for container elements (#4455)
* Track elements to containers

* Format

* Handle other access methods

* Format
2022-09-10 09:26:44 +02:00
bzgec 909e9ca359
Denote 'python xxx/donate-cpu.py' line as code (#4456) 2022-09-09 23:07:58 +02:00
Oliver Stöneberg 433293b9ab
added missing version bumps to 2.10 (#4420) 2022-09-09 21:02:04 +02:00
Oliver Stöneberg a556cc3863
donate-cpu: collect some `--debug-warnings` (#4422) 2022-09-09 20:56:14 +02:00
Oliver Stöneberg 9542a7b3cc
Makefile: some cleanups / added `VERBOSE` option (#4438) 2022-09-09 15:06:40 +02:00
Paul Fultz II 117a753b10
Partial fix 11154: FN: knownConditionTrueFalse (#4453)
* Partial fix 11154: FN: knownConditionTrueFalse

* Formay

* Add more tests

* FOrmat

* Fix FP

* Add test

* Check for side effects

* Format

* Update tests

* Format
2022-09-08 22:08:38 +02:00
Oliver Stöneberg dbc05da356
fixed some clang-tidy warnings (#4435) 2022-09-08 20:01:41 +02:00