Skip to content
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

Clean up MSVC warnings #1141

Merged
merged 6 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ target_compile_options(stdexec_executable_flags INTERFACE
# Silence warnings
target_compile_options(stdexec_executable_flags INTERFACE
$<$<CXX_COMPILER_ID:GNU>:-Wno-non-template-friend>
$<$<CXX_COMPILER_ID:NVHPC>:--diag_suppress177,550,111,497,554>)
$<$<CXX_COMPILER_ID:NVHPC>:--diag_suppress177,550,111,497,554>
$<$<CXX_COMPILER_ID:MSVC>:/wd4100 /wd4101 /wd4127 /wd4324 /wd4456 /wd4459>)

# Template backtrace limit
target_compile_options(stdexec_executable_flags INTERFACE
Expand Down Expand Up @@ -298,7 +299,9 @@ if (STDEXEC_ENABLE_TBB)
)
endif ()

option (STDEXEC_ENABLE_IO_URING_TESTS "Enable io_uring tests" ON)
include(CheckIncludeFileCXX)
CHECK_INCLUDE_FILE_CXX("linux/io_uring.h" STDEXEC_FOUND_IO_URING)
option (STDEXEC_ENABLE_IO_URING_TESTS "Enable io_uring tests" ${STDEXEC_FOUND_IO_URING})

option(STDEXEC_BUILD_EXAMPLES "Build stdexec examples" ON)
option(STDEXEC_BUILD_TESTS "Build stdexec tests" ON)
Expand Down
9 changes: 8 additions & 1 deletion include/exec/__detail/__bwos_lifo_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@
// Copyright (c) 2019 Maxim Egorushkin. MIT License.

#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
#if STDEXEC_MSVC()
#include <intrin.h>
#endif
namespace exec::bwos {
static inline void spin_loop_pause() noexcept {
#if STDEXEC_MSVC()
_mm_pause();
#else
__builtin_ia32_pause();
#endif
}
}
#elif defined(__arm__) || defined(__aarch64__) || defined(_M_ARM64)
Expand Down Expand Up @@ -170,7 +177,7 @@ namespace exec::bwos {
std::size_t block_size,
Allocator allocator)
: blocks_(
std::max(2ul, std::bit_ceil(num_blocks)),
std::max(static_cast<size_t>(2), std::bit_ceil(num_blocks)),
block_type(block_size, allocator),
allocator_of_t<block_type>(allocator))
, mask_(blocks_.size() - 1) {
Expand Down
8 changes: 4 additions & 4 deletions include/exec/static_thread_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ namespace exec {
++idx;
}
remote_queue* correct_queue = this_id == queue.id_ ? &queue : get_remote_queue();
std::size_t nThreads = available_parallelism();
for (std::size_t i = 0; i < nThreads; ++i) {
std::uint32_t nThreads = available_parallelism();
for (std::uint32_t i = 0; i < nThreads; ++i) {
auto [i0, iEnd] = even_share(nTasks, i, available_parallelism());
if (i0 == iEnd) {
continue;
Expand Down Expand Up @@ -676,8 +676,8 @@ namespace exec {
if (victims_.empty()) {
return {nullptr, index_};
}
std::uniform_int_distribution<std::uint32_t> dist(0, victims_.size() - 1);
std::uint32_t victimIndex = dist(rng_);
std::uniform_int_distribution<std::size_t> dist(0, victims_.size() - 1);
std::size_t victimIndex = dist(rng_);
auto& v = victims_[victimIndex];
return {v.try_steal(), v.index()};
}
Expand Down
5 changes: 0 additions & 5 deletions test/stdexec/algos/other/test_execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
* limitations under the License.
*/

#ifdef _WIN32
// __allocator is #defined in Windows SDK's shared/specstrings.h.
#include <Windows.h>
#endif

#include <atomic>
#include <catch2/catch.hpp>
#include <stdexec/execution.hpp>
Expand Down