Skip to content

Commit 65cbd55

Browse files
antony-rheneuslguohan
authored andcommitted
[build]: Fix compiling warnings using ARM 32 bit compiler (#1015)
1 parent b611808 commit 65cbd55

10 files changed

+24
-22
lines changed

fpmsyncd/fpm/fpm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ fpm_msg_next (fpm_msg_hdr_t *hdr, size_t *len)
221221
*len -= msg_len;
222222
}
223223

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

227227
/*

fpmsyncd/fpmlink.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void FpmLink::readData()
106106
/* Check for complete messages */
107107
while (true)
108108
{
109-
hdr = (fpm_msg_hdr_t *)(m_messageBuffer + start);
109+
hdr = reinterpret_cast<fpm_msg_hdr_t *>(static_cast<void *>(m_messageBuffer + start));
110110
left = m_pos - start;
111111
if (left < FPM_MSG_HDR_LEN)
112112
break;

fpmsyncd/fpmsyncd.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <iostream>
2+
#include <inttypes.h>
23
#include "logger.h"
34
#include "select.h"
45
#include "selectabletimer.h"
@@ -84,7 +85,7 @@ int main(int argc, char **argv)
8485
if (warmStartEnabled)
8586
{
8687
/* Obtain warm-restart timer defined for routing application */
87-
uint32_t warmRestartIval = sync.m_warmStartHelper.getRestartTimer();
88+
time_t warmRestartIval = sync.m_warmStartHelper.getRestartTimer();
8889
if (!warmRestartIval)
8990
{
9091
warmStartTimer.setInterval(timespec{DEFAULT_ROUTING_RESTART_INTERVAL, 0});
@@ -149,19 +150,19 @@ int main(int argc, char **argv)
149150
if (eoiuFlagsSet(bgpStateTable))
150151
{
151152
/* Obtain eoiu hold timer defined for bgp docker */
152-
uint32_t eoiuHoldIval = WarmStart::getWarmStartTimer("eoiu_hold", "bgp");
153+
uintmax_t eoiuHoldIval = WarmStart::getWarmStartTimer("eoiu_hold", "bgp");
153154
if (!eoiuHoldIval)
154155
{
155156
eoiuHoldTimer.setInterval(timespec{DEFAULT_EOIU_HOLD_INTERVAL, 0});
156157
eoiuHoldIval = DEFAULT_EOIU_HOLD_INTERVAL;
157158
}
158159
else
159160
{
160-
eoiuHoldTimer.setInterval(timespec{eoiuHoldIval, 0});
161+
eoiuHoldTimer.setInterval(timespec{(time_t)eoiuHoldIval, 0});
161162
}
162163
eoiuHoldTimer.start();
163164
s.addSelectable(&eoiuHoldTimer);
164-
SWSS_LOG_NOTICE("Warm-Restart started EOIU hold timer which is to expire in %d seconds.", eoiuHoldIval);
165+
SWSS_LOG_NOTICE("Warm-Restart started EOIU hold timer which is to expire in %" PRIuMAX " seconds.", eoiuHoldIval);
165166
s.removeSelectable(&eoiuCheckTimer);
166167
continue;
167168
}

orchagent/countercheckorch.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ void CounterCheckOrch::mcCounterCheck()
7979
bool isLossy = ((1 << prio) & pfcMask) == 0;
8080
if (newMcCounters[prio] == numeric_limits<uint64_t>::max())
8181
{
82-
SWSS_LOG_WARN("Could not retreive MC counters on queue %" PRIu64 " port %s",
82+
SWSS_LOG_WARN("Could not retreive MC counters on queue %zu port %s",
8383
prio,
8484
port.m_alias.c_str());
8585
}
8686
else if (!isLossy && mcCounters[prio] < newMcCounters[prio])
8787
{
88-
SWSS_LOG_WARN("Got Multicast %" PRIu64 " frame(s) on lossless queue %" PRIu64 " port %s",
88+
SWSS_LOG_WARN("Got Multicast %" PRIu64 " frame(s) on lossless queue %zu port %s",
8989
newMcCounters[prio] - mcCounters[prio],
9090
prio,
9191
port.m_alias.c_str());
@@ -125,13 +125,13 @@ void CounterCheckOrch::pfcFrameCounterCheck()
125125
bool isLossy = ((1 << prio) & pfcMask) == 0;
126126
if (newCounters[prio] == numeric_limits<uint64_t>::max())
127127
{
128-
SWSS_LOG_WARN("Could not retreive PFC frame count on queue %" PRIu64 " port %s",
128+
SWSS_LOG_WARN("Could not retreive PFC frame count on queue %zu port %s",
129129
prio,
130130
port.m_alias.c_str());
131131
}
132132
else if (isLossy && counters[prio] < newCounters[prio])
133133
{
134-
SWSS_LOG_WARN("Got PFC %" PRIu64 " frame(s) on lossy queue %" PRIu64 " port %s",
134+
SWSS_LOG_WARN("Got PFC %" PRIu64 " frame(s) on lossy queue %zu port %s",
135135
newCounters[prio] - counters[prio],
136136
prio,
137137
port.m_alias.c_str());

orchagent/crmorch.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ void CrmOrch::handleSetCommand(const string& key, const vector<FieldValueTuple>&
240240
if (field == CRM_POLLING_INTERVAL)
241241
{
242242
m_pollingInterval = chrono::seconds(to_uint<uint32_t>(value));
243-
auto interv = timespec { .tv_sec = m_pollingInterval.count(), .tv_nsec = 0 };
243+
auto interv = timespec { .tv_sec = (time_t)m_pollingInterval.count(), .tv_nsec = 0 };
244244
m_timer->setInterval(interv);
245245
m_timer->reset();
246246
}

orchagent/pfcactionhandler.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ bool PfcWdLossyHandler::getHwCounters(PfcWdHwStats& counters)
404404
return false;
405405
}
406406

407-
sai_object_id_t pg = portInstance.m_priority_group_ids[getQueueId()];
407+
sai_object_id_t pg = portInstance.m_priority_group_ids[static_cast <size_t> (getQueueId())];
408408
vector<uint64_t> pgStats;
409409
pgStats.resize(pgStatIds.size());
410410

@@ -469,7 +469,7 @@ PfcWdZeroBufferHandler::PfcWdZeroBufferHandler(sai_object_id_t port,
469469
return;
470470
}
471471

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

474474
attr.id = SAI_INGRESS_PRIORITY_GROUP_ATTR_BUFFER_PROFILE;
475475

@@ -521,7 +521,7 @@ PfcWdZeroBufferHandler::~PfcWdZeroBufferHandler(void)
521521
return;
522522
}
523523

524-
sai_object_id_t pg = portInstance.m_priority_group_ids[getQueueId()];
524+
sai_object_id_t pg = portInstance.m_priority_group_ids[size_t(getQueueId())];
525525

526526
attr.id = SAI_INGRESS_PRIORITY_GROUP_ATTR_BUFFER_PROFILE;
527527
attr.value.oid = m_originalPgBufferProfile;

orchagent/portsorch.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -1430,7 +1430,8 @@ bool PortsOrch::bake()
14301430
vector<FieldValueTuple> tuples;
14311431
string value;
14321432
bool foundPortConfigDone = m_portTable->hget("PortConfigDone", "count", value);
1433-
unsigned long portCount;
1433+
uintmax_t portCount;
1434+
char* endPtr = NULL;
14341435
SWSS_LOG_NOTICE("foundPortConfigDone = %d", foundPortConfigDone);
14351436

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

1450-
portCount = stoul(value);
1451-
SWSS_LOG_NOTICE("portCount = %" PRIu64 ", m_portCount = %u", portCount, m_portCount);
1451+
portCount = strtoumax(value.c_str(), &endPtr, 0);
1452+
SWSS_LOG_NOTICE("portCount = %" PRIuMAX ", m_portCount = %u", portCount, m_portCount);
14521453
if (portCount != keys.size() - 2)
14531454
{
14541455
// Invalid port table
1455-
SWSS_LOG_ERROR("Invalid port table: portCount, expecting %" PRIu64 ", got %" PRIu64,
1456+
SWSS_LOG_ERROR("Invalid port table: portCount, expecting %" PRIuMAX ", got %zu",
14561457
portCount, keys.size() - 2);
14571458

14581459
cleanPortTable(keys);

orchagent/qosorch.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ bool QosOrch::applySchedulerToQueueSchedulerGroup(Port &port, size_t queue_ind,
10531053
const sai_object_id_t group_id = getSchedulerGroup(port, queue_id);
10541054
if(group_id == SAI_NULL_OBJECT_ID)
10551055
{
1056-
SWSS_LOG_ERROR("Failed to find a scheduler group for port: %s queue: %" PRIu64, port.m_alias.c_str(), queue_ind);
1056+
SWSS_LOG_ERROR("Failed to find a scheduler group for port: %s queue: %zu", port.m_alias.c_str(), queue_ind);
10571057
return false;
10581058
}
10591059

orchagent/watermarkorch.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ void WatermarkOrch::handleWmConfigUpdate(const std::string &key, const std::vect
9898
{
9999
if (i.first == "interval")
100100
{
101-
auto intervT = timespec { .tv_sec = to_uint<uint32_t>(i.second.c_str()) , .tv_nsec = 0 };
101+
auto intervT = timespec { .tv_sec = static_cast<time_t>(to_uint<uint32_t>(i.second.c_str())), .tv_nsec = 0 };
102102
m_telemetryTimer->setInterval(intervT);
103103
// reset the timer interval when current timer expires
104104
m_timerChanged = true;
@@ -295,7 +295,7 @@ void WatermarkOrch::clearSingleWm(Table *table, string wm_name, vector<sai_objec
295295
{
296296
/* Zero-out some WM in some table for some vector of object ids*/
297297
SWSS_LOG_ENTER();
298-
SWSS_LOG_DEBUG("clear WM %s, for %" PRId64 " obj ids", wm_name.c_str(), obj_ids.size());
298+
SWSS_LOG_DEBUG("clear WM %s, for %zu obj ids", wm_name.c_str(), obj_ids.size());
299299

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

warmrestart/warmRestartAssist.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class AppRestartAssist
108108
std::string m_appTableName; // application table name
109109

110110
bool m_warmStartInProgress; // indicate if warm start is in progress
111-
uint32_t m_reconcileTimer; // reconcile timer value
111+
time_t m_reconcileTimer; // reconcile timer value
112112
SelectableTimer m_warmStartTimer; // reconcile timer
113113

114114
// Set or get cache entry state

0 commit comments

Comments
 (0)