-
Notifications
You must be signed in to change notification settings - Fork 0
Fix CI build failures on macOS, Clang, and Windows #1
New issue
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
Merged
+176
−26
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
920f9b3
Fix CI build failures on macOS, Clang, and Windows
cursoragent 21df671
fix: force move_only_function polyfill when CMake probe fails
cursoragent 4e8622b
fix(cmake): install-safe polyfill -include for move_only_function
cursoragent 9ddfdfb
Fix CI: Clang -include polyfill path and Windows unistd in tests
cursoragent 264b348
Fix macOS/Windows CI: drop CMake -include, fix udp_loopback guard
cursoragent 7dcebc7
Fix macOS CI test failures: relax timing, drain when_any
cursoragent b57b3a0
Fix resume_on_scheduler when thread_pool is stopped
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| #pragma once | ||
|
|
||
| // Polyfill std::move_only_function when the standard library does not provide it | ||
| // (e.g. libc++ on Apple Clang in CI). Included from headers that use std::move_only_function. | ||
|
|
||
| #include <functional> | ||
| #include <memory> | ||
| #include <type_traits> | ||
| #include <utility> | ||
| #include <version> | ||
|
|
||
| #if !defined(NETLIB_POLYFILL_MOVE_ONLY_FUNCTION) && defined(__cpp_lib_move_only_function) \ | ||
| && (__cpp_lib_move_only_function >= 202110L) | ||
| // std::move_only_function is available. | ||
| #else | ||
|
|
||
| namespace rrmode::netlib::detail { | ||
|
|
||
| template<typename> | ||
| class move_only_function; | ||
|
|
||
| template<typename R, typename... Args> | ||
| class move_only_function<R(Args...)> { | ||
| struct impl_base { | ||
| virtual ~impl_base() = default; | ||
| virtual R call(Args... args) = 0; | ||
| }; | ||
|
|
||
| template<typename F> | ||
| struct impl final : impl_base { | ||
| F fn; | ||
|
|
||
| explicit impl(F&& f) : fn(std::move(f)) {} | ||
|
|
||
| R call(Args... args) override { | ||
| if constexpr (std::is_void_v<R>) { | ||
| fn(std::forward<Args>(args)...); | ||
| } else { | ||
| return fn(std::forward<Args>(args)...); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| std::unique_ptr<impl_base> impl_{}; | ||
|
|
||
| public: | ||
| move_only_function() noexcept = default; | ||
|
|
||
| move_only_function(std::nullptr_t) noexcept {} | ||
|
|
||
| move_only_function(move_only_function&& other) noexcept = default; | ||
| move_only_function& operator=(move_only_function&& other) noexcept = default; | ||
|
|
||
| move_only_function(move_only_function const&) = delete; | ||
| move_only_function& operator=(move_only_function const&) = delete; | ||
|
|
||
| template<typename F> | ||
| requires std::is_invocable_r_v<R, F&, Args...> && (!std::is_same_v<std::decay_t<F>, move_only_function>) | ||
| move_only_function(F&& f) : impl_{std::make_unique<impl<std::decay_t<F>>>(std::forward<F>(f))} {} | ||
|
|
||
| explicit operator bool() const noexcept { return static_cast<bool>(impl_); } | ||
|
|
||
| R operator()(Args... args) const { | ||
| if (!impl_) { | ||
| throw std::bad_function_call{}; | ||
| } | ||
| return impl_->call(std::forward<Args>(args)...); | ||
| } | ||
| }; | ||
|
|
||
| } // namespace rrmode::netlib::detail | ||
|
|
||
| namespace std { | ||
| using rrmode::netlib::detail::move_only_function; | ||
| } // namespace std | ||
|
|
||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.