From ec9b9e41ab3643818e66d9fd454ec362faa158d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Tue, 23 Apr 2024 13:36:01 +0200 Subject: [PATCH] Fixed warnings - strict-prototypes (#800) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro Hernández Cordero (cherry picked from commit 25799501c12b7fbc8ab5d5188c040cf84d333ab9) --- .../resource/action__type_support.h.em | 2 +- rosidl_generator_c/resource/msg__functions.c.em | 2 +- rosidl_generator_c/resource/msg__functions.h.em | 2 +- .../resource/msg__type_support.h.em | 2 +- .../resource/srv__type_support.h.em | 2 +- .../rosidl_generator_c/separate_compilation.c | 2 +- .../rosidl_generator_c/separate_compilation.h | 2 +- .../test/rosidl_generator_c/test_descriptions.c | 16 ++++++++-------- .../test/rosidl_generator_c/test_interfaces.c | 4 ++-- .../resource/srv__type_support.c.em | 8 ++++---- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/rosidl_generator_c/resource/action__type_support.h.em b/rosidl_generator_c/resource/action__type_support.h.em index efab57097..a1747c6c0 100644 --- a/rosidl_generator_c/resource/action__type_support.h.em +++ b/rosidl_generator_c/resource/action__type_support.h.em @@ -14,7 +14,7 @@ const rosidl_action_type_support_t * ROSIDL_TYPESUPPORT_INTERFACE__ACTION_SYMBOL_NAME( rosidl_typesupport_c, @(',\n '.join(action.namespaced_type.namespaced_name())) -)(); +)(void); @{ TEMPLATE( diff --git a/rosidl_generator_c/resource/msg__functions.c.em b/rosidl_generator_c/resource/msg__functions.c.em index 0c15b7475..f7fe8d7f1 100644 --- a/rosidl_generator_c/resource/msg__functions.c.em +++ b/rosidl_generator_c/resource/msg__functions.c.em @@ -317,7 +317,7 @@ bool } @(message_typename) * -@(message_typename)__create() +@(message_typename)__create(void) { rcutils_allocator_t allocator = rcutils_get_default_allocator(); @(message_typename) * msg = (@(message_typename) *)allocator.allocate(sizeof(@(message_typename)), allocator.state); diff --git a/rosidl_generator_c/resource/msg__functions.h.em b/rosidl_generator_c/resource/msg__functions.h.em index af8b208c8..7fd27767f 100644 --- a/rosidl_generator_c/resource/msg__functions.h.em +++ b/rosidl_generator_c/resource/msg__functions.h.em @@ -50,7 +50,7 @@ void */ ROSIDL_GENERATOR_C_PUBLIC_@(package_name) @(message_typename) * -@(message_typename)__create(); +@(message_typename)__create(void); /// Destroy @(interface_path_to_string(interface_path)) message. /** diff --git a/rosidl_generator_c/resource/msg__type_support.h.em b/rosidl_generator_c/resource/msg__type_support.h.em index 9c0065cc8..785c4f55b 100644 --- a/rosidl_generator_c/resource/msg__type_support.h.em +++ b/rosidl_generator_c/resource/msg__type_support.h.em @@ -14,4 +14,4 @@ const rosidl_message_type_support_t * ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME( rosidl_typesupport_c, @(',\n '.join(message.structure.namespaced_type.namespaced_name())) -)(); +)(void); diff --git a/rosidl_generator_c/resource/srv__type_support.h.em b/rosidl_generator_c/resource/srv__type_support.h.em index af2621cfc..5cfbd883f 100644 --- a/rosidl_generator_c/resource/srv__type_support.h.em +++ b/rosidl_generator_c/resource/srv__type_support.h.em @@ -35,7 +35,7 @@ const rosidl_service_type_support_t * ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME( rosidl_typesupport_c, @(',\n '.join(service.namespaced_type.namespaced_name())) -)(); +)(void); // Forward declare the function to create a service event message for this type. ROSIDL_GENERATOR_C_PUBLIC_@(package_name) diff --git a/rosidl_generator_tests/test/rosidl_generator_c/separate_compilation.c b/rosidl_generator_tests/test/rosidl_generator_c/separate_compilation.c index 2aa2646f1..38dcae4f8 100644 --- a/rosidl_generator_tests/test/rosidl_generator_c/separate_compilation.c +++ b/rosidl_generator_tests/test/rosidl_generator_c/separate_compilation.c @@ -21,7 +21,7 @@ #include "rosidl_generator_tests/msg/detail/defaults__struct.h" #include "rosidl_generator_tests/msg/detail/defaults__functions.h" -int func() +int func(void) { rosidl_generator_tests__msg__Defaults * msg = rosidl_generator_tests__msg__Defaults__create(); if (!msg) { diff --git a/rosidl_generator_tests/test/rosidl_generator_c/separate_compilation.h b/rosidl_generator_tests/test/rosidl_generator_c/separate_compilation.h index 2520043df..c9ad7b9f9 100644 --- a/rosidl_generator_tests/test/rosidl_generator_c/separate_compilation.h +++ b/rosidl_generator_tests/test/rosidl_generator_c/separate_compilation.h @@ -15,6 +15,6 @@ #ifndef ROSIDL_GENERATOR_C__SEPARATE_COMPILATION_H_ #define ROSIDL_GENERATOR_C__SEPARATE_COMPILATION_H_ -int func(); +int func(void); #endif // ROSIDL_GENERATOR_C__SEPARATE_COMPILATION_H_ diff --git a/rosidl_generator_tests/test/rosidl_generator_c/test_descriptions.c b/rosidl_generator_tests/test/rosidl_generator_c/test_descriptions.c index 8e907b68a..d49fb04ab 100644 --- a/rosidl_generator_tests/test/rosidl_generator_c/test_descriptions.c +++ b/rosidl_generator_tests/test/rosidl_generator_c/test_descriptions.c @@ -66,10 +66,10 @@ bool string_char_equal(const rosidl_runtime_c__String * lhs, const char * rhs) return 0 == memcmp(lhs->data, rhs, rhs_len); } -int test_description_linkage(); -int test_copied_type_description_struct_hashes(); -int test_source_defined(); -int test_same_name_types(); +int test_description_linkage(void); +int test_copied_type_description_struct_hashes(void); +int test_source_defined(void); +int test_same_name_types(void); int main(void) { @@ -103,7 +103,7 @@ int main(void) return rc != 0; } -int test_description_linkage() +int test_description_linkage(void) { // Smoke test linkage and basic values for msg, srv, action // Message @@ -168,7 +168,7 @@ int test_description_linkage() return 0; } -int test_source_defined() +int test_source_defined(void) { // Smoke test that definitions are present for raw type sources // Message @@ -277,7 +277,7 @@ int test_source_defined() return 0; } -int test_copied_type_description_struct_hashes() +int test_copied_type_description_struct_hashes(void) { #define runtimehash(x) rosidl_runtime_c__type_description__ ## x ## __get_type_hash(NULL) #define msghash(x) type_description_interfaces__msg__ ## x ## __get_type_hash(NULL) @@ -313,7 +313,7 @@ int test_copied_type_description_struct_hashes() return rc; } -int test_same_name_types() +int test_same_name_types(void) { // Msg and srv with same name in this package // Regression check case, this was receiving "srv" encoding with Empty.srv sources diff --git a/rosidl_generator_tests/test/rosidl_generator_c/test_interfaces.c b/rosidl_generator_tests/test/rosidl_generator_c/test_interfaces.c index 55b971f72..94d5aa96b 100644 --- a/rosidl_generator_tests/test/rosidl_generator_c/test_interfaces.c +++ b/rosidl_generator_tests/test/rosidl_generator_c/test_interfaces.c @@ -424,7 +424,7 @@ static int test_bounded_sequences(void) return 0; } -int test_unbounded_sequences() +int test_unbounded_sequences(void) { rosidl_generator_tests__msg__UnboundedSequences * seq = NULL; seq = rosidl_generator_tests__msg__UnboundedSequences__create(); @@ -999,7 +999,7 @@ static int test_multi_nested(void) return 0; } -int test_wstrings() +int test_wstrings(void) { rosidl_generator_tests__msg__WStrings * wstr = NULL; wstr = rosidl_generator_tests__msg__WStrings__create(); diff --git a/rosidl_typesupport_introspection_c/resource/srv__type_support.c.em b/rosidl_typesupport_introspection_c/resource/srv__type_support.c.em index ee71830f2..d218f670d 100644 --- a/rosidl_typesupport_introspection_c/resource/srv__type_support.c.em +++ b/rosidl_typesupport_introspection_c/resource/srv__type_support.c.em @@ -96,17 +96,17 @@ static rosidl_service_type_support_t @(function_prefix)__@(service.namespaced_ty // Forward declaration of message type support functions for service members const rosidl_message_type_support_t * -ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_c, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name + SERVICE_REQUEST_MESSAGE_SUFFIX))(); +ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_c, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name + SERVICE_REQUEST_MESSAGE_SUFFIX))(void); const rosidl_message_type_support_t * -ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_c, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name + SERVICE_RESPONSE_MESSAGE_SUFFIX))(); +ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_c, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name + SERVICE_RESPONSE_MESSAGE_SUFFIX))(void); const rosidl_message_type_support_t * -ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_c, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name + SERVICE_EVENT_MESSAGE_SUFFIX))(); +ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_introspection_c, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name + SERVICE_EVENT_MESSAGE_SUFFIX))(void); ROSIDL_TYPESUPPORT_INTROSPECTION_C_EXPORT_@(package_name) const rosidl_service_type_support_t * -ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_introspection_c, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name))() { +ROSIDL_TYPESUPPORT_INTERFACE__SERVICE_SYMBOL_NAME(rosidl_typesupport_introspection_c, @(', '.join([package_name] + list(interface_path.parents[0].parts))), @(service.namespaced_type.name))(void) { if (!@(function_prefix)__@(service.namespaced_type.name)_service_type_support_handle.typesupport_identifier) { @(function_prefix)__@(service.namespaced_type.name)_service_type_support_handle.typesupport_identifier = rosidl_typesupport_introspection_c__identifier;