diff --git a/score/mw/com/gateway/gateway_application/gateway_application.cpp b/score/mw/com/gateway/gateway_application/gateway_application.cpp index 23086a666..04f1ada54 100644 --- a/score/mw/com/gateway/gateway_application/gateway_application.cpp +++ b/score/mw/com/gateway/gateway_application/gateway_application.cpp @@ -474,7 +474,7 @@ score::Result GatewayApplication::RegisterUpdateNotification(impl::Instanc } auto& proxy_event = event_it->second; - proxy_event.Subscribe(kGatewaySubscribeSamples); + score::cpp::ignore = proxy_event.Subscribe(kGatewaySubscribeSamples); using ReceiveCallback = safecpp::MoveOnlyScopedFunction; auto scoped_handler = std::make_shared( @@ -483,7 +483,8 @@ score::Result GatewayApplication::RegisterUpdateNotification(impl::Instanc auto specifier_result = impl::InstanceSpecifier::Create(std::string{spec}); if (specifier_result.has_value()) { - transport_layer_->NotifyUpdate(std::move(specifier_result).value(), elem_type, std::string{elem_name}); + score::cpp::ignore = transport_layer_->NotifyUpdate( + std::move(specifier_result).value(), elem_type, std::string{elem_name}); } }); @@ -525,7 +526,7 @@ score::Result GatewayApplication::UnregisterUpdateNotification(impl::Insta return MakeUnexpected(GatewayErrorc::kUnknownServiceElement); } - event_it->second.UnsetReceiveHandler(); + score::cpp::ignore = event_it->second.UnsetReceiveHandler(); event_it->second.Unsubscribe(); return {}; } @@ -555,7 +556,7 @@ score::Result GatewayApplication::NotifyUpdate(impl::InstanceSpecifier ser return MakeUnexpected(GatewayErrorc::kUnknownServiceElement); } - event_it->second.Notify(); + score::cpp::ignore = event_it->second.Notify(); return {}; } diff --git a/score/mw/com/gateway/gateway_application/gateway_application_test.cpp b/score/mw/com/gateway/gateway_application/gateway_application_test.cpp index 97b3b3ec7..18b6dee8a 100644 --- a/score/mw/com/gateway/gateway_application/gateway_application_test.cpp +++ b/score/mw/com/gateway/gateway_application/gateway_application_test.cpp @@ -255,7 +255,7 @@ TEST(GatewayApplicationSetupTest, SetupWithoutInjectedTransportCallsTransportFac // When Setup() is called without a pre-injected transport // Then TransportFactory::Create is invoked and the process terminates - EXPECT_DEATH(app.Setup(), ".*"); + EXPECT_DEATH(score::cpp::ignore = app.Setup(), ".*"); } // --------------------------------------------------------------------------- diff --git a/score/mw/com/gateway/transport_layer/sample/bidirectional_transport.cpp b/score/mw/com/gateway/transport_layer/sample/bidirectional_transport.cpp index 445ff13d6..b8b6fa924 100644 --- a/score/mw/com/gateway/transport_layer/sample/bidirectional_transport.cpp +++ b/score/mw/com/gateway/transport_layer/sample/bidirectional_transport.cpp @@ -318,7 +318,7 @@ void BidirectionalTransport::HandleIncomingMessage(std::unique_ptrGetType())) { - SendAck(message->GetSequenceNumber()); + score::cpp::ignore = SendAck(message->GetSequenceNumber()); } // Post to dispatch queue rather than calling the handler inline. diff --git a/score/mw/com/gateway/transport_layer/sample/sample_hypervisor_transport.cpp b/score/mw/com/gateway/transport_layer/sample/sample_hypervisor_transport.cpp index 68e16aec5..5ae57f344 100644 --- a/score/mw/com/gateway/transport_layer/sample/sample_hypervisor_transport.cpp +++ b/score/mw/com/gateway/transport_layer/sample/sample_hypervisor_transport.cpp @@ -142,7 +142,11 @@ void SampleHyperVisorTransport::HandleProvideServiceRequest(std::unique_ptr message) @@ -166,7 +170,11 @@ void SampleHyperVisorTransport::HandleOfferServiceRequest(std::unique_ptr message) @@ -178,7 +186,12 @@ void SampleHyperVisorTransport::HandleUpdateNotification(std::unique_ptr message) @@ -190,8 +203,12 @@ void SampleHyperVisorTransport::HandleRegisterNotificationRequest(std::unique_pt log::LogError("LoLa") << "SampleTransport: Invalid instance specifier in RegisterNotificationRequest!"; return; } - gateway_app_.RegisterUpdateNotification( + const auto result = gateway_app_.RegisterUpdateNotification( specifier_result.value(), request.GetElementType(), request.GetElementName()); + if (!result.has_value()) + { + log::LogError("LoLa") << "SampleTransport: RegisterUpdateNotification failed!"; + } } void SampleHyperVisorTransport::HandleUnregisterNotificationRequest(std::unique_ptr message) @@ -203,8 +220,12 @@ void SampleHyperVisorTransport::HandleUnregisterNotificationRequest(std::unique_ log::LogError("LoLa") << "SampleTransport: Invalid instance specifier in UnregisterNotificationRequest!"; return; } - gateway_app_.UnregisterUpdateNotification( + const auto result = gateway_app_.UnregisterUpdateNotification( specifier_result.value(), request.GetElementType(), request.GetElementName()); + if (!result.has_value()) + { + log::LogError("LoLa") << "SampleTransport: UnregisterUpdateNotification failed!"; + } } void SampleHyperVisorTransport::Shutdown() diff --git a/score/mw/com/gateway/transport_layer/sample/sample_hypervisor_transport_test.cpp b/score/mw/com/gateway/transport_layer/sample/sample_hypervisor_transport_test.cpp index 78f661c8b..27d02e427 100644 --- a/score/mw/com/gateway/transport_layer/sample/sample_hypervisor_transport_test.cpp +++ b/score/mw/com/gateway/transport_layer/sample/sample_hypervisor_transport_test.cpp @@ -202,7 +202,7 @@ TEST_F(SampleHyperVisorTransportTest, OfferServiceRequestWithCorrectType) SendRequest(::testing::Property(&TransportMessage::GetType, MessageType::kOfferServiceRequest))) .WillOnce(::testing::Return(score::Result{})); // when calling OfferService on SampleHyperVisorTransport - transport_->OfferService(specifier); + score::cpp::ignore = transport_->OfferService(specifier); } TEST_F(SampleHyperVisorTransportTest, StopOfferServiceRequestWithCorrectType) @@ -216,7 +216,7 @@ TEST_F(SampleHyperVisorTransportTest, StopOfferServiceRequestWithCorrectType) SendRequest(::testing::Property(&TransportMessage::GetType, MessageType::kStopOfferServiceRequest))) .WillOnce(::testing::Return(score::Result{})); // when calling StopOfferService on SampleHyperVisorTransport - transport_->StopOfferService(specifier); + score::cpp::ignore = transport_->StopOfferService(specifier); } TEST_F(SampleHyperVisorTransportTest, NotifyUpdateWithCorrectType) @@ -230,7 +230,7 @@ TEST_F(SampleHyperVisorTransportTest, NotifyUpdateWithCorrectType) SendNotification(::testing::Property(&TransportMessage::GetType, MessageType::kUpdateNotification))) .WillOnce(::testing::Return(score::Result{})); // when calling NotifyUpdate on SampleHyperVisorTransport - transport_->NotifyUpdate(specifier, impl::ServiceElementType::EVENT, "SpeedEvent"); + score::cpp::ignore = transport_->NotifyUpdate(specifier, impl::ServiceElementType::EVENT, "SpeedEvent"); } TEST_F(SampleHyperVisorTransportTest, RegisterUpdateNotificationWithCorrectType) @@ -244,7 +244,8 @@ TEST_F(SampleHyperVisorTransportTest, RegisterUpdateNotificationWithCorrectType) SendRequest(::testing::Property(&TransportMessage::GetType, MessageType::kRegisterNotificationRequest))) .WillOnce(::testing::Return(score::Result{})); // when calling RegisterUpdateNotification on SampleHyperVisorTransport - transport_->RegisterUpdateNotification(specifier, impl::ServiceElementType::EVENT, "SpeedEvent"); + score::cpp::ignore = + transport_->RegisterUpdateNotification(specifier, impl::ServiceElementType::EVENT, "SpeedEvent"); } TEST_F(SampleHyperVisorTransportTest, UnregisterUpdateNotificationWithCorrectType) @@ -259,7 +260,8 @@ TEST_F(SampleHyperVisorTransportTest, UnregisterUpdateNotificationWithCorrectTyp SendRequest(::testing::Property(&TransportMessage::GetType, MessageType::kUnregisterNotificationRequest))) .WillOnce(::testing::Return(score::Result{})); // when calling UnregisterUpdateNotification on SampleHyperVisorTransport - transport_->UnregisterUpdateNotification(specifier, impl::ServiceElementType::EVENT, "SpeedEvent"); + score::cpp::ignore = + transport_->UnregisterUpdateNotification(specifier, impl::ServiceElementType::EVENT, "SpeedEvent"); } TEST_F(SampleHyperVisorTransportTest, ResolveShmPathReturnsEmptyObjectIfSpecifierCanNotBeResolved) @@ -622,7 +624,9 @@ TEST_F(SampleHyperVisorTransportTest, ProvideServiceDeathTest) // When calling ProvideService with a valid instance specifier, then it is expected to terminate. // TODO This test needs to be adapted when implementing ResolveShmPaths() and GetShmSizes() based on the actual // HyperVisor SHM technology. - EXPECT_DEATH(transport_->ProvideService(CreateValidInstanceSpecifier(), std::vector{}), ".*"); + EXPECT_DEATH( + score::cpp::ignore = transport_->ProvideService(CreateValidInstanceSpecifier(), std::vector{}), + ".*"); } } // namespace diff --git a/score/mw/com/impl/bindings/lola/proxy_event_common_test.cpp b/score/mw/com/impl/bindings/lola/proxy_event_common_test.cpp index 4ae88baf4..205f53d3c 100644 --- a/score/mw/com/impl/bindings/lola/proxy_event_common_test.cpp +++ b/score/mw/com/impl/bindings/lola/proxy_event_common_test.cpp @@ -346,10 +346,10 @@ TYPED_TEST(LolaProxyEventCommonFixture, RegisterSubscriptionStateChangeHandler) last_subscription_state = new_state; return true; }; - this->proxy_event_->SetSubscriptionStateChangeHandler(subscription_state_callback); + score::cpp::ignore = this->proxy_event_->SetSubscriptionStateChangeHandler(subscription_state_callback); // When subscribed - this->proxy_event_->Subscribe(1U); + score::cpp::ignore = this->proxy_event_->Subscribe(1U); // Then the callback is triggered with kSubscribed new status EXPECT_EQ(this->proxy_event_->GetSubscriptionState(), SubscriptionState::kSubscribed); @@ -372,10 +372,10 @@ TYPED_TEST(LolaProxyEventCommonFixture, RegisterSubscriptionStateChangeHandlerSe last_subscription_state = new_state; return new_state != SubscriptionState::kSubscribed; }; - this->proxy_event_->SetSubscriptionStateChangeHandler(subscription_state_callback); + score::cpp::ignore = this->proxy_event_->SetSubscriptionStateChangeHandler(subscription_state_callback); // When subscribed - this->proxy_event_->Subscribe(1U); + score::cpp::ignore = this->proxy_event_->Subscribe(1U); // Then the callback is triggered with kSubscribed new status EXPECT_EQ(this->proxy_event_->GetSubscriptionState(), SubscriptionState::kSubscribed); @@ -398,11 +398,11 @@ TYPED_TEST(LolaProxyEventCommonFixture, RegisterAndRemoveSubscriptionStateChange last_subscription_state = new_state; return true; }; - this->proxy_event_->SetSubscriptionStateChangeHandler(subscription_state_callback); + score::cpp::ignore = this->proxy_event_->SetSubscriptionStateChangeHandler(subscription_state_callback); // When removing the callback and subscribing - this->proxy_event_->UnsetSubscriptionStateChangeHandler(); - this->proxy_event_->Subscribe(1U); + score::cpp::ignore = this->proxy_event_->UnsetSubscriptionStateChangeHandler(); + score::cpp::ignore = this->proxy_event_->Subscribe(1U); // Then the callback is not triggered EXPECT_EQ(this->proxy_event_->GetSubscriptionState(), SubscriptionState::kSubscribed); diff --git a/score/mw/com/impl/methods/proxy_method_test.cpp b/score/mw/com/impl/methods/proxy_method_test.cpp index a0aada27a..f08a415fd 100644 --- a/score/mw/com/impl/methods/proxy_method_test.cpp +++ b/score/mw/com/impl/methods/proxy_method_test.cpp @@ -1105,7 +1105,7 @@ TEST_F(ProxyMethodWithNonTrivialConstructibleInArgsAndReturnFixture, this->GivenAValidProxyMethod(); // When calling InitializeInArgsAndReturnValues - this->unit_->InitializeInArgsAndReturnValues(this->GetProxyBinding()); + score::cpp::ignore = this->unit_->InitializeInArgsAndReturnValues(this->GetProxyBinding()); // Then the zero copy call operator returns a pointer pointing to an initialized object (i.e. the non-trivial // default constructor was called, initializing value to NonTriviallyConstructibleType::kInitialValue @@ -1127,7 +1127,7 @@ TEST_F(ProxyMethodWithNonTrivialConstructibleInArgsAndReturnFixture, this->GivenAValidProxyMethod(); // When calling InitializeInArgsAndReturnValues - this->unit_->InitializeInArgsAndReturnValues(this->GetProxyBinding()); + score::cpp::ignore = this->unit_->InitializeInArgsAndReturnValues(this->GetProxyBinding()); // Then the copy call operator returns a pointer pointing to an initialized object (i.e. the non-trivial // default constructor was called, initializing value to NonTriviallyConstructibleType::kInitialValue @@ -1143,7 +1143,7 @@ TEST_F(ProxyMethodWithNonTrivialConstructibleInArgsOnlyFixture, InitializeInArgs this->GivenAValidProxyMethod(); // When calling InitializeInArgsAndReturnValues - this->unit_->InitializeInArgsAndReturnValues(this->GetProxyBinding()); + score::cpp::ignore = this->unit_->InitializeInArgsAndReturnValues(this->GetProxyBinding()); // Then Allocate returns a pointer pointing to an initialized object (i.e. the non-trivial default constructor was // called, initializing value to NonTriviallyConstructibleType::kInitialValue @@ -1182,7 +1182,7 @@ TEST_F(ProxyMethodWithNonTrivialConstructibleReturnOnlyFixture, this->GivenAValidProxyMethod(); // When calling InitializeInArgsAndReturnValues - this->unit_->InitializeInArgsAndReturnValues(this->GetProxyBinding()); + score::cpp::ignore = this->unit_->InitializeInArgsAndReturnValues(this->GetProxyBinding()); // Then the copy call operator returns a pointer pointing to an initialized object (i.e. the non-trivial // default constructor was called, initializing value to NonTriviallyConstructibleType::kInitialValue diff --git a/score/mw/com/impl/skeleton_field_test.cpp b/score/mw/com/impl/skeleton_field_test.cpp index a483d62a3..5160a767f 100644 --- a/score/mw/com/impl/skeleton_field_test.cpp +++ b/score/mw/com/impl/skeleton_field_test.cpp @@ -1408,7 +1408,7 @@ TEST_F(SkeletonFieldMoveConstructionFixture, SecondRegisterSetHandlerReplacesHan MySetterAndGetterSkeleton unit2{std::move(unit)}; // Then the method should still be usable (validated by calling RegisterSetHandler which dispatches to the method) - unit2.my_setter_field_.RegisterSetHandler([](TestSampleType& /*value*/) noexcept {}); + score::cpp::ignore = unit2.my_setter_field_.RegisterSetHandler([](TestSampleType& /*value*/) noexcept {}); } TEST_F(SkeletonFieldMoveConstructionFixture, diff --git a/score/mw/com/impl/traits_test.cpp b/score/mw/com/impl/traits_test.cpp index c5dc791dd..a8acc48d7 100644 --- a/score/mw/com/impl/traits_test.cpp +++ b/score/mw/com/impl/traits_test.cpp @@ -1060,7 +1060,7 @@ TEST_F(GeneratedSkeletonCreationInstanceIdentifierTestFixture, CanInterpretAsSke std::ignore = unit.some_field.Update(field_value); // and registering a field set handler - unit.some_field.RegisterSetHandler([](TestSampleType&) {}); + score::cpp::ignore = unit.some_field.RegisterSetHandler([](TestSampleType&) {}); // and offering the service const auto result = unit.OfferService(); diff --git a/score/mw/com/test/common_test_resources/proxy_event_receiver.h b/score/mw/com/test/common_test_resources/proxy_event_receiver.h index 19e5e6f0f..c7d03a321 100644 --- a/score/mw/com/test/common_test_resources/proxy_event_receiver.h +++ b/score/mw/com/test/common_test_resources/proxy_event_receiver.h @@ -39,12 +39,12 @@ class ProxyEventReceiver std::cout << "ProxyEventReceiver: Received event notification" << std::endl; received_sample_notification.notify(); }; - proxy_event_or_field_.SetReceiveHandler(receive_handler); + score::cpp::ignore = proxy_event_or_field_.SetReceiveHandler(receive_handler); } ~ProxyEventReceiver() { - proxy_event_or_field_.UnsetReceiveHandler(); + score::cpp::ignore = proxy_event_or_field_.UnsetReceiveHandler(); } ProxyEventReceiver(const ProxyEventReceiver&) = delete; diff --git a/score/mw/com/test/common_test_resources/proxy_event_state_change_notifier.h b/score/mw/com/test/common_test_resources/proxy_event_state_change_notifier.h index 346acb914..21e5f031c 100644 --- a/score/mw/com/test/common_test_resources/proxy_event_state_change_notifier.h +++ b/score/mw/com/test/common_test_resources/proxy_event_state_change_notifier.h @@ -53,7 +53,7 @@ class ProxyEventStateChangeNotifier ~ProxyEventStateChangeNotifier() { - proxy_event_.UnsetSubscriptionStateChangeHandler(); + score::cpp::ignore = proxy_event_.UnsetSubscriptionStateChangeHandler(); } ProxyEventStateChangeNotifier(const ProxyEventStateChangeNotifier&) = delete; diff --git a/score/mw/com/test/generic_skeleton/generic_generic_interaction_app.cpp b/score/mw/com/test/generic_skeleton/generic_generic_interaction_app.cpp index 6ba69bcfe..af6c9b31f 100644 --- a/score/mw/com/test/generic_skeleton/generic_generic_interaction_app.cpp +++ b/score/mw/com/test/generic_skeleton/generic_generic_interaction_app.cpp @@ -109,7 +109,7 @@ int run_provider(score::cpp::stop_token stop_token) typed_sample->counter = i; std::cout << "[PROVIDER] Sending sample: " << i << std::endl; - generic_event.Send(std::move(sample_res.value())); + score::cpp::ignore = generic_event.Send(std::move(sample_res.value())); std::cout << "[PROVIDER] " << PAYLOAD_SIZE << "-byte Event Sent sample: " << i << std::endl; std::this_thread::sleep_for(std::chrono::milliseconds(10)); i++; @@ -149,7 +149,7 @@ int run_consumer() // Get reference to the GenericProxyEvent auto& generic_event = event_it->second; - generic_event.Subscribe(kSamplesToSubscribe); + score::cpp::ignore = generic_event.Subscribe(kSamplesToSubscribe); std::uint64_t expected{0}; std::uint64_t received{0}; @@ -159,7 +159,7 @@ int run_consumer() while (received < kSamplesToProcess) { // The receiver callback operates on type-erased memory (SamplePtr) - generic_event.GetNewSamples( + score::cpp::ignore = generic_event.GetNewSamples( [&](auto sample) { auto* typed_sample = static_cast(sample.get()); diff --git a/score/mw/com/test/generic_skeleton/generic_typed_interaction_app.cpp b/score/mw/com/test/generic_skeleton/generic_typed_interaction_app.cpp index 0ec8c528f..ed2c2d213 100644 --- a/score/mw/com/test/generic_skeleton/generic_typed_interaction_app.cpp +++ b/score/mw/com/test/generic_skeleton/generic_typed_interaction_app.cpp @@ -103,7 +103,7 @@ int run_provider(score::cpp::stop_token stop_token) } auto* typed_sample = static_cast(sample_res.value().Get()); typed_sample->counter = i; - generic_event.Send(std::move(sample_res.value())); + score::cpp::ignore = generic_event.Send(std::move(sample_res.value())); score::mw::log::LogInfo("GenericSkeletonProvider") << PAYLOAD_SIZE << "-byte Event Sent sample: " << i; std::this_thread::sleep_for(std::chrono::milliseconds(10)); @@ -158,11 +158,11 @@ int run_consumer() std::uint64_t expected{0}; int data_mismatches{0}; bool is_first_sample{true}; - proxy.event_.Subscribe(kSamplesToSubscribe); + score::cpp::ignore = proxy.event_.Subscribe(kSamplesToSubscribe); while (received < kSamplesToProcess) { - proxy.event_.GetNewSamples( + score::cpp::ignore = proxy.event_.GetNewSamples( [&](score::mw::com::SamplePtr sample) { if (is_first_sample) {