Skip to content

Commit 682ef15

Browse files
authored
nodiscard ChipError Batch project-chip#5: clusters app code (project-chip#41863)
* Batch project-chip#5 nodiscard errors: clusters app code * Fix CI & missed cleanup * Missed cleanup * Clang tidy
1 parent a1dc96e commit 682ef15

File tree

67 files changed

+238
-255
lines changed

Some content is hidden

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

67 files changed

+238
-255
lines changed

src/app/clusters/actions-server/actions-server.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ActionsServer::~ActionsServer()
3939

4040
void ActionsServer::Shutdown()
4141
{
42-
CommandHandlerInterfaceRegistry::Instance().UnregisterCommandHandler(this);
42+
TEMPORARY_RETURN_IGNORED CommandHandlerInterfaceRegistry::Instance().UnregisterCommandHandler(this);
4343
AttributeAccessInterfaceRegistry::Instance().Unregister(this);
4444
}
4545

@@ -170,7 +170,7 @@ void ActionsServer::HandleCommand(HandlerContext & handlerContext, FuncT func)
170170
if (actionIndex != kMaxActionListLength)
171171
{
172172
ActionStructStorage action;
173-
mDelegate.ReadActionAtIndex(actionIndex, action);
173+
TEMPORARY_RETURN_IGNORED mDelegate.ReadActionAtIndex(actionIndex, action);
174174
// Check if the command bit is set in the SupportedCommands of an ations.
175175
if (!(action.supportedCommands.Raw() & (1 << handlerContext.mRequestPath.mCommandId)))
176176
{

src/app/clusters/application-launcher-server/application-launcher-server.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ bool emberAfApplicationLauncherClusterLaunchAppCallback(app::CommandHandler * co
262262
ChipLogError(Zcl, "ApplicationLauncher target app not found");
263263
LauncherResponseType response;
264264
response.status = StatusEnum::kAppNotAvailable;
265-
responder.Success(response);
265+
TEMPORARY_RETURN_IGNORED responder.Success(response);
266266
return true;
267267
}
268268

@@ -297,7 +297,7 @@ bool emberAfApplicationLauncherClusterLaunchAppCallback(app::CommandHandler * co
297297
ChipLogProgress(Zcl, "ApplicationLauncher target app not found");
298298
LauncherResponseType response;
299299
response.status = StatusEnum::kAppNotAvailable;
300-
responder.Success(response);
300+
TEMPORARY_RETURN_IGNORED responder.Success(response);
301301
return true;
302302
}
303303
#endif // CHIP_DEVICE_CONFIG_APP_PLATFORM_ENABLED
@@ -356,7 +356,7 @@ bool emberAfApplicationLauncherClusterStopAppCallback(app::CommandHandler * comm
356356
ChipLogError(Zcl, "ApplicationLauncher target app not loaded");
357357
LauncherResponseType response;
358358
response.status = StatusEnum::kAppNotAvailable;
359-
responder.Success(response);
359+
TEMPORARY_RETURN_IGNORED responder.Success(response);
360360
return true;
361361
}
362362

@@ -445,7 +445,7 @@ bool emberAfApplicationLauncherClusterHideAppCallback(app::CommandHandler * comm
445445
ChipLogError(Zcl, "ApplicationLauncher target app not loaded");
446446
LauncherResponseType response;
447447
response.status = StatusEnum::kAppNotAvailable;
448-
responder.Success(response);
448+
TEMPORARY_RETURN_IGNORED responder.Success(response);
449449
return true;
450450
}
451451

src/app/clusters/bindings/BindingManager.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class BindingFabricTableDelegate : public chip::FabricTable::Delegate
3333
{
3434
if (iter->fabricIndex == fabricIndex)
3535
{
36-
bindingTable.RemoveAt(iter);
36+
TEMPORARY_RETURN_IGNORED bindingTable.RemoveAt(iter);
3737
}
3838
else
3939
{
@@ -72,7 +72,7 @@ CHIP_ERROR Manager::Init(const ManagerInitParams & params)
7272
VerifyOrReturnError(params.mFabricTable != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
7373
VerifyOrReturnError(params.mStorage != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
7474
mInitParams = params;
75-
params.mFabricTable->AddFabricDelegate(&gFabricTableDelegate);
75+
TEMPORARY_RETURN_IGNORED params.mFabricTable->AddFabricDelegate(&gFabricTableDelegate);
7676
Table::GetInstance().SetPersistentStorage(params.mStorage);
7777
CHIP_ERROR error = Table::GetInstance().LoadFromStorage();
7878
if (error != CHIP_NO_ERROR)

src/app/clusters/bindings/binding-cluster.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ DataModel::ActionReturnStatus BindingCluster::WriteAttribute(const DataModel::Wr
181181
{
182182
if (bindingTableIter->type == Binding::MATTER_UNICAST_BINDING)
183183
{
184-
Binding::Manager::GetInstance().UnicastBindingRemoved(bindingTableIter.GetIndex());
184+
TEMPORARY_RETURN_IGNORED Binding::Manager::GetInstance().UnicastBindingRemoved(bindingTableIter.GetIndex());
185185
}
186186
ReturnErrorOnFailure(Binding::Table::GetInstance().RemoveAt(bindingTableIter));
187187
}

src/app/clusters/bindings/binding-table.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ CHIP_ERROR Table::Add(const TableEntry & entry)
5858
}
5959
if (error != CHIP_NO_ERROR)
6060
{
61-
mStorage->SyncDeleteKeyValue(DefaultStorageKeyAllocator::BindingTableEntry(newIndex).KeyName());
61+
TEMPORARY_RETURN_IGNORED mStorage->SyncDeleteKeyValue(
62+
DefaultStorageKeyAllocator::BindingTableEntry(newIndex).KeyName());
6263
}
6364
}
6465
if (error != CHIP_NO_ERROR)

src/app/clusters/boolean-state-configuration-server/boolean-state-configuration-cluster.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ CHIP_ERROR SuppressAlarms(EndpointId ep, BitMask<BooleanStateConfiguration::Alar
336336
Delegate * delegate = GetDelegate(ep);
337337
if (!isDelegateNull(delegate))
338338
{
339-
delegate->HandleSuppressAlarm(alarm);
339+
TEMPORARY_RETURN_IGNORED delegate->HandleSuppressAlarm(alarm);
340340
}
341341

342342
VerifyOrReturnError(Status::Success == AlarmsSuppressed::Get(ep, &alarmsSuppressed), attribute_error);
@@ -414,7 +414,7 @@ bool emberAfBooleanStateConfigurationClusterEnableDisableAlarmCallback(
414414

415415
if (!isDelegateNull(delegate))
416416
{
417-
delegate->HandleEnableDisableAlarms(alarms);
417+
TEMPORARY_RETURN_IGNORED delegate->HandleEnableDisableAlarms(alarms);
418418
}
419419

420420
VerifyOrExit(Status::Success == AlarmsActive::Get(ep, &alarmsActive), status.Emplace(Status::Failure));

src/app/clusters/camera-av-settings-user-level-management-server/camera-av-settings-user-level-management-server.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ CameraAvSettingsUserLevelMgmtServer::CameraAvSettingsUserLevelMgmtServer(Endpoin
5454
CameraAvSettingsUserLevelMgmtServer::~CameraAvSettingsUserLevelMgmtServer()
5555
{
5656
// Unregister command handler and attribute access interfaces
57-
CommandHandlerInterfaceRegistry::Instance().UnregisterCommandHandler(this);
57+
TEMPORARY_RETURN_IGNORED CommandHandlerInterfaceRegistry::Instance().UnregisterCommandHandler(this);
5858
AttributeAccessInterfaceRegistry::Instance().Unregister(this);
5959
mDelegate.SetServer(nullptr);
6060
}
@@ -356,7 +356,7 @@ void CameraAvSettingsUserLevelMgmtServer::SetPan(Optional<int16_t> aPan)
356356
if (aPan.HasValue())
357357
{
358358
mMptzPosition.pan = aPan;
359-
StoreMPTZPosition(mMptzPosition);
359+
TEMPORARY_RETURN_IGNORED StoreMPTZPosition(mMptzPosition);
360360
MarkDirty(Attributes::MPTZPosition::Id);
361361
}
362362
}
@@ -369,7 +369,7 @@ void CameraAvSettingsUserLevelMgmtServer::SetTilt(Optional<int16_t> aTilt)
369369
if (aTilt.HasValue())
370370
{
371371
mMptzPosition.tilt = aTilt;
372-
StoreMPTZPosition(mMptzPosition);
372+
TEMPORARY_RETURN_IGNORED StoreMPTZPosition(mMptzPosition);
373373
MarkDirty(Attributes::MPTZPosition::Id);
374374
}
375375
}
@@ -382,7 +382,7 @@ void CameraAvSettingsUserLevelMgmtServer::SetZoom(Optional<uint8_t> aZoom)
382382
if (aZoom.HasValue())
383383
{
384384
mMptzPosition.zoom = aZoom;
385-
StoreMPTZPosition(mMptzPosition);
385+
TEMPORARY_RETURN_IGNORED StoreMPTZPosition(mMptzPosition);
386386
MarkDirty(Attributes::MPTZPosition::Id);
387387
}
388388
}
@@ -571,7 +571,7 @@ void CameraAvSettingsUserLevelMgmtServer::LoadPersistentAttributes()
571571
}
572572

573573
// Signal delegate that all persistent configuration attributes have been loaded.
574-
mDelegate.PersistentAttributesLoadedCallback();
574+
TEMPORARY_RETURN_IGNORED mDelegate.PersistentAttributesLoadedCallback();
575575
}
576576

577577
/**

src/app/clusters/camera-av-stream-management-server/camera-av-stream-management-server.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ CameraAVStreamMgmtServer::~CameraAVStreamMgmtServer()
8181
mDelegate.SetCameraAVStreamMgmtServer(nullptr);
8282

8383
// Unregister command handler and attribute access interfaces
84-
CommandHandlerInterfaceRegistry::Instance().UnregisterCommandHandler(this);
84+
TEMPORARY_RETURN_IGNORED CommandHandlerInterfaceRegistry::Instance().UnregisterCommandHandler(this);
8585
AttributeAccessInterfaceRegistry::Instance().Unregister(this);
8686
}
8787

@@ -168,7 +168,7 @@ CHIP_ERROR CameraAVStreamMgmtServer::Init()
168168
mEndpointId));
169169
}
170170

171-
LoadPersistentAttributes();
171+
TEMPORARY_RETURN_IGNORED LoadPersistentAttributes();
172172

173173
VerifyOrReturnError(AttributeAccessInterfaceRegistry::Instance().Register(this), CHIP_ERROR_INTERNAL);
174174
ReturnErrorOnFailure(CommandHandlerInterfaceRegistry::Instance().RegisterCommandHandler(this));
@@ -1014,7 +1014,7 @@ void CameraAVStreamMgmtServer::ModifyVideoStream(const uint16_t streamID, const
10141014
}
10151015
if (wasModified)
10161016
{
1017-
PersistAndNotify<Attributes::AllocatedVideoStreams::Id>();
1017+
TEMPORARY_RETURN_IGNORED PersistAndNotify<Attributes::AllocatedVideoStreams::Id>();
10181018
ChipLogProgress(Camera, "Modified video stream with ID: %d", streamID);
10191019
}
10201020
return;
@@ -1042,7 +1042,7 @@ void CameraAVStreamMgmtServer::ModifySnapshotStream(const uint16_t streamID, con
10421042
}
10431043
if (wasModified)
10441044
{
1045-
PersistAndNotify<Attributes::AllocatedSnapshotStreams::Id>();
1045+
TEMPORARY_RETURN_IGNORED PersistAndNotify<Attributes::AllocatedSnapshotStreams::Id>();
10461046
ChipLogProgress(Camera, "Modified snapshot stream with ID: %d", streamID);
10471047
}
10481048
return;
@@ -1134,7 +1134,7 @@ CHIP_ERROR CameraAVStreamMgmtServer::SetViewport(const Globals::Structs::Viewpor
11341134
}
11351135
mViewport = aViewport;
11361136

1137-
StoreViewport(mViewport);
1137+
TEMPORARY_RETURN_IGNORED StoreViewport(mViewport);
11381138
mDelegate.OnAttributeChanged(Attributes::Viewport::Id);
11391139
auto path = ConcreteAttributePath(mEndpointId, CameraAvStreamManagement::Id, Attributes::Viewport::Id);
11401140
MatterReportingAttributeChangeCallback(path);
@@ -1583,7 +1583,7 @@ void CameraAVStreamMgmtServer::LoadPersistentAttributes()
15831583
}
15841584

15851585
// Signal delegate that all persistent configuration attributes have been loaded.
1586-
mDelegate.PersistentAttributesLoadedCallback();
1586+
TEMPORARY_RETURN_IGNORED mDelegate.PersistentAttributesLoadedCallback();
15871587
}
15881588

15891589
CHIP_ERROR CameraAVStreamMgmtServer::StoreViewport(const Globals::Structs::ViewportStruct::Type & viewport)
@@ -2035,7 +2035,7 @@ void CameraAVStreamMgmtServer::HandleVideoStreamAllocate(HandlerContext & ctx,
20352035
{
20362036
// Add the allocated videostream object in the AllocatedVideoStreams list.
20372037
videoStreamArgs.videoStreamID = videoStreamID;
2038-
AddVideoStream(videoStreamArgs);
2038+
TEMPORARY_RETURN_IGNORED AddVideoStream(videoStreamArgs);
20392039

20402040
// Call delegate with the allocated stream parameters and new allocation action
20412041
mDelegate.OnVideoStreamAllocated(videoStreamArgs, StreamAllocationAction::kNewAllocation);
@@ -2046,7 +2046,7 @@ void CameraAVStreamMgmtServer::HandleVideoStreamAllocate(HandlerContext & ctx,
20462046

20472047
VideoStreamStruct & videoStreamToUpdate = *it;
20482048
// Reusing the existing stream. Update range parameters and check if they were modified
2049-
UpdateVideoStreamRangeParams(videoStreamToUpdate, videoStreamArgs, wasModified);
2049+
TEMPORARY_RETURN_IGNORED UpdateVideoStreamRangeParams(videoStreamToUpdate, videoStreamArgs, wasModified);
20502050

20512051
// Call delegate with the final updated stream parameters and appropriate action
20522052
mDelegate.OnVideoStreamAllocated(videoStreamToUpdate,
@@ -2125,7 +2125,7 @@ void CameraAVStreamMgmtServer::HandleVideoStreamDeallocate(HandlerContext & ctx,
21252125

21262126
if (status == Status::Success)
21272127
{
2128-
RemoveVideoStream(videoStreamID);
2128+
TEMPORARY_RETURN_IGNORED RemoveVideoStream(videoStreamID);
21292129
}
21302130

21312131
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
@@ -2207,7 +2207,7 @@ void CameraAVStreamMgmtServer::HandleAudioStreamAllocate(HandlerContext & ctx,
22072207
{
22082208
// Add the allocated audiostream object in the AllocatedAudioStreams list.
22092209
audioStreamArgs.audioStreamID = audioStreamID;
2210-
AddAudioStream(audioStreamArgs);
2210+
TEMPORARY_RETURN_IGNORED AddAudioStream(audioStreamArgs);
22112211
}
22122212

22132213
response.audioStreamID = audioStreamID;
@@ -2229,7 +2229,7 @@ void CameraAVStreamMgmtServer::HandleAudioStreamDeallocate(HandlerContext & ctx,
22292229

22302230
if (status == Status::Success)
22312231
{
2232-
RemoveAudioStream(audioStreamID);
2232+
TEMPORARY_RETURN_IGNORED RemoveAudioStream(audioStreamID);
22332233
}
22342234

22352235
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);
@@ -2344,13 +2344,13 @@ void CameraAVStreamMgmtServer::HandleSnapshotStreamAllocate(HandlerContext & ctx
23442344
allocatedSnapshotStream.watermarkEnabled = snapshotStreamArgs.watermarkEnabled;
23452345
allocatedSnapshotStream.OSDEnabled = snapshotStreamArgs.OSDEnabled;
23462346

2347-
AddSnapshotStream(allocatedSnapshotStream);
2347+
TEMPORARY_RETURN_IGNORED AddSnapshotStream(allocatedSnapshotStream);
23482348
}
23492349
else
23502350
{
23512351
SnapshotStreamStruct & snapshotStreamToUpdate = *it;
23522352
// Reusing the existing stream. Update range parameters
2353-
UpdateSnapshotStreamRangeParams(snapshotStreamToUpdate, snapshotStreamArgs);
2353+
TEMPORARY_RETURN_IGNORED UpdateSnapshotStreamRangeParams(snapshotStreamToUpdate, snapshotStreamArgs);
23542354
}
23552355

23562356
response.snapshotStreamID = snapshotStreamID;
@@ -2421,7 +2421,7 @@ void CameraAVStreamMgmtServer::HandleSnapshotStreamDeallocate(HandlerContext & c
24212421

24222422
if (status == Status::Success)
24232423
{
2424-
RemoveSnapshotStream(snapshotStreamID);
2424+
TEMPORARY_RETURN_IGNORED RemoveSnapshotStream(snapshotStreamID);
24252425
}
24262426

24272427
ctx.mCommandHandler.AddStatus(ctx.mRequestPath, status);

src/app/clusters/chime-server/chime-server.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ ChimeServer::~ChimeServer()
5252
mDelegate.SetChimeServer(nullptr);
5353

5454
// unregister
55-
CommandHandlerInterfaceRegistry::Instance().UnregisterCommandHandler(this);
55+
TEMPORARY_RETURN_IGNORED CommandHandlerInterfaceRegistry::Instance().UnregisterCommandHandler(this);
5656
AttributeAccessInterfaceRegistry::Instance().Unregister(this);
5757
}
5858

@@ -218,7 +218,7 @@ Status ChimeServer::SetSelectedChime(uint8_t chimeID)
218218
// Write new value to persistent storage.
219219
auto endpointId = GetEndpointId();
220220
ConcreteAttributePath path = ConcreteAttributePath(endpointId, Chime::Id, SelectedChime::Id);
221-
GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mSelectedChime);
221+
TEMPORARY_RETURN_IGNORED GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mSelectedChime);
222222

223223
// and mark as dirty
224224
MatterReportingAttributeChangeCallback(path);
@@ -237,7 +237,7 @@ Status ChimeServer::SetEnabled(bool Enabled)
237237
// Write new value to persistent storage.
238238
auto endpointId = GetEndpointId();
239239
ConcreteAttributePath path = ConcreteAttributePath(endpointId, Chime::Id, Enabled::Id);
240-
GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mEnabled);
240+
TEMPORARY_RETURN_IGNORED GetSafeAttributePersistenceProvider()->WriteScalarValue(path, mEnabled);
241241

242242
// and mark as dirty
243243
MatterReportingAttributeChangeCallback(path);

src/app/clusters/closure-control-server/closure-control-cluster-logic.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,12 @@ CHIP_ERROR ClusterLogic::SetMainState(MainStateEnum mainState)
177177
// EngageStateChanged event SHALL be generated when the MainStateEnum attribute changes state to and from disengaged state
178178
if (mState.mMainState == MainStateEnum::kDisengaged)
179179
{
180-
GenerateEngageStateChangedEvent(true);
180+
TEMPORARY_RETURN_IGNORED GenerateEngageStateChangedEvent(true);
181181
}
182182

183183
if (mainState == MainStateEnum::kDisengaged)
184184
{
185-
GenerateEngageStateChangedEvent(false);
185+
TEMPORARY_RETURN_IGNORED GenerateEngageStateChangedEvent(false);
186186
}
187187

188188
mState.mMainState = mainState;
@@ -192,20 +192,20 @@ CHIP_ERROR ClusterLogic::SetMainState(MainStateEnum mainState)
192192
{
193193
if (mainState == MainStateEnum::kCalibrating)
194194
{
195-
SetCountdownTimeFromCluster(mDelegate.GetCalibrationCountdownTime());
195+
TEMPORARY_RETURN_IGNORED SetCountdownTimeFromCluster(mDelegate.GetCalibrationCountdownTime());
196196
}
197197
else if (mainState == MainStateEnum::kMoving)
198198
{
199-
SetCountdownTimeFromCluster(mDelegate.GetMovingCountdownTime());
199+
TEMPORARY_RETURN_IGNORED SetCountdownTimeFromCluster(mDelegate.GetMovingCountdownTime());
200200
}
201201
else if (mainState == MainStateEnum::kWaitingForMotion)
202202
{
203-
SetCountdownTimeFromCluster(mDelegate.GetWaitingForMotionCountdownTime());
203+
TEMPORARY_RETURN_IGNORED SetCountdownTimeFromCluster(mDelegate.GetWaitingForMotionCountdownTime());
204204
}
205205
else
206206
{
207207
// Reset the countdown time to 0 when the main state is not in motion or calibration.
208-
SetCountdownTimeFromCluster(DataModel::Nullable<ElapsedS>(0));
208+
TEMPORARY_RETURN_IGNORED SetCountdownTimeFromCluster(DataModel::Nullable<ElapsedS>(0));
209209
}
210210
}
211211

@@ -293,15 +293,15 @@ CHIP_ERROR ClusterLogic::SetOverallCurrentState(const DataModel::Nullable<Generi
293293
{
294294
// As secureState field is not set in present current state and incoming current state has value, we generate the
295295
// event
296-
GenerateSecureStateChangedEvent(incomingOverallCurrentState.secureState.Value());
296+
TEMPORARY_RETURN_IGNORED GenerateSecureStateChangedEvent(incomingOverallCurrentState.secureState.Value());
297297
}
298298
else
299299
{
300300
// If the secureState field is set in both present and incoming current state, we generate the event only if the
301301
// value has changed.
302302
if (mState.mOverallCurrentState.Value().secureState.Value() != incomingOverallCurrentState.secureState.Value())
303303
{
304-
GenerateSecureStateChangedEvent(incomingOverallCurrentState.secureState.Value());
304+
TEMPORARY_RETURN_IGNORED GenerateSecureStateChangedEvent(incomingOverallCurrentState.secureState.Value());
305305
}
306306
}
307307
}

0 commit comments

Comments
 (0)