From 0cf270836c08b3ff66949ab0a5aa1c6b882c5952 Mon Sep 17 00:00:00 2001 From: Russ Webber Date: Tue, 12 Jul 2022 13:12:36 +1000 Subject: [PATCH 1/6] fix: add limits include Signed-off-by: Russ Webber --- include/xtypes/UnionType.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/xtypes/UnionType.hpp b/include/xtypes/UnionType.hpp index bb4e239a..1f051515 100644 --- a/include/xtypes/UnionType.hpp +++ b/include/xtypes/UnionType.hpp @@ -29,6 +29,7 @@ #include #include #include +#include namespace eprosima { namespace xtypes { From dd90f6d8b5edcb0e077e1956b240815194bfb1f8 Mon Sep 17 00:00:00 2001 From: Russ Webber Date: Fri, 29 Jul 2022 12:48:26 +1000 Subject: [PATCH 2/6] fix: cast wchar_t and char16_t to int for sstream Signed-off-by: Russ Webber --- include/xtypes/DynamicDataImpl.hpp | 4 ++-- include/xtypes/idl/generator.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/xtypes/DynamicDataImpl.hpp b/include/xtypes/DynamicDataImpl.hpp index 61c92054..66d83a36 100644 --- a/include/xtypes/DynamicDataImpl.hpp +++ b/include/xtypes/DynamicDataImpl.hpp @@ -142,10 +142,10 @@ inline std::string ReadableDynamicDataRef::to_string() const ss << "<" << type_name << "> " << node.data().value(); break; case TypeKind::CHAR_16_TYPE: - ss << "<" << type_name << "> " << node.data().value(); + ss << "<" << type_name << "> " << static_cast(node.data().value()); break; case TypeKind::WIDE_CHAR_TYPE: - ss << "<" << type_name << "> " << node.data().value(); + ss << "<" << type_name << "> " << static_cast(node.data().value()); break; case TypeKind::INT_8_TYPE: ss << "<" << type_name << "> " << node.data().value(); diff --git a/include/xtypes/idl/generator.hpp b/include/xtypes/idl/generator.hpp index cb4f1d24..696f7e1a 100644 --- a/include/xtypes/idl/generator.hpp +++ b/include/xtypes/idl/generator.hpp @@ -242,14 +242,14 @@ inline std::string label_value( { char16_t temp = static_cast(value); std::stringstream ss; - ss << "L'" << temp << "'"; + ss << "L'" << static_cast(temp) << "'"; return ss.str(); } case TypeKind::WIDE_CHAR_TYPE: { wchar_t temp = static_cast(value); std::stringstream ss; - ss << "L'" << temp << "'"; + ss << "L'" << static_cast(temp) << "'"; return ss.str(); } case TypeKind::INT_8_TYPE: From 490da2efe3ef5d76628de3ba2f81e8ab22c1cd0a Mon Sep 17 00:00:00 2001 From: Russ Webber Date: Fri, 29 Jul 2022 13:05:30 +1000 Subject: [PATCH 3/6] fix: required use of template keyword in c++20 Signed-off-by: Russ Webber --- include/xtypes/StringType.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/xtypes/StringType.hpp b/include/xtypes/StringType.hpp index 7fe289ef..9407b509 100644 --- a/include/xtypes/StringType.hpp +++ b/include/xtypes/StringType.hpp @@ -109,7 +109,7 @@ class TStringType : public MutableCollectionType virtual void destroy_instance( uint8_t* instance) const override { - reinterpret_cast*>(instance)->std::basic_string::~basic_string(); + reinterpret_cast*>(instance)->std::template basic_string::~basic_string(); } virtual bool compare_instance( From 4438f2258c11317de18951b2b2a44c7237e7c71c Mon Sep 17 00:00:00 2001 From: Russ Webber Date: Wed, 5 Oct 2022 11:23:56 +1100 Subject: [PATCH 4/6] fix: when converting int8/uint8 to str, cast to int Signed-off-by: Russ Webber --- include/xtypes/DynamicDataImpl.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/xtypes/DynamicDataImpl.hpp b/include/xtypes/DynamicDataImpl.hpp index 66d83a36..2411eb34 100644 --- a/include/xtypes/DynamicDataImpl.hpp +++ b/include/xtypes/DynamicDataImpl.hpp @@ -148,10 +148,10 @@ inline std::string ReadableDynamicDataRef::to_string() const ss << "<" << type_name << "> " << static_cast(node.data().value()); break; case TypeKind::INT_8_TYPE: - ss << "<" << type_name << "> " << node.data().value(); + ss << "<" << type_name << "> " << static_cast(node.data().value()); break; case TypeKind::UINT_8_TYPE: - ss << "<" << type_name << "> " << node.data().value(); + ss << "<" << type_name << "> " << static_cast(node.data().value()); break; case TypeKind::INT_16_TYPE: ss << "<" << type_name << "> " << node.data().value(); From 100b01640f595bcdfd27f078d06b54037e10b165 Mon Sep 17 00:00:00 2001 From: Russ Webber Date: Wed, 5 Oct 2022 12:11:36 +1100 Subject: [PATCH 5/6] fix: pin cpp-peglib to v1.8.2 Signed-off-by: Russ Webber --- CMakeLists.txt | 2 +- include/xtypes/idl/parser.hpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b5b9bbea..44d48106 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ add_library(${PROJECT_NAME} INTERFACE) # Download the cpp-peglib header file needed file(DOWNLOAD - https://raw.githubusercontent.com/yhirose/cpp-peglib/master/peglib.h + https://raw.githubusercontent.com/yhirose/cpp-peglib/v1.8.2/peglib.h ${PROJECT_SOURCE_DIR}/thirdparty/cpp-peglib/peglib.h ) diff --git a/include/xtypes/idl/parser.hpp b/include/xtypes/idl/parser.hpp index 618acd48..d78f924e 100644 --- a/include/xtypes/idl/parser.hpp +++ b/include/xtypes/idl/parser.hpp @@ -284,8 +284,9 @@ class Parser , context_(nullptr) { parser_.enable_ast(); - parser_.log = std::bind(&Parser::parser_log_cb_, this, std::placeholders::_1, + peg::Log log = std::bind(&Parser::parser_log_cb_, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3); + parser_.set_logger(log); } Context parse( @@ -675,8 +676,9 @@ class Parser to_lower(aux_id); } - for (const std::string& name : parser_.get_rule_names()) + for (const auto &item : parser_.get_grammar()) { + const auto &name = item.first; if (name.find("KW_") == 0) // If it starts with "KW_", is a reserved word. You are welcome. { if (parser_[name.c_str()].parse(aux_id.c_str()).ret) From 40f274c859e8351f43717b7f02908aedf59ca5c5 Mon Sep 17 00:00:00 2001 From: Russ Webber Date: Wed, 2 Nov 2022 14:31:31 +1100 Subject: [PATCH 6/6] fix: install peglib into include folder, cmake files into appropriate place Signed-off-by: Russ Webber --- CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44d48106..03f24e0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ target_include_directories(${PROJECT_NAME} $ $ $ - $ + # $ ) target_compile_features(${PROJECT_NAME} @@ -231,12 +231,13 @@ set(LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Installation dir set(DATA_INSTALL_DIR ${CMAKE_INSTALL_DATADIR} CACHE PATH "Installation directory for data") include(CMakePackageConfigHelpers) +string(REPLACE "/${CMAKE_LIBRARY_ARCHITECTURE}" "" CMAKE_INSTALL_LIBDIR_ARCHIND "${CMAKE_INSTALL_LIBDIR}") configure_package_config_file( ${PROJECT_SOURCE_DIR}/cmake/config.cmake.in ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config.cmake INSTALL_DESTINATION - ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake + ${CMAKE_INSTALL_LIBDIR_ARCHIND}/cmake/${PROJECT_NAME} PATH_VARS BIN_INSTALL_DIR INCLUDE_INSTALL_DIR @@ -278,7 +279,7 @@ install( DIRECTORY ${PROJECT_SOURCE_DIR}/thirdparty/cpp-peglib/ DESTINATION - thirdparty/cpp-peglib/include + ${INCLUDE_INSTALL_DIR} # this is a hack, but it's still more appropriate than thirdparty FILES_MATCHING PATTERN "*.h" ) @@ -295,5 +296,5 @@ install( ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config.cmake ${PROJECT_BINARY_DIR}/cmake/config/${PROJECT_NAME}-config-version.cmake DESTINATION - ${DATA_INSTALL_DIR}/${PROJECT_NAME}/cmake + ${CMAKE_INSTALL_LIBDIR_ARCHIND}/cmake/${PROJECT_NAME} )