Skip to content

Commit

Permalink
Merge branch 'COVESA:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
reymor authored Jun 25, 2024
2 parents d58996c + 6c0e9db commit 96f5ece
Show file tree
Hide file tree
Showing 33 changed files with 182 additions and 167 deletions.
86 changes: 46 additions & 40 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,67 @@ name: C/C++ CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

jobs:
build_on_ubuntu_boost_183_gcc_x86:
runs-on: ubuntu-latest
steps:
- name: Ubuntu - Install boost 1.83.0 with gcc and x86
uses: MarkusJx/[email protected]
id: ubuntu-gcc-1_83-x86
with:
boost_version: 1.83.0
platform_version: 20.04
boost_install_dir: /home/runner
toolset: gcc
arch: x86
cache: true

- uses: actions/checkout@v3

- name: install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y googletest asciidoc source-highlight doxygen graphviz
- name: Run CMake config
run: cmake -Bbuild -DBOOST_ROOT=/home/runner/boost/boost/ -DGTEST_ROOT=/usr/src/googletest/googletest/ -DCMAKE_INSTALL_PREFIX=${{ runner.workspace }}/install .

- name: Build CMake
run: cmake --build build -t all build_tests doc install

- uses: actions/upload-artifact@v2
with:
name: vsomeip
path: '${{ runner.workspace }}/install/**/*'
- name: Ubuntu - Install boost 1.83.0 with gcc and x86
uses: MarkusJx/[email protected]
id: ubuntu-gcc-1_83-x86
with:
boost_version: 1.83.0
platform_version: 20.04
boost_install_dir: /home/runner
toolset: gcc
arch: x86
cache: true

- uses: actions/checkout@v4

- name: install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y googletest asciidoc source-highlight doxygen graphviz libbenchmark-dev
- name: Run CMake config
run: cmake -Bbuild -DBOOST_ROOT=/home/runner/boost/boost/ -DGTEST_ROOT=/usr/src/googletest

- name: Build CMake
run: cmake --build build --target build_tests

- name: Run Unit tests
run: ctest --test-dir build --tests-regex '^unit_' --verbose

- name: Run BenchMark tests
run: env -C build test/benchmark_tests/benchmark_tests_bin

- uses: actions/upload-artifact@v4
with:
name: vsomeip
path: "${{ runner.workspace }}/install/**/*"

build_on_windows_boost_183_gcc_x86:
runs-on: windows-latest
steps:
- name: Windows - Install boost 1.83.0 with gcc and x86
uses: MarkusJx/[email protected]
id: windows-gcc-1_83-x86
with:
- name: Windows - Install boost 1.83.0 with gcc and x86
uses: MarkusJx/[email protected]
id: windows-gcc-1_83-x86
with:
boost_version: 1.83.0
platform: windows
boost_install_dir: C:\runner
toolset: msvc
arch: x86
cache: true

- uses: actions/checkout@v3

- name: Run CMake
run: cmake -Bbuild -D BOOST_ROOT=C:\runner\boost/boost\ .
- uses: actions/checkout@v4

- name: Run CMake
run: cmake -Bbuild -D BOOST_ROOT=C:\runner\boost/boost\ .

- name: Build CMake
run: cmake --build build
- name: Build CMake
run: cmake --build build
2 changes: 1 addition & 1 deletion Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ libvsomeip_sd_srcs = [

cc_defaults {
name: "vsomeip_defaults",
cpp_std: "c++17",

cppflags: [
"-std=c++14",
"-fexceptions",
"-Wno-non-virtual-dtor",
"-Wno-unused-const-variable",
Expand Down
16 changes: 13 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ if(NOT CMAKE_BUILD_TYPE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

set(CMAKE_CXX_STANDARD 17)

# OS
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(DL_LIBRARY "dl")
Expand All @@ -73,7 +75,10 @@ endif()

set(NO_DEPRECATED "")
set(OPTIMIZE "")
set(OS_CXX_FLAGS "${OS_CXX_FLAGS} -D_GLIBCXX_USE_NANOSLEEP -pthread -O -Wall -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector-strong -fasynchronous-unwind-tables -fno-omit-frame-pointer -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Wpedantic -Werror -fPIE")
if(NOT DEFINED _FORTIFY_SOURCE)
set(_FORTIFY_SOURCE 2)
endif()
set(OS_CXX_FLAGS "${OS_CXX_FLAGS} -D_GLIBCXX_USE_NANOSLEEP -pthread -O -Wall -Wextra -Wformat -Wformat-security -Wconversion -fexceptions -fstrict-aliasing -fstack-protector-strong -fasynchronous-unwind-tables -fno-omit-frame-pointer -D_FORTIFY_SOURCE=${_FORTIFY_SOURCE} -Wformat -Wformat-security -Wpedantic -Werror -fPIE")

# force all use of std::mutex and std::recursive_mutex to use runtime init
# instead of static initialization so mutexes can be hooked to enable PI as needed
Expand Down Expand Up @@ -245,13 +250,13 @@ if (MSVC)
# add_definitions(-DVSOMEIP_DLL_COMPILATION) now it is controlled per target
SET(BOOST_WINDOWS_VERSION "0x600" CACHE STRING "Set the same Version as the Version with which Boost was built, otherwise there will be errors. (normaly 0x600 is for Windows 7 and 0x501 is for Windows XP)")
# Disable warning C4250 since it warns that the compiler is correctly following the C++ Standard. It's a "We-Are-Doing-Things-By-The-Book" notice, not a real warning.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_WIN32_WINNT=${BOOST_WINDOWS_VERSION} -DWIN32 -DBOOST_ASIO_DISABLE_IOCP /EHsc /std:c++14 /wd4250")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -D_WIN32_WINNT=${BOOST_WINDOWS_VERSION} -DWIN32 -DBOOST_ASIO_DISABLE_IOCP /EHsc /wd4250")
set(USE_RT "")
link_directories(${Boost_LIBRARY_DIR_DEBUG})
elseif(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
set(USE_RT "")
else()
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OS_CXX_FLAGS} -g ${OPTIMIZE} -std=c++14 ${NO_DEPRECATED} ${EXPORTSYMBOLS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OS_CXX_FLAGS} -g ${OPTIMIZE} ${NO_DEPRECATED} ${EXPORTSYMBOLS}")
set(USE_RT "rt")
endif()

Expand All @@ -265,6 +270,7 @@ list(SORT ${VSOMEIP_NAME}-cfg_SRC)
if (VSOMEIP_ENABLE_MULTIPLE_ROUTING_MANAGERS EQUAL 0)
add_library(${VSOMEIP_NAME}-cfg SHARED ${${VSOMEIP_NAME}-cfg_SRC})
set_target_properties (${VSOMEIP_NAME}-cfg PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
target_compile_features(${VSOMEIP_NAME}-cfg PRIVATE cxx_std_17)
if (MSVC)
set_target_properties(${VSOMEIP_NAME}-cfg PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
endif()
Expand Down Expand Up @@ -299,6 +305,7 @@ list(SORT ${VSOMEIP_NAME}_SRC)

add_library(${VSOMEIP_NAME} SHARED ${${VSOMEIP_NAME}_SRC})
set_target_properties (${VSOMEIP_NAME} PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
target_compile_features(${VSOMEIP_NAME} PRIVATE cxx_std_17)
if (MSVC)
set_target_properties(${VSOMEIP_NAME} PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION")
else ()
Expand Down Expand Up @@ -328,6 +335,7 @@ file(GLOB ${VSOMEIP_NAME}-sd_SRC
list(SORT ${VSOMEIP_NAME}-sd_SRC)

add_library(${VSOMEIP_NAME}-sd SHARED ${${VSOMEIP_NAME}-sd_SRC})
target_compile_features(${VSOMEIP_NAME}-sd PRIVATE cxx_std_17)
set_target_properties (${VSOMEIP_NAME}-sd PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
if (MSVC)
set_target_properties(${VSOMEIP_NAME}-sd PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
Expand All @@ -345,6 +353,7 @@ file(GLOB_RECURSE ${VSOMEIP_NAME}-e2e_SRC
list(SORT ${VSOMEIP_NAME}-e2e_SRC)

add_library(${VSOMEIP_NAME}-e2e SHARED ${${VSOMEIP_NAME}-e2e_SRC})
target_compile_features(${VSOMEIP_NAME}-e2e PRIVATE cxx_std_17)
set_target_properties (${VSOMEIP_NAME}-e2e PROPERTIES VERSION ${VSOMEIP_VERSION} SOVERSION ${VSOMEIP_MAJOR_VERSION})
if (MSVC)
set_target_properties(${VSOMEIP_NAME}-e2e PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
Expand Down Expand Up @@ -372,6 +381,7 @@ file(GLOB_RECURSE ${VSOMEIP_COMPAT_NAME}_SRC
list(SORT ${VSOMEIP_COMPAT_NAME}_SRC)

add_library(${VSOMEIP_COMPAT_NAME} SHARED ${${VSOMEIP_COMPAT_NAME}_SRC})
target_compile_features(${VSOMEIP_COMPAT_NAME} PRIVATE cxx_std_17)
set_target_properties (${VSOMEIP_COMPAT_NAME} PROPERTIES VERSION ${VSOMEIP_COMPAT_VERSION} SOVERSION ${VSOMEIP_COMPAT_MAJOR_VERSION})
if (MSVC)
set_target_properties(${VSOMEIP_COMPAT_NAME} PROPERTIES COMPILE_DEFINITIONS "VSOMEIP_DLL_COMPILATION_PLUGIN")
Expand Down
12 changes: 6 additions & 6 deletions examples/hello_world/hello_world_service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
#if defined ANDROID || defined __ANDROID__
#include "android/log.h"
#define LOG_TAG "hello_world_service"
#define LOG_INF(...) fprintf(stdout, __VA_ARGS__), fprintf(stdout, "\n"), (void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, ##__VA_ARGS__)
#define LOG_ERR(...) fprintf(stderr, __VA_ARGS__), fprintf(stderr, "\n"), (void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, ##__VA_ARGS__)
#define LOG_INF(...) std::fprintf(stdout, __VA_ARGS__), std::fprintf(stdout, "\n"), (void)__android_log_print(ANDROID_LOG_INFO, LOG_TAG, ##__VA_ARGS__)
#define LOG_ERR(...) std::fprintf(stderr, __VA_ARGS__), std::fprintf(stderr, "\n"), (void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, ##__VA_ARGS__)
#else
#include <cstdio>
#define LOG_INF(...) fprintf(stdout, __VA_ARGS__), fprintf(stdout, "\n")
#define LOG_ERR(...) fprintf(stderr, __VA_ARGS__), fprintf(stderr, "\n")
#define LOG_INF(...) std::fprintf(stdout, __VA_ARGS__), std::fprintf(stdout, "\n")
#define LOG_ERR(...) std::fprintf(stderr, __VA_ARGS__), std::fprintf(stderr, "\n")
#endif

static vsomeip::service_t service_id = 0x1111;
Expand All @@ -32,9 +32,9 @@ class hello_world_service {
hello_world_service() :
rtm_(vsomeip::runtime::get()),
app_(rtm_->create_application()),
stop_(false),
stop_thread_(std::bind(&hello_world_service::stop, this))
stop_(false)
{
stop_thread_ = std::thread{&hello_world_service::stop, this};
}

~hello_world_service()
Expand Down
6 changes: 3 additions & 3 deletions implementation/configuration/include/internal.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ typedef enum {
IS_SUBSCRIBING
} subscription_state_e;

const std::uint32_t MESSAGE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
inline constexpr std::uint32_t MESSAGE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();

const std::uint32_t QUEUE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
inline constexpr std::uint32_t QUEUE_SIZE_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();

#define VSOMEIP_DEFAULT_NPDU_DEBOUNCING_NANO 2 * 1000 * 1000
#define VSOMEIP_DEFAULT_NPDU_MAXIMUM_RETENTION_NANO 5 * 1000 * 1000

const std::uint32_t MAX_RECONNECTS_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();
inline constexpr std::uint32_t MAX_RECONNECTS_UNLIMITED = (std::numeric_limits<std::uint32_t>::max)();

const std::uint32_t ANY_UID = 0xFFFFFFFF;
const std::uint32_t ANY_GID = 0xFFFFFFFF;
Expand Down
10 changes: 5 additions & 5 deletions implementation/configuration/include/internal_android.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,17 @@ typedef enum {
IS_SUBSCRIBING
} subscription_state_e;

const std::uint32_t MESSAGE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
inline constexpr std::uint32_t MESSAGE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();

const std::uint32_t QUEUE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
inline constexpr std::uint32_t QUEUE_SIZE_UNLIMITED = std::numeric_limits<std::uint32_t>::max();

#define VSOMEIP_DEFAULT_NPDU_DEBOUNCING_NANO 2 * 1000 * 1000
#define VSOMEIP_DEFAULT_NPDU_MAXIMUM_RETENTION_NANO 5 * 1000 * 1000

const std::uint32_t MAX_RECONNECTS_UNLIMITED = std::numeric_limits<std::uint32_t>::max();
inline constexpr std::uint32_t MAX_RECONNECTS_UNLIMITED = std::numeric_limits<std::uint32_t>::max();

const std::uint32_t ANY_UID = 0xFFFFFFFF;
const std::uint32_t ANY_GID = 0xFFFFFFFF;
inline constexpr std::uint32_t ANY_UID = 0xFFFFFFFF;
inline constexpr std::uint32_t ANY_GID = 0xFFFFFFFF;

enum class port_type_e {
PT_OPTIONAL,
Expand Down
13 changes: 7 additions & 6 deletions implementation/configuration/src/configuration_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ bool configuration_impl::load(const std::string &_name) {

// Tell, if reading of configuration file(s) failed.
// (This may file if the logger configuration is incomplete/missing).
for (auto f : its_failed)
for (const auto& f : its_failed)
VSOMEIP_WARNING << "Reading of configuration file \""
<< f << "\" failed. Configuration may be incomplete.";

Expand All @@ -342,7 +342,7 @@ bool configuration_impl::load(const std::string &_name) {

std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();

for (auto i : its_input) {
for (const auto& i : its_input) {
if (utility::is_file(i))
VSOMEIP_INFO << "Using configuration file: \"" << i << "\".";

Expand Down Expand Up @@ -561,7 +561,7 @@ bool configuration_impl::load_data(const std::vector<configuration_element> &_el

if (is_logging_loaded_) {
logger::logger_impl::init(shared_from_this());
for (auto w : its_warnings)
for (const auto& w : its_warnings)
VSOMEIP_WARNING << w;
}
}
Expand Down Expand Up @@ -3255,16 +3255,17 @@ void configuration_impl::trim(std::string &_s) {
std::find_if(
_s.begin(),
_s.end(),
[](unsigned char ch) { return !std::isspace(ch); }
[](const auto ch) { return !std::isspace(ch); }
)
);

_s.erase(
std::find_if(
_s.rbegin(),
_s.rend(),
[](unsigned char ch) { return !std::isspace(ch); }).base(),
_s.end()
[](const auto ch) { return !std::isspace(ch); }
).base(),
_s.end()
);
}

Expand Down
3 changes: 3 additions & 0 deletions implementation/endpoints/include/endpoint_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class endpoint_impl: public virtual endpoint {
std::uint32_t _max_message_size,
configuration::endpoint_queue_limit_t _queue_limit,
const std::shared_ptr<configuration>& _configuration);
endpoint_impl(endpoint_impl<Protocol> const&) = delete;
endpoint_impl(endpoint_impl<Protocol> const&&) = delete;

virtual ~endpoint_impl();

void enable_magic_cookies();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct storage :
{
socket_type_t &socket_;
receive_handler_t handler_;
byte_t *buffer_;
std::size_t length_;
byte_t *buffer_ = nullptr;
size_t length_;
uid_t uid_;
gid_t gid_;
size_t bytes_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class local_uds_client_endpoint_impl: public local_uds_client_endpoint_base_impl
const endpoint_type& _remote,
boost::asio::io_context &_io,
const std::shared_ptr<configuration>& _configuration);
virtual ~local_uds_client_endpoint_impl();
virtual ~local_uds_client_endpoint_impl() = default;

void start();
void stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class local_uds_server_endpoint_impl: public local_uds_server_endpoint_base_impl
const std::shared_ptr<configuration>& _configuration,
bool _is_routing_endpoint);

virtual ~local_uds_server_endpoint_impl();
virtual ~local_uds_server_endpoint_impl() = default;

void start();
void stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ struct storage :
socket_type_t &socket_;
endpoint_type_t &sender_;
receive_handler_t handler_;
byte_t *buffer_;
byte_t *buffer_ = nullptr;
size_t length_;
std::uint8_t multicast_id_;
bool is_v4_;
Expand Down
2 changes: 1 addition & 1 deletion implementation/endpoints/src/endpoint_manager_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ std::shared_ptr<endpoint> endpoint_manager_base::create_local(client_t _client)
return create_local_unlocked(_client);
}

void endpoint_manager_base::remove_local(client_t _client) {
void endpoint_manager_base::remove_local(const client_t _client) {
std::shared_ptr<endpoint> its_endpoint(find_local(_client));
if (its_endpoint) {
its_endpoint->register_error_handler(nullptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ local_uds_client_endpoint_impl::local_uds_client_endpoint_impl(
is_supporting_magic_cookies_ = false;
}

local_uds_client_endpoint_impl::~local_uds_client_endpoint_impl() {

}

bool local_uds_client_endpoint_impl::is_local() const {

return true;
}

Expand Down
Loading

0 comments on commit 96f5ece

Please sign in to comment.