turn on warnings and errors (#280)

This commit is contained in:
Marcin K Szczodrak
2016-07-25 21:19:07 -07:00
committed by Jonathan Hui
parent 3b4bf8594e
commit 318fe4b415
26 changed files with 174 additions and 61 deletions
+3
View File
@@ -50,6 +50,9 @@ COMMONCFLAGS = \
-ffunction-sections \
-Os \
-g \
-Wall \
-Wextra \
-Werror \
$(NULL)
CPPFLAGS = \
+27
View File
@@ -39,6 +39,32 @@ MKDIR_P := mkdir -p
LN_S := ln -s
RM_F := rm -f
COMMONCFLAGS := \
-O1 \
-g \
-Wall \
-Wextra \
-Werror \
$(NULL)
CPPFLAGS = \
$(COMMONCFLAGS) \
$(NULL)
CFLAGS = \
$(COMMONCFLAGS) \
$(NULL)
CXXFLAGS = \
$(COMMONCFLAGS) \
-fno-exceptions \
-fno-rtti \
$(NULL)
LDFLAGS = \
$(COMMONCFLAGS) \
$(NULL)
INSTALL := /usr/bin/install
INSTALLFLAGS := -p
@@ -86,6 +112,7 @@ define configure-target
$(ECHO) " CONFIG $(1)..."
(cd $(BuildPath)/$(1) && $(AbsTopSourceDir)/configure \
INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" \
--prefix=/ \
--exec-prefix=/$(1) \
$(configure_OPTIONS))
+3
View File
@@ -36,5 +36,8 @@
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
{
(void)aLogLevel;
(void)aLogRegion;
(void)aFormat;
}
+3
View File
@@ -41,6 +41,9 @@ void PlatformInit(int argc, char *argv[])
cc2538RadioInit();
cc2538RandomInit();
otPlatUartEnable();
(void)argc;
(void)argv;
}
void PlatformProcessDrivers(void)
+1 -1
View File
@@ -47,7 +47,7 @@ extern uint8_t _einit_array;
__extension__ typedef int __guard __attribute__((mode(__DI__)));
int __cxa_guard_acquire(__guard *g) { return !*(char *)(g); }
void __cxa_guard_release(__guard *g) { *(char *)g = 1; }
void __cxa_guard_abort(__guard *g) {}
void __cxa_guard_abort(__guard *g) { (void)g; }
void __cxa_pure_virtual(void) { while (1); }
void IntDefaultHandler(void);
-15
View File
@@ -85,16 +85,6 @@ extern "C" {
*
*/
/**
* @def OT_TOOL_DEPRECATED
*
* Indicate to the compiler to warn upon use that a field or function
* has been deprecated.
*
* @param[in] symbol The name of the field or function to deprecate.
*
*/
// =========== TOOLCHAIN SELECTION : START ===========
#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
@@ -105,7 +95,6 @@ extern "C" {
#define OT_TOOL_PACKED_BEGIN
#define OT_TOOL_PACKED_FIELD __attribute__((packed))
#define OT_TOOL_PACKED_END __attribute__((packed))
#define OT_TOOL_DEPRECATED(symbol) __attribute__((deprecated))
#elif defined(__ICCARM__) || defined(__ICC8051__)
@@ -116,14 +105,12 @@ extern "C" {
#define OT_TOOL_PACKED_BEGIN __packed
#define OT_TOOL_PACKED_FIELD
#define OT_TOOL_PACKED_END
#define OT_TOOL_DEPRECATED(symbol)
#elif defined(_MSC_VER)
#define OT_TOOL_PACKED_BEGIN __pragma(pack(push,1))
#define OT_TOOL_PACKED_FIELD
#define OT_TOOL_PACKED_END __pragma(pack(pop))
#define OT_TOOL_DEPRECATED(symbol) __pragma(deprecated(symbol))
#elif defined(__SDCC)
@@ -132,7 +119,6 @@ extern "C" {
#define OT_TOOL_PACKED_BEGIN
#define OT_TOOL_PACKED_FIELD
#define OT_TOOL_PACKED_END
#define OT_TOOL_DEPRECATED(symbol)
#else
@@ -143,7 +129,6 @@ extern "C" {
#define OT_TOOL_PACKED_BEGIN
#define OT_TOOL_PACKED_FIELD
#define OT_TOOL_PACKED_END
#define OT_TOOL_DEPRECATED(symbol)
#endif
+36 -5
View File
@@ -178,6 +178,9 @@ void Interpreter::ProcessHelp(int argc, char *argv[])
{
sServer->OutputFormat("%s\r\n", sCommands[i].mName);
}
(void)argc;
(void)argv;
}
void Interpreter::ProcessChannel(int argc, char *argv[])
@@ -376,6 +379,8 @@ void Interpreter::ProcessEidCache(int argc, char *argv[])
}
exit:
(void)argc;
(void)argv;
AppendResult(kThreadError_None);
}
@@ -384,6 +389,8 @@ void Interpreter::ProcessExtAddress(int argc, char *argv[])
OutputBytes(otGetExtendedAddress(), OT_EXT_ADDRESS_SIZE);
sServer->OutputFormat("\r\n");
AppendResult(kThreadError_None);
(void)argc;
(void)argv;
}
void Interpreter::ProcessExtPanId(int argc, char *argv[])
@@ -535,6 +542,8 @@ void Interpreter::ProcessLeaderData(int argc, char *argv[])
sServer->OutputFormat("Leader Router ID: %d\r\n", leaderData.mLeaderRouterId);
exit:
(void)argc;
(void)argv;
AppendResult(error);
}
@@ -589,7 +598,9 @@ exit:
void Interpreter::ProcessMode(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
otLinkModeConfig linkMode = {};
otLinkModeConfig linkMode;
memset(&linkMode, 0, sizeof(otLinkModeConfig));
if (argc == 0)
{
@@ -657,6 +668,8 @@ void Interpreter::ProcessNetworkDataRegister(int argc, char *argv[])
SuccessOrExit(error = otSendServerData());
exit:
(void)argc;
(void)argv;
AppendResult(error);
}
@@ -741,6 +754,8 @@ void Interpreter::HandleEchoResponse(void *aContext, Message &aMessage, const Ip
}
sServer->OutputFormat("\r\n");
(void)aContext;
}
void Interpreter::ProcessPing(int argc, char *argv[])
@@ -806,14 +821,18 @@ void Interpreter::HandlePingTimer(void *aContext)
{
sPingTimer.Start(sInterval);
}
(void)aContext;
}
ThreadError Interpreter::ProcessPrefixAdd(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
otBorderRouterConfig config = {};
otBorderRouterConfig config;
int argcur = 0;
memset(&config, 0, sizeof(otBorderRouterConfig));
char *prefixLengthStr;
char *endptr;
@@ -898,9 +917,11 @@ exit:
ThreadError Interpreter::ProcessPrefixRemove(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
struct otIp6Prefix prefix = {};
struct otIp6Prefix prefix;
int argcur = 0;
memset(&prefix, 0, sizeof(otIp6Prefix));
char *prefixLengthStr;
char *endptr;
@@ -923,6 +944,7 @@ ThreadError Interpreter::ProcessPrefixRemove(int argc, char *argv[])
error = otRemoveBorderRouter(&prefix);
exit:
(void)argc;
return error;
}
@@ -967,14 +989,18 @@ void Interpreter::ProcessRloc16(int argc, char *argv[])
{
sServer->OutputFormat("%04x\r\n", otGetRloc16());
sServer->OutputFormat("Done\r\n");
(void)argc;
(void)argv;
}
ThreadError Interpreter::ProcessRouteAdd(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
otExternalRouteConfig config = {};
otExternalRouteConfig config;
int argcur = 0;
memset(&config, 0, sizeof(otExternalRouteConfig));
char *prefixLengthStr;
char *endptr;
@@ -1029,9 +1055,10 @@ exit:
ThreadError Interpreter::ProcessRouteRemove(int argc, char *argv[])
{
ThreadError error = kThreadError_None;
struct otIp6Prefix prefix = {};
struct otIp6Prefix prefix;
int argcur = 0;
memset(&prefix, 0, sizeof(struct otIp6Prefix));
char *prefixLengthStr;
char *endptr;
@@ -1293,6 +1320,8 @@ void Interpreter::ProcessThread(int argc, char *argv[])
}
exit:
(void)argc;
(void)argv;
AppendResult(error);
}
@@ -1300,6 +1329,8 @@ void Interpreter::ProcessVersion(int argc, char *argv[])
{
sServer->OutputFormat("%s\r\n", PACKAGE_NAME "/" PACKAGE_VERSION "; " __DATE__ " " __TIME__);
AppendResult(kThreadError_None);
(void)argc;
(void)argv;
}
void Interpreter::ProcessWhitelist(int argc, char *argv[])
+2 -1
View File
@@ -46,7 +46,8 @@ ThreadError Udp::Start(void)
{
ThreadError error;
otSockAddr sockaddr = {};
otSockAddr sockaddr;
memset(&sockaddr, 0, sizeof(otSockAddr));
sockaddr.mPort = 7335;
SuccessOrExit(error = otOpenUdpSocket(&mSocket, &HandleUdpReceive, this));
+2 -2
View File
@@ -132,8 +132,8 @@ ThreadError Mac::ActiveScan(uint32_t aScanChannels, uint16_t aScanDuration, Acti
mActiveScanHandler = aHandler;
mActiveScanContext = aContext;
mScanChannels = (aScanChannels == 0) ? kScanChannelsAll : aScanChannels;
mScanDuration = (aScanDuration == 0) ? kScanDurationDefault : aScanDuration;
mScanChannels = (aScanChannels == 0) ? static_cast<uint32_t>(kScanChannelsAll) : aScanChannels;
mScanDuration = (aScanDuration == 0) ? static_cast<uint16_t>(kScanDurationDefault) : aScanDuration;
mScanChannel = kPhyMinChannel;
mScanChannels >>= kPhyMinChannel;
+1 -1
View File
@@ -125,7 +125,7 @@ ThreadError Ip6::SendDatagram(Message &message, MessageInfo &messageInfo, IpProt
header.Init();
header.SetPayloadLength(payloadLength);
header.SetNextHeader(ipproto);
header.SetHopLimit(messageInfo.mHopLimit ? messageInfo.mHopLimit : kDefaultHopLimit);
header.SetHopLimit(messageInfo.mHopLimit ? messageInfo.mHopLimit : static_cast<uint8_t>(kDefaultHopLimit));
if (messageInfo.GetSockAddr().IsUnspecified())
{
+6 -2
View File
@@ -128,9 +128,11 @@ exit:
otLinkModeConfig otGetLinkMode(void)
{
otLinkModeConfig config = {};
otLinkModeConfig config;
uint8_t mode = sThreadNetif->GetMle().GetDeviceMode();
memset(&config, 0, sizeof(otLinkModeConfig));
if (mode & Mle::ModeTlv::kModeRxOnWhenIdle)
{
config.mRxOnWhenIdle = 1;
@@ -753,11 +755,13 @@ bool otActiveScanInProgress(void)
void HandleActiveScanResult(void *aContext, Mac::Frame *aFrame)
{
otHandleActiveScanResult handler = reinterpret_cast<otHandleActiveScanResult>(aContext);
otActiveScanResult result = {};
otActiveScanResult result;
Mac::Address address;
Mac::Beacon *beacon;
uint8_t payloadLength;
memset(&result, 0, sizeof(otActiveScanResult));
if (aFrame == NULL)
{
handler(NULL);
+8 -1
View File
@@ -224,6 +224,9 @@ exit:
void AddressResolver::HandleUdpReceive(void *aContext, otMessage aMessage, const otMessageInfo *aMessageInfo)
{
(void)aContext;
(void)aMessage;
(void)aMessageInfo;
}
void AddressResolver::HandleAddressNotification(void *aContext, Coap::Header &aHeader, Message &aMessage,
@@ -398,6 +401,8 @@ void AddressResolver::HandleAddressError(Coap::Header &aHeader, Message &aMessag
Mac::ExtAddress macAddr;
Ip6::Address destination;
(void)aMessageInfo;
VerifyOrExit(aHeader.GetCode() == Coap::Header::kCodePost, error = kThreadError_Drop);
otLogInfoArp("Received address error notification\n");
@@ -623,6 +628,8 @@ void AddressResolver::HandleDstUnreach(void *aContext, Message &aMessage, const
{
AddressResolver *obj = reinterpret_cast<AddressResolver *>(aContext);
obj->HandleDstUnreach(aMessage, aMessageInfo, aIcmpHeader);
(void)aMessageInfo;
}
void AddressResolver::HandleDstUnreach(Message &aMessage, const Ip6::MessageInfo &aMessageInfo,
@@ -645,7 +652,7 @@ void AddressResolver::HandleDstUnreach(Message &aMessage, const Ip6::MessageInfo
}
exit:
{}
(void)aMessageInfo;
}
} // namespace Thread
+1
View File
@@ -791,6 +791,7 @@ int Lowpan::DecompressExtensionHeader(Message &aMessage, const uint8_t *aBuf, ui
rval = cur - aBuf;
exit:
(void)aBufLength;
return rval;
}
+1
View File
@@ -1140,6 +1140,7 @@ ThreadError MeshForwarder::CheckReachability(uint8_t *aFrame, uint8_t aFrameLeng
error = mMle.CheckReachability(aMeshSource.mShortAddress, aMeshDest.mShortAddress, ip6Header);
exit:
(void)aFrameLength;
return error;
}
+6 -1
View File
@@ -1535,6 +1535,7 @@ ThreadError Mle::HandleDataResponse(const Message &aMessage, const Ip6::MessageI
networkData.GetNetworkData(), networkData.GetLength());
exit:
(void)aMessageInfo;
return error;
}
@@ -1754,6 +1755,7 @@ ThreadError Mle::HandleChildIdResponse(const Message &aMessage, const Ip6::Messa
}
exit:
(void)aMessageInfo;
return error;
}
@@ -1875,12 +1877,15 @@ Neighbor *Mle::GetNeighbor(const Mac::Address &aAddress)
Neighbor *Mle::GetNeighbor(const Ip6::Address &aAddress)
{
(void)aAddress;
return NULL;
}
uint16_t Mle::GetNextHop(uint16_t aDestination) const
{
return (mParent.mState == Neighbor::kStateValid) ? mParent.mValid.mRloc16 : Mac::kShortAddrInvalid;
(void)aDestination;
return (mParent.mState == Neighbor::kStateValid) ? mParent.mValid.mRloc16 : static_cast<uint16_t>
(Mac::kShortAddrInvalid);
}
bool Mle::IsRoutingLocator(const Ip6::Address &aAddress) const
+5 -1
View File
@@ -973,6 +973,8 @@ ThreadError MleRouter::HandleLinkReject(const Message &aMessage, const Ip6::Mess
{
Mac::ExtAddress macAddr;
(void)aMessage;
otLogInfoMle("Received link reject\n");
macAddr.Set(aMessageInfo.GetPeerAddr());
@@ -2524,11 +2526,13 @@ exit:
void MleRouter::HandleUdpReceive(void *aContext, otMessage aMessage, const otMessageInfo *aMessageInfo)
{
MleRouter *obj = reinterpret_cast<MleRouter *>(aContext);
(void)aMessageInfo;
obj->HandleUdpReceive(*static_cast<Message *>(aMessage), *static_cast<const Ip6::MessageInfo *>(aMessageInfo));
}
void MleRouter::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessageInfo)
{
(void)aMessageInfo;
HandleAddressSolicitResponse(aMessage);
}
@@ -2903,7 +2907,7 @@ ThreadError MleRouter::AppendConnectivity(Message &aMessage)
}
}
tlv.SetLeaderCost((cost < kMaxRouteCost) ? cost : kMaxRouteCost);
tlv.SetLeaderCost((cost < kMaxRouteCost) ? cost : static_cast<uint8_t>(kMaxRouteCost));
tlv.SetIdSequence(mRouterIdSequence);
SuccessOrExit(error = aMessage.Append(&tlv, sizeof(tlv)));
+1 -1
View File
@@ -116,7 +116,7 @@ public:
* This method returns the Length value.
*
*/
uint8_t GetLength(void) const { return mLength; }
size_t GetLength(void) const { return mLength; }
/**
* This method sets the Length value.
+1
View File
@@ -723,6 +723,7 @@ bool Leader::IsStableUpdated(uint16_t aRloc16, uint8_t *aTlvs, uint8_t aTlvsLeng
}
exit:
(void)aRloc16;
return rval;
}
+1 -1
View File
@@ -265,7 +265,7 @@ void Local::HandleUdpReceive(Message &aMessage, const Ip6::MessageInfo &aMessage
otLogInfoNetData("Network data registration acknowledged\n");
exit:
{}
(void)aMessageInfo;
}
} // namespace NetworkData
+1
View File
@@ -97,6 +97,7 @@ ThreadError Encoder::Finalize(uint8_t *aOutBuf, uint16_t &aOutLength)
aOutLength = 0;
exit:
(void)aOutBuf;
return error;
}
+37 -5
View File
@@ -834,7 +834,7 @@ NcpBase::OutboundFrameFeedVPacked(const char *pack_format, va_list args)
packed_len = spinel_datatype_vpack(buf, sizeof(buf), pack_format, args);
if ((packed_len > 0) && (packed_len <= sizeof(buf)))
if ((packed_len > 0) && (packed_len <= static_cast<spinel_ssize_t>(sizeof(buf))))
{
errorCode = OutboundFrameFeedData(buf, packed_len);
}
@@ -864,6 +864,9 @@ NcpBase::OutboundFrameFeedPacked(const char *pack_format, ...)
void NcpBase::CommandHandler_NOOP(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len)
{
SendLastStatus(header, SPINEL_STATUS_OK);
(void)command;
(void)arg_ptr;
(void)arg_len;
}
void NcpBase::CommandHandler_RESET(uint8_t header, unsigned int command, const uint8_t *arg_ptr, uint16_t arg_len)
@@ -872,6 +875,10 @@ void NcpBase::CommandHandler_RESET(uint8_t header, unsigned int command, const u
otDisable();
otEnable();
SendLastStatus(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_STATUS_RESET_SOFTWARE);
(void)header;
(void)command;
(void)arg_ptr;
(void)arg_len;
}
void NcpBase::CommandHandler_PROP_VALUE_GET(uint8_t header, unsigned int command, const uint8_t *arg_ptr,
@@ -890,6 +897,7 @@ void NcpBase::CommandHandler_PROP_VALUE_GET(uint8_t header, unsigned int command
{
SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR);
}
(void)command;
}
void NcpBase::CommandHandler_PROP_VALUE_SET(uint8_t header, unsigned int command, const uint8_t *arg_ptr,
@@ -910,6 +918,7 @@ void NcpBase::CommandHandler_PROP_VALUE_SET(uint8_t header, unsigned int command
{
SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR);
}
(void)command;
}
void NcpBase::CommandHandler_PROP_VALUE_INSERT(uint8_t header, unsigned int command, const uint8_t *arg_ptr,
@@ -930,6 +939,7 @@ void NcpBase::CommandHandler_PROP_VALUE_INSERT(uint8_t header, unsigned int comm
{
SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR);
}
(void)command;
}
void NcpBase::CommandHandler_PROP_VALUE_REMOVE(uint8_t header, unsigned int command, const uint8_t *arg_ptr,
@@ -950,6 +960,7 @@ void NcpBase::CommandHandler_PROP_VALUE_REMOVE(uint8_t header, unsigned int comm
{
SendLastStatus(header, SPINEL_STATUS_PARSE_ERROR);
}
(void)command;
}
@@ -1081,12 +1092,14 @@ void NcpBase::GetPropertyHandler_LOCK(uint8_t header, spinel_prop_key_t key)
{
// TODO: Implement property lock (Needs API!)
SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED);
(void)key;
}
void NcpBase::GetPropertyHandler_PHY_ENABLED(uint8_t header, spinel_prop_key_t key)
{
// TODO: Implement PHY_ENBLED (Needs API!)
SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED);
(void)key;
}
void NcpBase::GetPropertyHandler_PHY_FREQ(uint8_t header, spinel_prop_key_t key)
@@ -1651,6 +1664,7 @@ void NcpBase::GetPropertyHandler_IPV6_LL_ADDR(uint8_t header, spinel_prop_key_t
{
// TODO!
SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED);
(void)key;
}
void NcpBase::GetPropertyHandler_IPV6_ADDRESS_TABLE(uint8_t header, spinel_prop_key_t key)
@@ -1693,18 +1707,21 @@ void NcpBase::GetPropertyHandler_IPV6_ROUTE_TABLE(uint8_t header, spinel_prop_ke
{
// TODO: Implement get route table
SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED);
(void)key;
}
void NcpBase::GetPropertyHandler_THREAD_LOCAL_ROUTES(uint8_t header, spinel_prop_key_t key)
{
// TODO: Implement get external route table
SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED);
(void)key;
}
void NcpBase::GetPropertyHandler_STREAM_NET(uint8_t header, spinel_prop_key_t key)
{
// TODO: Implement explicit data poll.
SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED);
(void)key;
}
void NcpBase::GetPropertyHandler_CNTR(uint8_t header, spinel_prop_key_t key)
@@ -1847,6 +1864,9 @@ void NcpBase::SetPropertyHandler_POWER_STATE(uint8_t header, spinel_prop_key_t k
{
// TODO: Implement POWER_STATE
SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED);
(void)key;
(void)value_ptr;
(void)value_len;
}
void NcpBase::SetPropertyHandler_PHY_ENABLED(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
@@ -1894,6 +1914,9 @@ void NcpBase::SetPropertyHandler_PHY_TX_POWER(uint8_t header, spinel_prop_key_t
{
// TODO: Implement PHY_TX_POWER
SendLastStatus(header, SPINEL_STATUS_UNIMPLEMENTED);
(void)key;
(void)value_ptr;
(void)value_len;
}
void NcpBase::SetPropertyHandler_PHY_CHAN(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
@@ -2502,6 +2525,7 @@ void NcpBase::SetPropertyHandler_STREAM_NET_INSECURE(uint8_t header, spinel_prop
SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode));
}
(void)key;
}
void NcpBase::SetPropertyHandler_STREAM_NET(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
@@ -2566,6 +2590,7 @@ void NcpBase::SetPropertyHandler_STREAM_NET(uint8_t header, spinel_prop_key_t ke
SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode));
}
(void)key;
}
void NcpBase::SetPropertyHandler_IPV6_ML_PREFIX(uint8_t header, spinel_prop_key_t key, const uint8_t *value_ptr,
@@ -2741,6 +2766,7 @@ void NcpBase::SetPropertyHandler_CNTR_RESET(uint8_t header, spinel_prop_key_t ke
// There is currently no getter for PROP_CNTR_RESET, so we just
// return SPINEL_STATUS_OK for success when the counters are reset.
SendLastStatus(header, ThreadErrorToSpinelStatus(errorCode));
(void)key;
}
// ----------------------------------------------------------------------------
@@ -2835,11 +2861,13 @@ void NcpBase::InsertPropertyHandler_THREAD_LOCAL_ROUTES(uint8_t header, spinel_p
spinel_ssize_t parsedLength;
ThreadError errorCode = kThreadError_None;
otExternalRouteConfig ext_route_config = {};
otExternalRouteConfig ext_route_config;
otIp6Address *addr_ptr;
bool stable = false;
uint8_t flags = 0;
memset(&ext_route_config, 0, sizeof(otExternalRouteConfig));
VerifyOrExit(
mAllowLocalNetworkDataChange == true,
SendLastStatus(header, SPINEL_STATUS_INVALID_STATE)
@@ -2900,11 +2928,13 @@ void NcpBase::InsertPropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_p
spinel_ssize_t parsedLength;
ThreadError errorCode = kThreadError_None;
otBorderRouterConfig border_router_config = {};
otBorderRouterConfig border_router_config;
otIp6Address *addr_ptr;
bool stable = false;
uint8_t flags = 0;
memset(&border_router_config, 0, sizeof(otBorderRouterConfig));
VerifyOrExit(
mAllowLocalNetworkDataChange == true,
SendLastStatus(header, SPINEL_STATUS_INVALID_STATE)
@@ -3072,7 +3102,8 @@ void NcpBase::RemovePropertyHandler_THREAD_LOCAL_ROUTES(uint8_t header, spinel_p
spinel_ssize_t parsedLength;
ThreadError errorCode = kThreadError_None;
otIp6Prefix ip6_prefix = {};
otIp6Prefix ip6_prefix;
memset(&ip6_prefix, 0, sizeof(otIp6Prefix));
otIp6Address *addr_ptr;
VerifyOrExit(
@@ -3123,7 +3154,8 @@ void NcpBase::RemovePropertyHandler_THREAD_ON_MESH_NETS(uint8_t header, spinel_p
spinel_ssize_t parsedLength;
ThreadError errorCode = kThreadError_None;
otIp6Prefix ip6_prefix = {};
otIp6Prefix ip6_prefix;
memset(&ip6_prefix, 0, sizeof(otIp6Prefix));
otIp6Address *addr_ptr;
VerifyOrExit(
+2 -2
View File
@@ -118,12 +118,11 @@ NcpUart::OutboundFrameFeedMessage(Message &message)
{
ThreadError errorCode;
uint16_t inLength;
uint16_t outLength;
uint8_t inBuf[16];
for (int offset = 0; offset < message.GetLength(); offset += sizeof(inBuf))
{
outLength = OutboundFrameGetRemaining();
(void) OutboundFrameGetRemaining();
inLength = message.Read(offset, sizeof(inBuf), inBuf);
errorCode = OutboundFrameFeedData(inBuf, inLength);
@@ -182,6 +181,7 @@ void NcpUart::ReceiveTask(const uint8_t *aBuf, uint16_t aBufLength)
void NcpUart::HandleFrame(void *context, uint8_t *aBuf, uint16_t aBufLength)
{
sNcpUart->HandleFrame(aBuf, aBufLength);
(void)context;
}
void NcpUart::HandleFrame(uint8_t *aBuf, uint16_t aBufLength)
+9 -9
View File
@@ -191,9 +191,9 @@ spinel_packed_uint_encode(uint8_t *bytes, spinel_size_t len, unsigned int value)
{
const spinel_ssize_t encoded_size = spinel_packed_uint_size(value);
if (len >= encoded_size)
if ((spinel_ssize_t)len >= encoded_size)
{
spinel_size_t i;
spinel_ssize_t i;
for (i = 0; i != encoded_size - 1; ++i)
{
@@ -373,7 +373,7 @@ spinel_datatype_vunpack_(const uint8_t *data_ptr, spinel_size_t data_len, const
require(pui_len > 0, bail);
require(pui_len <= data_len, bail);
require(pui_len <= (spinel_ssize_t)data_len, bail);
ret += pui_len;
data_ptr += pui_len;
@@ -423,7 +423,7 @@ spinel_datatype_vunpack_(const uint8_t *data_ptr, spinel_size_t data_len, const
pui_len = 0;
}
require_action(data_len >= (block_len + pui_len), bail, (ret = -1, errno = EOVERFLOW));
require_action((spinel_ssize_t)data_len >= (block_len + pui_len), bail, (ret = -1, errno = EOVERFLOW));
if (NULL != block_ptr_ptr)
{
@@ -464,7 +464,7 @@ spinel_datatype_vunpack_(const uint8_t *data_ptr, spinel_size_t data_len, const
pui_len = 0;
}
require_action(data_len >= (block_len + pui_len), bail, (ret = -1, errno = EOVERFLOW));
require_action((spinel_ssize_t)data_len >= (block_len + pui_len), bail, (ret = -1, errno = EOVERFLOW));
actual_len = spinel_datatype_vunpack_(block_ptr, block_len, pack_format + 2, args);
@@ -691,7 +691,7 @@ spinel_datatype_vpack_(uint8_t *data_ptr, spinel_size_t data_len_max, const char
spinel_ssize_t encoded_size = spinel_packed_uint_encode(data_ptr, data_len_max, arg);
ret += encoded_size;
if (data_len_max >= encoded_size)
if ((spinel_ssize_t)data_len_max >= encoded_size)
{
data_ptr += encoded_size;
data_len_max -= encoded_size;
@@ -793,7 +793,7 @@ spinel_datatype_vpack_(uint8_t *data_ptr, spinel_size_t data_len_max, const char
ret += size_len + struct_len;
if (struct_len + size_len <= data_len_max)
if (struct_len + size_len <= (spinel_ssize_t)data_len_max)
{
data_ptr += size_len;
data_len_max -= size_len;
@@ -1174,7 +1174,7 @@ main(void)
if (l != 0xDEADBEEF)
{
printf("error: l != 0xDEADBEEF; (0x%08X)\n", l);
printf("error: l != 0xDEADBEEF; (0x%08X)\n", (unsigned int)l);
goto bail;
}
@@ -1234,7 +1234,7 @@ main(void)
if (l != 0xDEADBEEF)
{
printf("error: l != 0xDEADBEEF; (0x%08X)\n", l);
printf("error: l != 0xDEADBEEF; (0x%08X)\n", (unsigned int)l);
goto bail;
}
+2
View File
@@ -55,6 +55,8 @@ extern "C" void otPlatUartSendDone(void)
extern "C" void otPlatUartReceived(const uint8_t *aBuf, uint16_t aBufLength)
{
(void)aBuf;
(void)aBufLength;
}
ThreadNetif sMockThreadNetif;
-9
View File
@@ -74,20 +74,11 @@ void test_packed_union()
VerifyOrQuit(sizeof(packed_t) == 5, "Toolchain::OT_TOOL_PACKED failed 3\n");
}
int test_deprecated() OT_TOOL_DEPRECATED(test_deprecated);
int test_deprecated()
{
return 0;
}
void TestToolchain(void)
{
test_packed1();
test_packed2();
test_packed_union();
SuccessOrQuit(test_deprecated(), "Toolchain::OT_TOOL_DEPRECATED failed\n");
}
int main(void)
+15 -4
View File
@@ -140,6 +140,8 @@ static void signal_SIGINT(int sig)
// this signal again we peform the system default action.
signal(SIGINT, gPreviousHandlerForSIGINT);
gPreviousHandlerForSIGINT = NULL;
(void)sig;
}
static void signal_SIGTERM(int sig)
@@ -151,6 +153,7 @@ static void signal_SIGTERM(int sig)
// this signal again we peform the system default action.
signal(SIGTERM, gPreviousHandlerForSIGTERM);
gPreviousHandlerForSIGTERM = NULL;
(void) sig;
}
static void signal_SIGHUP(int sig)
@@ -161,6 +164,8 @@ static void signal_SIGHUP(int sig)
// We don't restore the "previous handler"
// because we always want to let the main
// loop decide what to do for hangups.
(void) sig;
}
static void signal_critical(int sig, siginfo_t * info, void * ucontext)
@@ -176,6 +181,7 @@ static void signal_critical(int sig, siginfo_t * info, void * ucontext)
// Shut up compiler warning.
(void)uc;
(void)info;
fprintf(stderr, " *** FATAL ERROR: Caught signal %d (%s):\n", sig, strsignal(sig));
@@ -797,8 +803,7 @@ bail:
static bool setup_res_gpio(const char* path)
{
int setup_fd;
int prev_errno = 0;
int setup_fd = -1;
char* dir_path = NULL;
char* value_path = NULL;
int len;
@@ -859,12 +864,18 @@ static void trigger_reset(void)
if (gResGpioValueFd >= 0)
{
lseek(gResGpioValueFd, 0, SEEK_SET);
write(gResGpioValueFd, "0\n", 2);
if (write(gResGpioValueFd, "0\n", 2) == -1)
{
// TODO: Handle error
}
usleep(10 * USEC_PER_MSEC);
lseek(gResGpioValueFd, 0, SEEK_SET);
write(gResGpioValueFd, "1\n", 2);
if (write(gResGpioValueFd, "1\n", 2) == -1)
{
// TODO: Handle error
}
syslog(LOG_NOTICE, "Triggered hardware reset");
}