From 95bbda0fd4a1bcf6fc1869b4785ef96487ecc651 Mon Sep 17 00:00:00 2001 From: Michael Carroll Date: Tue, 9 Apr 2024 00:03:01 +0000 Subject: [PATCH] Fix how header template works to prevent double-inclusion Bug introduced in ros2/rosidl_typesupport_fastrtps#116 Signed-off-by: Michael Carroll --- .../resource/msg__rosidl_typesupport_fastrtps_cpp.hpp.em | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rosidl_typesupport_fastrtps_cpp/resource/msg__rosidl_typesupport_fastrtps_cpp.hpp.em b/rosidl_typesupport_fastrtps_cpp/resource/msg__rosidl_typesupport_fastrtps_cpp.hpp.em index cd9e34b..9088710 100644 --- a/rosidl_typesupport_fastrtps_cpp/resource/msg__rosidl_typesupport_fastrtps_cpp.hpp.em +++ b/rosidl_typesupport_fastrtps_cpp/resource/msg__rosidl_typesupport_fastrtps_cpp.hpp.em @@ -7,13 +7,13 @@ include_parts = [package_name] + list(interface_path.parents[0].parts) + [ include_base = '/'.join(include_parts) header_files = [ + 'cstddef', 'rosidl_runtime_c/message_type_support_struct.h', 'rosidl_typesupport_interface/macros.h', package_name + '/msg/rosidl_typesupport_fastrtps_cpp__visibility_control.h', include_base + '__struct.hpp', ] }@ -#include @[for header_file in header_files]@ @[ if header_file in include_directives]@ // already included above @@ -21,7 +21,11 @@ header_files = [ @[ else]@ @{include_directives.add(header_file)}@ @[ end if]@ +@[ if '/' not in header_file]@ +#include <@(header_file)> +@[ else]@ #include "@(header_file)" +@[ end if]@ @[end for]@ #ifndef _WIN32