diff --git a/examples/c/discovery/src/main.c b/examples/c/discovery/src/main.c index 81e5aacac..d84ba740a 100644 --- a/examples/c/discovery/src/main.c +++ b/examples/c/discovery/src/main.c @@ -14,6 +14,7 @@ #include iox2_callback_progression_e list_callback(const iox2_static_config_t* static_details, void* callback_context) { + (void) callback_context; printf("Found Service: %s, ServiceID: %s\n", static_details->name, static_details->id); return iox2_callback_progression_e_CONTINUE; } diff --git a/examples/c/domains/src/discovery.c b/examples/c/domains/src/discovery.c index 26e9bc1b9..8d41c7b76 100644 --- a/examples/c/domains/src/discovery.c +++ b/examples/c/domains/src/discovery.c @@ -14,6 +14,7 @@ #include iox2_callback_progression_e list_callback(const iox2_static_config_t* static_details, void* callback_context) { + (void) callback_context; printf("Found Service: %s, ServiceID: %s\n", static_details->name, static_details->id); return iox2_callback_progression_e_CONTINUE; } diff --git a/examples/c/domains/src/subscriber.c b/examples/c/domains/src/subscriber.c index d8ef93bde..70be8d78d 100644 --- a/examples/c/domains/src/subscriber.c +++ b/examples/c/domains/src/subscriber.c @@ -94,11 +94,8 @@ int main(int argc, char** argv) { goto drop_service; } - uint64_t counter = 0; printf("subscribed to: [domain: \"%s\", service: \"%s\"]\n", argv[1], argv[2]); while (iox2_node_wait(&node_handle, 1, 0) == IOX2_OK) { - counter += 1; - // receive sample iox2_sample_h sample = NULL; if (iox2_subscriber_receive(&subscriber, NULL, &sample) != IOX2_OK) { diff --git a/examples/c/event_multiplexing/src/notifier.c b/examples/c/event_multiplexing/src/notifier.c index 67ecff8ee..87fce2984 100644 --- a/examples/c/event_multiplexing/src/notifier.c +++ b/examples/c/event_multiplexing/src/notifier.c @@ -56,7 +56,7 @@ int main(int argc, char** argv) { iox2_port_factory_event_h service = NULL; if (iox2_service_builder_event_open_or_create(service_builder_event, NULL, &service) != IOX2_OK) { printf("Unable to create service!\n"); - goto drop_node; + goto drop_service_name; } // create notifier diff --git a/examples/c/publish_subscribe/src/subscriber.c b/examples/c/publish_subscribe/src/subscriber.c index 75acdc848..2707bb2fe 100644 --- a/examples/c/publish_subscribe/src/subscriber.c +++ b/examples/c/publish_subscribe/src/subscriber.c @@ -73,10 +73,7 @@ int main(void) { goto drop_service; } - uint64_t counter = 0; while (iox2_node_wait(&node_handle, 1, 0) == IOX2_OK) { - counter += 1; - // receive sample iox2_sample_h sample = NULL; if (iox2_subscriber_receive(&subscriber, NULL, &sample) != IOX2_OK) { diff --git a/examples/c/publish_subscribe_with_user_header/src/subscriber.c b/examples/c/publish_subscribe_with_user_header/src/subscriber.c index 6dad2039c..312b0deb7 100644 --- a/examples/c/publish_subscribe_with_user_header/src/subscriber.c +++ b/examples/c/publish_subscribe_with_user_header/src/subscriber.c @@ -86,10 +86,7 @@ int main(void) { goto drop_service; } - uint64_t counter = 0; while (iox2_node_wait(&node_handle, 1, 0) == IOX2_OK) { - counter += 1; - // receive sample iox2_sample_h sample = NULL; if (iox2_subscriber_receive(&subscriber, NULL, &sample) != IOX2_OK) { diff --git a/examples/cxx/event_based_communication/src/pubsub_event.hpp b/examples/cxx/event_based_communication/src/pubsub_event.hpp index e180c1f12..8a11f4a73 100644 --- a/examples/cxx/event_based_communication/src/pubsub_event.hpp +++ b/examples/cxx/event_based_communication/src/pubsub_event.hpp @@ -26,7 +26,7 @@ enum class PubSubEvent : uint8_t { SentSample = 4, ReceivedSample = 5, SentHistory = 6, - Unknown + Unknown = 7 }; namespace iox { diff --git a/examples/cxx/health_monitoring/src/central_daemon.cpp b/examples/cxx/health_monitoring/src/central_daemon.cpp index 468904068..e90091b81 100644 --- a/examples/cxx/health_monitoring/src/central_daemon.cpp +++ b/examples/cxx/health_monitoring/src/central_daemon.cpp @@ -23,7 +23,9 @@ using namespace iox2; constexpr iox::units::Duration CYCLE_TIME = iox::units::Duration::fromMilliseconds(100); +namespace { void find_and_cleanup_dead_nodes(); +} auto main() -> int { auto service_name_1 = ServiceName::create("service_1").expect(""); @@ -93,14 +95,16 @@ auto main() -> int { return 0; } +namespace { void find_and_cleanup_dead_nodes() { Node::list(Config::global_config(), [](auto node_state) { node_state.dead([](auto view) { std::cout << "detected dead node: "; - view.details().and_then([](auto details) { std::cout << details.name().to_string().c_str(); }); + view.details().and_then([](const auto& details) { std::cout << details.name().to_string().c_str(); }); std::cout << std::endl; view.remove_stale_resources().expect(""); }); return CallbackProgression::Continue; }).expect(""); } +} // namespace diff --git a/examples/cxx/health_monitoring/src/subscriber.cpp b/examples/cxx/health_monitoring/src/subscriber.cpp index 58943d321..8d1506f9c 100644 --- a/examples/cxx/health_monitoring/src/subscriber.cpp +++ b/examples/cxx/health_monitoring/src/subscriber.cpp @@ -25,10 +25,12 @@ constexpr iox::units::Duration REACTION_BUFFER = iox::units::Duration::fromMilli constexpr iox::units::Duration CYCLE_TIME_1 = iox::units::Duration::fromMilliseconds(1000) + REACTION_BUFFER; constexpr iox::units::Duration CYCLE_TIME_2 = iox::units::Duration::fromMilliseconds(1500) + REACTION_BUFFER; +namespace { void find_and_cleanup_dead_nodes(); void handle_incoming_events(Listener& listener, const Subscriber& subscriber, const ServiceName& service_name); +} // namespace auto main() -> int { auto service_name_1 = ServiceName::create("service_1").expect(""); @@ -94,6 +96,7 @@ auto main() -> int { return 0; } +namespace { void handle_incoming_events(Listener& listener, const Subscriber& subscriber, const ServiceName& service_name) { @@ -119,10 +122,11 @@ void find_and_cleanup_dead_nodes() { Node::list(Config::global_config(), [](auto node_state) { node_state.dead([](auto view) { std::cout << "detected dead node: "; - view.details().and_then([](auto details) { std::cout << details.name().to_string().c_str(); }); + view.details().and_then([](const auto& details) { std::cout << details.name().to_string().c_str(); }); std::cout << std::endl; view.remove_stale_resources().expect(""); }); return CallbackProgression::Continue; }).expect(""); } +} // namespace diff --git a/iceoryx2-ffi/cxx/src/port_factory_event.cpp b/iceoryx2-ffi/cxx/src/port_factory_event.cpp index b6803a040..be7e2fd03 100644 --- a/iceoryx2-ffi/cxx/src/port_factory_event.cpp +++ b/iceoryx2-ffi/cxx/src/port_factory_event.cpp @@ -79,9 +79,8 @@ auto PortFactoryEvent::dynamic_config() const -> const DynamicConfigEvent& { } template -auto PortFactoryEvent::nodes(const iox::function)>& callback) const +auto PortFactoryEvent::nodes([[maybe_unused]] const iox::function)>& callback) const -> iox::expected { - static_cast(callback); IOX_TODO(); } diff --git a/iceoryx2-ffi/cxx/src/service.cpp b/iceoryx2-ffi/cxx/src/service.cpp index 97d5ddbcc..9df8a59d0 100644 --- a/iceoryx2-ffi/cxx/src/service.cpp +++ b/iceoryx2-ffi/cxx/src/service.cpp @@ -38,13 +38,10 @@ auto Service::does_exist(const ServiceName& service_name, } template -auto Service::details(const ServiceName& service_name, - const ConfigView config, - const MessagingPattern messaging_pattern) +auto Service::details([[maybe_unused]] const ServiceName& service_name, + [[maybe_unused]] const ConfigView config, + [[maybe_unused]] const MessagingPattern messaging_pattern) -> iox::expected>, ServiceDetailsError> { - static_cast(service_name); - static_cast(config); - static_cast(messaging_pattern); IOX_TODO(); } diff --git a/iceoryx2-ffi/cxx/tests/src/waitset_tests.cpp b/iceoryx2-ffi/cxx/tests/src/waitset_tests.cpp index e18b07da7..1014e7abb 100644 --- a/iceoryx2-ffi/cxx/tests/src/waitset_tests.cpp +++ b/iceoryx2-ffi/cxx/tests/src/waitset_tests.cpp @@ -284,6 +284,8 @@ TYPED_TEST(WaitSetTest, triggering_everything_works) { std::vector> listeners; std::vector> guards; + guards.reserve(NUMBER_OF_INTERVALS + NUMBER_OF_NOTIFICATIONS + NUMBER_OF_DEADLINES); + listeners.reserve(NUMBER_OF_NOTIFICATIONS + NUMBER_OF_DEADLINES); for (uint64_t idx = 0; idx < NUMBER_OF_INTERVALS; ++idx) { guards.emplace_back(sut.attach_interval(Duration::fromNanoseconds(1)).expect(""));