From 50d5be2b399e9bcc43973f99d72d76e4effd8cc0 Mon Sep 17 00:00:00 2001 From: Saikrishna Arcot Date: Mon, 4 Apr 2022 13:51:42 -0700 Subject: [PATCH] Make changes to support compiling on Bullseye with GCC 10 (#2216) Types of changes done: * Add missing includes in header files and .cpp files * Don't use parentheses when doing list initialization in constructors * Make sure variables are initialized before first use Signed-off-by: Saikrishna Arcot --- cfgmgr/buffermgrdyn.cpp | 10 +++++----- lib/subintf.cpp | 1 + lib/subintf.h | 2 ++ orchagent/directory.h | 1 + orchagent/mplsrouteorch.cpp | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/cfgmgr/buffermgrdyn.cpp b/cfgmgr/buffermgrdyn.cpp index b4578c2370ba..322b5848bf93 100644 --- a/cfgmgr/buffermgrdyn.cpp +++ b/cfgmgr/buffermgrdyn.cpp @@ -29,9 +29,9 @@ using namespace swss; BufferMgrDynamic::BufferMgrDynamic(DBConnector *cfgDb, DBConnector *stateDb, DBConnector *applDb, const vector &tables, shared_ptr> gearboxInfo, shared_ptr> zeroProfilesInfo) : Orch(tables), m_platform(), - m_bufferDirections({BUFFER_INGRESS, BUFFER_EGRESS}), - m_bufferObjectNames({"priority group", "queue"}), - m_bufferDirectionNames({"ingress", "egress"}), + m_bufferDirections{BUFFER_INGRESS, BUFFER_EGRESS}, + m_bufferObjectNames{"priority group", "queue"}, + m_bufferDirectionNames{"ingress", "egress"}, m_applDb(applDb), m_zeroProfilesLoaded(false), m_supportRemoving(true), @@ -39,8 +39,8 @@ BufferMgrDynamic::BufferMgrDynamic(DBConnector *cfgDb, DBConnector *stateDb, DBC m_cfgDeviceMetaDataTable(cfgDb, CFG_DEVICE_METADATA_TABLE_NAME), m_applBufferPoolTable(applDb, APP_BUFFER_POOL_TABLE_NAME), m_applBufferProfileTable(applDb, APP_BUFFER_PROFILE_TABLE_NAME), - m_applBufferObjectTables({ProducerStateTable(applDb, APP_BUFFER_PG_TABLE_NAME), ProducerStateTable(applDb, APP_BUFFER_QUEUE_TABLE_NAME)}), - m_applBufferProfileListTables({ProducerStateTable(applDb, APP_BUFFER_PORT_INGRESS_PROFILE_LIST_NAME), ProducerStateTable(applDb, APP_BUFFER_PORT_EGRESS_PROFILE_LIST_NAME)}), + m_applBufferObjectTables{ProducerStateTable(applDb, APP_BUFFER_PG_TABLE_NAME), ProducerStateTable(applDb, APP_BUFFER_QUEUE_TABLE_NAME)}, + m_applBufferProfileListTables{ProducerStateTable(applDb, APP_BUFFER_PORT_INGRESS_PROFILE_LIST_NAME), ProducerStateTable(applDb, APP_BUFFER_PORT_EGRESS_PROFILE_LIST_NAME)}, m_statePortTable(stateDb, STATE_PORT_TABLE_NAME), m_stateBufferMaximumTable(stateDb, STATE_BUFFER_MAXIMUM_VALUE_TABLE), m_stateBufferPoolTable(stateDb, STATE_BUFFER_POOL_TABLE_NAME), diff --git a/lib/subintf.cpp b/lib/subintf.cpp index ab26ee62de89..4f934ff65947 100644 --- a/lib/subintf.cpp +++ b/lib/subintf.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "subintf.h" using namespace swss; diff --git a/lib/subintf.h b/lib/subintf.h index ec5d0c465630..263faf9f3a4f 100644 --- a/lib/subintf.h +++ b/lib/subintf.h @@ -1,5 +1,7 @@ #pragma once +#include + #define VLAN_SUB_INTERFACE_SEPARATOR "." namespace swss { class subIntf diff --git a/orchagent/directory.h b/orchagent/directory.h index ecae1564a29e..4d5857b18ef7 100644 --- a/orchagent/directory.h +++ b/orchagent/directory.h @@ -6,6 +6,7 @@ #include #include +#include #include #include diff --git a/orchagent/mplsrouteorch.cpp b/orchagent/mplsrouteorch.cpp index ef40987a19de..73dbbdb1944e 100644 --- a/orchagent/mplsrouteorch.cpp +++ b/orchagent/mplsrouteorch.cpp @@ -465,7 +465,7 @@ bool RouteOrch::addLabelRoute(LabelRouteBulkContext& ctx, const NextHopGroupKey Label& label = ctx.label; /* next_hop_id indicates the next hop id or next hop group id of this route */ - sai_object_id_t next_hop_id; + sai_object_id_t next_hop_id = SAI_NULL_OBJECT_ID; bool blackhole = false; if (m_syncdLabelRoutes.find(vrf_id) == m_syncdLabelRoutes.end())