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

iox-#2066 Switch to C++17 #2096

Merged
merged 9 commits into from
Nov 17, 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
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build --cxxopt="-std=c++14"
build --cxxopt="-std=c++17"

# For using clang
build:clang --action_env=BAZEL_COMPILER=clang
Expand Down
2 changes: 1 addition & 1 deletion .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ hicpp-*,
# void bar(Foo& foo) {...}
#
# * rule: readability-use-anyofallof
# justification: requires C++20 and std::ranges but we only use C++14
# justification: requires C++20 and std::ranges but we only use C++17
#
# * rule: cppcoreguidelines-non-private-member-variables-in-classes
# justification: Sometimes it makes sense to have protected members to extend the base class.
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ codebase follows these rules, things are work in progress.
without heap)
2) **No exceptions are allowed**, all function and methods need to have `noexcept` in their signature
3) **No undefined behavior**, zero-cost abstract is not feasible in high safety environments
4) **Use C++14**
4) **Use C++17**
5) **[Rule of Five](https://en.cppreference.com/w/cpp/language/rule_of_three)**, if there is a non-default
destructor needed, the rule of five has to be applied
6) **Keep the [STL](https://en.wikipedia.org/wiki/Standard_Template_Library) dependencies to a minimum**,
Expand Down
1 change: 1 addition & 0 deletions doc/website/release-notes/iceoryx-unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
- Extend 'iceperf' with 'WaitSet' [#2003](https://github.com/eclipse-iceoryx/iceoryx/issues/2003)
- Create iceoryx version header for the C-binding [#1014](https://github.com/eclipse-iceoryx/iceoryx/issues/1014)
- Create macros to deprecate header and code constructs [#2057](https://github.com/eclipse-iceoryx/iceoryx/issues/2057)
- Switch to C++17 on all platforms [#2066](https://github.com/eclipse-iceoryx/iceoryx/issues/2066)

**Bugfixes:**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct CmdArgs
contents = std::make_unique<std::vector<std::string>>(arguments);
for (uint64_t i = 0; i < static_cast<uint64_t>(argc); ++i)
{
argv[i] = const_cast<char*>((*contents)[i].data());
argv[i] = (*contents)[i].data();
}
}

Expand Down
2 changes: 1 addition & 1 deletion iceoryx_hoofs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The following sections have a column labeled `internal` to indicate that the API
is not stable and can change anytime. You should never rely on it and there is no
support if it is used and breaks your code after an update.

Some modules contain STL constructs which are not part of the C++14 standard as well as convenience
Some modules contain STL constructs which are not part of the C++17 standard as well as convenience
constructs like the `NewType`. Since the classes re-implements some STL constructs,
the C++ STL coding guidelines are used for all files in this module, to help the user
to have a painless transition from the official STL types to ours.
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_platform/linux/IceoryxPlatformSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
# SPDX-License-Identifier: Apache-2.0

set_global(VAR ICEORYX_CXX_STANDARD VALUE 14)
set_global(VAR ICEORYX_CXX_STANDARD VALUE 17)
set_global(VAR ICEORYX_PLATFORM_STRING VALUE "Linux")

set_global(VAR ICEORYX_C_FLAGS VALUE )
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_platform/qnx/IceoryxPlatformSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# SPDX-License-Identifier: Apache-2.0

set_global(VAR ICEORYX_PLATFORM_STRING VALUE "QNX")
set_global(VAR ICEORYX_CXX_STANDARD VALUE 14)
set_global(VAR ICEORYX_CXX_STANDARD VALUE 17)

set_global(VAR ICEORYX_C_FLAGS VALUE )
set_global(VAR ICEORYX_CXX_FLAGS VALUE )
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_posh/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ iox_add_executable( TARGET ${PROJECT_PREFIX}_moduletests
INCLUDE_DIRECTORIES .
${CMAKE_BINARY_DIR}/generated
LIBS ${TEST_LINK_LIBS}
LIBS_LINUX dl
LIBS_LINUX dl stdc++fs
STACK_SIZE ${ICEORYX_POSH_TEST_STACK_SIZE}
FILES
${MODULETESTS_SRC}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ class PortUser_IntegrationTest : public Test
static_cast<void>(subscriberPortRouDi.dispatchCaProMessageAndGetPossibleResponse(caproMessage));

// Subscription done and ready to receive samples
while (!finished)
while (!finished || subscriberPortUser.hasNewChunks())
{
// Try to receive chunk
subscriberPortUser.tryGetChunk()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
#include <cpptoml.h>
#include <limits> // workaround for missing include in cpptoml.h

#if __cplusplus >= 201703L
#include <filesystem>
#endif

#include <fstream>
#include <string>
Expand All @@ -54,9 +52,6 @@ TEST_F(TomlGatewayConfigParserTest, ParsingFileIsSuccessful)
{
::testing::Test::RecordProperty("TEST_ID", "78b50f73-f17f-45e2-a091-aaad6c536c3a");

#if __cplusplus < 201703L
GTEST_SKIP() << "The test uses std::filesystem which is only available with C++17";
#else
auto tempFilePath = std::filesystem::temp_directory_path();
tempFilePath.append("test_gateway_config.toml");

Expand All @@ -69,15 +64,14 @@ TEST_F(TomlGatewayConfigParserTest, ParsingFileIsSuccessful)
)";
tempFile.close();

iox::roudi::ConfigFilePathString_t configFilePath{iox::TruncateToCapacity, tempFilePath.c_str()};
iox::roudi::ConfigFilePathString_t configFilePath{iox::TruncateToCapacity, tempFilePath.u8string().c_str()};

TomlGatewayConfigParser::parse(configFilePath)
.and_then([](const auto&) { GTEST_SUCCEED() << "We got a config!"; })
.or_else([](const auto& error) {
GTEST_FAIL() << "Expected a config but got error: "
<< iox::config::TOML_GATEWAY_CONFIG_FILE_PARSE_ERROR_STRINGS[static_cast<uint64_t>(error)];
});
#endif
}

class TomlGatewayConfigParserSuiteTest : public TestWithParam<CheckCharactersValidity_t>
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 @@ -34,7 +34,7 @@ if ($?) { build\hoofs\test\Debug\hoofs_moduletests.exe --gtest_filter="-*TimingT
if ($?) { build\hoofs\test\Debug\hoofs_mocktests.exe }
if ($?) { build\hoofs\test\Debug\hoofs_integrationtests.exe }
if ($?) { build\binding_c\test\Debug\binding_c_moduletests.exe --gtest_filter="-BindingC_Runtime_test.RuntimeNameLengthIsOutOfLimit:BindingC_Runtime_test.RuntimeNameIsNullptr:*TimingTest*" }
if ($?) { build\posh\test\Debug\posh_moduletests.exe --gtest_filter="-ChunkHeader_test.ChunkHeaderBinaryCompatibilityCheck:TomlGatewayConfigParserSuiteTest*:IceoryxRoudiApp_test.ConstructorCalledWithArgUniqueIdTwoTimesReturnError:IceoryxRoudiApp_test.ConstructorCalledWithArgVersionSetRunVariableToFalse:ValidTest*:ParseAllMalformedInput*:*TimingTest*:MePooSegment_test.SharedMemoryFileHandleRightsAfterConstructor" }
if ($?) { build\posh\test\Debug\posh_moduletests.exe --gtest_filter="-ChunkHeader_test.ChunkHeaderBinaryCompatibilityCheck:TomlGatewayConfigParser*:IceoryxRoudiApp_test.ConstructorCalledWithArgUniqueIdTwoTimesReturnError:IceoryxRoudiApp_test.ConstructorCalledWithArgVersionSetRunVariableToFalse:ValidTest*:ParseAllMalformedInput*:*TimingTest*:MePooSegment_test.SharedMemoryFileHandleRightsAfterConstructor" }
if ($?) { build\posh\test\Debug\posh_integrationtests.exe --gtest_filter="-ChunkBuildingBlocks_IntegrationTest.TwoHopsThreeThreadsNoSoFi:*TimingTest*" }

exit $LASTEXITCODE