Skip to content

Commit

Permalink
Add modernize-redundant-void-arg to clang-tidy (#23760)
Browse files Browse the repository at this point in the history
* Add modernize-redundant-void-arg to clang-tidy

* Update coding style guide

* Fix redundant void arg for Darwin, Tizen and webOS
  • Loading branch information
arkq authored and pull[bot] committed Mar 14, 2023
1 parent ae5e54e commit 1524bc6
Show file tree
Hide file tree
Showing 122 changed files with 191 additions and 190 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
Checks: >
bugprone-*,
modernize-redundant-void-arg,
modernize-use-bool-literals,
modernize-use-nullptr,
performance-for-range-copy,
Expand Down
22 changes: 11 additions & 11 deletions docs/style/coding/CODING_STYLE_GUIDE.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ leveraged through toolchain-compatibility preprocessor macros.
CHIP strives to use the latest C++ functionality as long as existing compilers
support such standards.

C{plusplus}14 is considered pervasive enough to be used. As compilers start
C{plusplus}14 is considered pervasive enough to be used. As compilers start
supporting standards such as C{plusplus}17, C{plusplus}20 and beyond,
CHIP may follow suit.

Expand Down Expand Up @@ -354,7 +354,7 @@ static chipDEFINE_ALIGNED_VAR(sThreadAttributes, sizeof (pthread_attr_t), uint64
#endif // USE_STRUCT_STORAGE
int foobar(void)
int foobar()
{
int retval;
int status;
Expand Down Expand Up @@ -427,10 +427,10 @@ destructed after deinitialization.
class ThreadAttributes
{
public:
ThreadAttributes(void) {};
~ThreadAttributes(void) {};
ThreadAttributes() {};
~ThreadAttributes() {};
operator pthread_attr_t *(void) { return &mAttributes; }
operator pthread_attr_t *() { return &mAttributes; }
private:
pthread_attr_t mAttributes;
Expand All @@ -444,7 +444,7 @@ extern void * foobar_entry(void *aArgument);
static chipDEFINE_ALIGNED_VAR(sThreadAttributes, sizeof (ThreadAttributes), uint64_t);
int foobar(void)
int foobar()
{
int retval = -1;
int status;
Expand Down Expand Up @@ -530,9 +530,9 @@ storage of objects from a static array of storage.
class Foo
{
public:
Foo(void);
Foo();
Foo(const Foo &inFoo);
~Foo(void);
~Foo();
};
// Global Variables
Expand All @@ -554,7 +554,7 @@ static void CreateFooAllocator(void *inStorage,
inDestroy);
}
static StaticAllocatorBitmap &GetFooAllocator(void)
static StaticAllocatorBitmap &GetFooAllocator()
{
return *sFooAllocator;
}
Expand All @@ -571,7 +571,7 @@ static void FooDestroy(AllocatorBase &inAllocator, void *inObject)
return;
}
int Init(void)
int Init()
{
static const size_t sFooCount = CHIP_FOO_COUNT;
static chipAllocatorStaticBitmapStorageDefine(sFooStorage, Foo, sFooCount, uint32_t, sizeof (void *));
Expand All @@ -586,7 +586,7 @@ int Init(void)
return retval;
}
Foo * FooAllocate(void)
Foo * FooAllocate()
{
Foo *foo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ CHIP_ERROR ActionsAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attr
}
} // anonymous namespace

void MatterActionsPluginServerInitCallback(void)
void MatterActionsPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
}
2 changes: 1 addition & 1 deletion examples/bridge-app/linux/bridged-actions-stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ CHIP_ERROR ActionsAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attr
}
} // anonymous namespace

void MatterActionsPluginServerInitCallback(void)
void MatterActionsPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
}
4 changes: 2 additions & 2 deletions examples/chip-tool/commands/common/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ const char * Command::GetArgumentDescription(size_t index) const
return nullptr;
}

const char * Command::GetAttribute(void) const
const char * Command::GetAttribute() const
{
size_t argsCount = mArgs.size();
for (size_t i = 0; i < argsCount; i++)
Expand All @@ -818,7 +818,7 @@ const char * Command::GetAttribute(void) const
return nullptr;
}

const char * Command::GetEvent(void) const
const char * Command::GetEvent() const
{
size_t argsCount = mArgs.size();
for (size_t i = 0; i < argsCount; i++)
Expand Down
2 changes: 1 addition & 1 deletion src/app/AttributePathExpandIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ using namespace chip;
// Note: Some of the generated files that depended by af.h are gen_config.h and gen_tokens.h
typedef uint8_t EmberAfClusterMask;

extern uint16_t emberAfEndpointCount(void);
extern uint16_t emberAfEndpointCount();
extern uint16_t emberAfIndexFromEndpoint(EndpointId endpoint);
extern uint8_t emberAfClusterCount(EndpointId endpoint, bool server);
extern uint16_t emberAfGetServerAttributeCount(chip::EndpointId endpoint, chip::ClusterId cluster);
Expand Down
2 changes: 1 addition & 1 deletion src/app/EventManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CircularEventReader : public TLV::TLVReader
virtual ~CircularEventReader() = default;
};

EventManagement & EventManagement::GetInstance(void)
EventManagement & EventManagement::GetInstance()
{
return sInstance;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ bool emberAfApplicationLauncherClusterHideAppCallback(app::CommandHandler * comm
// -----------------------------------------------------------------------------
// Plugin initialization

void MatterApplicationLauncherPluginServerInitCallback(void)
void MatterApplicationLauncherPluginServerInitCallback()
{
registerAttributeAccessOverride(&gApplicationLauncherAttrAccess);
}
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ bool emberAfContentLauncherClusterLaunchURLCallback(CommandHandler * commandObj,
// -----------------------------------------------------------------------------
// Plugin initialization

void MatterContentLauncherPluginServerInitCallback(void)
void MatterContentLauncherPluginServerInitCallback()
{
registerAttributeAccessOverride(&gContentLauncherAttrAccess);
}
2 changes: 1 addition & 1 deletion src/app/clusters/descriptor/descriptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ CHIP_ERROR DescriptorAttrAccess::Read(const ConcreteReadAttributePath & aPath, A
}
} // anonymous namespace

void MatterDescriptorPluginServerInitCallback(void)
void MatterDescriptorPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
}
2 changes: 1 addition & 1 deletion src/app/clusters/fixed-label-server/fixed-label-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ CHIP_ERROR FixedLabelAttrAccess::Read(const ConcreteReadAttributePath & aPath, A
}
} // anonymous namespace

void MatterFixedLabelPluginServerInitCallback(void)
void MatterFixedLabelPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
}
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void emberAfLocalizationConfigurationClusterServerInitCallback(EndpointId endpoi
}
}

void MatterLocalizationConfigurationPluginServerInitCallback(void)
void MatterLocalizationConfigurationPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
}
2 changes: 1 addition & 1 deletion src/app/clusters/mode-select-server/mode-select-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ inline bool areStartUpModeAndCurrentModeNonVolatile(EndpointId endpointId)

} // namespace

void MatterModeSelectPluginServerInitCallback(void)
void MatterModeSelectPluginServerInitCallback()
{
registerAttributeAccessOverride(&gModeSelectAttrAccess);
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/on-off-server/on-off-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ bool OnOffServer::OnWithRecallGlobalSceneCommand(app::CommandHandler * commandOb
return true;
}

uint32_t OnOffServer::calculateNextWaitTimeMS(void)
uint32_t OnOffServer::calculateNextWaitTimeMS()
{
const chip::System::Clock::Timestamp currentTime = chip::System::SystemClock().GetMonotonicTimestamp();
chip::System::Clock::Timestamp waitTime = UPDATE_TIME_MS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ class OpCredsFabricTableDelegate : public chip::FabricTable::Delegate

OpCredsFabricTableDelegate gFabricDelegate;

void MatterOperationalCredentialsPluginServerInitCallback(void)
void MatterOperationalCredentialsPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void DefaultOTARequestorDriver::StopPeriodicQueryTimer()
CancelDelayedAction(PeriodicQueryTimerHandler, this);
}

void DefaultOTARequestorDriver::RekickPeriodicQueryTimer(void)
void DefaultOTARequestorDriver::RekickPeriodicQueryTimer()
{
ChipLogProgress(SoftwareUpdate, "Rekicking the Periodic Query timer");
StopPeriodicQueryTimer();
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/ota-requestor/ota-requestor-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ bool emberAfOtaSoftwareUpdateRequestorClusterAnnounceOtaProviderCallback(
// -----------------------------------------------------------------------------
// Plugin initialization

void MatterOtaSoftwareUpdateRequestorPluginServerInitCallback(void)
void MatterOtaSoftwareUpdateRequestorPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ CHIP_ERROR PowerSourceConfigurationAttrAccess::Read(const ConcreteReadAttributeP

} // anonymous namespace

void MatterPowerSourceConfigurationPluginServerInitCallback(void)
void MatterPowerSourceConfigurationPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ CHIP_ERROR PowerSourceAttrAccess::Read(const ConcreteReadAttributePath & aPath,

} // anonymous namespace

void MatterPowerSourcePluginServerInitCallback(void)
void MatterPowerSourcePluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ enum class RemoteSensorType : uint8_t
kTemperatureSensor = 0x03,
};

static RemoteSensorType detectRemoteSensorConnected(void)
static RemoteSensorType detectRemoteSensorConnected()
{
// TODO: Detect the sensor types attached to the pump control cluster
// this could be pressure, flow or temperature sensors.
Expand Down Expand Up @@ -462,7 +462,7 @@ void MatterPumpConfigurationAndControlClusterServerAttributeChangedCallback(cons
}
}

void MatterPumpConfigurationAndControlPluginServerInitCallback(void)
void MatterPumpConfigurationAndControlPluginServerInitCallback()
{
emberAfDebugPrintln("Initialize PCC Plugin Server Cluster.");

Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/scenes/scenes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ EmberAfStatus emberAfScenesClusterMakeInvalidCallback(EndpointId endpoint)
ZCL_BOOLEAN_ATTRIBUTE_TYPE);
}

void emAfPluginScenesServerPrintInfo(void)
void emAfPluginScenesServerPrintInfo()
{
uint8_t i;
EmberAfSceneTableEntry entry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ bool emberAfUnitTestingClusterTestSimpleOptionalArgumentRequestCallback(
// -----------------------------------------------------------------------------
// Plugin initialization

void MatterUnitTestingPluginServerInitCallback(void)
void MatterUnitTestingPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
}
2 changes: 1 addition & 1 deletion src/app/clusters/thermostat-client/thermostat-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

using namespace chip;

void emberAfThermostatClusterClientInitCallback(void)
void emberAfThermostatClusterClientInitCallback()
{
// TODO
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ void emberAfTimeFormatLocalizationClusterServerInitCallback(EndpointId endpoint)
}
}

void MatterTimeFormatLocalizationPluginServerInitCallback(void)
void MatterTimeFormatLocalizationPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
}
2 changes: 1 addition & 1 deletion src/app/clusters/user-label-server/user-label-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class UserLabelFabricTableDelegate : public chip::FabricTable::Delegate

UserLabelFabricTableDelegate gUserLabelFabricDelegate;

void MatterUserLabelPluginServerInitCallback(void)
void MatterUserLabelPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
Server::GetInstance().GetFabricTable().AddFabricDelegate(&gUserLabelFabricDelegate);
Expand Down
8 changes: 4 additions & 4 deletions src/app/tests/integration/MockEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ size_t EventGenerator::GetNumStates()
return mNumStates;
}

LivenessEventGenerator::LivenessEventGenerator(void) : EventGenerator(10, 0) {}
LivenessEventGenerator::LivenessEventGenerator() : EventGenerator(10, 0) {}

void LivenessEventGenerator::Generate(void)
void LivenessEventGenerator::Generate()
{
// Scenario: monitoring liveness for two devices -- self and remote. Remote device goes offline and returns.
switch (mState)
Expand Down Expand Up @@ -131,13 +131,13 @@ chip::EventNumber LivenessEventGenerator::LogLiveness(chip::NodeId aNodeId, chip
return number;
}

MockEventGenerator * MockEventGenerator::GetInstance(void)
MockEventGenerator * MockEventGenerator::GetInstance()
{
static MockEventGeneratorImpl gMockEventGenerator;
return &gMockEventGenerator;
}

MockEventGeneratorImpl::MockEventGeneratorImpl(void) :
MockEventGeneratorImpl::MockEventGeneratorImpl() :
mpExchangeMgr(nullptr), mTimeBetweenEvents(0), mEventWraparound(false), mpEventGenerator(nullptr), mEventsLeft(0)
{}

Expand Down
4 changes: 2 additions & 2 deletions src/app/tests/integration/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ chip::TestPersistentStorageDelegate gStorage;
chip::PersistentStorageOperationalKeystore gOperationalKeystore;
chip::Credentials::PersistentStorageOpCertStore gOpCertStore;

void InitializeChip(void)
void InitializeChip()
{
CHIP_ERROR err = CHIP_NO_ERROR;
chip::FabricTable::InitParams fabricTableInitParams;
Expand Down Expand Up @@ -84,7 +84,7 @@ void InitializeChip(void)
}
}

void ShutdownChip(void)
void ShutdownChip()
{
gMessageCounterManager.Shutdown();
gExchangeManager.Shutdown();
Expand Down
2 changes: 1 addition & 1 deletion src/app/util/af-event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct EmberEventData
/** The control structure for the event. */
EmberEventControl * control;
/** The procedure to call when the event fires. */
void (*handler)(void);
void (*handler)();
};

// *****************************************************************************
Expand Down
Loading

0 comments on commit 1524bc6

Please sign in to comment.