misc: fix g++13 overloaded-virtual warning (#363)
There are two overloaded-virtual issues reported by g++13.
1. Copy assignment and move assignment overload is hidden in the derived
class
[ CXX] src/mem/cache/replacement_policies/weighted_lru_rp.cc ->
ALL/mem/cache/replacement_policies/weighted_lru_rp.o
In file included from src/mem/cache/base.hh:61,
from src/mem/cache/base.cc:46:
src/mem/cache/cache_blk.hh:172:5: error: ‘virtual gem5::CacheBlk&
gem5::CacheBlk::operator=(gem5::CacheBlk&&)’ was hidden
[-Werror=overloaded-virtual=]
172 | operator=(CacheBlk&& other)
| ^~~~~~~~
src/mem/cache/cache_blk.hh:518:19: note: by ‘gem5::TempCacheBlk&
gem5::TempCacheBlk::operator=(const gem5::TempCacheBlk&)’
518 | TempCacheBlk& operator=(const TempCacheBlk&) = delete;
| ^~~~~~~~
In this case, we can exiplict using parent operator= to keep the
function overload.
2. Intended overload hidden in SystemC is reported as error.
In file included from
src/systemc/ext/tlm_utils/simple_initiator_socket.h:24,
from src/systemc/tlm_bridge/gem5_to_tlm.hh:72,
from build/ALL/python/_m5/param_Gem5ToTlmBridge256.cc:17:
src/systemc/ext/tlm_utils/../tlm_core/2/sockets/initiator_socket.hh: In
instantiation of ‘class tlm::tlm_base_initiator_socket<256,
tlm::tlm_fw_transport_if<>, tlm::tlm_bw_transport_if<>, 1,
sc_core::SC_ONE_OR_MORE_BOUND>’:
src/systemc/ext/tlm_utils/../tlm_core/2/sockets/initiator_socket.hh:185:7:
required from ‘class tlm::tlm_initiator_socket<256,
tlm::tlm_base_protocol_types, 1, sc_core::SC_ONE_OR_MORE_BOUND>’
src/systemc/ext/tlm_utils/simple_initiator_socket.h:37:7: required from
‘class
tlm_utils::simple_initiator_socket_b<sc_gem5::Gem5ToTlmBridge<256>, 256,
tlm::tlm_base_protocol_types, sc_core::SC_ONE_OR_MORE_BOUND>’
src/systemc/ext/tlm_utils/simple_initiator_socket.h:156:7: required from
‘class tlm_utils::simple_initiator_socket<sc_gem5::Gem5ToTlmBridge<256>,
256, tlm::tlm_base_protocol_types>’
src/systemc/tlm_bridge/gem5_to_tlm.hh:147:46: required from ‘class
sc_gem5::Gem5ToTlmBridge<256>’
/usr/include/c++/13/type_traits:1411:38: required from ‘struct
std::is_base_of<sc_gem5::Gem5ToTlmBridgeBase,
sc_gem5::Gem5ToTlmBridge<256> >’
ext/pybind11/include/pybind11/detail/../detail/common.h:880:59: required
from ‘struct pybind11::class_<sc_gem5::Gem5ToTlmBridge<256>,
sc_gem5::Gem5ToTlmBridgeBase,
std::unique_ptr<sc_gem5::Gem5ToTlmBridge<256>, pybind11::nodelete>
>::is_valid_class_option<sc_gem5::Gem5ToTlmBridgeBase>’
ext/pybind11/include/pybind11/detail/../detail/common.h:719:35: required
by substitution of ‘template<class ... Ts> using
pybind11::detail::all_of = pybind11::detail::bool_constant<(Ts::value &&
...)> [with Ts = {pybind11::class_<sc_gem5::Gem5ToTlmBridge<256>,
sc_gem5::Gem5ToTlmBridgeBase,
std::unique_ptr<sc_gem5::Gem5ToTlmBridge<256>, pybind11::nodelete>
>::is_valid_class_option<sc_gem5::Gem5ToTlmBridgeBase>,
pybind11::class_<sc_gem5::Gem5ToTlmBridge<256>,
sc_gem5::Gem5ToTlmBridgeBase,
std::unique_ptr<sc_gem5::Gem5ToTlmBridge<256>, pybind11::nodelete>
>::is_valid_class_option<std::unique_ptr<sc_gem5::Gem5ToTlmBridge<256>,
pybind11::nodelete> >}]’
ext/pybind11/include/pybind11/pybind11.h:1506:70: required from ‘class
pybind11::class_<sc_gem5::Gem5ToTlmBridge<256>,
sc_gem5::Gem5ToTlmBridgeBase,
std::unique_ptr<sc_gem5::Gem5ToTlmBridge<256>, pybind11::nodelete> >’
build/ALL/python/_m5/param_Gem5ToTlmBridge256.cc:34:179: required from
here
src/systemc/ext/tlm_utils/../core/sc_port.hh:125:18: error: ‘void
sc_core::sc_port_b<IF>::bind(sc_core::sc_port_b<IF>&) [with IF =
tlm::tlm_fw_transport_if<>]’ was hidden [-Werror=overloaded-virtual=]
125 | virtual void bind(sc_port_b<IF> &p) { sc_port_base::bind(p); }
| ^~~~
In file included from
src/systemc/ext/tlm_utils/simple_initiator_socket.h:27:
src/systemc/ext/tlm_utils/../tlm_core/2/sockets/initiator_socket.hh:133:18:
note: by ‘tlm::tlm_base_initiator_socket<256,
tlm::tlm_fw_transport_if<>, tlm::tlm_bw_transport_if<>, 1,
sc_core::SC_ONE_OR_MORE_BOUND>::bind’
133 | virtual void bind(bw_interface_type &ifs) {
(get_base_export())(ifs); }
| ^~~~
src/systemc/ext/tlm_utils/../core/sc_port.hh:124:18: error: ‘void
sc_core::sc_port_b<IF>::bind(IF&) [with IF =
tlm::tlm_fw_transport_if<>]’ was hidden [-Werror=overloaded-virtual=]
124 | virtual void bind(IF &i) { sc_port_base::bind(i); }
| ^~~~
src/systemc/ext/tlm_utils/../tlm_core/2/sockets/initiator_socket.hh:133:18:
note: by ‘tlm::tlm_base_initiator_socket<256,
tlm::tlm_fw_transport_if<>, tlm::tlm_bw_transport_if<>, 1,
sc_core::SC_ONE_OR_MORE_BOUND>::bind’
133 | virtual void bind(bw_interface_type &ifs) {
(get_base_export())(ifs); }
| ^~~~
From the code comment, it's intended in SystemC header.
// The overloaded virtual is intended in SystemC, so we'll disable the
warning. // Please check section 9.3 of SystemC 2.3.1 release note for
more details.
The issue is we should move the skip to the base class.
This commit is contained in:
1
src/mem/cache/cache_blk.hh
vendored
1
src/mem/cache/cache_blk.hh
vendored
@@ -515,6 +515,7 @@ class TempCacheBlk final : public CacheBlk
|
||||
data = new uint8_t[size];
|
||||
}
|
||||
TempCacheBlk(const TempCacheBlk&) = delete;
|
||||
using CacheBlk::operator=;
|
||||
TempCacheBlk& operator=(const TempCacheBlk&) = delete;
|
||||
~TempCacheBlk() { delete [] data; };
|
||||
|
||||
|
||||
1
src/mem/cache/tags/fa_lru.hh
vendored
1
src/mem/cache/tags/fa_lru.hh
vendored
@@ -85,6 +85,7 @@ class FALRUBlk : public CacheBlk
|
||||
{
|
||||
public:
|
||||
FALRUBlk() : CacheBlk(), prev(nullptr), next(nullptr), inCachesMask(0) {}
|
||||
using CacheBlk::operator=;
|
||||
|
||||
/** The previous block in LRU order. */
|
||||
FALRUBlk *prev;
|
||||
|
||||
1
src/mem/cache/tags/sector_blk.hh
vendored
1
src/mem/cache/tags/sector_blk.hh
vendored
@@ -64,6 +64,7 @@ class SectorSubBlk : public CacheBlk
|
||||
public:
|
||||
SectorSubBlk() : CacheBlk(), _sectorBlk(nullptr), _sectorOffset(0) {}
|
||||
SectorSubBlk(const SectorSubBlk&) = delete;
|
||||
using CacheBlk::operator=;
|
||||
SectorSubBlk& operator=(const SectorSubBlk&) = delete;
|
||||
SectorSubBlk(SectorSubBlk&&) = delete;
|
||||
/**
|
||||
|
||||
@@ -114,6 +114,10 @@ class sc_port_base : public sc_object
|
||||
virtual sc_port_policy _portPolicy() const = 0;
|
||||
};
|
||||
|
||||
// The overloaded virtual is intended in SystemC, so we'll disable the warning.
|
||||
// Please check section 9.3 of SystemC 2.3.1 release note for more details.
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
|
||||
template <class IF>
|
||||
class sc_port_b : public sc_port_base
|
||||
{
|
||||
@@ -244,6 +248,7 @@ class sc_port_b : public sc_port_base
|
||||
sc_port_b(const sc_port_b<IF> &) {}
|
||||
sc_port_b<IF> &operator = (const sc_port_b<IF> &) { return *this; }
|
||||
};
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
template <class IF, int N=1, sc_port_policy P=SC_ONE_OR_MORE_BOUND>
|
||||
class sc_port : public sc_port_b<IF>
|
||||
|
||||
@@ -51,10 +51,6 @@ template <unsigned int BUSWIDTH, typename FW_IF, typename BW_IF, int N,
|
||||
sc_core::sc_port_policy POL>
|
||||
class tlm_base_target_socket;
|
||||
|
||||
// The overloaded virtual is intended in SystemC, so we'll disable the warning.
|
||||
// Please check section 9.3 of SystemC 2.3.1 release note for more details.
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Woverloaded-virtual"
|
||||
template <unsigned int BUSWIDTH=32, typename FW_IF=tlm_fw_transport_if<>,
|
||||
typename BW_IF=tlm_bw_transport_if<>, int N=1,
|
||||
sc_core::sc_port_policy POL=sc_core::SC_ONE_OR_MORE_BOUND>
|
||||
@@ -174,7 +170,6 @@ class tlm_base_initiator_socket :
|
||||
protected:
|
||||
export_type m_export;
|
||||
};
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
//
|
||||
// Convenience socket classes
|
||||
|
||||
Reference in New Issue
Block a user