Skip to content

Commit

Permalink
Merge pull request #751 from ros2/mergify/bp/iron/pr-750
Browse files Browse the repository at this point in the history
Fix deprecation warnings for message constants (backport #750)
  • Loading branch information
emersonknapp committed Jun 14, 2023
2 parents a57baea + 882d950 commit 364f916
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions rosidl_generator_cpp/resource/msg__struct.hpp.em
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,11 @@ template<typename ContainerAllocator>
const @(MSG_TYPE_TO_CPP['wstring'])
@(message.structure.namespaced_type.name)_<ContainerAllocator>::@(c.name) = u"@(escape_wstring(c.value))";
@[ else ]@
#if __cplusplus < 201703L
// static constexpr member variable definitions are only needed in C++14 and below, deprecated in C++17
template<typename ContainerAllocator>
constexpr @(MSG_TYPE_TO_CPP[c.type.typename]) @(message.structure.namespaced_type.name)_<ContainerAllocator>::@(c.name);
#endif // __cplusplus < 201703L
@[ end if]@
@[ if c.name in msvc_common_macros]@
#if defined(_WIN32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,12 @@ if(rosidl_generate_interfaces_LIBRARY_NAME)
endif()
set_property(TARGET ${rosidl_generate_interfaces_TARGET}${_target_suffix}
PROPERTY DEFINE_SYMBOL "ROSIDL_TYPESUPPORT_INTROSPECTION_CPP_BUILDING_DLL")
set_property(TARGET ${rosidl_generate_interfaces_TARGET}${_target_suffix}
PROPERTY CXX_STANDARD 17)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_target_properties(${rosidl_generate_interfaces_TARGET}${_target_suffix} PROPERTIES
CXX_STANDARD 17
COMPILE_OPTIONS -Wall -Wextra -Wpedantic
)
target_compile_options(${rosidl_generate_interfaces_TARGET}${_target_suffix}
PRIVATE -Wall -Wextra -Wpedantic)
endif()

target_include_directories(${rosidl_generate_interfaces_TARGET}${_target_suffix}
Expand Down

0 comments on commit 364f916

Please sign in to comment.