Skip to content

Commit

Permalink
Merge pull request #2065 from eclipse-iceoryx/iox-846-fix-warnings-on…
Browse files Browse the repository at this point in the history
…-windows

iox-#846 Fix warnings on windows
  • Loading branch information
elBoberido authored Nov 1, 2023
2 parents 6b43343 + 9bda38f commit 65f583b
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 47 deletions.
2 changes: 1 addition & 1 deletion doc/website/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ The `CMakeLists.txt` from `iceoryx_meta` can be used to easily develop iceoryx w
[Windows vcpkg-issue \#15035](https://github.com/microsoft/vcpkg/issues/15035#issuecomment-742427969.)
In this case try to rebuild the cmake files with:
```bash
cmake -Bbuild -Hiceoryx_meta -DCMAKE_SYSTEM_VERSION=10.0.18362.0
cmake -Bbuild -Hiceoryx_meta -DCMAKE_SYSTEM_VERSION="10.0.18362.0"
```
and restart the build command `cmake --build build`.

Expand Down
4 changes: 2 additions & 2 deletions iceoryx_dust/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ iox_add_executable( TARGET ${PROJECT_PREFIX}_integrationtests
FILES ${INTEGRATIONTESTS_SRC}
)

target_compile_options(${PROJECT_PREFIX}_moduletests PRIVATE ${TEST_CXX_FLAGS})
target_compile_options(${PROJECT_PREFIX}_integrationtests PRIVATE ${TEST_CXX_FLAGS})
target_compile_options(${PROJECT_PREFIX}_moduletests PRIVATE ${ICEORYX_TEST_CXX_FLAGS})
target_compile_options(${PROJECT_PREFIX}_integrationtests PRIVATE ${ICEORYX_TEST_CXX_FLAGS})
8 changes: 4 additions & 4 deletions iceoryx_hoofs/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ iox_add_executable( TARGET test_stress_sofi

add_subdirectory(stresstests/benchmark_optional_and_expected)

target_compile_options(${PROJECT_PREFIX}_moduletests PRIVATE ${TEST_CXX_FLAGS})
target_compile_options(${PROJECT_PREFIX}_mocktests PRIVATE ${TEST_CXX_FLAGS})
target_compile_options(${PROJECT_PREFIX}_integrationtests PRIVATE ${TEST_CXX_FLAGS})
target_compile_options(test_stress_sofi PRIVATE ${TEST_CXX_FLAGS})
target_compile_options(${PROJECT_PREFIX}_moduletests PRIVATE ${ICEORYX_TEST_CXX_FLAGS})
target_compile_options(${PROJECT_PREFIX}_mocktests PRIVATE ${ICEORYX_TEST_CXX_FLAGS})
target_compile_options(${PROJECT_PREFIX}_integrationtests PRIVATE ${ICEORYX_TEST_CXX_FLAGS})
target_compile_options(test_stress_sofi PRIVATE ${ICEORYX_TEST_CXX_FLAGS})
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ TYPED_TEST(ResizeableLockFreeQueueStressTest, MultiProducerMultiConsumerComplete
// verify counts
for (uint64_t i = 0; i < cycleLength; ++i)
{
EXPECT_EQ(producedCount[i], consumedCount[i]);
EXPECT_EQ(producedCount[i].load(), consumedCount[i].load());
}
}

Expand Down Expand Up @@ -552,7 +552,7 @@ TYPED_TEST(ResizeableLockFreeQueueStressTest, HybridMultiProducerMultiConsumer)

std::vector<std::thread> threads;

for (uint64_t id = 1; id <= numThreads; ++id)
for (uint32_t id = 1; id <= numThreads; ++id)
{
threads.emplace_back(work<Queue>, std::ref(q), id, std::ref(run));
}
Expand Down Expand Up @@ -769,9 +769,9 @@ TYPED_TEST(ResizeableLockFreeQueueStressTest, HybridMultiProducerMultiConsumer0v

// we expect at least one overflow in the test (since the queue is full in the beginning)
// we cannot expect one overflow in each thread due to thread scheduling
const auto numOverflows = std::accumulate(overflowCount.begin(), overflowCount.end(), 0LL);
EXPECT_GT(numOverflows, 0LL);
EXPECT_GT(numChanges, 0LL);
const auto numOverflows = std::accumulate(overflowCount.begin(), overflowCount.end(), 0ULL);
EXPECT_GT(numOverflows, 0ULL);
EXPECT_GT(numChanges, 0ULL);

// check whether all elements are there, but there is no specific ordering we can expect
// items are either in the local lists or the queue, in total we expect each count numThreads times
Expand Down
11 changes: 7 additions & 4 deletions iceoryx_meta/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,13 @@ message(" Build Properties")
message(" platform..................: " ${ICEORYX_PLATFORM_STRING})
message(" project name..............: " ${CMAKE_PROJECT_NAME})
message(" c compiler................: " ${CMAKE_C_COMPILER})
message(" c warning flags...........: " ${ICEORYX_C_WARNINGS})
message(" c++ standard..............: " ${ICEORYX_CXX_STANDARD})
message(" c++ compiler..............: " ${CMAKE_CXX_COMPILER})
message(" c++ warning flags.........: " ${ICEORYX_CXX_WARNINGS})
message(" c++ standard..............: " ${ICEORYX_CXX_STANDARD})
message(" cmake.....................: " ${CMAKE_VERSION})
message(" Flags from iceoryx platform")
message(" c flags...................: " ${ICEORYX_C_FLAGS})
message(" c warning flags...........: " ${ICEORYX_C_WARNINGS})
message(" c++ flags.................: " ${ICEORYX_CXX_FLAGS})
message(" c++ flags for tests.......: " ${ICEORYX_TEST_CXX_FLAGS})
message(" c++ warning flags.........: " ${ICEORYX_CXX_WARNINGS})
message("")

8 changes: 4 additions & 4 deletions iceoryx_platform/cmake/IceoryxPackageHelper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ Macro(iox_add_executable)
endif()

if ( IOX_USE_C_LANGUAGE )
target_compile_options(${IOX_TARGET} PRIVATE ${ICEORYX_C_WARNINGS} ${ICEORYX_SANITIZER_FLAGS})
target_compile_options(${IOX_TARGET} PRIVATE ${ICEORYX_C_FLAGS} ${ICEORYX_C_WARNINGS} ${ICEORYX_SANITIZER_FLAGS})
else()
target_compile_options(${IOX_TARGET} PRIVATE ${ICEORYX_CXX_WARNINGS} ${ICEORYX_SANITIZER_FLAGS})
target_compile_options(${IOX_TARGET} PRIVATE ${ICEORYX_CXX_FLAGS} ${ICEORYX_CXX_WARNINGS} ${ICEORYX_SANITIZER_FLAGS})
endif()

if ( IOX_STACK_SIZE )
Expand Down Expand Up @@ -329,9 +329,9 @@ Macro(iox_add_library)
set_target_properties( ${IOX_TARGET} PROPERTIES POSITION_INDEPENDENT_CODE ON )

if ( IOX_USE_C_LANGUAGE )
target_compile_options(${IOX_TARGET} PRIVATE ${ICEORYX_C_WARNINGS} ${ICEORYX_SANITIZER_FLAGS})
target_compile_options(${IOX_TARGET} PRIVATE ${ICEORYX_C_FLAGS} ${ICEORYX_C_WARNINGS} ${ICEORYX_SANITIZER_FLAGS})
else()
target_compile_options(${IOX_TARGET} PRIVATE ${ICEORYX_CXX_WARNINGS} ${ICEORYX_SANITIZER_FLAGS})
target_compile_options(${IOX_TARGET} PRIVATE ${ICEORYX_CXX_FLAGS} ${ICEORYX_CXX_WARNINGS} ${ICEORYX_SANITIZER_FLAGS})
endif()
target_link_libraries(${IOX_TARGET} PUBLIC ${IOX_PUBLIC_LIBS} PRIVATE ${IOX_PRIVATE_LIBS})
target_include_directories(${IOX_TARGET} PUBLIC ${IOX_PUBLIC_INCLUDES} PRIVATE ${IOX_PRIVATE_INCLUDES})
Expand Down
4 changes: 4 additions & 0 deletions iceoryx_platform/freertos/IceoryxPlatformSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
set_global(VAR ICEORYX_PLATFORM_STRING VALUE "FreeRTOS")
set_global(VAR ICEORYX_CXX_STANDARD VALUE 17)

set_global(VAR ICEORYX_C_FLAGS VALUE )
set_global(VAR ICEORYX_CXX_FLAGS VALUE )
set_global(VAR ICEORYX_TEST_CXX_FLAGS VALUE )

set_global(VAR ICEORYX_C_WARNINGS VALUE -W -Wall -Wextra -Wuninitialized -Wpedantic -Wstrict-aliasing -Wno-psabi) # -Wconversion and -Wcast-align cause a lot of warnings
set_global(VAR ICEORYX_CXX_WARNINGS VALUE ${ICEORYX_C_WARNINGS} -Wno-noexcept-type)

Expand Down
4 changes: 4 additions & 0 deletions iceoryx_platform/linux/IceoryxPlatformSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
set_global(VAR ICEORYX_CXX_STANDARD VALUE 14)
set_global(VAR ICEORYX_PLATFORM_STRING VALUE "Linux")

set_global(VAR ICEORYX_C_FLAGS VALUE )
set_global(VAR ICEORYX_CXX_FLAGS VALUE )
set_global(VAR ICEORYX_TEST_CXX_FLAGS VALUE )

set_global(VAR ICEORYX_C_WARNINGS VALUE -W -Wall -Wextra -Wuninitialized -Wpedantic -Wstrict-aliasing -Wcast-align -Wconversion)
set_global(VAR ICEORYX_CXX_WARNINGS VALUE ${ICEORYX_C_WARNINGS} -Wno-noexcept-type)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
Expand Down
4 changes: 4 additions & 0 deletions iceoryx_platform/mac/IceoryxPlatformSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
set_global(VAR ICEORYX_PLATFORM_STRING VALUE "MacOS")
set_global(VAR ICEORYX_CXX_STANDARD VALUE 17)

set_global(VAR ICEORYX_C_FLAGS VALUE )
set_global(VAR ICEORYX_CXX_FLAGS VALUE )
set_global(VAR ICEORYX_TEST_CXX_FLAGS VALUE )

set_global(VAR ICEORYX_C_WARNINGS VALUE -W -Wall -Wextra -Wuninitialized -Wpedantic -Wstrict-aliasing -Wcast-align -Wconversion)
set_global(VAR ICEORYX_CXX_WARNINGS VALUE ${ICEORYX_C_WARNINGS} -Wno-noexcept-type)

Expand Down
4 changes: 4 additions & 0 deletions iceoryx_platform/qnx/IceoryxPlatformSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
set_global(VAR ICEORYX_PLATFORM_STRING VALUE "QNX")
set_global(VAR ICEORYX_CXX_STANDARD VALUE 14)

set_global(VAR ICEORYX_C_FLAGS VALUE )
set_global(VAR ICEORYX_CXX_FLAGS VALUE )
set_global(VAR ICEORYX_TEST_CXX_FLAGS VALUE )

set_global(VAR ICEORYX_C_WARNINGS VALUE -W -Wall -Wextra -Wuninitialized -Wpedantic -Wstrict-aliasing -Wcast-align -Wconversion)
set_global(VAR ICEORYX_CXX_WARNINGS VALUE ${ICEORYX_C_WARNINGS} -Wno-noexcept-type -Wno-useless-cast)

Expand Down
4 changes: 4 additions & 0 deletions iceoryx_platform/unix/IceoryxPlatformSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
set_global(VAR ICEORYX_PLATFORM_STRING VALUE "Unix")
set_global(VAR ICEORYX_CXX_STANDARD VALUE 17)

set_global(VAR ICEORYX_C_FLAGS VALUE )
set_global(VAR ICEORYX_CXX_FLAGS VALUE )
set_global(VAR ICEORYX_TEST_CXX_FLAGS VALUE )

set_global(VAR ICEORYX_C_WARNINGS VALUE -W -Wall -Wextra -Wuninitialized -Wpedantic -Wstrict-aliasing -Wcast-align -Wconversion)
set_global(VAR ICEORYX_CXX_WARNINGS VALUE ${ICEORYX_C_WARNINGS} -Wno-noexcept-type)

Expand Down
4 changes: 4 additions & 0 deletions iceoryx_platform/win/IceoryxPlatformSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
set_global(VAR ICEORYX_PLATFORM_STRING VALUE "Windows")
set_global(VAR ICEORYX_CXX_STANDARD VALUE 17)

set_global(VAR ICEORYX_C_FLAGS VALUE )
set_global(VAR ICEORYX_CXX_FLAGS VALUE /EHsc)
set_global(VAR ICEORYX_TEST_CXX_FLAGS VALUE /bigobj)

set_global(VAR ICEORYX_C_WARNINGS VALUE /W0) # @todo iox-#846 set to /W1
set_global(VAR ICEORYX_CXX_WARNINGS VALUE ${ICEORYX_C_WARNINGS})

Expand Down
4 changes: 2 additions & 2 deletions iceoryx_posh/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ iox_add_executable( TARGET ${PROJECT_PREFIX}_integrationtests
${TESTUTILS_SRC}
)

target_compile_options(${PROJECT_PREFIX}_moduletests PRIVATE ${TEST_CXX_FLAGS})
target_compile_options(${PROJECT_PREFIX}_integrationtests PRIVATE ${TEST_CXX_FLAGS})
target_compile_options(${PROJECT_PREFIX}_moduletests PRIVATE ${ICEORYX_TEST_CXX_FLAGS})
target_compile_options(${PROJECT_PREFIX}_integrationtests PRIVATE ${ICEORYX_TEST_CXX_FLAGS})
Original file line number Diff line number Diff line change
Expand Up @@ -328,19 +328,18 @@ class PortUser_IntegrationTest : public Test

TIMING_TEST_F(PortUser_IntegrationTest, SingleProducer, Repeat(5), [&] {
::testing::Test::RecordProperty("TEST_ID", "bb62ac02-2b7d-4d1c-8699-9f5ba4d9bd5a");
constexpr uint32_t NUMBER_OF_PUBLISHERS_SINGLE_PRODUCER = 1U;
constexpr uint32_t INDEX_OF_PUBLISHER_SINGLE_PRODUCER = 0U;

std::thread subscribingThread(std::bind(&PortUser_IntegrationTest::subscriberThread<SubscriberPortSingleProducer>,
this,
NUMBER_OF_PUBLISHERS_SINGLE_PRODUCER,
std::ref(PortUser_IntegrationTest::m_subscriberPortRouDiSingleProducer),
std::ref(PortUser_IntegrationTest::m_subscriberPortUserSingleProducer)));
std::thread publishingThread(std::bind(&PortUser_IntegrationTest::publisherThread,
this,
INDEX_OF_PUBLISHER_SINGLE_PRODUCER,
std::ref(PortUser_IntegrationTest::m_publisherPortRouDiVector.front()),
std::ref(PortUser_IntegrationTest::m_publisherPortUserVector.front())));

std::thread subscribingThread([this] {
constexpr uint32_t NUMBER_OF_PUBLISHERS_SINGLE_PRODUCER = 1U;
subscriberThread(NUMBER_OF_PUBLISHERS_SINGLE_PRODUCER,
m_subscriberPortRouDiSingleProducer,
m_subscriberPortUserSingleProducer);
});
std::thread publishingThread([this] {
constexpr uint32_t INDEX_OF_PUBLISHER_SINGLE_PRODUCER = 0U;
publisherThread(
INDEX_OF_PUBLISHER_SINGLE_PRODUCER, m_publisherPortRouDiVector.front(), m_publisherPortUserVector.front());
});

if (subscribingThread.joinable())
{
Expand All @@ -358,21 +357,14 @@ TIMING_TEST_F(PortUser_IntegrationTest, SingleProducer, Repeat(5), [&] {

TIMING_TEST_F(PortUser_IntegrationTest, MultiProducer, Repeat(5), [&] {
::testing::Test::RecordProperty("TEST_ID", "d27279d3-26c0-4489-9208-bd361120525a");
std::thread subscribingThread(std::bind(&PortUser_IntegrationTest::subscriberThread<SubscriberPortMultiProducer>,
this,
NUMBER_OF_PUBLISHERS,
std::ref(PortUser_IntegrationTest::m_subscriberPortRouDiMultiProducer),
std::ref(PortUser_IntegrationTest::m_subscriberPortUserMultiProducer)));

std::thread subscribingThread([this] {
subscriberThread(NUMBER_OF_PUBLISHERS, m_subscriberPortRouDiMultiProducer, m_subscriberPortUserMultiProducer);
});

for (uint32_t i = 0U; i < NUMBER_OF_PUBLISHERS; i++)
{
m_publisherThreadVector.emplace_back(
std::bind(&PortUser_IntegrationTest::publisherThread,
this,
i,
std::ref(PortUser_IntegrationTest::m_publisherPortRouDiVector[i]),
std::ref(PortUser_IntegrationTest::m_publisherPortUserVector[i])));
[i, this] { publisherThread(i, m_publisherPortRouDiVector[i], m_publisherPortUserVector[i]); });
}

if (subscribingThread.joinable())
Expand Down
2 changes: 1 addition & 1 deletion tools/ci/build-test-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if ($?) { Write-Host "building sources" }

# We require the Windows SDK Version 10.0.18362.0 since a previous version had a bug which caused a fatal compilation error within iceoryx and was
# fixed with this version, see: https://github.com/microsoft/vcpkg/issues/15035#issuecomment-742427969.
if ($?) { cmake -Bbuild -Hiceoryx_meta -DBUILD_TEST=ON -DINTROSPECTION=OFF -DBINDING_C=ON -DEXAMPLES=ON -DCMAKE_CXX_FLAGS="/MP" -DCMAKE_SYSTEM_VERSION=10.0.18362.0 }
if ($?) { cmake -Bbuild -Hiceoryx_meta -DBUILD_TEST=ON -DINTROSPECTION=OFF -DBINDING_C=ON -DEXAMPLES=ON -DCMAKE_CXX_FLAGS="/MP" -DCMAKE_SYSTEM_VERSION="10.0.18362.0" }

if ($?) { cmake --build build }

Expand Down

0 comments on commit 65f583b

Please sign in to comment.