From b5f6ae0073a650ead09494a1c8222fb0d799ffd0 Mon Sep 17 00:00:00 2001 From: Miguel Barro Date: Fri, 15 Jul 2022 10:21:21 +0200 Subject: [PATCH 1/8] Refs 15174: Fixing Fast-DDS install to include the dlls in the libraries component. This pull request mandatory piggyback. Signed-off-by: Miguel Barro --- src/cpp/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index 675d0555797..5c6ef49412a 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -565,10 +565,10 @@ endif() install(TARGETS ${PROJECT_NAME} eProsima_atomic EXPORT ${PROJECT_NAME}-${FASTDDS_LINKING}-targets + COMPONENT libraries RUNTIME DESTINATION ${BIN_INSTALL_DIR}${MSVCARCH_DIR_EXTENSION} LIBRARY DESTINATION ${LIB_INSTALL_DIR}${MSVCARCH_DIR_EXTENSION} ARCHIVE DESTINATION ${LIB_INSTALL_DIR}${MSVCARCH_DIR_EXTENSION} - COMPONENT libraries ) export(TARGETS ${PROJECT_NAME} eProsima_atomic FILE ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-${FASTDDS_LINKING}-targets.cmake) From 2d43d8ef7754e695f81695e519e325df79e5c72a Mon Sep 17 00:00:00 2001 From: Miguel Barro Date: Fri, 15 Jul 2022 10:48:47 +0200 Subject: [PATCH 2/8] Refs 15174. Introduced a new CMake option to force thirdparty shared_mutex use Signed-off-by: Miguel Barro --- CMakeLists.txt | 9 +++++++++ include/fastrtps/config.h.in | 2 ++ include/fastrtps/utils/shared_mutex.hpp | 2 ++ 3 files changed, 13 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d4c1bb8e59a..105bae2f5de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,6 +207,15 @@ endif() option(SQLITE3_SUPPORT "Activate SQLITE3 support" ON) +option(USE_THIRDPARTY_SHARED_MUTEX [=[ +Forces the use of a Boost-based shared_mutex implementation +instead of the framework one. Useful to cope with issues on +framework implementations like misguided sanitizer reports. +This implementation will be used by default on frameworks +lacking the shared_mutex feature like those not fulfilling +C++17. +]=] OFF) + ############################################################################### # SHM as Default transport ############################################################################### diff --git a/include/fastrtps/config.h.in b/include/fastrtps/config.h.in index 323282dadab..2d3b28a08c7 100644 --- a/include/fastrtps/config.h.in +++ b/include/fastrtps/config.h.in @@ -62,6 +62,8 @@ #define HAVE_SQLITE3 @HAVE_SQLITE3@ #endif /* ifndef HAVE_SQLITE3 */ +// Using thirdparty shared_mutex +#cmakedefine USE_THIRDPARTY_SHARED_MUTEX // TLS support #ifndef TLS_FOUND diff --git a/include/fastrtps/utils/shared_mutex.hpp b/include/fastrtps/utils/shared_mutex.hpp index d5dd91d2e28..c9f6749a574 100644 --- a/include/fastrtps/utils/shared_mutex.hpp +++ b/include/fastrtps/utils/shared_mutex.hpp @@ -14,6 +14,8 @@ // Detect if the share_mutex feature is available #if defined(__has_include) && __has_include() && !defined(__cpp_lib_shared_mutex) || \ + /* allow users to ignore shared_mutex framework implementation */ \ + defined(USE_THIRDPARTY_SHARED_MUTEX) || \ /* deprecated procedure if the good one is not available*/ \ ( !(defined(__has_include) && __has_include()) && \ !(defined(HAVE_CXX17) && HAVE_CXX17) && __cplusplus < 201703 ) From 9cc67a70ef9bab0d3f5181e49127f9269984b698 Mon Sep 17 00:00:00 2001 From: Miguel Barro Date: Fri, 15 Jul 2022 11:07:20 +0200 Subject: [PATCH 3/8] Refs 15174. Improving shared_mutex.hpp Signed-off-by: Miguel Barro --- include/fastrtps/utils/shared_mutex.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/fastrtps/utils/shared_mutex.hpp b/include/fastrtps/utils/shared_mutex.hpp index c9f6749a574..4c4cdd3c941 100644 --- a/include/fastrtps/utils/shared_mutex.hpp +++ b/include/fastrtps/utils/shared_mutex.hpp @@ -355,9 +355,8 @@ shared_lock::try_lock() namespace eprosima { -using shared_mutex = std::shared_mutex; -template< class Mutex > -using shared_lock = std::shared_lock; +using std::shared_mutex; +using std::shared_lock; } //namespace eprosima From 4e34701bd489b4223a92fced752e8e3387635220 Mon Sep 17 00:00:00 2001 From: Miguel Barro Date: Fri, 15 Jul 2022 12:20:51 +0200 Subject: [PATCH 4/8] Refs 15174. Updated versions.md Signed-off-by: Miguel Barro --- versions.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/versions.md b/versions.md index fe0b685dedb..db1f083c6bf 100644 --- a/versions.md +++ b/versions.md @@ -1,3 +1,8 @@ +Version 2.7.1 +------------- + +* Added a new CMake option to allow users to enforce use of our third party shared_mutex + Version 2.7.0 ------------- From 3d21165b358bed9ca6f292ed030809807a91f32c Mon Sep 17 00:00:00 2001 From: MiguelBarro <45819833+MiguelBarro@users.noreply.github.com> Date: Fri, 15 Jul 2022 13:29:46 +0200 Subject: [PATCH 5/8] Update versions.md Co-authored-by: jsantiago-eProsima <90755661+jsantiago-eProsima@users.noreply.github.com> --- versions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.md b/versions.md index db1f083c6bf..e5f563bbe19 100644 --- a/versions.md +++ b/versions.md @@ -1,7 +1,7 @@ Version 2.7.1 ------------- -* Added a new CMake option to allow users to enforce use of our third party shared_mutex +* Added a new CMake option to allow users to force the use of our third party shared_mutex Version 2.7.0 ------------- From 440a0baef09a6db311d864af654904cc13a5bd9b Mon Sep 17 00:00:00 2001 From: Miguel Barro Date: Fri, 15 Jul 2022 14:05:54 +0200 Subject: [PATCH 6/8] Refs 15174. Make sure all shared_mutex.hpp inclusions are preceded by config.h inclusion. Make sure all compilation units in the library use the same shared_mutex implementation. Signed-off-by: Miguel Barro --- src/cpp/rtps/participant/RTPSParticipantImpl.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cpp/rtps/participant/RTPSParticipantImpl.h b/src/cpp/rtps/participant/RTPSParticipantImpl.h index cfeba1f424b..d90018b1399 100644 --- a/src/cpp/rtps/participant/RTPSParticipantImpl.h +++ b/src/cpp/rtps/participant/RTPSParticipantImpl.h @@ -28,9 +28,6 @@ #include #include -#include -#include - #if defined(_WIN32) #include #else @@ -68,6 +65,9 @@ #include #endif // if HAVE_SECURITY +#include +#include + namespace eprosima { namespace fastdds { From 666f52837a0fbbc90db5670b05b71fa3a79febea Mon Sep 17 00:00:00 2001 From: Miguel Barro Date: Mon, 18 Jul 2022 09:44:51 +0200 Subject: [PATCH 7/8] Refs 15174. Introduce a warning in thirdparty shared_mutex build if the config.h is not included. Prevents future issues including shared_mutex.hpp Signed-off-by: Miguel Barro --- include/fastrtps/config.h.in | 2 +- include/fastrtps/utils/shared_mutex.hpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/fastrtps/config.h.in b/include/fastrtps/config.h.in index 2d3b28a08c7..e7c31b4fca8 100644 --- a/include/fastrtps/config.h.in +++ b/include/fastrtps/config.h.in @@ -63,7 +63,7 @@ #endif /* ifndef HAVE_SQLITE3 */ // Using thirdparty shared_mutex -#cmakedefine USE_THIRDPARTY_SHARED_MUTEX +#cmakedefine01 USE_THIRDPARTY_SHARED_MUTEX // TLS support #ifndef TLS_FOUND diff --git a/include/fastrtps/utils/shared_mutex.hpp b/include/fastrtps/utils/shared_mutex.hpp index 4c4cdd3c941..402be0b9317 100644 --- a/include/fastrtps/utils/shared_mutex.hpp +++ b/include/fastrtps/utils/shared_mutex.hpp @@ -8,6 +8,15 @@ #ifndef _UTILS_SHARED_MUTEX_HPP_ #define _UTILS_SHARED_MUTEX_HPP_ +#ifndef USE_THIRDPARTY_SHARED_MUTEX +# if defined(_MSC_VER) && _MSVC_LANG < 202302L +# pragma message("warning: USE_THIRDPARTY_SHARED_MUTEX not defined. By default use framework version.") +# else +# warning "USE_THIRDPARTY_SHARED_MUTEX not defined. By default use framework version." +# endif +# define USE_THIRDPARTY_SHARED_MUTEX 0 +#endif + #if defined(__has_include) && __has_include() # include #endif // if defined(__has_include) && __has_include() @@ -15,7 +24,7 @@ // Detect if the share_mutex feature is available #if defined(__has_include) && __has_include() && !defined(__cpp_lib_shared_mutex) || \ /* allow users to ignore shared_mutex framework implementation */ \ - defined(USE_THIRDPARTY_SHARED_MUTEX) || \ + (~ USE_THIRDPARTY_SHARED_MUTEX + 1) || \ /* deprecated procedure if the good one is not available*/ \ ( !(defined(__has_include) && __has_include()) && \ !(defined(HAVE_CXX17) && HAVE_CXX17) && __cplusplus < 201703 ) From 125535c17b201e6d09150adb78c04bf21179342a Mon Sep 17 00:00:00 2001 From: Miguel Barro Date: Mon, 18 Jul 2022 10:57:05 +0200 Subject: [PATCH 8/8] Refs 15174. Linter pass Signed-off-by: Miguel Barro --- include/fastrtps/utils/shared_mutex.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/fastrtps/utils/shared_mutex.hpp b/include/fastrtps/utils/shared_mutex.hpp index 402be0b9317..d2fbf9b5f81 100644 --- a/include/fastrtps/utils/shared_mutex.hpp +++ b/include/fastrtps/utils/shared_mutex.hpp @@ -13,9 +13,9 @@ # pragma message("warning: USE_THIRDPARTY_SHARED_MUTEX not defined. By default use framework version.") # else # warning "USE_THIRDPARTY_SHARED_MUTEX not defined. By default use framework version." -# endif +# endif // if defined(_MSC_VER) && _MSVC_LANG < 202302L # define USE_THIRDPARTY_SHARED_MUTEX 0 -#endif +#endif // ifndef USE_THIRDPARTY_SHARED_MUTEX #if defined(__has_include) && __has_include() # include @@ -24,7 +24,7 @@ // Detect if the share_mutex feature is available #if defined(__has_include) && __has_include() && !defined(__cpp_lib_shared_mutex) || \ /* allow users to ignore shared_mutex framework implementation */ \ - (~ USE_THIRDPARTY_SHARED_MUTEX + 1) || \ + (~USE_THIRDPARTY_SHARED_MUTEX + 1) || \ /* deprecated procedure if the good one is not available*/ \ ( !(defined(__has_include) && __has_include()) && \ !(defined(HAVE_CXX17) && HAVE_CXX17) && __cplusplus < 201703 )