Skip to content

Commit

Permalink
Fixes #160 ("More GCC suggest-override warnings").
Browse files Browse the repository at this point in the history
  • Loading branch information
igaztanaga committed Dec 26, 2021
1 parent 9789c8d commit 55ad499
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 48 deletions.
1 change: 1 addition & 0 deletions doc/interprocess.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -6808,6 +6808,7 @@ thank them:
[section:release_notes_boost_1_79_00 Boost 1.79 Release]

* Fixed bugs:
* [@https://github.com/boostorg/interprocess/issues/160 GitHub #160 (['"More GCC suggest-override warnings"])].
* [@https://github.com/boostorg/interprocess/pull/162 GitHub #162 (['"Fix missing sys/stat.h include on musl-based systems"])].

[endsect]
Expand Down
4 changes: 2 additions & 2 deletions include/boost/interprocess/detail/in_place_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ struct placement_destroy : public in_place_interface
: in_place_interface(::boost::container::dtl::alignment_of<T>::value, sizeof(T), typeid(T).name())
{}

virtual void destroy_n(void *mem, std::size_t num, std::size_t &destroyed)
virtual void destroy_n(void *mem, std::size_t num, std::size_t &destroyed) BOOST_OVERRIDE
{
T* memory = static_cast<T*>(mem);
for(destroyed = 0; destroyed < num; ++destroyed)
(memory++)->~T();
}

virtual void construct_n(void *, std::size_t, std::size_t &) {}
virtual void construct_n(void *, std::size_t, std::size_t &) BOOST_OVERRIDE {}

private:
void destroy(void *mem)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ class basic_managed_multi_shared_memory
group_services(frontend_t *const frontend)
: mp_frontend(frontend), m_group(0), m_min_segment_size(0){}

virtual std::pair<void *, size_type> create_new_segment(size_type alloc_size)
virtual std::pair<void *, size_type> create_new_segment(size_type alloc_size) BOOST_OVERRIDE
{ (void)alloc_size;
/*
//We should allocate an extra byte so that the
Expand All @@ -144,10 +144,10 @@ class basic_managed_multi_shared_memory
return result_type(static_cast<void *>(0), 0);
}

virtual bool update_segments ()
virtual bool update_segments BOOST_OVERRIDE ()
{ return true; }

virtual ~group_services(){}
virtual ~group_services() BOOST_OVERRIDE{}

void set_group(segment_group_id group)
{ m_group = group; }
Expand Down
6 changes: 3 additions & 3 deletions include/boost/interprocess/detail/named_proxy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct CtorArgN : public placement_destroy<T>

virtual void construct_n(void *mem
, std::size_t num
, std::size_t &constructed)
, std::size_t &constructed) BOOST_OVERRIDE
{
T* memory = static_cast<T*>(mem);
for(constructed = 0; constructed < num; ++constructed){
Expand Down Expand Up @@ -200,7 +200,7 @@ struct CtorArg##N : placement_destroy<T>\
CtorArg##N ( BOOST_MOVE_UREF##N )\
BOOST_MOVE_COLON##N BOOST_MOVE_FWD_INIT##N{}\
\
virtual void construct_n(void *mem, std::size_t num, std::size_t &constructed)\
virtual void construct_n(void *mem, std::size_t num, std::size_t &constructed) BOOST_OVERRIDE\
{\
T* memory = static_cast<T*>(mem);\
for(constructed = 0; constructed < num; ++constructed){\
Expand Down Expand Up @@ -230,7 +230,7 @@ struct CtorIt##N : public placement_destroy<T>\
CtorIt##N ( BOOST_MOVE_VAL##N )\
BOOST_MOVE_COLON##N BOOST_MOVE_VAL_INIT##N{}\
\
virtual void construct_n(void *mem, std::size_t num, std::size_t &constructed)\
virtual void construct_n(void *mem, std::size_t num, std::size_t &constructed) BOOST_OVERRIDE\
{\
T* memory = static_cast<T*>(mem);\
for(constructed = 0; constructed < num; ++constructed){\
Expand Down
2 changes: 1 addition & 1 deletion include/boost/interprocess/detail/os_thread_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ class launch_thread_impl
: f_( f )
{}

void run()
virtual void run() BOOST_OVERRIDE
{ f_(); }

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class bad_weak_ptr
{
public:

virtual char const * what() const BOOST_NOEXCEPT_OR_NOTHROW
virtual char const * what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE
{ return "boost::interprocess::bad_weak_ptr"; }
};

Expand Down
12 changes: 6 additions & 6 deletions include/boost/interprocess/streams/bufferstream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class basic_bufferbuf
: basic_streambuf_t(), m_mode(mode), m_buffer(buf), m_length(length)
{ this->set_pointers(); }

virtual ~basic_bufferbuf(){}
virtual ~basic_bufferbuf() BOOST_OVERRIDE {}

public:
//!Returns the pointer and size of the internal buffer.
Expand All @@ -115,14 +115,14 @@ class basic_bufferbuf
}

protected:
virtual int_type underflow()
virtual int_type underflow() BOOST_OVERRIDE
{
// Precondition: gptr() >= egptr(). Returns a character, if available.
return this->gptr() != this->egptr() ?
CharTraits::to_int_type(*this->gptr()) : CharTraits::eof();
}

virtual int_type pbackfail(int_type c = CharTraits::eof())
virtual int_type pbackfail(int_type c = CharTraits::eof()) BOOST_OVERRIDE
{
if(this->gptr() != this->eback()) {
if(!CharTraits::eq_int_type(c, CharTraits::eof())) {
Expand All @@ -147,7 +147,7 @@ class basic_bufferbuf
return CharTraits::eof();
}

virtual int_type overflow(int_type c = CharTraits::eof())
virtual int_type overflow(int_type c = CharTraits::eof()) BOOST_OVERRIDE
{
if(m_mode & std::ios_base::out) {
if(!CharTraits::eq_int_type(c, CharTraits::eof())) {
Expand Down Expand Up @@ -181,7 +181,7 @@ class basic_bufferbuf

virtual pos_type seekoff(off_type off, std::ios_base::seekdir dir,
std::ios_base::openmode mode
= std::ios_base::in | std::ios_base::out)
= std::ios_base::in | std::ios_base::out) BOOST_OVERRIDE
{
bool in = false;
bool out = false;
Expand Down Expand Up @@ -246,7 +246,7 @@ class basic_bufferbuf
}

virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode
= std::ios_base::in | std::ios_base::out)
= std::ios_base::in | std::ios_base::out) BOOST_OVERRIDE
{ return seekoff(pos - pos_type(off_type(0)), std::ios_base::beg, mode); }

private:
Expand Down
10 changes: 5 additions & 5 deletions include/boost/interprocess/streams/vectorstream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class basic_vectorbuf
}

protected:
virtual int_type underflow()
virtual int_type underflow() BOOST_OVERRIDE
{
if (base_t::gptr() == 0)
return CharTraits::eof();
Expand All @@ -229,7 +229,7 @@ class basic_vectorbuf
return CharTraits::eof();
}

virtual int_type pbackfail(int_type c = CharTraits::eof())
virtual int_type pbackfail(int_type c = CharTraits::eof()) BOOST_OVERRIDE
{
if(this->gptr() != this->eback()) {
if(!CharTraits::eq_int_type(c, CharTraits::eof())) {
Expand All @@ -254,7 +254,7 @@ class basic_vectorbuf
return CharTraits::eof();
}

virtual int_type overflow(int_type c = CharTraits::eof())
virtual int_type overflow(int_type c = CharTraits::eof()) BOOST_OVERRIDE
{
if(m_mode & std::ios_base::out) {
if(!CharTraits::eq_int_type(c, CharTraits::eof())) {
Expand Down Expand Up @@ -289,7 +289,7 @@ class basic_vectorbuf

virtual pos_type seekoff(off_type off, std::ios_base::seekdir dir,
std::ios_base::openmode mode
= std::ios_base::in | std::ios_base::out)
= std::ios_base::in | std::ios_base::out) BOOST_OVERRIDE
{
//Get seek mode
bool in(0 != (mode & std::ios_base::in)), out(0 != (mode & std::ios_base::out));
Expand Down Expand Up @@ -357,7 +357,7 @@ class basic_vectorbuf
}

virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode
= std::ios_base::in | std::ios_base::out)
= std::ios_base::in | std::ios_base::out) BOOST_OVERRIDE
{ return seekoff(pos - pos_type(off_type(0)), std::ios_base::beg, mode); }

private:
Expand Down
16 changes: 8 additions & 8 deletions include/boost/interprocess/sync/windows/named_condition_any.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,33 +231,33 @@ class winapi_named_condition_any
: m_condition_data(cond_data)
{}

virtual std::size_t get_data_size() const
virtual std::size_t get_data_size() const BOOST_OVERRIDE
{ return sizeof(sem_counts); }

virtual const void *buffer_with_final_data_to_file()
virtual const void *buffer_with_final_data_to_file() BOOST_OVERRIDE
{
sem_counts[0] = m_condition_data.m_sem_block_queue.value();
sem_counts[1] = m_condition_data.m_sem_block_lock.value();
return &sem_counts;
}

virtual const void *buffer_with_init_data_to_file()
virtual const void *buffer_with_init_data_to_file() BOOST_OVERRIDE
{
sem_counts[0] = 0;
sem_counts[1] = 1;
return &sem_counts;
}

virtual void *buffer_to_store_init_data_from_file()
virtual void *buffer_to_store_init_data_from_file() BOOST_OVERRIDE
{ return &sem_counts; }

virtual bool open(create_enum_t op, const char *id_name)
virtual bool open(create_enum_t op, const char *id_name) BOOST_OVERRIDE
{ return this->open_impl(op, id_name); }

virtual bool open(create_enum_t op, const wchar_t *id_name)
virtual bool open(create_enum_t op, const wchar_t *id_name) BOOST_OVERRIDE
{ return this->open_impl(op, id_name); }

virtual void close()
virtual void close() BOOST_OVERRIDE
{
m_condition_data.m_sem_block_queue.close();
m_condition_data.m_sem_block_lock.close();
Expand All @@ -267,7 +267,7 @@ class winapi_named_condition_any
m_condition_data.m_nwaiters_to_unblock = 0;
}

virtual ~named_cond_callbacks()
virtual ~named_cond_callbacks() BOOST_OVERRIDE
{}

private:
Expand Down
16 changes: 8 additions & 8 deletions include/boost/interprocess/sync/windows/named_mutex.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,19 @@ class winapi_named_mutex
: m_mtx_wrapper(mtx_wrapper)
{}

virtual std::size_t get_data_size() const
virtual std::size_t get_data_size() const BOOST_OVERRIDE
{ return 0u; }

virtual const void *buffer_with_init_data_to_file()
virtual const void *buffer_with_init_data_to_file() BOOST_OVERRIDE
{ return 0; }

virtual const void *buffer_with_final_data_to_file()
virtual const void *buffer_with_final_data_to_file() BOOST_OVERRIDE
{ return 0; }

virtual void *buffer_to_store_init_data_from_file()
virtual void *buffer_to_store_init_data_from_file() BOOST_OVERRIDE
{ return 0; }

virtual bool open(create_enum_t, const char *id_name)
virtual bool open(create_enum_t, const char *id_name) BOOST_OVERRIDE
{
std::string aux_str = "Global\\bipc.mut.";
aux_str += id_name;
Expand All @@ -112,7 +112,7 @@ class winapi_named_mutex
return m_mtx_wrapper.open_or_create(aux_str.c_str(), mut_perm);
}

virtual bool open(create_enum_t, const wchar_t *id_name)
virtual bool open(create_enum_t, const wchar_t *id_name) BOOST_OVERRIDE
{
std::wstring aux_str = L"Global\\bipc.mut.";
aux_str += id_name;
Expand All @@ -122,12 +122,12 @@ class winapi_named_mutex
return m_mtx_wrapper.open_or_create(aux_str.c_str(), mut_perm);
}

virtual void close()
virtual void close() BOOST_OVERRIDE
{
m_mtx_wrapper.close();
}

virtual ~named_mut_callbacks()
virtual ~named_mut_callbacks() BOOST_OVERRIDE
{}

private:
Expand Down
16 changes: 8 additions & 8 deletions include/boost/interprocess/sync/windows/named_semaphore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,19 @@ class winapi_named_semaphore
: m_sem_wrapper(sem_wrapper), m_sem_count(sem_cnt)
{}

virtual std::size_t get_data_size() const
virtual std::size_t get_data_size() const BOOST_OVERRIDE
{ return sizeof(sem_count_t); }

virtual const void *buffer_with_final_data_to_file()
virtual const void *buffer_with_final_data_to_file() BOOST_OVERRIDE
{ return &m_sem_count; }

virtual const void *buffer_with_init_data_to_file()
virtual const void *buffer_with_init_data_to_file() BOOST_OVERRIDE
{ return &m_sem_count; }

virtual void *buffer_to_store_init_data_from_file()
virtual void *buffer_to_store_init_data_from_file() BOOST_OVERRIDE
{ return &m_sem_count; }

virtual bool open(create_enum_t, const char *id_name)
virtual bool open(create_enum_t, const char *id_name) BOOST_OVERRIDE
{
std::string aux_str = "Global\\bipc.sem.";
aux_str += id_name;
Expand All @@ -106,7 +106,7 @@ class winapi_named_semaphore
, winapi_semaphore_wrapper::MaxCount, sem_perm, created);
}

virtual bool open(create_enum_t, const wchar_t *id_name)
virtual bool open(create_enum_t, const wchar_t *id_name) BOOST_OVERRIDE
{
std::wstring aux_str = L"Global\\bipc.sem.";
aux_str += id_name;
Expand All @@ -119,12 +119,12 @@ class winapi_named_semaphore
, winapi_semaphore_wrapper::MaxCount, sem_perm, created);
}

virtual void close()
virtual void close() BOOST_OVERRIDE
{
m_sem_wrapper.close();
}

virtual ~named_sem_callbacks()
virtual ~named_sem_callbacks() BOOST_OVERRIDE
{}

private:
Expand Down
6 changes: 3 additions & 3 deletions test/shared_ptr_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class derived_class
: public base_class
{
public:
virtual ~derived_class()
virtual ~derived_class() BOOST_OVERRIDE
{}
};

Expand Down Expand Up @@ -286,9 +286,9 @@ struct X
struct Y: public X
{
Y(){ ++cnt; }
virtual ~Y(){ --cnt; }
virtual ~Y() BOOST_OVERRIDE{ --cnt; }

virtual int id() const
virtual int id() const BOOST_OVERRIDE
{ return 2; }

private:
Expand Down

0 comments on commit 55ad499

Please sign in to comment.