We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
any_unique.hpp
co_await mutex.async_lock()
When using co_await on unifex::async_mutex::async_lock() within the provided code, Clang-Tidy produces the warning:
co_await
unifex::async_mutex::async_lock()
1 warning generated. ../include/unifex/any_unique.hpp:210:5: warning: Undefined or garbage value returned to caller [clang-analyzer-core.uninitialized.UndefReturn] 210 | return self.impl_; | ^ /tmp/libunifex/build/test.cc:16:63: note: Calling 'g' 16 | unifex::just_from([]() -> unifex::task<void> { co_await g(); })); | ^~~ /tmp/libunifex/build/test.cc:12:12: note: Calling 'f' 12 | co_await f(); | ^~~ /tmp/libunifex/build/test.cc:8:3: note: Calling 'type::await_transform' 8 | co_await mutex.async_lock(); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/unifex/task.hpp:373:21: note: 'is_sender_for_v' is false 373 | if constexpr (is_sender_for_v<remove_cvref_t<Value>, schedule>) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/unifex/task.hpp:373:7: note: Taking false branch 373 | if constexpr (is_sender_for_v<remove_cvref_t<Value>, schedule>) { | ^ ../include/unifex/task.hpp:381:28: note: Assuming the condition is true 381 | } else if constexpr (unifex::sender<Value>) { | ^~~~~~~~~~~~~~~~~~~~~ ../include/unifex/task.hpp:381:14: note: Taking true branch 381 | } else if constexpr (unifex::sender<Value>) { | ^ ../include/unifex/task.hpp:384:13: note: Calling '_fn::operator()' 384 | with_scheduler_affinity(static_cast<Value&&>(value), this->sched_)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/unifex/with_scheduler_affinity.hpp:143:9: note: Calling copy constructor for 'any_scheduler' 143 | static_cast<Scheduler&&>(sched), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/unifex/any_scheduler.hpp:165:13: note: Calling '_copy_as_fn::operator()' 165 | : impl_(_copy_as<any_scheduler>(that.impl_).impl_) {} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/unifex/any_scheduler.hpp:41:12: note: Calling '_fn::operator()' 41 | return tag_invoke(*this, t); | ^~~~~~~~~~~~~~~~~~~~ ../include/unifex/tag_invoke.hpp:34:12: note: Calling 'tag_invoke' 34 | return tag_invoke((CPO &&) cpo, (Args &&) args...); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/unifex/detail/with_type_erased_tag_invoke.hpp:42:22: note: Calling 'get_object_address' 42 | void* objPtr = get_object_address( | ^~~~~~~~~~~~~~~~~~~ 43 | extract_this<Args...>{}((decltype(args)&&)args...)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/unifex/any_unique.hpp:210:5: note: Undefined or garbage value returned to caller 210 | return self.impl_; | ^ ~~~~~~~~~~
The following code reproduces the issue:
// test.cc #include <unifex/async_mutex.hpp> #include <unifex/just_from.hpp> #include <unifex/sync_wait.hpp> #include <unifex/task.hpp> unifex::task<void> f() { unifex::async_mutex mutex; co_await mutex.async_lock(); mutex.unlock(); } unifex::task<void> g() { co_await f(); } int main() { unifex::sync_wait( unifex::just_from([]() -> unifex::task<void> { co_await g(); })); return 0; }
clang-tidy test.cc -- -std=c++20 -DUNIFEX_NO_ASYNC_STACKS -DUNIFEX_LOG_DANGLING_STOP_CALLBACKS=OFF -I../include
The issue occurs with the following environment:
root@aa028fac873c:/tmp/libunifex/build# clang++ --version Debian clang version 19.1.4 (1~deb12u1) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm-19/bin root@aa028fac873c:/tmp/libunifex/build# clang-tidy --version Debian LLVM version 19.1.4 Optimized build. root@aa028fac873c:/tmp/libunifex/build# cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" root@aa028fac873c:/tmp/libunifex/build# git status HEAD detached at fdd2c23 nothing to commit, working tree clean
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Description
When using
co_await
onunifex::async_mutex::async_lock()
within the provided code, Clang-Tidy produces the warning:Minimal Reproducible Example
The following code reproduces the issue:
Environment
The issue occurs with the following environment:
The text was updated successfully, but these errors were encountered: