diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 45a5fae74..953bfb066 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -366,8 +366,8 @@ void Interpreter::ProcessHelp(int argc, char *argv[]) mServer->OutputFormat("%s\r\n", sCommands[i].mName); } - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); } void Interpreter::ProcessAutoStart(int argc, char *argv[]) @@ -470,8 +470,8 @@ exit: void Interpreter::ProcessBufferInfo(int argc, char *argv[]) { otBufferInfo bufferInfo; - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); otMessageGetBufferInfo(mInstance, &bufferInfo); @@ -914,8 +914,8 @@ void Interpreter::ProcessEidCache(int argc, char *argv[]) } exit: - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); AppendResult(OT_ERROR_NONE); } #endif // OPENTHREAD_FTD @@ -932,7 +932,7 @@ void Interpreter::ProcessEui64(int argc, char *argv[]) mServer->OutputFormat("\r\n"); exit: - (void)argv; + OT_UNUSED_VARIABLE(argv); AppendResult(error); } @@ -963,8 +963,8 @@ exit: void Interpreter::ProcessExit(int argc, char *argv[]) { exit(0); - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); } #endif @@ -994,8 +994,8 @@ exit: void Interpreter::ProcessFactoryReset(int argc, char *argv[]) { otInstanceFactoryReset(mInstance); - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); } void Interpreter::ProcessHashMacAddress(int argc, char *argv[]) @@ -1010,7 +1010,7 @@ void Interpreter::ProcessHashMacAddress(int argc, char *argv[]) mServer->OutputFormat("\r\n"); exit: - (void)argv; + OT_UNUSED_VARIABLE(argv); AppendResult(error); } @@ -1264,8 +1264,8 @@ void Interpreter::ProcessLeaderData(int argc, char *argv[]) mServer->OutputFormat("Leader Router ID: %d\r\n", leaderData.mLeaderRouterId); exit: - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); AppendResult(error); } @@ -1465,8 +1465,8 @@ void Interpreter::ProcessNetworkDataRegister(int argc, char *argv[]) SuccessOrExit(error = otBorderRouterRegister(mInstance)); exit: - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); AppendResult(error); } #endif // OPENTHREAD_ENABLE_BORDER_ROUTER @@ -1550,8 +1550,8 @@ void Interpreter::ProcessParent(int argc, char *argv[]) mServer->OutputFormat("Age: %d\r\n", parentInfo.mAge); exit: - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); AppendResult(error); } @@ -1962,7 +1962,7 @@ otError Interpreter::ProcessPrefixRemove(int argc, char *argv[]) error = otBorderRouterRemoveOnMeshPrefix(mInstance, &prefix); exit: - (void)argc; + OT_UNUSED_VARIABLE(argc); return error; } @@ -2079,16 +2079,16 @@ exit: void Interpreter::ProcessReset(int argc, char *argv[]) { otInstanceReset(mInstance); - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); } void Interpreter::ProcessRloc16(int argc, char *argv[]) { mServer->OutputFormat("%04x\r\n", otThreadGetRloc16(mInstance)); mServer->OutputFormat("Done\r\n"); - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); } #if OPENTHREAD_ENABLE_BORDER_ROUTER @@ -2455,8 +2455,8 @@ void Interpreter::ProcessSingleton(int argc, char *argv[]) mServer->OutputFormat("false\r\n"); } - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); AppendResult(error); } @@ -2545,8 +2545,8 @@ void Interpreter::ProcessThread(int argc, char *argv[]) } exit: - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); AppendResult(error); } @@ -2574,8 +2574,8 @@ void Interpreter::ProcessVersion(int argc, char *argv[]) otStringPtr version(otGetVersionString()); mServer->OutputFormat("%s\r\n", (const char *)version); AppendResult(OT_ERROR_NONE); - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); } #if OPENTHREAD_ENABLE_COMMISSIONER && OPENTHREAD_FTD diff --git a/src/cli/cli_coap.cpp b/src/cli/cli_coap.cpp index f6dd9386e..5af664956 100644 --- a/src/cli/cli_coap.cpp +++ b/src/cli/cli_coap.cpp @@ -341,8 +341,8 @@ void Coap::HandleClientResponse(otCoapHeader *aHeader, otMessage *aMessage, cons PrintPayload(aMessage); } - (void)aHeader; - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aHeader); + OT_UNUSED_VARIABLE(aMessageInfo); } } // namespace Cli diff --git a/src/cli/cli_dataset.cpp b/src/cli/cli_dataset.cpp index 4fd8cbcec..54445ed52 100644 --- a/src/cli/cli_dataset.cpp +++ b/src/cli/cli_dataset.cpp @@ -223,9 +223,9 @@ otError Dataset::ProcessHelp(otInstance *aInstance, int argc, char *argv[]) sServer->OutputFormat("%s\r\n", sCommands[i].mName); } - (void)aInstance; - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); return OT_ERROR_NONE; } @@ -234,8 +234,8 @@ otError Dataset::ProcessActive(otInstance *aInstance, int argc, char *argv[]) otOperationalDataset dataset; otDatasetGetActive(aInstance, &dataset); - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); return Print(dataset); } @@ -244,8 +244,8 @@ otError Dataset::ProcessPending(otInstance *aInstance, int argc, char *argv[]) otOperationalDataset dataset; otDatasetGetPending(aInstance, &dataset); - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); return Print(dataset); } @@ -260,7 +260,7 @@ otError Dataset::ProcessActiveTimestamp(otInstance *aInstance, int argc, char *a sDataset.mActiveTimestamp = static_cast(value); sDataset.mIsActiveTimestampSet = true; - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -276,7 +276,7 @@ otError Dataset::ProcessChannel(otInstance *aInstance, int argc, char *argv[]) sDataset.mChannel = static_cast(value); sDataset.mIsChannelSet = true; - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -291,7 +291,7 @@ otError Dataset::ProcessChannelMask(otInstance *aInstance, int argc, char *argv[ SuccessOrExit(error = Interpreter::ParseLong(argv[0], value)); sDataset.mChannelMaskPage0 = static_cast(value); sDataset.mIsChannelMaskPage0Set = true; - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -300,9 +300,9 @@ exit: otError Dataset::ProcessClear(otInstance *aInstance, int argc, char *argv[]) { memset(&sDataset, 0, sizeof(sDataset)); - (void)aInstance; - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); return OT_ERROR_NONE; } @@ -325,7 +325,7 @@ otError Dataset::ProcessCommit(otInstance *aInstance, int argc, char *argv[]) ExitNow(error = OT_ERROR_PARSE); } - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -341,7 +341,7 @@ otError Dataset::ProcessDelay(otInstance *aInstance, int argc, char *argv[]) sDataset.mDelay = static_cast(value); sDataset.mIsDelaySet = true; - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -358,7 +358,7 @@ otError Dataset::ProcessExtPanId(otInstance *aInstance, int argc, char *argv[]) memcpy(sDataset.mExtendedPanId.m8, extPanId, sizeof(sDataset.mExtendedPanId)); sDataset.mIsExtendedPanIdSet = true; - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -376,7 +376,7 @@ otError Dataset::ProcessMasterKey(otInstance *aInstance, int argc, char *argv[]) memcpy(sDataset.mMasterKey.m8, key, sizeof(sDataset.mMasterKey)); sDataset.mIsMasterKeySet = true; - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -393,7 +393,7 @@ otError Dataset::ProcessMeshLocalPrefix(otInstance *aInstance, int argc, char *a memcpy(sDataset.mMeshLocalPrefix.m8, prefix.mFields.m8, sizeof(sDataset.mMeshLocalPrefix.m8)); sDataset.mIsMeshLocalPrefixSet = true; - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -411,7 +411,7 @@ otError Dataset::ProcessNetworkName(otInstance *aInstance, int argc, char *argv[ memcpy(sDataset.mNetworkName.m8, argv[0], length); sDataset.mIsNetworkNameSet = true; - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -427,7 +427,7 @@ otError Dataset::ProcessPanId(otInstance *aInstance, int argc, char *argv[]) sDataset.mPanId = static_cast(value); sDataset.mIsPanIdSet = true; - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -443,7 +443,7 @@ otError Dataset::ProcessPendingTimestamp(otInstance *aInstance, int argc, char * sDataset.mPendingTimestamp = static_cast(value); sDataset.mIsPendingTimestampSet = true; - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -565,7 +565,7 @@ otError Dataset::ProcessMgmtSetCommand(otInstance *aInstance, int argc, char *ar ExitNow(error = OT_ERROR_PARSE); } - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -661,7 +661,7 @@ otError Dataset::ProcessMgmtGetCommand(otInstance *aInstance, int argc, char *ar ExitNow(error = OT_ERROR_PARSE); } - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -679,7 +679,7 @@ otError Dataset::ProcessPSKc(otInstance *aInstance, int argc, char *argv[]) error = OT_ERROR_PARSE); sDataset.mIsPSKcSet = true; - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; @@ -729,7 +729,7 @@ otError Dataset::ProcessSecurityPolicy(otInstance *aInstance, int argc, char *ar } sDataset.mIsSecurityPolicySet = true; - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); exit: return error; diff --git a/src/cli/cli_uart.cpp b/src/cli/cli_uart.cpp index f3d859937..177506f63 100644 --- a/src/cli/cli_uart.cpp +++ b/src/cli/cli_uart.cpp @@ -251,8 +251,8 @@ void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat Uart::sUartServer->OutputFormat("\r\n"); va_end(args); - (void)aLogLevel; - (void)aLogRegion; + OT_UNUSED_VARIABLE(aLogLevel); + OT_UNUSED_VARIABLE(aLogRegion); } #ifdef __cplusplus } // extern "C" diff --git a/src/core/api/instance_api.cpp b/src/core/api/instance_api.cpp index 2a096e433..469bfdf8f 100644 --- a/src/core/api/instance_api.cpp +++ b/src/core/api/instance_api.cpp @@ -222,7 +222,7 @@ otLogLevel otGetDynamicLogLevel(otInstance *aInstance) logLevel = aInstance->mLogLevel; #else logLevel = static_cast(OPENTHREAD_CONFIG_LOG_LEVEL); - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); #endif return logLevel; @@ -236,8 +236,8 @@ otError otSetDynamicLogLevel(otInstance *aInstance, otLogLevel aLogLevel) aInstance->mLogLevel = aLogLevel; #else error = OT_ERROR_DISABLED_FEATURE; - (void)aInstance; - (void)aLogLevel; + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aLogLevel); #endif return error; diff --git a/src/core/api/link_raw_api.cpp b/src/core/api/link_raw_api.cpp index 98a05a586..f32fc58b9 100644 --- a/src/core/api/link_raw_api.cpp +++ b/src/core/api/link_raw_api.cpp @@ -345,7 +345,7 @@ otError LinkRaw::Transmit(otRadioFrame *aFrame, otLinkRawTransmitDone aCallback) mTransmitDoneCallback = aCallback; #if OPENTHREAD_CONFIG_ENABLE_SOFTWARE_RETRANSMIT - (void)aFrame; + OT_UNUSED_VARIABLE(aFrame); mTransmitAttempts = 0; mCsmaAttempts = 0; diff --git a/src/core/api/thread_api.cpp b/src/core/api/thread_api.cpp index ff33c2934..fcb8033f2 100644 --- a/src/core/api/thread_api.cpp +++ b/src/core/api/thread_api.cpp @@ -458,7 +458,7 @@ bool otThreadGetAutoStart(otInstance *aInstance) return autoStart != 0; #else - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); return false; #endif } @@ -469,8 +469,8 @@ otError otThreadSetAutoStart(otInstance *aInstance, bool aStartAutomatically) uint8_t autoStart = aStartAutomatically ? 1 : 0; return otPlatSettingsSet(aInstance, Settings::kKeyThreadAutoStart, &autoStart, sizeof(autoStart)); #else - (void)aInstance; - (void)aStartAutomatically; + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aStartAutomatically); return OT_ERROR_NOT_IMPLEMENTED; #endif } diff --git a/src/core/api/thread_ftd_api.cpp b/src/core/api/thread_ftd_api.cpp index 6a87fb093..7cfa92028 100644 --- a/src/core/api/thread_ftd_api.cpp +++ b/src/core/api/thread_ftd_api.cpp @@ -244,8 +244,8 @@ otError otThreadSetSteeringData(otInstance *aInstance, otExtAddress *aExtAddress #if OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB error = aInstance->mThreadNetif.GetMle().SetSteeringData(aExtAddress); #else - (void)aInstance; - (void)aExtAddress; + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aExtAddress); error = OT_ERROR_DISABLED_FEATURE; #endif // OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB diff --git a/src/core/coap/coap_secure.cpp b/src/core/coap/coap_secure.cpp index 848e88efc..eda824715 100644 --- a/src/core/coap/coap_secure.cpp +++ b/src/core/coap/coap_secure.cpp @@ -150,7 +150,7 @@ otError CoapSecure::SendMessage(Message &aMessage, const Ip6::MessageInfo &aMess otError CoapSecure::Send(Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); return mNetif.GetDtls().Send(aMessage, aMessage.GetLength()); } diff --git a/src/core/common/logging.cpp b/src/core/common/logging.cpp index ad700935a..b94f534a9 100644 --- a/src/core/common/logging.cpp +++ b/src/core/common/logging.cpp @@ -108,7 +108,7 @@ static void DumpLine(otInstance *aInstance, otLogLevel aLogLevel, otLogRegion aL otLogDump("%s", buf); - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); } void otDump(otInstance *aInstance, otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aId, const void *aBuf, diff --git a/src/core/common/message.cpp b/src/core/common/message.cpp index 4aef8a121..2c0864611 100644 --- a/src/core/common/message.cpp +++ b/src/core/common/message.cpp @@ -65,8 +65,7 @@ MessagePool::MessagePool(otInstance *aInstance) : mNumFreeBuffers = kNumBuffers; #endif - // This is required to remove warning of "unused member variable". - (void)mInstance; + OT_UNUSED_VARIABLE(mInstance); } Message *MessagePool::New(uint8_t aType, uint16_t aReserved) @@ -418,7 +417,7 @@ otError Message::Append(const void *aBuf, uint16_t aLength) bytesWritten = Write(oldLength, aLength, aBuf); assert(bytesWritten == (int)aLength); - (void)bytesWritten; + OT_UNUSED_VARIABLE(bytesWritten); exit: return error; diff --git a/src/core/mac/mac.cpp b/src/core/mac/mac.cpp index bf64528f6..24f0fdf92 100644 --- a/src/core/mac/mac.cpp +++ b/src/core/mac/mac.cpp @@ -286,7 +286,7 @@ otError Mac::ConvertBeaconToActiveScanResult(Frame *aBeaconFrame, otActiveScanRe otLogInfoMac(GetInstance(), "Received Beacon, %s", beaconPayload->ToInfoString(stringBuffer, sizeof(stringBuffer))); - (void)stringBuffer; + OT_UNUSED_VARIABLE(stringBuffer); exit: return error; @@ -684,7 +684,7 @@ void Mac::SendBeacon(Frame &aFrame) otLogInfoMac(GetInstance(), "Sending Beacon, %s", beaconPayload->ToInfoString(stringBuffer, sizeof(stringBuffer))); - (void)stringBuffer; + OT_UNUSED_VARIABLE(stringBuffer); } void Mac::ProcessTransmitSecurity(Frame &aFrame) @@ -1169,7 +1169,7 @@ void Mac::SentFrame(otError aError) ExitNow(); } - (void)stringBuffer; + OT_UNUSED_VARIABLE(stringBuffer); break; } @@ -1622,7 +1622,7 @@ exit: otLogInfoMac(GetInstance(), "Frame rx failed, error:%s, %s", otThreadErrorToString(error), aFrame->ToInfoString(stringBuffer, sizeof(stringBuffer))); - (void)stringBuffer; + OT_UNUSED_VARIABLE(stringBuffer); } switch (error) diff --git a/src/core/meshcop/commissioner.cpp b/src/core/meshcop/commissioner.cpp index fbb8993e6..9d299431d 100644 --- a/src/core/meshcop/commissioner.cpp +++ b/src/core/meshcop/commissioner.cpp @@ -842,7 +842,7 @@ void Commissioner::HandleRelayReceive(Coap::Header &aHeader, Message &aMessage, mNetif.GetCoapSecure().Receive(aMessage, joinerMessageInfo); exit: - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); otLogFuncExit(); } @@ -861,7 +861,7 @@ void Commissioner::HandleDatasetChanged(Coap::Header &aHeader, Message &aMessage aHeader.GetCode() == OT_COAP_CODE_POST); otLogInfoMeshCoP(GetInstance(), "received dataset changed"); - (void)aMessage; + OT_UNUSED_VARIABLE(aMessage); SuccessOrExit(mNetif.GetCoap().SendEmptyAck(aHeader, aMessageInfo)); @@ -881,7 +881,7 @@ void Commissioner::HandleJoinerFinalize(void *aContext, otCoapHeader *aHeader, o void Commissioner::HandleJoinerFinalize(Coap::Header &aHeader, Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); StateTlv::State state = StateTlv::kAccept; ProvisioningUrlTlv provisioningUrl; @@ -974,7 +974,7 @@ otError Commissioner::SendRelayTransmit(void *aContext, Message &aMessage, const otError Commissioner::SendRelayTransmit(Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); otError error = OT_ERROR_NONE; Coap::Header header; JoinerUdpPortTlv udpPort; diff --git a/src/core/meshcop/dtls.cpp b/src/core/meshcop/dtls.cpp index ac3aa7b8e..64e88c800 100644 --- a/src/core/meshcop/dtls.cpp +++ b/src/core/meshcop/dtls.cpp @@ -370,7 +370,7 @@ int Dtls::HandleMbedtlsExportKeys(const unsigned char *aMasterSecret, const unsi otLogInfoMeshCoP(GetInstance(), "Generated KEK"); - (void)aMasterSecret; + OT_UNUSED_VARIABLE(aMasterSecret); return 0; } diff --git a/src/core/meshcop/joiner_router.cpp b/src/core/meshcop/joiner_router.cpp index 3cffb0edc..c01ecc747 100644 --- a/src/core/meshcop/joiner_router.cpp +++ b/src/core/meshcop/joiner_router.cpp @@ -303,7 +303,7 @@ void JoinerRouter::HandleRelayTransmit(Coap::Header &aHeader, Message &aMessage, } exit: - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); if (error != OT_ERROR_NONE && message != NULL) { @@ -513,7 +513,7 @@ void JoinerRouter::HandleJoinerEntrustResponse(void *aContext, otCoapHeader *aHe void JoinerRouter::HandleJoinerEntrustResponse(Coap::Header *aHeader, Message *aMessage, const Ip6::MessageInfo *aMessageInfo, otError aResult) { - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); mExpectJoinEntRsp = false; SendDelayedJoinerEntrust(); diff --git a/src/core/meshcop/leader.cpp b/src/core/meshcop/leader.cpp index ed38d2f0f..69d173f79 100644 --- a/src/core/meshcop/leader.cpp +++ b/src/core/meshcop/leader.cpp @@ -117,7 +117,7 @@ void Leader::HandlePetition(Coap::Header &aHeader, Message &aMessage, const Ip6: mTimer.Start(Timer::SecToMsec(kTimeoutLeaderPetition)); exit: - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); SendPetitionResponse(aHeader, aMessageInfo, state); } diff --git a/src/core/net/dhcp6_client.cpp b/src/core/net/dhcp6_client.cpp index 6f28d39b3..0b371338a 100644 --- a/src/core/net/dhcp6_client.cpp +++ b/src/core/net/dhcp6_client.cpp @@ -84,7 +84,7 @@ otInstance *Dhcp6Client::GetInstance(void) void Dhcp6Client::UpdateAddresses(otInstance *aInstance, otDhcpAddress *aAddresses, uint32_t aNumAddresses, void *aContext) { - (void)aContext; + OT_UNUSED_VARIABLE(aContext); bool found = false; bool newAgent = false; otDhcpAddress *address = NULL; @@ -529,7 +529,7 @@ void Dhcp6Client::HandleUdpReceive(void *aContext, otMessage *aMessage, const ot void Dhcp6Client::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo) { Dhcp6Header header; - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); VerifyOrExit(aMessage.Read(aMessage.GetOffset(), sizeof(header), &header) == sizeof(header)); aMessage.MoveOffset(sizeof(header)); diff --git a/src/core/net/dns_client.cpp b/src/core/net/dns_client.cpp index b0333f95d..e40654efa 100644 --- a/src/core/net/dns_client.cpp +++ b/src/core/net/dns_client.cpp @@ -460,7 +460,7 @@ void Client::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessag // RFC1035 7.3. Resolver cannot rely that a response will come from the same address // which it sent the corresponding query to. - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); VerifyOrExit(aMessage.Read(aMessage.GetOffset(), sizeof(responseHeader), &responseHeader) == sizeof(responseHeader)); diff --git a/src/core/thread/address_resolver.cpp b/src/core/thread/address_resolver.cpp index 0a2ac09d4..e41569be4 100644 --- a/src/core/thread/address_resolver.cpp +++ b/src/core/thread/address_resolver.cpp @@ -669,7 +669,7 @@ void AddressResolver::HandleIcmpReceive(void *aContext, otMessage *aMessage, con *static_cast(aMessageInfo), *static_cast(aIcmpHeader)); - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); } void AddressResolver::HandleIcmpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo, @@ -692,7 +692,7 @@ void AddressResolver::HandleIcmpReceive(Message &aMessage, const Ip6::MessageInf } exit: - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); } } // namespace ot diff --git a/src/core/thread/mesh_forwarder.cpp b/src/core/thread/mesh_forwarder.cpp index b8df4ce75..be8a9b2e1 100644 --- a/src/core/thread/mesh_forwarder.cpp +++ b/src/core/thread/mesh_forwarder.cpp @@ -1783,7 +1783,7 @@ exit: otLogInfoMac(GetInstance(), "Dropping rx frame, error:%s, %s", otThreadErrorToString(error), aFrame.ToInfoString(stringBuffer, sizeof(stringBuffer))); - (void)stringBuffer; + OT_UNUSED_VARIABLE(stringBuffer); } } @@ -1859,7 +1859,7 @@ exit: aMessageInfo.mLinkSecurity ? "yes" : "no" ); - (void)srcStringBuffer; + OT_UNUSED_VARIABLE(srcStringBuffer); if (message != NULL) { @@ -2014,8 +2014,8 @@ exit: char srcStringBuffer[Mac::Address::kAddressStringSize]; char dstStringBuffer[Mac::Address::kAddressStringSize]; - (void)srcStringBuffer; - (void)dstStringBuffer; + OT_UNUSED_VARIABLE(srcStringBuffer); + OT_UNUSED_VARIABLE(dstStringBuffer); otLogInfoMac( GetInstance(), @@ -2126,8 +2126,8 @@ exit: char srcStringBuffer[Mac::Address::kAddressStringSize]; char dstStringBuffer[Mac::Address::kAddressStringSize]; - (void)srcStringBuffer; - (void)dstStringBuffer; + OT_UNUSED_VARIABLE(srcStringBuffer); + OT_UNUSED_VARIABLE(dstStringBuffer); otLogInfoMac( GetInstance(), diff --git a/src/core/thread/mle.cpp b/src/core/thread/mle.cpp index 60d22e12b..4407ec2d8 100644 --- a/src/core/thread/mle.cpp +++ b/src/core/thread/mle.cpp @@ -2489,7 +2489,7 @@ otError Mle::HandleLeaderData(const Message &aMessage, const Ip6::MessageInfo &a exit: - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); if (dataRequest) { @@ -2814,7 +2814,7 @@ exit: otLogWarnMleErr(GetInstance(), error, "Failed to process Child ID Response"); } - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); return error; } @@ -3040,7 +3040,7 @@ otError Mle::HandleAnnounce(const Message &aMessage, const Ip6::MessageInfo &aMe } exit: - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aMessageInfo); return error; } @@ -3216,7 +3216,7 @@ Neighbor *Mle::GetNeighbor(const Mac::Address &aAddress) uint16_t Mle::GetNextHop(uint16_t aDestination) const { - (void)aDestination; + OT_UNUSED_VARIABLE(aDestination); return (mParent.GetState() == Neighbor::kStateValid) ? mParent.GetRloc16() : static_cast (Mac::kShortAddrInvalid); } diff --git a/src/core/thread/mle.hpp b/src/core/thread/mle.hpp index 3be370370..48c5b4019 100644 --- a/src/core/thread/mle.hpp +++ b/src/core/thread/mle.hpp @@ -1209,7 +1209,7 @@ protected: * @returns A pointer to the neighbor object. * */ - Neighbor *GetNeighbor(const Ip6::Address &aAddress) { (void)aAddress; return NULL; } + Neighbor *GetNeighbor(const Ip6::Address &aAddress) { OT_UNUSED_VARIABLE(aAddress); return NULL; } /** * This method returns the next hop towards an RLOC16 destination. diff --git a/src/core/thread/mle_router.cpp b/src/core/thread/mle_router.cpp index c47d00627..d2eea8dff 100644 --- a/src/core/thread/mle_router.cpp +++ b/src/core/thread/mle_router.cpp @@ -2033,7 +2033,7 @@ otError MleRouter::UpdateChildAddresses(const AddressRegistrationTlv &aTlv, Chil (count == 1) ? "" : "es"); } - (void)stringBuffer; + OT_UNUSED_VARIABLE(stringBuffer); return OT_ERROR_NONE; } @@ -3886,8 +3886,8 @@ void MleRouter::HandleAddressSolicitResponse(void *aContext, otCoapHeader *aHead void MleRouter::HandleAddressSolicitResponse(Coap::Header *aHeader, Message *aMessage, const Ip6::MessageInfo *aMessageInfo, otError aResult) { - (void)aResult; - (void)aMessageInfo; + OT_UNUSED_VARIABLE(aResult); + OT_UNUSED_VARIABLE(aMessageInfo); ThreadStatusTlv statusTlv; ThreadRloc16Tlv rlocTlv; diff --git a/src/core/thread/mle_router_mtd.hpp b/src/core/thread/mle_router_mtd.hpp index c3abc144a..62d90148e 100644 --- a/src/core/thread/mle_router_mtd.hpp +++ b/src/core/thread/mle_router_mtd.hpp @@ -146,7 +146,7 @@ private: otError HandleDiscoveryRequest(const Message &, const Ip6::MessageInfo &) { return OT_ERROR_DROP; } void StopAdvertiseTimer(void) { } - otError ProcessRouteTlv(const RouteTlv &aRoute) { (void)aRoute; return OT_ERROR_NONE; } + otError ProcessRouteTlv(const RouteTlv &aRoute) { OT_UNUSED_VARIABLE(aRoute); return OT_ERROR_NONE; } }; } // namespace Mle diff --git a/src/core/thread/network_data_leader_ftd.cpp b/src/core/thread/network_data_leader_ftd.cpp index a0f9f0bdf..a32783bf8 100644 --- a/src/core/thread/network_data_leader_ftd.cpp +++ b/src/core/thread/network_data_leader_ftd.cpp @@ -541,7 +541,7 @@ bool Leader::IsStableUpdated(uint16_t aRloc16, uint8_t *aTlvs, uint8_t aTlvsLeng } exit: - (void)aRloc16; + OT_UNUSED_VARIABLE(aRloc16); return rval; } diff --git a/src/core/thread/thread_netif.cpp b/src/core/thread/thread_netif.cpp index d57bc2365..d314964c3 100644 --- a/src/core/thread/thread_netif.cpp +++ b/src/core/thread/thread_netif.cpp @@ -195,7 +195,7 @@ otError ThreadNetif::TmfFilter(const Message &aMessage, const Ip6::MessageInfo & (aMessageInfo.GetSockAddr().IsLinkLocal() && aMessageInfo.GetPeerAddr().IsLinkLocal()), error = OT_ERROR_NOT_TMF); exit: - (void)aMessage; + OT_UNUSED_VARIABLE(aMessage); return error; } diff --git a/src/diag/diag_process.cpp b/src/diag/diag_process.cpp index 6161732c8..2f5e3a898 100644 --- a/src/diag/diag_process.cpp +++ b/src/diag/diag_process.cpp @@ -149,8 +149,8 @@ void Diag::ProcessStart(int argc, char *argv[], char *aOutput, size_t aOutputMax snprintf(aOutput, aOutputMaxLen, "start diagnostics mode\r\nstatus 0x%02x\r\n", error); exit: - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); AppendErrorResult(error, aOutput, aOutputMaxLen); } @@ -169,8 +169,8 @@ void Diag::ProcessStop(int argc, char *argv[], char *aOutput, size_t aOutputMaxL static_cast(sStats.first_lqi), error); exit: - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); AppendErrorResult(error, aOutput, aOutputMaxLen); } @@ -314,8 +314,8 @@ void Diag::ProcessSleep(int argc, char *argv[], char *aOutput, size_t aOutputMax snprintf(aOutput, aOutputMaxLen, "sleeping now...\r\n"); exit: - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); AppendErrorResult(error, aOutput, aOutputMaxLen); } @@ -330,14 +330,14 @@ void Diag::ProcessStats(int argc, char *argv[], char *aOutput, size_t aOutputMax static_cast(sStats.first_rssi), static_cast(sStats.first_lqi)); exit: - (void)argc; - (void)argv; + OT_UNUSED_VARIABLE(argc); + OT_UNUSED_VARIABLE(argv); AppendErrorResult(error, aOutput, aOutputMaxLen); } void Diag::DiagTransmitDone(otInstance *aInstance, otError aError) { - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); if (aError == OT_ERROR_NONE) { sStats.sent_packets++; @@ -356,7 +356,7 @@ void Diag::DiagTransmitDone(otInstance *aInstance, otError aError) void Diag::DiagReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError) { - (void)aInstance; + OT_UNUSED_VARIABLE(aInstance); if (aError == OT_ERROR_NONE) { // for sensitivity test, only record the rssi and lqi for the first packet @@ -394,7 +394,7 @@ extern "C" void otPlatDiagAlarmFired(otInstance *aInstance) extern "C" void otPlatDiagRadioTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError) { - (void)aFrame; + OT_UNUSED_VARIABLE(aFrame); Diag::DiagTransmitDone(aInstance, aError); } diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index bed028f99..cb2b3f206 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -1467,7 +1467,7 @@ void NcpBase::HandleReceive(const uint8_t *aBuf, uint16_t aBufLength) void NcpBase::HandleFrameRemovedFromNcpBuffer(void *aContext, NcpFrameBuffer::FrameTag aFrameTag, NcpFrameBuffer *aNcpBuffer) { - (void)aNcpBuffer; + OT_UNUSED_VARIABLE(aNcpBuffer); static_cast(aContext)->HandleFrameRemovedFromNcpBuffer(aFrameTag); } @@ -1833,9 +1833,9 @@ otError NcpBase::OutboundFrameFeedPacked(const char *aPackFormat, ...) otError NcpBase::CommandHandler_NOOP(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen) { - (void)aCommand; - (void)aArgPtr; - (void)aArgLen; + OT_UNUSED_VARIABLE(aCommand); + OT_UNUSED_VARIABLE(aArgPtr); + OT_UNUSED_VARIABLE(aArgLen); return SendLastStatus(aHeader, SPINEL_STATUS_OK); } @@ -1846,10 +1846,10 @@ otError NcpBase::CommandHandler_RESET(uint8_t aHeader, unsigned int aCommand, co otError error = OT_ERROR_NONE; // We aren't using any of the arguments to this function. - (void)aHeader; - (void)aCommand; - (void)aArgPtr; - (void)aArgLen; + OT_UNUSED_VARIABLE(aHeader); + OT_UNUSED_VARIABLE(aCommand); + OT_UNUSED_VARIABLE(aArgPtr); + OT_UNUSED_VARIABLE(aArgLen); // Signal a platform reset. If implemented, this function // shouldn't return. @@ -1891,7 +1891,7 @@ otError NcpBase::CommandHandler_PROP_VALUE_GET(uint8_t aHeader, unsigned int aCo error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - (void)aCommand; + OT_UNUSED_VARIABLE(aCommand); return error; } @@ -1928,7 +1928,7 @@ otError NcpBase::CommandHandler_PROP_VALUE_SET(uint8_t aHeader, unsigned int aCo error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - (void)aCommand; + OT_UNUSED_VARIABLE(aCommand); return error; } @@ -1965,7 +1965,7 @@ otError NcpBase::CommandHandler_PROP_VALUE_INSERT(uint8_t aHeader, unsigned int error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - (void)aCommand; + OT_UNUSED_VARIABLE(aCommand); return error; } @@ -2002,7 +2002,7 @@ otError NcpBase::CommandHandler_PROP_VALUE_REMOVE(uint8_t aHeader, unsigned int error = SendLastStatus(aHeader, SPINEL_STATUS_PARSE_ERROR); } - (void)aCommand; + OT_UNUSED_VARIABLE(aCommand); return error; } @@ -2010,9 +2010,9 @@ otError NcpBase::CommandHandler_PROP_VALUE_REMOVE(uint8_t aHeader, unsigned int otError NcpBase::CommandHandler_NET_SAVE(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen) { - (void)aCommand; - (void)aArgPtr; - (void)aArgLen; + OT_UNUSED_VARIABLE(aCommand); + OT_UNUSED_VARIABLE(aArgPtr); + OT_UNUSED_VARIABLE(aArgLen); return SendLastStatus(aHeader, SPINEL_STATUS_UNIMPLEMENTED); } @@ -2020,9 +2020,9 @@ otError NcpBase::CommandHandler_NET_SAVE(uint8_t aHeader, unsigned int aCommand, otError NcpBase::CommandHandler_NET_CLEAR(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen) { - (void)aCommand; - (void)aArgPtr; - (void)aArgLen; + OT_UNUSED_VARIABLE(aCommand); + OT_UNUSED_VARIABLE(aArgPtr); + OT_UNUSED_VARIABLE(aArgLen); return SendLastStatus(aHeader, ThreadErrorToSpinelStatus(otInstanceErasePersistentInfo(mInstance))); } @@ -2030,9 +2030,9 @@ otError NcpBase::CommandHandler_NET_CLEAR(uint8_t aHeader, unsigned int aCommand otError NcpBase::CommandHandler_NET_RECALL(uint8_t aHeader, unsigned int aCommand, const uint8_t *aArgPtr, uint16_t aArgLen) { - (void)aCommand; - (void)aArgPtr; - (void)aArgLen; + OT_UNUSED_VARIABLE(aCommand); + OT_UNUSED_VARIABLE(aArgPtr); + OT_UNUSED_VARIABLE(aArgLen); return SendLastStatus(aHeader, SPINEL_STATUS_UNIMPLEMENTED); } @@ -2089,7 +2089,7 @@ exit: error = SendLastStatus(aHeader, spinelError); } - (void)aCommand; + OT_UNUSED_VARIABLE(aCommand); return error; } @@ -2133,7 +2133,7 @@ otError NcpBase::CommandHandler_POKE(uint8_t aHeader, unsigned int aCommand, con exit: error = SendLastStatus(aHeader, spinelError); - (void)aCommand; + OT_UNUSED_VARIABLE(aCommand); return error; } @@ -2299,7 +2299,7 @@ otError NcpBase::GetPropertyHandler_HWADDR(uint8_t aHeader, spinel_prop_key_t aK otError NcpBase::GetPropertyHandler_LOCK(uint8_t aHeader, spinel_prop_key_t aKey) { // TODO: Implement property lock (Needs API!) - (void)aKey; + OT_UNUSED_VARIABLE(aKey); return SendLastStatus(aHeader, SPINEL_STATUS_UNIMPLEMENTED); } @@ -3364,7 +3364,7 @@ exit: otError NcpBase::GetPropertyHandler_IPV6_ROUTE_TABLE(uint8_t aHeader, spinel_prop_key_t aKey) { // TODO: Implement get route table - (void)aKey; + OT_UNUSED_VARIABLE(aKey); return SendLastStatus(aHeader, SPINEL_STATUS_UNIMPLEMENTED); } @@ -3463,7 +3463,7 @@ exit: otError NcpBase::GetPropertyHandler_STREAM_NET(uint8_t aHeader, spinel_prop_key_t aKey) { // TODO: Implement explicit data poll. - (void)aKey; + OT_UNUSED_VARIABLE(aKey); return SendLastStatus(aHeader, SPINEL_STATUS_UNIMPLEMENTED); } @@ -4247,9 +4247,9 @@ otError NcpBase::SetPropertyHandler_POWER_STATE(uint8_t aHeader, spinel_prop_key uint16_t aValueLen) { // TODO: Implement POWER_STATE - (void)aKey; - (void)aValuePtr; - (void)aValueLen; + OT_UNUSED_VARIABLE(aKey); + OT_UNUSED_VARIABLE(aValuePtr); + OT_UNUSED_VARIABLE(aValueLen); return SendLastStatus(aHeader, SPINEL_STATUS_UNIMPLEMENTED); } @@ -4822,7 +4822,7 @@ exit: error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } - (void)aKey; + OT_UNUSED_VARIABLE(aKey); return error; } @@ -5152,7 +5152,7 @@ exit: error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } - (void)aKey; + OT_UNUSED_VARIABLE(aKey); return error; } @@ -5219,7 +5219,7 @@ exit: error = SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } - (void)aKey; + OT_UNUSED_VARIABLE(aKey); return error; } @@ -5601,7 +5601,7 @@ otError NcpBase::SetPropertyHandler_CNTR_RESET(uint8_t aHeader, spinel_prop_key_ error = OT_ERROR_NOT_IMPLEMENTED; exit: - (void)aKey; + OT_UNUSED_VARIABLE(aKey); // There is currently no getter for PROP_CNTR_RESET, so we just // return SPINEL_STATUS_OK for success when the counters are reset. @@ -5638,7 +5638,7 @@ otError NcpBase::SetPropertyHandler_THREAD_COMMISSIONER_ENABLED(uint8_t aHeader, } exit: - (void)aKey; + OT_UNUSED_VARIABLE(aKey); return SendLastStatus(aHeader, ThreadErrorToSpinelStatus(error)); } @@ -7490,8 +7490,8 @@ otError otNcpRegisterPeekPokeDelagates(otNcpDelegateAllowPeekPoke aAllowPeekDele ncp->RegisterPeekPokeDelagates(aAllowPeekDelegate, aAllowPokeDelegate); } #else - (void)aAllowPeekDelegate; - (void)aAllowPokeDelegate; + OT_UNUSED_VARIABLE(aAllowPeekDelegate); + OT_UNUSED_VARIABLE(aAllowPokeDelegate); error = OT_ERROR_DISABLED_FEATURE; @@ -7515,7 +7515,7 @@ void otNcpRegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers) } #else - (void)aHandlers; + OT_UNUSED_VARIABLE(aHandlers); #endif } @@ -7530,7 +7530,7 @@ void otNcpHandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix) } #else - (void)aUlaPrefix; + OT_UNUSED_VARIABLE(aUlaPrefix); #endif } @@ -7545,6 +7545,6 @@ void otNcpHandleLegacyNodeDidJoin(const otExtAddress *aExtAddr) } #else - (void)aExtAddr; + OT_UNUSED_VARIABLE(aExtAddr); #endif } diff --git a/src/ncp/ncp_spi.cpp b/src/ncp/ncp_spi.cpp index 93ea2ad76..f1f296bca 100644 --- a/src/ncp/ncp_spi.cpp +++ b/src/ncp/ncp_spi.cpp @@ -248,8 +248,8 @@ void NcpSpi::SpiTransactionProcess(void) void NcpSpi::HandleFrameAddedToTxBuffer(void *aContext, NcpFrameBuffer::FrameTag aTag, NcpFrameBuffer *aNcpFrameBuffer) { - (void)aNcpFrameBuffer; - (void)aTag; + OT_UNUSED_VARIABLE(aNcpFrameBuffer); + OT_UNUSED_VARIABLE(aTag); static_cast(aContext)->mPrepareTxFrameTask.Post(); } diff --git a/src/ncp/ncp_uart.cpp b/src/ncp/ncp_uart.cpp index 7c834dbb7..b99190b20 100644 --- a/src/ncp/ncp_uart.cpp +++ b/src/ncp/ncp_uart.cpp @@ -108,8 +108,8 @@ NcpUart::NcpUart(otInstance *aInstance): void NcpUart::HandleFrameAddedToNcpBuffer(void *aContext, NcpFrameBuffer::FrameTag aTag, NcpFrameBuffer *aNcpFrameBuffer) { - (void)aNcpFrameBuffer; - (void)aTag; + OT_UNUSED_VARIABLE(aNcpFrameBuffer); + OT_UNUSED_VARIABLE(aTag); static_cast(aContext)->HandleFrameAddedToNcpBuffer(); } @@ -293,8 +293,8 @@ void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat va_end(args); - (void)aLogLevel; - (void)aLogRegion; + OT_UNUSED_VARIABLE(aLogLevel); + OT_UNUSED_VARIABLE(aLogRegion); } #ifdef __cplusplus } // extern "C"