Skip to content

Commit bed7970

Browse files
[orchagent] Arm 32-bit arch compilation warning Fixes (sonic-net#1488)
**What I did** Replaced %l variants with PRI format specifier to fix compilation warnings for arm 32-bit arch **How I verified it** Compiled and verified for arm 32-bit arch (marvell-armhf) * [orchagent] Arm 32-bit arch compilation warning Fixes * [orchagent] removed explicit type cast
1 parent b9084a7 commit bed7970

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

orchagent/mirrororch.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ bool MirrorOrch::setUnsetPortMirror(Port port,
748748
if (set)
749749
{
750750
port_attr.value.objlist.count = 1;
751-
port_attr.value.objlist.list = (long unsigned int *)calloc(port_attr.value.objlist.count, sizeof(sai_object_id_t));
751+
port_attr.value.objlist.list = reinterpret_cast<sai_object_id_t *>(calloc(port_attr.value.objlist.count, sizeof(sai_object_id_t)));
752752
port_attr.value.objlist.list[0] = sessionId;
753753
}
754754
else

orchagent/portsorch.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -4348,7 +4348,7 @@ bool PortsOrch::initGearboxPort(Port &port)
43484348
{
43494349
if (m_gearboxInterfaceMap.find(port.m_index) != m_gearboxInterfaceMap.end())
43504350
{
4351-
SWSS_LOG_NOTICE("BOX: port_id:0x%lx index:%d alias:%s", port.m_port_id, port.m_index, port.m_alias.c_str());
4351+
SWSS_LOG_NOTICE("BOX: port_id:0x%" PRIx64 " index:%d alias:%s", port.m_port_id, port.m_index, port.m_alias.c_str());
43524352

43534353
phy_id = m_gearboxInterfaceMap[port.m_index].phy_id;
43544354
phyOidStr = m_gearboxPhyMap[phy_id].phy_oid;
@@ -4405,11 +4405,11 @@ bool PortsOrch::initGearboxPort(Port &port)
44054405
status = sai_port_api->create_port(&systemPort, phyOid, static_cast<uint32_t>(attrs.size()), attrs.data());
44064406
if (status != SAI_STATUS_SUCCESS)
44074407
{
4408-
SWSS_LOG_ERROR("BOX: Failed to create Gearbox system-side port for alias:%s port_id:0x%lx index:%d status:%d",
4408+
SWSS_LOG_ERROR("BOX: Failed to create Gearbox system-side port for alias:%s port_id:0x%" PRIx64 " index:%d status:%d",
44094409
port.m_alias.c_str(), port.m_port_id, port.m_index, status);
44104410
return false;
44114411
}
4412-
SWSS_LOG_NOTICE("BOX: Created Gearbox system-side port 0x%lx for alias:%s index:%d",
4412+
SWSS_LOG_NOTICE("BOX: Created Gearbox system-side port 0x%" PRIx64 " for alias:%s index:%d",
44134413
systemPort, port.m_alias.c_str(), port.m_index);
44144414

44154415
/* Create LINE-SIDE port */
@@ -4488,11 +4488,11 @@ bool PortsOrch::initGearboxPort(Port &port)
44884488
status = sai_port_api->create_port(&linePort, phyOid, static_cast<uint32_t>(attrs.size()), attrs.data());
44894489
if (status != SAI_STATUS_SUCCESS)
44904490
{
4491-
SWSS_LOG_ERROR("BOX: Failed to create Gearbox line-side port for alias:%s port_id:0x%lx index:%d status:%d",
4491+
SWSS_LOG_ERROR("BOX: Failed to create Gearbox line-side port for alias:%s port_id:0x%" PRIx64 " index:%d status:%d",
44924492
port.m_alias.c_str(), port.m_port_id, port.m_index, status);
44934493
return false;
44944494
}
4495-
SWSS_LOG_NOTICE("BOX: Created Gearbox line-side port 0x%lx for alias:%s index:%d",
4495+
SWSS_LOG_NOTICE("BOX: Created Gearbox line-side port 0x%" PRIx64 " for alias:%s index:%d",
44964496
linePort, port.m_alias.c_str(), port.m_index);
44974497

44984498
/* Connect SYSTEM-SIDE to LINE-SIDE */
@@ -4508,11 +4508,11 @@ bool PortsOrch::initGearboxPort(Port &port)
45084508
status = sai_port_api->create_port_connector(&connector, phyOid, static_cast<uint32_t>(attrs.size()), attrs.data());
45094509
if (status != SAI_STATUS_SUCCESS)
45104510
{
4511-
SWSS_LOG_ERROR("BOX: Failed to connect Gearbox system-side:0x%lx to line-side:0x%lx; status:%d", systemPort, linePort, status);
4511+
SWSS_LOG_ERROR("BOX: Failed to connect Gearbox system-side:0x%" PRIx64 " to line-side:0x%" PRIx64 "; status:%d", systemPort, linePort, status);
45124512
return false;
45134513
}
45144514

4515-
SWSS_LOG_NOTICE("BOX: Connected Gearbox ports; system-side:0x%lx to line-side:0x%lx", systemPort, linePort);
4515+
SWSS_LOG_NOTICE("BOX: Connected Gearbox ports; system-side:0x%" PRIx64 " to line-side:0x%" PRIx64, systemPort, linePort);
45164516
m_gearboxPortListLaneMap[port.m_port_id] = make_tuple(systemPort, linePort);
45174517
}
45184518
}

orchagent/saihelper.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ extern "C" {
55
#include "saiextensions.h"
66
}
77

8+
#include <inttypes.h>
89
#include <string.h>
910
#include <fstream>
1011
#include <map>
@@ -256,7 +257,7 @@ void initSaiRedis(const string &record_location)
256257

257258
if (status != SAI_STATUS_SUCCESS)
258259
{
259-
SWSS_LOG_ERROR("Failed to notify syncd INIT_VIEW, rv:%d gSwitchId %lx", status, gSwitchId);
260+
SWSS_LOG_ERROR("Failed to notify syncd INIT_VIEW, rv:%d gSwitchId %" PRIx64, status, gSwitchId);
260261
exit(EXIT_FAILURE);
261262
}
262263
SWSS_LOG_NOTICE("Notify syncd INIT_VIEW");
@@ -320,7 +321,7 @@ sai_status_t initSaiPhyApi(swss::gearbox_phy_t *phy)
320321
SWSS_LOG_ERROR("BOX: Failed to create PHY:%d rtn:%d", phy->phy_id, status);
321322
return status;
322323
}
323-
SWSS_LOG_NOTICE("BOX: Created PHY:%d Oid:0x%lx", phy->phy_id, phyOid);
324+
SWSS_LOG_NOTICE("BOX: Created PHY:%d Oid:0x%" PRIx64, phy->phy_id, phyOid);
324325

325326
phy->phy_oid = sai_serialize_object_id(phyOid);
326327

0 commit comments

Comments
 (0)