Skip to content

Commit fbccfe5

Browse files
authored
nodiscard ChipError Batch project-chip#19: platform-specific src: Darwin (project-chip#42083)
* Batch project-chip#19 nodiscard errors: platform-specific src: Darwin * Fix CI * Apply review suggestions * Apply review suggestions
1 parent effde51 commit fbccfe5

21 files changed

+65
-68
lines changed

src/darwin/Framework/CHIP/MTRCommissionableBrowser.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ CHIP_ERROR Stop(id owner)
123123

124124
#if CONFIG_NETWORK_LAYER_BLE
125125
mBleScannerDelegateOwner = owner; // retain the owner until OnBleScanStopped is called
126-
PlatformMgrImpl().StopBleScan(); // doesn't actually fail, and if it did we'd want to carry on regardless
126+
TEMPORARY_RETURN_IGNORED PlatformMgrImpl().StopBleScan(); // doesn't actually fail, and if it did we'd want to carry on regardless
127127
#else
128128
(void) owner;
129129
#endif // CONFIG_NETWORK_LAYER_BLE

src/darwin/Framework/CHIP/MTRCommissioneeInfo.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ - (instancetype)initWithCommissioningInfo:(const chip::Controller::ReadCommissio
6969
// attributes, using a wildcard-endpoint path.
7070
pathFilters.emplace_back(MTRClusterIDTypeNetworkCommissioningID, MTRAttributeIDTypeGlobalAttributeFeatureMapID);
7171

72-
info.attributes->ForEachAttribute([&](const ConcreteAttributePath & path) -> CHIP_ERROR {
72+
TEMPORARY_RETURN_IGNORED info.attributes->ForEachAttribute([&](const ConcreteAttributePath & path) -> CHIP_ERROR {
7373
// Only grab paths that are included in extraAttributesToRead so that
7474
// API consumers don't develop dependencies on implementation details
7575
// (like which other attributes we happen to read).
@@ -118,7 +118,7 @@ - (instancetype)initWithCommissioningInfo:(const chip::Controller::ReadCommissio
118118
_attributes = attributes;
119119

120120
// Now grab the Network Commissioning information in a nicer form.
121-
info.attributes->ForEachAttribute(MTRClusterIDTypeNetworkCommissioningID, [&](const ConcreteAttributePath & path) -> CHIP_ERROR {
121+
TEMPORARY_RETURN_IGNORED info.attributes->ForEachAttribute(MTRClusterIDTypeNetworkCommissioningID, [&](const ConcreteAttributePath & path) -> CHIP_ERROR {
122122
if (path.mAttributeId != MTRAttributeIDTypeGlobalAttributeFeatureMapID) {
123123
return CHIP_NO_ERROR;
124124
}

src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ - (instancetype)init
211211

212212
// Start the work queue and leave it running. There is no performance
213213
// cost to having an idle dispatch queue, and it simplifies our logic.
214-
DeviceLayer::PlatformMgrImpl().StartEventLoopTask();
214+
TEMPORARY_RETURN_IGNORED DeviceLayer::PlatformMgrImpl().StartEventLoopTask();
215215

216216
_chipWorkQueue = DeviceLayer::PlatformMgrImpl().GetWorkQueue();
217217
_controllerFactory = &DeviceControllerFactory::GetInstance();
@@ -779,7 +779,7 @@ - (void)preWarmCommissioningSession
779779
MTR_LOG_ERROR("Can't pre-warm, Matter controller factory is not running");
780780
} else {
781781
MTR_LOG("Pre-warming commissioning session");
782-
self->_controllerFactory->EnsureAndRetainSystemState();
782+
TEMPORARY_RETURN_IGNORED self->_controllerFactory->EnsureAndRetainSystemState();
783783
err = DeviceLayer::PlatformMgrImpl().StartBleScan(&self->_preWarmingDelegate, DeviceLayer::BleScanMode::kPreWarm);
784784
if (err != CHIP_NO_ERROR) {
785785
MTR_LOG_ERROR("Pre-warming failed: %" CHIP_ERROR_FORMAT, err.Format());
@@ -934,7 +934,7 @@ - (void)controllerShuttingDown:(MTRDeviceController_Concrete *)controller
934934
// Clear out out group keys for this fabric index, in case fabric
935935
// indices get reused later. If a new controller is started on the
936936
// same fabric it will be handed the IPK at that point.
937-
self->_groupDataProvider.RemoveGroupKeys(fabricIndex);
937+
TEMPORARY_RETURN_IGNORED self->_groupDataProvider.RemoveGroupKeys(fabricIndex);
938938
}
939939

940940
// If there are no other controllers left, we can shut down some things.

src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,14 @@ - (void)setOTAProviderDelegate:(id<MTROTAProviderDelegate>)otaProviderDelegate q
316316
+ (nullable NSNumber *)nodeIDFromNOC:(MTRCertificateDERBytes)noc
317317
{
318318
NSNumber * nodeID = nil;
319-
ExtractNodeIDFromNOC(noc, &nodeID);
319+
TEMPORARY_RETURN_IGNORED ExtractNodeIDFromNOC(noc, &nodeID);
320320
return nodeID;
321321
}
322322

323323
+ (nullable NSNumber *)fabricIDFromNOC:(MTRCertificateDERBytes)noc
324324
{
325325
NSNumber * fabricID = nil;
326-
ExtractFabricIDFromNOC(noc, &fabricID);
326+
TEMPORARY_RETURN_IGNORED ExtractFabricIDFromNOC(noc, &fabricID);
327327
return fabricID;
328328
}
329329

src/darwin/Framework/CHIP/MTRDeviceController_Concrete.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ - (void)_controllerSuspended
359359
auto * fabricTable = factory.fabricTable;
360360
if (fabricTable) {
361361
// We don't care about errors here. If our fabric is gone, nothing to do.
362-
fabricTable->SetShouldAdvertiseIdentity(self->_storedFabricIndex, chip::FabricTable::AdvertiseIdentity::No);
362+
TEMPORARY_RETURN_IGNORED fabricTable->SetShouldAdvertiseIdentity(self->_storedFabricIndex, chip::FabricTable::AdvertiseIdentity::No);
363363
[factory resetOperationalAdvertising];
364364
}
365365
}
@@ -376,7 +376,7 @@ - (void)_controllerResumed
376376
auto * fabricTable = factory.fabricTable;
377377
if (fabricTable) {
378378
// We don't care about errors here. If our fabric is gone, nothing to do.
379-
fabricTable->SetShouldAdvertiseIdentity(self->_storedFabricIndex, chip::FabricTable::AdvertiseIdentity::Yes);
379+
TEMPORARY_RETURN_IGNORED fabricTable->SetShouldAdvertiseIdentity(self->_storedFabricIndex, chip::FabricTable::AdvertiseIdentity::Yes);
380380
[factory resetOperationalAdvertising];
381381
}
382382
}

src/darwin/Framework/CHIP/MTRDiagnosticLogsDownloader.mm

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -667,16 +667,16 @@ - (void)handleBDXTransferSessionEndForFileDesignator:(NSString *)fileDesignator
667667

668668
if (error != nil) {
669669
auto err = [MTRError errorToCHIPErrorCode:error];
670-
transfer->Reject(err);
670+
TEMPORARY_RETURN_IGNORED transfer->Reject(err);
671671
} else {
672-
transfer->Accept();
672+
TEMPORARY_RETURN_IGNORED transfer->Accept();
673673
}
674674
};
675675

676676
auto abortHandler = ^(NSError * error) {
677677
assertChipStackLockedByCurrentThread();
678678
auto err = [MTRError errorToCHIPErrorCode:error];
679-
transfer->Reject(err);
679+
TEMPORARY_RETURN_IGNORED transfer->Reject(err);
680680
};
681681

682682
[mDelegate handleBDXTransferSessionBeginForFileDesignator:fileDesignator
@@ -728,9 +728,9 @@ - (void)handleBDXTransferSessionEndForFileDesignator:(NSString *)fileDesignator
728728

729729
if (error != nil) {
730730
auto err = [MTRError errorToCHIPErrorCode:error];
731-
transfer->Reject(err);
731+
TEMPORARY_RETURN_IGNORED transfer->Reject(err);
732732
} else {
733-
transfer->Continue();
733+
TEMPORARY_RETURN_IGNORED transfer->Continue();
734734
}
735735
};
736736

src/darwin/Framework/CHIP/MTREndpointInfo.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ + (BOOL)populateChildrenForEndpoints:(NSDictionary<NSNumber *, MTREndpointInfo *
212212
using namespace Descriptor::Attributes;
213213

214214
NSMutableDictionary<NSNumber *, MTREndpointInfo *> * endpoints = [[NSMutableDictionary alloc] init];
215-
cache->ForEachAttribute(Descriptor::Id, [&](const ConcreteAttributePath & path) -> CHIP_ERROR {
215+
TEMPORARY_RETURN_IGNORED cache->ForEachAttribute(Descriptor::Id, [&](const ConcreteAttributePath & path) -> CHIP_ERROR {
216216
VerifyOrReturnError(path.mAttributeId == DeviceTypeList::Id, CHIP_NO_ERROR);
217217

218218
CHIP_ERROR err = CHIP_NO_ERROR;

src/darwin/Framework/CHIP/MTRFramework.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void MTRFrameworkInit()
3030
// malloc/free so there is nothing to initialize, so this just needs
3131
// to happen to avoid debug assertions. The malloc version of
3232
// MemoryInit() never fails.
33-
chip::Platform::MemoryInit();
33+
TEMPORARY_RETURN_IGNORED chip::Platform::MemoryInit();
3434

3535
// Suppress CHIP logging until we actually need it for redirection
3636
// (see MTRSetLogCallback()). Logging to os_log is always enabled.

src/darwin/Framework/CHIP/MTROTAImageTransferHandler.mm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,20 +535,18 @@ - (void)SetOtaImageTransferHandler:(MTROTAImageTransferHandler *)otaImageTransfe
535535
payloadHeader.GetMessageType(), ChipLogValueProtocolId(payloadHeader.GetProtocolID()));
536536

537537
VerifyOrReturnError(ec != nullptr, CHIP_ERROR_INCORRECT_STATE);
538-
CHIP_ERROR err;
539538

540539
// If we receive a ReceiveInit message, then we prepare for transfer.
541540
//
542541
// If init succeeds, or is not needed, we send the message to the AsyncTransferFacilitator for processing.
543542
if (payloadHeader.HasMessageType(MessageType::ReceiveInit)) {
544-
err = Init(ec);
543+
CHIP_ERROR err = Init(ec);
545544
if (err != CHIP_NO_ERROR) {
546545
ChipLogError(Controller, "OnMessageReceived: Failed to prepare for transfer for BDX: %" CHIP_ERROR_FORMAT, err.Format());
547546
return err;
548547
}
549548
}
550549

551550
// Send the message to the AsyncFacilitator to drive the BDX session state machine.
552-
AsyncTransferFacilitator::OnMessageReceived(ec, payloadHeader, std::move(payload));
553-
return err;
551+
return AsyncTransferFacilitator::OnMessageReceived(ec, payloadHeader, std::move(payload));
554552
}

src/darwin/Framework/CHIP/MTROTAUnsolicitedBDXMessageHandler.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
assertChipStackLockedByCurrentThread();
4949

5050
VerifyOrReturn(mExchangeMgr != nullptr);
51-
mExchangeMgr->UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::BDX::Id);
51+
TEMPORARY_RETURN_IGNORED mExchangeMgr->UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::BDX::Id);
5252

5353
VerifyOrReturn(mOTAImageTransferHandler != nullptr);
5454

0 commit comments

Comments
 (0)