Added BOOST_OVERRIDE according to -Wsuggest-override

This commit is contained in:
Ion Gaztañaga
2021-12-27 01:01:10 +01:00
parent f8988cb155
commit 40735223d5
7 changed files with 21 additions and 21 deletions

View File

@ -160,18 +160,18 @@ class BOOST_CONTAINER_DECL monotonic_buffer_resource
//! then allocate the return block from the newly-allocated internal `current_buffer`. //! then allocate the return block from the newly-allocated internal `current_buffer`.
//! //!
//! <b>Throws</b>: Nothing unless `upstream_resource()->allocate()` throws. //! <b>Throws</b>: Nothing unless `upstream_resource()->allocate()` throws.
void* do_allocate(std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE; virtual void* do_allocate(std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE;
//! <b>Effects</b>: None //! <b>Effects</b>: None
//! //!
//! <b>Throws</b>: Nothing //! <b>Throws</b>: Nothing
//! //!
//! <b>Remarks</b>: Memory used by this resource increases monotonically until its destruction. //! <b>Remarks</b>: Memory used by this resource increases monotonically until its destruction.
void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) BOOST_NOEXCEPT BOOST_OVERRIDE; virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) BOOST_NOEXCEPT BOOST_OVERRIDE;
//! <b>Returns</b>: //! <b>Returns</b>:
//! `this == dynamic_cast<const monotonic_buffer_resource*>(&other)`. //! `this == dynamic_cast<const monotonic_buffer_resource*>(&other)`.
bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT BOOST_OVERRIDE; virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT BOOST_OVERRIDE;
}; };
} //namespace pmr { } //namespace pmr {

View File

@ -144,7 +144,7 @@ class resource_adaptor_imp
protected: protected:
//! <b>Returns</b>: Allocated memory obtained by calling m_alloc.allocate. The size and alignment //! <b>Returns</b>: Allocated memory obtained by calling m_alloc.allocate. The size and alignment
//! of the allocated memory shall meet the requirements for a class derived from memory_resource. //! of the allocated memory shall meet the requirements for a class derived from memory_resource.
virtual void* do_allocate(std::size_t bytes, std::size_t alignment) virtual void* do_allocate(std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE
{ {
if (alignment <= priv_guaranteed_allocator_alignment()) if (alignment <= priv_guaranteed_allocator_alignment())
return this->ebo_alloc_t::get().allocate(bytes); return this->ebo_alloc_t::get().allocate(bytes);
@ -156,7 +156,7 @@ class resource_adaptor_imp
//! subsequently deallocated. //! subsequently deallocated.
//! //!
//! <b>Effects</b>: Returns memory to the allocator using m_alloc.deallocate(). //! <b>Effects</b>: Returns memory to the allocator using m_alloc.deallocate().
virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE
{ {
if (alignment <= priv_guaranteed_allocator_alignment()) if (alignment <= priv_guaranteed_allocator_alignment())
this->ebo_alloc_t::get().deallocate((char*)p, bytes); this->ebo_alloc_t::get().deallocate((char*)p, bytes);
@ -167,7 +167,7 @@ class resource_adaptor_imp
//! Let p be dynamic_cast<const resource_adaptor_imp*>(&other). //! Let p be dynamic_cast<const resource_adaptor_imp*>(&other).
//! //!
//! <b>Returns</b>: false if p is null, otherwise the value of m_alloc == p->m_alloc. //! <b>Returns</b>: false if p is null, otherwise the value of m_alloc == p->m_alloc.
virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT BOOST_OVERRIDE
{ {
const resource_adaptor_imp* p = dynamic_cast<const resource_adaptor_imp*>(&other); const resource_adaptor_imp* p = dynamic_cast<const resource_adaptor_imp*>(&other);
return p && p->ebo_alloc_t::get() == this->ebo_alloc_t::get(); return p && p->ebo_alloc_t::get() == this->ebo_alloc_t::get();

View File

@ -103,13 +103,13 @@ class BOOST_CONTAINER_DECL synchronized_pool_resource
protected: protected:
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::do_allocate() //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::do_allocate()
void* do_allocate(std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE; virtual void* do_allocate(std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE;
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::do_deallocate(void*,std::size_t,std::size_t) //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::do_deallocate(void*,std::size_t,std::size_t)
void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE; virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE;
//! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::do_is_equal(const memory_resource&)const //! @copydoc ::boost::container::pmr::unsynchronized_pool_resource::do_is_equal(const memory_resource&)const
bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT BOOST_OVERRIDE; virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT BOOST_OVERRIDE;
//Non-standard observers //Non-standard observers
public: public:

View File

@ -134,18 +134,18 @@ class BOOST_CONTAINER_DECL unsynchronized_pool_resource
//! using `upstream_resource()->allocate()`. //! using `upstream_resource()->allocate()`.
//! //!
//! <b>Throws</b>: Nothing unless `upstream_resource()->allocate()` throws. //! <b>Throws</b>: Nothing unless `upstream_resource()->allocate()` throws.
void* do_allocate(std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE; virtual void* do_allocate(std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE;
//! <b>Effects</b>: Return the memory at p to the pool. It is unspecified if or under //! <b>Effects</b>: Return the memory at p to the pool. It is unspecified if or under
//! what circumstances this operation will result in a call to //! what circumstances this operation will result in a call to
//! `upstream_resource()->deallocate()`. //! `upstream_resource()->deallocate()`.
//! //!
//! <b>Throws</b>: Nothing. //! <b>Throws</b>: Nothing.
void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE; virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE;
//! <b>Returns</b>: //! <b>Returns</b>:
//! `this == dynamic_cast<const unsynchronized_pool_resource*>(&other)`. //! `this == dynamic_cast<const unsynchronized_pool_resource*>(&other)`.
bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT BOOST_OVERRIDE; virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT BOOST_OVERRIDE;
//Non-standard observers //Non-standard observers
public: public:

View File

@ -59,7 +59,7 @@ class BOOST_SYMBOL_VISIBLE exception
: std_exception_t(), m_msg(msg) : std_exception_t(), m_msg(msg)
{} {}
virtual const char *what() const BOOST_NOEXCEPT_OR_NOTHROW virtual const char *what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE
{ return m_msg ? m_msg : "unknown boost::container exception"; } { return m_msg ? m_msg : "unknown boost::container exception"; }
private: private:

View File

@ -21,10 +21,10 @@ class derived_from_memory_resource
: id(i) : id(i)
{} {}
virtual ~derived_from_memory_resource() virtual ~derived_from_memory_resource() BOOST_OVERRIDE
{ destructor_called = true; } { destructor_called = true; }
virtual void* do_allocate(std::size_t bytes, std::size_t alignment) virtual void* do_allocate(std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE
{ {
do_allocate_called = true; do_allocate_called = true;
do_allocate_bytes = bytes; do_allocate_bytes = bytes;
@ -32,7 +32,7 @@ class derived_from_memory_resource
return do_allocate_return; return do_allocate_return;
} }
virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE
{ {
do_deallocate_called = true; do_deallocate_called = true;
do_deallocate_p = p; do_deallocate_p = p;
@ -40,7 +40,7 @@ class derived_from_memory_resource
do_deallocate_alignment = alignment; do_deallocate_alignment = alignment;
} }
virtual bool do_is_equal(const boost::container::pmr::memory_resource& other) const BOOST_NOEXCEPT virtual bool do_is_equal(const boost::container::pmr::memory_resource& other) const BOOST_NOEXCEPT BOOST_OVERRIDE
{ {
do_is_equal_called = true; do_is_equal_called = true;
do_is_equal_other = &other; do_is_equal_other = &other;

View File

@ -35,10 +35,10 @@ class memory_resource_logger
, m_mismatches() , m_mismatches()
{} {}
virtual ~memory_resource_logger() virtual ~memory_resource_logger() BOOST_OVERRIDE
{ this->reset(); } { this->reset(); }
virtual void* do_allocate(std::size_t bytes, std::size_t alignment) virtual void* do_allocate(std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE
{ {
char *addr =(char*)std::malloc(bytes); char *addr =(char*)std::malloc(bytes);
if(!addr){ if(!addr){
@ -52,7 +52,7 @@ class memory_resource_logger
return addr; return addr;
} }
virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) BOOST_OVERRIDE
{ {
std::size_t i = 0, max = m_info.size(); std::size_t i = 0, max = m_info.size();
while(i != max && m_info[i].address != p){ while(i != max && m_info[i].address != p){
@ -69,7 +69,7 @@ class memory_resource_logger
} }
} }
virtual bool do_is_equal(const boost::container::pmr::memory_resource& other) const BOOST_NOEXCEPT virtual bool do_is_equal(const boost::container::pmr::memory_resource& other) const BOOST_NOEXCEPT BOOST_OVERRIDE
{ {
return static_cast<const memory_resource *>(this) == &other; return static_cast<const memory_resource *>(this) == &other;
} }