Skip to content

Commit 3a34ff9

Browse files
authored
nodiscard ChipError Batch #4: non-clusters app code (#41862)
* Batch #4 nodiscard errors: non-clusters app code * Fix clang
1 parent da7742a commit 3a34ff9

46 files changed

Lines changed: 196 additions & 206 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/app/AttributeValueEncoder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ void AttributeValueEncoder::EnsureListEnded()
8989
// fails, because that would mean that we've corrupted our data, and since
9090
// mEncodeState.mAllowPartialData is true nothing will clean up for us here.
9191
auto * attributeDataWriter = mAttributeReportIBsBuilder.GetAttributeReport().GetAttributeData().GetWriter();
92-
VerifyOrDie(attributeDataWriter->UnreserveBuffer(kEndOfListByteCount + kEndOfAttributeReportIBByteCount) == CHIP_NO_ERROR);
93-
VerifyOrDie(attributeDataWriter->EndContainer(kAttributeDataIBType) == CHIP_NO_ERROR);
92+
SuccessOrDie(attributeDataWriter->UnreserveBuffer(kEndOfListByteCount + kEndOfAttributeReportIBByteCount));
93+
SuccessOrDie(attributeDataWriter->EndContainer(kAttributeDataIBType));
9494

9595
AttributeReportBuilder builder;
96-
VerifyOrDie(builder.FinishAttribute(mAttributeReportIBsBuilder) == CHIP_NO_ERROR);
96+
SuccessOrDie(builder.FinishAttribute(mAttributeReportIBsBuilder));
9797

9898
if (!mEncodedAtLeastOneListItem)
9999
{

src/app/BufferedReadCallback.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ CHIP_ERROR BufferedReadCallback::GenerateListTLV(TLV::ScopedBufferTLVReader & aR
9494

9595
ReturnErrorOnFailure(writer.EndContainer(outerType));
9696

97-
writer.Finalize(backingBuffer);
97+
TEMPORARY_RETURN_IGNORED writer.Finalize(backingBuffer);
9898

9999
aReader.Init(std::move(backingBuffer), totalBufSize);
100100

src/app/ClusterStateCache.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ void ClusterStateCacheT<CanEnableDataCaching>::OnAttributeData(const ConcreteDat
426426
dataSnapshot.Init(*apData);
427427
}
428428

429-
UpdateCache(aPath, apData, aStatus);
429+
TEMPORARY_RETURN_IGNORED UpdateCache(aPath, apData, aStatus);
430430

431431
//
432432
// Forward the call through.
@@ -458,7 +458,7 @@ void ClusterStateCacheT<CanEnableDataCaching>::OnEventData(const EventHeader & a
458458
dataSnapshot.Init(*apData);
459459
}
460460

461-
UpdateEventCache(aEventHeader, apData, apStatus);
461+
TEMPORARY_RETURN_IGNORED UpdateEventCache(aEventHeader, apData, apStatus);
462462
mCallback.OnEventData(aEventHeader, apData ? &dataSnapshot : nullptr, apStatus);
463463
}
464464

src/app/CommandHandlerImpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ Status CommandHandlerImpl::ProcessInvokeRequest(System::PacketBufferHandle && pa
260260
reader.Init(std::move(payload));
261261
VerifyOrReturnError(invokeRequestMessage.Init(reader) == CHIP_NO_ERROR, Status::InvalidAction);
262262
#if CHIP_CONFIG_IM_PRETTY_PRINT
263-
invokeRequestMessage.PrettyPrint();
263+
TEMPORARY_RETURN_IGNORED invokeRequestMessage.PrettyPrint();
264264
#endif
265265
VerifyOrDie(mpResponder);
266266
if (mpResponder->GetGroupId().HasValue())
@@ -980,7 +980,7 @@ void CommandHandlerImpl::TestOnlyInvokeCommandRequestWithFaultsInjected(CommandH
980980
VerifyOrDieWithMsg(invokeRequestMessage.Init(reader) == CHIP_NO_ERROR, DataManagement,
981981
"TH Failure: Failed 'invokeRequestMessage.Init(reader)'");
982982
#if CHIP_CONFIG_IM_PRETTY_PRINT
983-
invokeRequestMessage.PrettyPrint();
983+
TEMPORARY_RETURN_IGNORED invokeRequestMessage.PrettyPrint();
984984
#endif
985985

986986
VerifyOrDieWithMsg(invokeRequestMessage.GetSuppressResponse(&mSuppressResponse) == CHIP_NO_ERROR, DataManagement,

src/app/CommandHandlerImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ class CommandHandlerImpl : public CommandHandler
325325
// The return value of RollbackResponse is ignored, as we prioritize
326326
// conveying the error generated by addResponseFunction to the
327327
// caller.
328-
RollbackResponse();
328+
TEMPORARY_RETURN_IGNORED RollbackResponse();
329329
}
330330
return err;
331331
}

src/app/CommandResponseSender.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ CHIP_ERROR CommandResponseSender::OnMessageReceived(Messaging::ExchangeContext *
6161
failureStatusToSend.SetValue(Status::Failure);
6262
ExitNow();
6363
}
64-
StatusResponse::Send(Status::InvalidAction, mExchangeCtx.Get(), false /*aExpectResponse*/);
64+
TEMPORARY_RETURN_IGNORED StatusResponse::Send(Status::InvalidAction, mExchangeCtx.Get(), false /*aExpectResponse*/);
6565
return err;
6666
exit:
6767
if (failureStatusToSend.HasValue())
6868
{
69-
StatusResponse::Send(failureStatusToSend.Value(), mExchangeCtx.Get(), false /*aExpectResponse*/);
69+
TEMPORARY_RETURN_IGNORED StatusResponse::Send(failureStatusToSend.Value(), mExchangeCtx.Get(), false /*aExpectResponse*/);
7070
}
7171
Close();
7272
return err;

src/app/CommandResponseSender.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class CommandResponseSender : public Messaging::ExchangeDelegate,
113113
VerifyOrReturn(mExchangeCtx);
114114
auto * msgContext = mExchangeCtx->GetReliableMessageContext();
115115
VerifyOrReturn(msgContext != nullptr);
116-
msgContext->FlushAcks();
116+
TEMPORARY_RETURN_IGNORED msgContext->FlushAcks();
117117
}
118118

119119
void AddInvokeResponseToSend(System::PacketBufferHandle && aPacket) override
@@ -173,7 +173,7 @@ class CommandResponseSender : public Messaging::ExchangeDelegate,
173173

174174
void SendStatusResponse(Protocols::InteractionModel::Status aStatus)
175175
{
176-
StatusResponse::Send(aStatus, mExchangeCtx.Get(), /*aExpectResponse = */ false);
176+
TEMPORARY_RETURN_IGNORED StatusResponse::Send(aStatus, mExchangeCtx.Get(), /*aExpectResponse = */ false);
177177
}
178178

179179
CHIP_ERROR SendCommandResponse();

src/app/CommandSender.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ CHIP_ERROR CommandSender::OnMessageReceived(Messaging::ExchangeContext * apExcha
250250
SuccessOrExit(err);
251251
if (moreChunkedMessages)
252252
{
253-
StatusResponse::Send(Status::Success, apExchangeContext, /*aExpectResponse = */ true);
253+
TEMPORARY_RETURN_IGNORED StatusResponse::Send(Status::Success, apExchangeContext, /*aExpectResponse = */ true);
254254
MoveToState(State::AwaitingResponse);
255255
return CHIP_NO_ERROR;
256256
}
@@ -276,7 +276,7 @@ CHIP_ERROR CommandSender::OnMessageReceived(Messaging::ExchangeContext * apExcha
276276

277277
if (sendStatusResponse)
278278
{
279-
StatusResponse::Send(Status::InvalidAction, apExchangeContext, /*aExpectResponse = */ false);
279+
TEMPORARY_RETURN_IGNORED StatusResponse::Send(Status::InvalidAction, apExchangeContext, /*aExpectResponse = */ false);
280280
}
281281

282282
if (mState != State::AwaitingResponse)
@@ -305,7 +305,7 @@ CHIP_ERROR CommandSender::ProcessInvokeResponse(System::PacketBufferHandle && pa
305305
ReturnErrorOnFailure(invokeResponseMessage.Init(reader));
306306

307307
#if CHIP_CONFIG_IM_PRETTY_PRINT
308-
invokeResponseMessage.PrettyPrint();
308+
TEMPORARY_RETURN_IGNORED invokeResponseMessage.PrettyPrint();
309309
#endif
310310

311311
ReturnErrorOnFailure(invokeResponseMessage.GetSuppressResponse(&suppressResponse));
@@ -403,7 +403,7 @@ CHIP_ERROR CommandSender::ProcessInvokeResponseIB(InvokeResponseIB::Parser & aIn
403403
ReturnErrorOnFailure(commandPath.GetEndpointId(&endpointId));
404404

405405
StatusIB::Parser status;
406-
commandStatus.GetErrorStatus(&status);
406+
TEMPORARY_RETURN_IGNORED commandStatus.GetErrorStatus(&status);
407407
ReturnErrorOnFailure(status.DecodeStatusIB(statusIB));
408408
ReturnErrorOnFailure(GetRef(commandStatus, commandRef, commandRefRequired));
409409
}
@@ -416,7 +416,7 @@ CHIP_ERROR CommandSender::ProcessInvokeResponseIB(InvokeResponseIB::Parser & aIn
416416
ReturnErrorOnFailure(commandPath.GetEndpointId(&endpointId));
417417
ReturnErrorOnFailure(commandPath.GetClusterId(&clusterId));
418418
ReturnErrorOnFailure(commandPath.GetCommandId(&commandId));
419-
commandData.GetFields(&commandDataReader);
419+
TEMPORARY_RETURN_IGNORED commandData.GetFields(&commandDataReader);
420420
ReturnErrorOnFailure(GetRef(commandData, commandRef, commandRefRequired));
421421
err = CHIP_NO_ERROR;
422422
hasDataResponse = true;
@@ -605,7 +605,7 @@ CHIP_ERROR CommandSender::FinishCommandInternal(FinishCommandParameters & aFinis
605605

606606
if (mpPendingResponseTracker && aFinishCommandParams.commandRef.HasValue())
607607
{
608-
mpPendingResponseTracker->Add(aFinishCommandParams.commandRef.Value());
608+
TEMPORARY_RETURN_IGNORED mpPendingResponseTracker->Add(aFinishCommandParams.commandRef.Value());
609609
}
610610

611611
if (aFinishCommandParams.timedInvokeTimeoutMs.HasValue())

src/app/EventManagement.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,8 @@ CHIP_ERROR EventManagement::ConstructEvent(EventLoadOutContext * apContext, Even
326326
// Revisit FabricRemovedCB function should the encoding of fabricIndex change in the future.
327327
if (apOptions->mFabricIndex != kUndefinedFabricIndex)
328328
{
329-
apContext->mWriter.Put(TLV::ProfileTag(kEventManagementProfile, kFabricIndexTag), apOptions->mFabricIndex);
329+
TEMPORARY_RETURN_IGNORED apContext->mWriter.Put(TLV::ProfileTag(kEventManagementProfile, kFabricIndexTag),
330+
apOptions->mFabricIndex);
330331
}
331332
ReturnErrorOnFailure(eventDataIBBuilder.EndOfEventDataIB());
332333
ReturnErrorOnFailure(eventReportBuilder.EndOfEventReportIB());
@@ -342,8 +343,9 @@ void EventManagement::CreateEventManagement(Messaging::ExchangeManager * apExcha
342343
System::Clock::Milliseconds64 aMonotonicStartupTime)
343344
{
344345

345-
sInstance.Init(apExchangeManager, aNumBuffers, apCircularEventBuffer, apLogStorageResources, apEventNumberCounter,
346-
aMonotonicStartupTime, &InteractionModelEngine::GetInstance()->GetReportingEngine());
346+
TEMPORARY_RETURN_IGNORED sInstance.Init(apExchangeManager, aNumBuffers, apCircularEventBuffer, apLogStorageResources,
347+
apEventNumberCounter, aMonotonicStartupTime,
348+
&InteractionModelEngine::GetInstance()->GetReportingEngine());
347349
}
348350

349351
/**
@@ -905,7 +907,7 @@ void CircularEventReader::Init(CircularEventBufferWrapper * apBufWrapper)
905907
if (apBufWrapper->mpCurrent == nullptr)
906908
return;
907909

908-
TLVReader::Init(*apBufWrapper, apBufWrapper->mpCurrent->DataLength());
910+
TEMPORARY_RETURN_IGNORED TLVReader::Init(*apBufWrapper, apBufWrapper->mpCurrent->DataLength());
909911
mMaxLen = apBufWrapper->mpCurrent->DataLength();
910912
for (prev = apBufWrapper->mpCurrent->GetPreviousCircularEventBuffer(); prev != nullptr;
911913
prev = prev->GetPreviousCircularEventBuffer())
@@ -919,7 +921,7 @@ void CircularEventReader::Init(CircularEventBufferWrapper * apBufWrapper)
919921
CHIP_ERROR CircularEventBufferWrapper::GetNextBuffer(TLVReader & aReader, const uint8_t *& aBufStart, uint32_t & aBufLen)
920922
{
921923
CHIP_ERROR err = CHIP_NO_ERROR;
922-
mpCurrent->GetNextBuffer(aReader, aBufStart, aBufLen);
924+
TEMPORARY_RETURN_IGNORED mpCurrent->GetNextBuffer(aReader, aBufStart, aBufLen);
923925
SuccessOrExit(err);
924926

925927
if ((aBufLen == 0) && (mpCurrent->GetPreviousCircularEventBuffer() != nullptr))

src/app/FailSafeContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void FailSafeContext::ScheduleFailSafeCleanup(FabricIndex fabricIndex, bool addN
100100
ChipLogError(FailSafe, "Failed to post fail-safe timer expired: %" CHIP_ERROR_FORMAT, status.Format());
101101
}
102102

103-
PlatformMgr().ScheduleWork(HandleDisarmFailSafe, reinterpret_cast<intptr_t>(this));
103+
TEMPORARY_RETURN_IGNORED PlatformMgr().ScheduleWork(HandleDisarmFailSafe, reinterpret_cast<intptr_t>(this));
104104
}
105105

106106
CHIP_ERROR FailSafeContext::ArmFailSafe(FabricIndex accessingFabricIndex, System::Clock::Seconds16 expiryLengthSeconds)

0 commit comments

Comments
 (0)