From bed79702c9da7957b775a0c960f67dd426db34d5 Mon Sep 17 00:00:00 2001 From: Sabareesh-Kumar-Anandan <59681634+Sabareesh-Kumar-Anandan@users.noreply.github.com> Date: Wed, 11 Nov 2020 05:21:39 +0530 Subject: [PATCH] [orchagent] Arm 32-bit arch compilation warning Fixes (#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 --- orchagent/mirrororch.cpp | 2 +- orchagent/portsorch.cpp | 14 +++++++------- orchagent/saihelper.cpp | 5 +++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/orchagent/mirrororch.cpp b/orchagent/mirrororch.cpp index 4b98db9e30db..1abb522e21a5 100644 --- a/orchagent/mirrororch.cpp +++ b/orchagent/mirrororch.cpp @@ -748,7 +748,7 @@ bool MirrorOrch::setUnsetPortMirror(Port port, if (set) { port_attr.value.objlist.count = 1; - port_attr.value.objlist.list = (long unsigned int *)calloc(port_attr.value.objlist.count, sizeof(sai_object_id_t)); + port_attr.value.objlist.list = reinterpret_cast(calloc(port_attr.value.objlist.count, sizeof(sai_object_id_t))); port_attr.value.objlist.list[0] = sessionId; } else diff --git a/orchagent/portsorch.cpp b/orchagent/portsorch.cpp index c6aa40ecc6bc..63f1e3ac2cf6 100755 --- a/orchagent/portsorch.cpp +++ b/orchagent/portsorch.cpp @@ -4348,7 +4348,7 @@ bool PortsOrch::initGearboxPort(Port &port) { if (m_gearboxInterfaceMap.find(port.m_index) != m_gearboxInterfaceMap.end()) { - SWSS_LOG_NOTICE("BOX: port_id:0x%lx index:%d alias:%s", port.m_port_id, port.m_index, port.m_alias.c_str()); + SWSS_LOG_NOTICE("BOX: port_id:0x%" PRIx64 " index:%d alias:%s", port.m_port_id, port.m_index, port.m_alias.c_str()); phy_id = m_gearboxInterfaceMap[port.m_index].phy_id; phyOidStr = m_gearboxPhyMap[phy_id].phy_oid; @@ -4405,11 +4405,11 @@ bool PortsOrch::initGearboxPort(Port &port) status = sai_port_api->create_port(&systemPort, phyOid, static_cast(attrs.size()), attrs.data()); if (status != SAI_STATUS_SUCCESS) { - SWSS_LOG_ERROR("BOX: Failed to create Gearbox system-side port for alias:%s port_id:0x%lx index:%d status:%d", + SWSS_LOG_ERROR("BOX: Failed to create Gearbox system-side port for alias:%s port_id:0x%" PRIx64 " index:%d status:%d", port.m_alias.c_str(), port.m_port_id, port.m_index, status); return false; } - SWSS_LOG_NOTICE("BOX: Created Gearbox system-side port 0x%lx for alias:%s index:%d", + SWSS_LOG_NOTICE("BOX: Created Gearbox system-side port 0x%" PRIx64 " for alias:%s index:%d", systemPort, port.m_alias.c_str(), port.m_index); /* Create LINE-SIDE port */ @@ -4488,11 +4488,11 @@ bool PortsOrch::initGearboxPort(Port &port) status = sai_port_api->create_port(&linePort, phyOid, static_cast(attrs.size()), attrs.data()); if (status != SAI_STATUS_SUCCESS) { - SWSS_LOG_ERROR("BOX: Failed to create Gearbox line-side port for alias:%s port_id:0x%lx index:%d status:%d", + SWSS_LOG_ERROR("BOX: Failed to create Gearbox line-side port for alias:%s port_id:0x%" PRIx64 " index:%d status:%d", port.m_alias.c_str(), port.m_port_id, port.m_index, status); return false; } - SWSS_LOG_NOTICE("BOX: Created Gearbox line-side port 0x%lx for alias:%s index:%d", + SWSS_LOG_NOTICE("BOX: Created Gearbox line-side port 0x%" PRIx64 " for alias:%s index:%d", linePort, port.m_alias.c_str(), port.m_index); /* Connect SYSTEM-SIDE to LINE-SIDE */ @@ -4508,11 +4508,11 @@ bool PortsOrch::initGearboxPort(Port &port) status = sai_port_api->create_port_connector(&connector, phyOid, static_cast(attrs.size()), attrs.data()); if (status != SAI_STATUS_SUCCESS) { - SWSS_LOG_ERROR("BOX: Failed to connect Gearbox system-side:0x%lx to line-side:0x%lx; status:%d", systemPort, linePort, status); + SWSS_LOG_ERROR("BOX: Failed to connect Gearbox system-side:0x%" PRIx64 " to line-side:0x%" PRIx64 "; status:%d", systemPort, linePort, status); return false; } - SWSS_LOG_NOTICE("BOX: Connected Gearbox ports; system-side:0x%lx to line-side:0x%lx", systemPort, linePort); + SWSS_LOG_NOTICE("BOX: Connected Gearbox ports; system-side:0x%" PRIx64 " to line-side:0x%" PRIx64, systemPort, linePort); m_gearboxPortListLaneMap[port.m_port_id] = make_tuple(systemPort, linePort); } } diff --git a/orchagent/saihelper.cpp b/orchagent/saihelper.cpp index 70fc0a9495f4..8e50eb13d5f1 100644 --- a/orchagent/saihelper.cpp +++ b/orchagent/saihelper.cpp @@ -5,6 +5,7 @@ extern "C" { #include "saiextensions.h" } +#include #include #include #include @@ -256,7 +257,7 @@ void initSaiRedis(const string &record_location) if (status != SAI_STATUS_SUCCESS) { - SWSS_LOG_ERROR("Failed to notify syncd INIT_VIEW, rv:%d gSwitchId %lx", status, gSwitchId); + SWSS_LOG_ERROR("Failed to notify syncd INIT_VIEW, rv:%d gSwitchId %" PRIx64, status, gSwitchId); exit(EXIT_FAILURE); } SWSS_LOG_NOTICE("Notify syncd INIT_VIEW"); @@ -320,7 +321,7 @@ sai_status_t initSaiPhyApi(swss::gearbox_phy_t *phy) SWSS_LOG_ERROR("BOX: Failed to create PHY:%d rtn:%d", phy->phy_id, status); return status; } - SWSS_LOG_NOTICE("BOX: Created PHY:%d Oid:0x%lx", phy->phy_id, phyOid); + SWSS_LOG_NOTICE("BOX: Created PHY:%d Oid:0x%" PRIx64, phy->phy_id, phyOid); phy->phy_oid = sai_serialize_object_id(phyOid);