[multi-radio] fix clang-tidy warnings (#6821)

- enable TREL in clang-tidy check
- add explicit keyword to constructors
- fix inconsistent parameter names
- remove redundant initializer
- use nullptr
This commit is contained in:
Jonathan Hui
2021-07-16 09:48:56 -07:00
committed by GitHub
parent 53af491df5
commit d89f9222f0
8 changed files with 12 additions and 15 deletions
+1
View File
@@ -115,6 +115,7 @@ readonly OT_CLANG_TIDY_BUILD_OPTS=(
'-DOT_SNTP_CLIENT=ON'
'-DOT_SRP_CLIENT=ON'
'-DOT_THREAD_VERSION=1.2'
'-DOT_TREL=ON'
'-DOT_COVERAGE=ON'
'-DOT_LOG_LEVEL_DYNAMIC=ON'
'-DOT_COMPILE_WARNING_AS_ERROR=ON'
+3 -3
View File
@@ -47,7 +47,7 @@ using namespace ot;
otError otMultiRadioGetNeighborInfo(otInstance * aInstance,
const otExtAddress * aExtAddress,
otMultiRadioNeighborInfo *aInfo)
otMultiRadioNeighborInfo *aNeighborInfo)
{
Error error = kErrorNone;
Instance &instance = *static_cast<Instance *>(aInstance);
@@ -55,9 +55,9 @@ otError otMultiRadioGetNeighborInfo(otInstance * aInstance,
neighbor = instance.Get<NeighborTable>().FindNeighbor(*static_cast<const Mac::ExtAddress *>(aExtAddress),
Neighbor::kInStateAnyExceptInvalid);
VerifyOrExit(neighbor != NULL, error = kErrorNotFound);
VerifyOrExit(neighbor != nullptr, error = kErrorNotFound);
neighbor->PopulateMultiRadioInfo(*aInfo);
neighbor->PopulateMultiRadioInfo(*aNeighborInfo);
exit:
return error;
-3
View File
@@ -51,9 +51,6 @@ TxFrames::TxFrames(Instance &aInstance)
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
, mTxFrameTrel(aInstance.Get<Trel::Link>().GetTransmitFrame())
#endif
#if OPENTHREAD_CONFIG_MULTI_RADIO
, mSelectedRadioTypes()
#endif
{
}
+1 -1
View File
@@ -671,7 +671,7 @@ public:
* @param[in] aMask A bit-mask representing the radio types (the first bit corresponds to radio type 0, and so on)
*
*/
RadioTypes(uint8_t aMask)
explicit RadioTypes(uint8_t aMask)
: mBitMask(aMask)
{
}
+2 -2
View File
@@ -116,14 +116,14 @@ void Packet::Init(uint8_t *aBuffer, uint16_t aLength)
mLength = aLength;
}
void Packet::Init(Header::Type aType, uint8_t *mPayload, uint16_t mPayloadLength)
void Packet::Init(Header::Type aType, uint8_t *aPayload, uint16_t aPayloadLength)
{
uint16_t headerSize = Header::GetSize(aType);
// The payload buffer should reserve enough bytes for
// header (depending on type) before the payload.
Init(mPayload - headerSize, mPayloadLength + headerSize);
Init(aPayload - headerSize, aPayloadLength + headerSize);
GetHeader().Init(aType);
}
-1
View File
@@ -284,7 +284,6 @@ public:
* @param[in] aPayloadLength The length (number of bytes) in the payload only (not including the header).
*
*/
void Init(Header::Type aType, uint8_t *aPayload, uint16_t aPayloadLength);
/**
+2 -2
View File
@@ -314,11 +314,11 @@ public:
* on the radio link.
*
* @param[in] aNeighbor The neighbor for which the deferred ack status is being reported.
* @param[in] aTxError The deferred ack error status: `kErrorNone` to indicate a deferred ack was received,
* @param[in] aError The deferred ack error status: `kErrorNone` to indicate a deferred ack was received,
* `kErrorNoAck` to indicate an ack timeout.
*
*/
void HandleDeferredAck(Neighbor &aNeighbor, Error aTxError);
void HandleDeferredAck(Neighbor &aNeighbor, Error aError);
#endif
private:
+3 -3
View File
@@ -114,7 +114,7 @@ public:
* @param[in] aInstance A reference to the OpenThread instance.
*
*/
RadioSelector(Instance &aInstance);
explicit RadioSelector(Instance &aInstance);
/**
* This method updates the neighbor info (for multi radio support) on a received frame event.
@@ -173,13 +173,13 @@ public:
* The `aTxFrames` will also be updated to indicate which radio links are to be used.
*
* @param[inout] aMessage The message to send.
* @param[in] aDest The MAC destination address.
* @param[in] aMacDest The MAC destination address.
* @param[inout] aTxFrames The set of TxFrames for all radio links.
*
* @returns A reference to `mTxFrame` to use when preparing the frame for tx.
*
*/
Mac::TxFrame &SelectRadio(Message &aMessage, const Mac::Address &aDest, Mac::TxFrames &aTxFrames);
Mac::TxFrame &SelectRadio(Message &aMessage, const Mac::Address &aMacDest, Mac::TxFrames &aTxFrames);
private:
enum