Skip to content

Commit

Permalink
Clang tidy readability-redundant-* (#17121)
Browse files Browse the repository at this point in the history
* Ran clang-tidy using readability-redundant-*

* Restyle

* Add back session holder init: it looks like -Wextra is more strict on what calls should be made on base classes
  • Loading branch information
andy31415 authored Apr 7, 2022
1 parent d56fca1 commit 0c06ba5
Show file tree
Hide file tree
Showing 27 changed files with 15 additions and 62 deletions.
6 changes: 3 additions & 3 deletions examples/chip-tool/commands/common/CHIPCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ CHIP_ERROR CHIPCommand::MaybeSetUpStack()
chip::FabricId fabricId = strtoull(name.c_str(), nullptr, 0);
if (fabricId >= kIdentityOtherFabricId)
{
ReturnLogErrorOnFailure(InitializeCommissioner(name.c_str(), fabricId, trustStore));
ReturnLogErrorOnFailure(InitializeCommissioner(name, fabricId, trustStore));
}

// Initialize Group Data, including IPK
Expand Down Expand Up @@ -168,7 +168,7 @@ CHIP_ERROR CHIPCommand::MaybeTearDownStack()
chip::FabricId fabricId = strtoull(name.c_str(), nullptr, 0);
if (fabricId >= kIdentityOtherFabricId)
{
ReturnLogErrorOnFailure(ShutdownCommissioner(name.c_str()));
ReturnLogErrorOnFailure(ShutdownCommissioner(name));
}

StopTracing();
Expand Down Expand Up @@ -286,7 +286,7 @@ chip::FabricId CHIPCommand::CurrentCommissionerId()
chip::Controller::DeviceCommissioner & CHIPCommand::CurrentCommissioner()
{
auto item = mCommissioners.find(GetIdentity());
return *item->second.get();
return *item->second;
}

CHIP_ERROR CHIPCommand::ShutdownCommissioner(std::string key)
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/commands/common/Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ void Commands::ShowCommand(std::string executable, std::string clusterName, Comm
{
fprintf(stderr, "Usage:\n");

std::string arguments = "";
std::string arguments;
arguments += command->GetName();

size_t argumentsCount = command->GetArgumentsCount();
Expand Down
2 changes: 0 additions & 2 deletions src/access/AccessControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ class AccessControl
*/
CHIP_ERROR RemoveTarget(size_t index) { return mDelegate->RemoveTarget(index); }

public:
const Delegate & GetDelegate() const { return *mDelegate; }

Delegate & GetDelegate() { return *mDelegate; }
Expand Down Expand Up @@ -267,7 +266,6 @@ class AccessControl

CHIP_ERROR Next(Entry & entry) { return mDelegate->Next(entry); }

public:
const Delegate & GetDelegate() const { return *mDelegate; }

Delegate & GetDelegate() { return *mDelegate; }
Expand Down
17 changes: 0 additions & 17 deletions src/access/examples/ExampleAccessControlDelegate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ class SubjectStorage
return CHIP_ERROR_INVALID_ARGUMENT;
}

public:
CHIP_ERROR Serialize(chip::TLV::TLVWriter & writer) const { return writer.Put(chip::TLV::AnonymousTag(), mNode); }

CHIP_ERROR Deserialize(chip::TLV::TLVReader & reader)
Expand All @@ -142,10 +141,8 @@ class SubjectStorage
private:
static bool IsValid(NodeId node) { return node != kUndefinedNodeId; }

private:
static_assert(sizeof(NodeId) == 8, "Expecting 8 byte node ID");

private:
NodeId mNode;
};

Expand Down Expand Up @@ -194,7 +191,6 @@ class TargetStorage
return CHIP_ERROR_INVALID_ARGUMENT;
}

public:
CHIP_ERROR Serialize(chip::TLV::TLVWriter & writer) const
{
ReturnErrorOnFailure(writer.Put(chip::TLV::AnonymousTag(), mCluster));
Expand Down Expand Up @@ -241,7 +237,6 @@ class TargetStorage
!((target.flags & Target::kDeviceType) && !IsValidDeviceType(target.deviceType));
}

private:
void Decode(Target & target) const
{
auto & flags = target.flags;
Expand Down Expand Up @@ -297,7 +292,6 @@ class TargetStorage
}
}

private:
static_assert(sizeof(ClusterId) == 4, "Expecting 4 byte cluster ID");
static_assert(sizeof(EndpointId) == 2, "Expecting 2 byte endpoint ID");
static_assert(sizeof(DeviceTypeId) == 4, "Expecting 4 byte device type ID");
Expand Down Expand Up @@ -346,7 +340,6 @@ class TargetStorage
// (mDeviceType >> kEndpointShift) --> extract endpoint from mDeviceType
static constexpr int kEndpointShift = 16;

private:
ClusterId mCluster;
DeviceTypeId mDeviceType;
};
Expand Down Expand Up @@ -390,7 +383,6 @@ class EntryStorage
return nullptr;
}

public:
// Pool support
static EntryStorage pool[kEntryStoragePoolSize];

Expand Down Expand Up @@ -419,7 +411,6 @@ class EntryStorage
return pool <= this && this < end;
}

public:
EntryStorage() = default;

void Init()
Expand Down Expand Up @@ -457,7 +448,6 @@ class EntryStorage
}
}

public:
enum class ConvertDirection
{
kAbsoluteToRelative,
Expand Down Expand Up @@ -512,7 +502,6 @@ class EntryStorage
index = found ? toIndex : ArraySize(acl);
}

public:
static constexpr uint8_t kTagInUse = 1;
static constexpr uint8_t kTagFabricIndex = 2;
static constexpr uint8_t kTagAuthMode = 3;
Expand Down Expand Up @@ -598,7 +587,6 @@ class EntryStorage
return reader.ExitContainer(container);
}

public:
static constexpr size_t kMaxSubjects = CHIP_CONFIG_EXAMPLE_ACCESS_CONTROL_MAX_SUBJECTS_PER_ENTRY;
static constexpr size_t kMaxTargets = CHIP_CONFIG_EXAMPLE_ACCESS_CONTROL_MAX_TARGETS_PER_ENTRY;

Expand Down Expand Up @@ -648,7 +636,6 @@ class EntryDelegate : public Entry::Delegate
return pool <= &delegate && &delegate < end;
}

public:
void Release() override
{
mStorage->Release();
Expand Down Expand Up @@ -840,7 +827,6 @@ class EntryDelegate : public Entry::Delegate
return CHIP_ERROR_SENTINEL;
}

public:
void Init(Entry & entry, EntryStorage & storage)
{
entry.SetDelegate(*this);
Expand Down Expand Up @@ -922,7 +908,6 @@ class EntryIteratorDelegate : public EntryIterator::Delegate
return pool <= &delegate && &delegate < end;
}

public:
void Release() override { mInUse = false; }

CHIP_ERROR Next(Entry & entry) override
Expand Down Expand Up @@ -963,7 +948,6 @@ class EntryIteratorDelegate : public EntryIterator::Delegate
return CHIP_ERROR_SENTINEL;
}

public:
void Init(EntryIterator & iterator, const FabricIndex * fabricIndex)
{
iterator.SetDelegate(*this);
Expand Down Expand Up @@ -1245,7 +1229,6 @@ class AccessControlDelegate : public AccessControl::Delegate
return CHIP_ERROR_NOT_IMPLEMENTED;
}

public:
void SetStorageDelegate(chip::PersistentStorageDelegate * storageDelegate) { mStorageDelegate = storageDelegate; }

private:
Expand Down
2 changes: 0 additions & 2 deletions src/app/AttributeCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ class AttributeCache : protected ReadClient::Callback
*/
CHIP_ERROR UpdateCache(const ConcreteDataAttributePath & aPath, TLV::TLVReader * apData, const StatusIB & aStatus);

private:
//
// ReadClient::Callback
//
Expand All @@ -360,7 +359,6 @@ class AttributeCache : protected ReadClient::Callback
return mCallback.OnDeallocatePaths(std::move(aReadPrepareParams));
}

private:
Callback & mCallback;
NodeState mCache;
std::set<ConcreteAttributePath> mChangedAttributeSet;
Expand Down
2 changes: 0 additions & 2 deletions src/app/BufferedReadCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ class BufferedReadCallback : public ReadClient::Callback
*/
CHIP_ERROR BufferData(const ConcreteDataAttributePath & aPath, TLV::TLVReader * apReader);

private:
//
// ReadClient::Callback
//
Expand All @@ -84,7 +83,6 @@ class BufferedReadCallback : public ReadClient::Callback
return mCallback.OnDeallocatePaths(std::move(aReadPrepareParams));
}

private:
/*
* Given a reader positioned at a list element, allocate a packet buffer, copy the list item where
* the reader is positioned into that buffer and add it to our buffered list for tracking.
Expand Down
1 change: 0 additions & 1 deletion src/app/ReadClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ static void DefaultResubscribePolicy(uint32_t aNumCumulativeRetries, uint32_t &
"Computing Resubscribe policy: attempts %" PRIu32 ", max wait time %" PRIu32 " ms, selected wait time %" PRIu32
" ms",
aNumCumulativeRetries, maxWaitTimeInMsec, waitTimeInMsec);
return;
}

ReadClient::ReadClient(InteractionModelEngine * apImEngine, Messaging::ExchangeManager * apExchangeMgr, Callback & apCallback,
Expand Down
3 changes: 1 addition & 2 deletions src/app/WriteHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,11 @@ class WriteHandler : public Messaging::ExchangeDelegate
*/
void Close();

private: // ExchangeDelegate
// ExchangeDelegate
CHIP_ERROR OnMessageReceived(Messaging::ExchangeContext * apExchangeContext, const PayloadHeader & aPayloadHeader,
System::PacketBufferHandle && aPayload) override;
void OnResponseTimeout(Messaging::ExchangeContext * apExchangeContext) override;

private:
Messaging::ExchangeContext * mpExchangeCtx = nullptr;
WriteResponseMessage::Builder mWriteResponseBuilder;
State mState = State::Uninitialized;
Expand Down
5 changes: 0 additions & 5 deletions src/app/util/af.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,11 +587,6 @@ uint8_t emberAfGetAddressIndex(void);
*/
EmberNetworkStatus emberAfNetworkState(void);

/**
* @brief Get this node's radio channel for the current network.
*/
uint8_t emberAfGetRadioChannel(void);

/**
* @brief Returns the current network parameters.
*/
Expand Down
1 change: 0 additions & 1 deletion src/app/util/ember-compatibility-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,6 @@ void IncreaseClusterDataVersion(const ConcreteClusterPath & aConcreteClusterPath
ChipLogDetail(DataManagement, "Endpoint %" PRIx16 ", Cluster " ChipLogFormatMEI " update version to %" PRIx32,
aConcreteClusterPath.mEndpointId, ChipLogValueMEI(aConcreteClusterPath.mClusterId), *(version));
}
return;
}

CHIP_ERROR SendSuccessStatus(AttributeReportIB::Builder & aAttributeReport, AttributeDataIB::Builder & aAttributeDataIBBuilder)
Expand Down
2 changes: 1 addition & 1 deletion src/controller/python/OpCredsBinding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ extern chip::Controller::ScriptDevicePairingDelegate sPairingDelegate;
class TestCommissioner : public chip::Controller::AutoCommissioner
{
public:
TestCommissioner() : AutoCommissioner() { Reset(); }
TestCommissioner() { Reset(); }
~TestCommissioner() {}
CHIP_ERROR SetCommissioningParameters(const chip::Controller::CommissioningParameters & params) override
{
Expand Down
1 change: 0 additions & 1 deletion src/controller/tests/data_model/TestRead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ class TestReadInteraction : public app::ReadHandler::ApplicationCallback
// of reads in parallel and wait for them all to succeed.
static void SubscribeThenReadHelper(nlTestSuite * apSuite, TestContext & aCtx, size_t aSubscribeCount, size_t aReadCount);

private:
bool mEmitSubscriptionError = false;
int32_t mNumActiveSubscriptions = 0;
bool mAlterSubscriptionIntervals = false;
Expand Down
1 change: 0 additions & 1 deletion src/credentials/FabricTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,6 @@ void FabricTable::UpdateNextAvailableFabricIndex()
}

mNextAvailableFabricIndex.ClearValue();
return;
}

CHIP_ERROR FabricTable::StoreFabricIndexInfo() const
Expand Down
4 changes: 2 additions & 2 deletions src/credentials/GroupDataProviderImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ struct GroupData : public GroupDataProvider::GroupInfo, PersistentData<kPersiste
bool first = true;

GroupData() : GroupInfo(nullptr){};
GroupData(chip::FabricIndex fabric) : GroupInfo(), fabric_index(fabric) {}
GroupData(chip::FabricIndex fabric) : fabric_index(fabric) {}
GroupData(chip::FabricIndex fabric, chip::GroupId group) : GroupInfo(group, nullptr), fabric_index(fabric) {}

CHIP_ERROR UpdateKey(DefaultStorageKeyAllocator & key) override
Expand Down Expand Up @@ -505,7 +505,7 @@ struct KeyMapData : public GroupDataProvider::GroupKey, LinkedData
chip::GroupId group_id = kUndefinedGroupId;
chip::KeysetId keyset_id = 0;

KeyMapData() : GroupKey(){};
KeyMapData(){};
KeyMapData(chip::FabricIndex fabric, uint16_t link_id = 0, chip::GroupId group = kUndefinedGroupId, chip::KeysetId keyset = 0) :
GroupKey(group, keyset), LinkedData(link_id), fabric_index(fabric)
{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ void GenericPlatformManagerImpl_POSIX<ImplClass>::_RunEventLoop()
// StopEventLoopTask().
//
pthread_cond_signal(&mEventQueueStoppedCond);

return;
}

template <class ImplClass>
Expand Down
1 change: 0 additions & 1 deletion src/inet/IPAddress.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ class DLL_EXPORT IPAddress
static constexpr uint16_t kMaxStringLength = INET6_ADDRSTRLEN;
#endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS || CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK

public:
IPAddress() = default;
IPAddress(const IPAddress & other) = default;

Expand Down
1 change: 0 additions & 1 deletion src/inet/InetInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ class InterfaceId
static constexpr size_t kMaxIfNameLength = Z_DEVICE_MAX_NAME_LEN;
#endif

public:
~InterfaceId() = default;

constexpr InterfaceId() : mPlatformInterface(kPlatformNull) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ constexpr size_t kMaxRecords = 10;
class TestAllocator : public QueryResponderAllocator<kMaxRecords>
{
public:
TestAllocator() : QueryResponderAllocator<kMaxRecords>()
TestAllocator()
{
#if CHIP_CONFIG_MEMORY_DEBUG_DMALLOC
// void dmalloc_track(const dmalloc_track_t track_func)
Expand Down
1 change: 0 additions & 1 deletion src/lib/shell/commands/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ void RegisterConfigCommands()

// Register the root `config` command with the top-level shell.
Engine::Root().RegisterCommands(&sConfigComand, 1);
return;
}

} // namespace Shell
Expand Down
1 change: 0 additions & 1 deletion src/lib/shell/commands/OnboardingCodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ void RegisterOnboardingCodesCommands()

// Register the root `device` command with the top-level shell.
Engine::Root().RegisterCommands(&sDeviceComand, 1);
return;
}

} // namespace Shell
Expand Down
1 change: 0 additions & 1 deletion src/messaging/ReliableMessageContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ class ReliableMessageContext
// will send that ack at some point.
void SetPendingPeerAckMessageCounter(uint32_t aPeerAckMessageCounter);

private:
friend class ReliableMessageMgr;
friend class ExchangeContext;
friend class ExchangeMessageDispatch;
Expand Down
7 changes: 2 additions & 5 deletions src/messaging/ReliableMessageMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace chip {
namespace Messaging {

ReliableMessageMgr::RetransTableEntry::RetransTableEntry(ReliableMessageContext * rc) :
ec(*rc->GetExchangeContext()), retainedBuf(EncryptedPacketBufferHandle()), nextRetransTime(0), sendCount(0)
ec(*rc->GetExchangeContext()), nextRetransTime(0), sendCount(0)
{
ec->SetMessageNotAcked(true);
}
Expand Down Expand Up @@ -89,10 +89,7 @@ void ReliableMessageMgr::TicklessDebugDumpRetransTable(const char * log)
});
}
#else
void ReliableMessageMgr::TicklessDebugDumpRetransTable(const char * log)
{
return;
}
void ReliableMessageMgr::TicklessDebugDumpRetransTable(const char * log) {}
#endif // RMP_TICKLESS_DEBUG

void ReliableMessageMgr::ExecuteActions()
Expand Down
1 change: 0 additions & 1 deletion src/messaging/ReliableMessageMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class ReliableMessageMgr
including both successfully and failure send. */
};

public:
ReliableMessageMgr(BitMapObjectPool<ExchangeContext, CHIP_CONFIG_MAX_EXCHANGE_CONTEXTS> & contextPool);
~ReliableMessageMgr();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ void UserDirectedCommissioningServer::SetUDCClientProcessingState(char * instanc
client->SetUDCClientProcessingState(state);

mUdcClients.MarkUDCClientActive(client);

return;
}

void UserDirectedCommissioningServer::OnCommissionableNodeFound(const Dnssd::DiscoveredNodeData & nodeData)
Expand Down
Loading

0 comments on commit 0c06ba5

Please sign in to comment.