Skip to content

Commit

Permalink
[build]: Fix compiling warnings using ARM 32 bit compiler (#1015)
Browse files Browse the repository at this point in the history
  • Loading branch information
antony-rheneus authored and lguohan committed Aug 16, 2019
1 parent b611808 commit 65cbd55
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion fpmsyncd/fpm/fpm.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ fpm_msg_next (fpm_msg_hdr_t *hdr, size_t *len)
*len -= msg_len;
}

return (fpm_msg_hdr_t *) (((char*) hdr) + msg_len);
return reinterpret_cast<fpm_msg_hdr_t *>(static_cast<void *>(((char*) hdr) + msg_len));
}

/*
Expand Down
2 changes: 1 addition & 1 deletion fpmsyncd/fpmlink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void FpmLink::readData()
/* Check for complete messages */
while (true)
{
hdr = (fpm_msg_hdr_t *)(m_messageBuffer + start);
hdr = reinterpret_cast<fpm_msg_hdr_t *>(static_cast<void *>(m_messageBuffer + start));
left = m_pos - start;
if (left < FPM_MSG_HDR_LEN)
break;
Expand Down
9 changes: 5 additions & 4 deletions fpmsyncd/fpmsyncd.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <iostream>
#include <inttypes.h>
#include "logger.h"
#include "select.h"
#include "selectabletimer.h"
Expand Down Expand Up @@ -84,7 +85,7 @@ int main(int argc, char **argv)
if (warmStartEnabled)
{
/* Obtain warm-restart timer defined for routing application */
uint32_t warmRestartIval = sync.m_warmStartHelper.getRestartTimer();
time_t warmRestartIval = sync.m_warmStartHelper.getRestartTimer();
if (!warmRestartIval)
{
warmStartTimer.setInterval(timespec{DEFAULT_ROUTING_RESTART_INTERVAL, 0});
Expand Down Expand Up @@ -149,19 +150,19 @@ int main(int argc, char **argv)
if (eoiuFlagsSet(bgpStateTable))
{
/* Obtain eoiu hold timer defined for bgp docker */
uint32_t eoiuHoldIval = WarmStart::getWarmStartTimer("eoiu_hold", "bgp");
uintmax_t eoiuHoldIval = WarmStart::getWarmStartTimer("eoiu_hold", "bgp");
if (!eoiuHoldIval)
{
eoiuHoldTimer.setInterval(timespec{DEFAULT_EOIU_HOLD_INTERVAL, 0});
eoiuHoldIval = DEFAULT_EOIU_HOLD_INTERVAL;
}
else
{
eoiuHoldTimer.setInterval(timespec{eoiuHoldIval, 0});
eoiuHoldTimer.setInterval(timespec{(time_t)eoiuHoldIval, 0});
}
eoiuHoldTimer.start();
s.addSelectable(&eoiuHoldTimer);
SWSS_LOG_NOTICE("Warm-Restart started EOIU hold timer which is to expire in %d seconds.", eoiuHoldIval);
SWSS_LOG_NOTICE("Warm-Restart started EOIU hold timer which is to expire in %" PRIuMAX " seconds.", eoiuHoldIval);
s.removeSelectable(&eoiuCheckTimer);
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions orchagent/countercheckorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ void CounterCheckOrch::mcCounterCheck()
bool isLossy = ((1 << prio) & pfcMask) == 0;
if (newMcCounters[prio] == numeric_limits<uint64_t>::max())
{
SWSS_LOG_WARN("Could not retreive MC counters on queue %" PRIu64 " port %s",
SWSS_LOG_WARN("Could not retreive MC counters on queue %zu port %s",
prio,
port.m_alias.c_str());
}
else if (!isLossy && mcCounters[prio] < newMcCounters[prio])
{
SWSS_LOG_WARN("Got Multicast %" PRIu64 " frame(s) on lossless queue %" PRIu64 " port %s",
SWSS_LOG_WARN("Got Multicast %" PRIu64 " frame(s) on lossless queue %zu port %s",
newMcCounters[prio] - mcCounters[prio],
prio,
port.m_alias.c_str());
Expand Down Expand Up @@ -125,13 +125,13 @@ void CounterCheckOrch::pfcFrameCounterCheck()
bool isLossy = ((1 << prio) & pfcMask) == 0;
if (newCounters[prio] == numeric_limits<uint64_t>::max())
{
SWSS_LOG_WARN("Could not retreive PFC frame count on queue %" PRIu64 " port %s",
SWSS_LOG_WARN("Could not retreive PFC frame count on queue %zu port %s",
prio,
port.m_alias.c_str());
}
else if (isLossy && counters[prio] < newCounters[prio])
{
SWSS_LOG_WARN("Got PFC %" PRIu64 " frame(s) on lossy queue %" PRIu64 " port %s",
SWSS_LOG_WARN("Got PFC %" PRIu64 " frame(s) on lossy queue %zu port %s",
newCounters[prio] - counters[prio],
prio,
port.m_alias.c_str());
Expand Down
2 changes: 1 addition & 1 deletion orchagent/crmorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void CrmOrch::handleSetCommand(const string& key, const vector<FieldValueTuple>&
if (field == CRM_POLLING_INTERVAL)
{
m_pollingInterval = chrono::seconds(to_uint<uint32_t>(value));
auto interv = timespec { .tv_sec = m_pollingInterval.count(), .tv_nsec = 0 };
auto interv = timespec { .tv_sec = (time_t)m_pollingInterval.count(), .tv_nsec = 0 };
m_timer->setInterval(interv);
m_timer->reset();
}
Expand Down
6 changes: 3 additions & 3 deletions orchagent/pfcactionhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ bool PfcWdLossyHandler::getHwCounters(PfcWdHwStats& counters)
return false;
}

sai_object_id_t pg = portInstance.m_priority_group_ids[getQueueId()];
sai_object_id_t pg = portInstance.m_priority_group_ids[static_cast <size_t> (getQueueId())];
vector<uint64_t> pgStats;
pgStats.resize(pgStatIds.size());

Expand Down Expand Up @@ -469,7 +469,7 @@ PfcWdZeroBufferHandler::PfcWdZeroBufferHandler(sai_object_id_t port,
return;
}

sai_object_id_t pg = portInstance.m_priority_group_ids[queueId];
sai_object_id_t pg = portInstance.m_priority_group_ids[static_cast <size_t> (queueId)];

attr.id = SAI_INGRESS_PRIORITY_GROUP_ATTR_BUFFER_PROFILE;

Expand Down Expand Up @@ -521,7 +521,7 @@ PfcWdZeroBufferHandler::~PfcWdZeroBufferHandler(void)
return;
}

sai_object_id_t pg = portInstance.m_priority_group_ids[getQueueId()];
sai_object_id_t pg = portInstance.m_priority_group_ids[size_t(getQueueId())];

attr.id = SAI_INGRESS_PRIORITY_GROUP_ATTR_BUFFER_PROFILE;
attr.value.oid = m_originalPgBufferProfile;
Expand Down
9 changes: 5 additions & 4 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,8 @@ bool PortsOrch::bake()
vector<FieldValueTuple> tuples;
string value;
bool foundPortConfigDone = m_portTable->hget("PortConfigDone", "count", value);
unsigned long portCount;
uintmax_t portCount;
char* endPtr = NULL;
SWSS_LOG_NOTICE("foundPortConfigDone = %d", foundPortConfigDone);

bool foundPortInitDone = m_portTable->get("PortInitDone", tuples);
Expand All @@ -1447,12 +1448,12 @@ bool PortsOrch::bake()
return false;
}

portCount = stoul(value);
SWSS_LOG_NOTICE("portCount = %" PRIu64 ", m_portCount = %u", portCount, m_portCount);
portCount = strtoumax(value.c_str(), &endPtr, 0);
SWSS_LOG_NOTICE("portCount = %" PRIuMAX ", m_portCount = %u", portCount, m_portCount);
if (portCount != keys.size() - 2)
{
// Invalid port table
SWSS_LOG_ERROR("Invalid port table: portCount, expecting %" PRIu64 ", got %" PRIu64,
SWSS_LOG_ERROR("Invalid port table: portCount, expecting %" PRIuMAX ", got %zu",
portCount, keys.size() - 2);

cleanPortTable(keys);
Expand Down
2 changes: 1 addition & 1 deletion orchagent/qosorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ bool QosOrch::applySchedulerToQueueSchedulerGroup(Port &port, size_t queue_ind,
const sai_object_id_t group_id = getSchedulerGroup(port, queue_id);
if(group_id == SAI_NULL_OBJECT_ID)
{
SWSS_LOG_ERROR("Failed to find a scheduler group for port: %s queue: %" PRIu64, port.m_alias.c_str(), queue_ind);
SWSS_LOG_ERROR("Failed to find a scheduler group for port: %s queue: %zu", port.m_alias.c_str(), queue_ind);
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions orchagent/watermarkorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void WatermarkOrch::handleWmConfigUpdate(const std::string &key, const std::vect
{
if (i.first == "interval")
{
auto intervT = timespec { .tv_sec = to_uint<uint32_t>(i.second.c_str()) , .tv_nsec = 0 };
auto intervT = timespec { .tv_sec = static_cast<time_t>(to_uint<uint32_t>(i.second.c_str())), .tv_nsec = 0 };
m_telemetryTimer->setInterval(intervT);
// reset the timer interval when current timer expires
m_timerChanged = true;
Expand Down Expand Up @@ -295,7 +295,7 @@ void WatermarkOrch::clearSingleWm(Table *table, string wm_name, vector<sai_objec
{
/* Zero-out some WM in some table for some vector of object ids*/
SWSS_LOG_ENTER();
SWSS_LOG_DEBUG("clear WM %s, for %" PRId64 " obj ids", wm_name.c_str(), obj_ids.size());
SWSS_LOG_DEBUG("clear WM %s, for %zu obj ids", wm_name.c_str(), obj_ids.size());

vector<FieldValueTuple> vfvt = {{wm_name, "0"}};

Expand Down
2 changes: 1 addition & 1 deletion warmrestart/warmRestartAssist.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class AppRestartAssist
std::string m_appTableName; // application table name

bool m_warmStartInProgress; // indicate if warm start is in progress
uint32_t m_reconcileTimer; // reconcile timer value
time_t m_reconcileTimer; // reconcile timer value
SelectableTimer m_warmStartTimer; // reconcile timer

// Set or get cache entry state
Expand Down

0 comments on commit 65cbd55

Please sign in to comment.