From 4019d171a31e501d71dfbd61fc682fb449cbdf50 Mon Sep 17 00:00:00 2001 From: Eugene Zelenko Date: Sun, 3 May 2020 20:29:19 -0700 Subject: [PATCH] Use BOOST_OVERRIDE to fix GCC -Wsuggest-override and Clang-tidy modernize-use-override warnings. --- .../boost/log/attributes/attribute_value.hpp | 2 +- .../log/attributes/attribute_value_impl.hpp | 4 +-- .../log/detail/attachable_sstream_buf.hpp | 6 ++-- .../log/detail/date_time_format_parser.hpp | 6 ++-- include/boost/log/exceptions.hpp | 30 +++++++++---------- include/boost/log/sinks/async_frontend.hpp | 8 ++--- .../boost/log/sinks/basic_sink_frontend.hpp | 2 +- include/boost/log/sinks/sync_frontend.hpp | 6 ++-- .../boost/log/sources/severity_feature.hpp | 4 +-- src/default_sink.hpp | 8 ++--- src/named_scope.cpp | 8 ++--- src/setup/default_filter_factory.hpp | 14 ++++----- src/setup/default_formatter_factory.hpp | 2 +- src/setup/init_from_settings.cpp | 6 ++-- src/syslog_backend.cpp | 4 +-- src/text_file_backend.cpp | 8 ++--- src/threadsafe_queue.cpp | 10 +++---- src/timer.cpp | 2 +- 18 files changed, 65 insertions(+), 65 deletions(-) diff --git a/include/boost/log/attributes/attribute_value.hpp b/include/boost/log/attributes/attribute_value.hpp index 197ef86..a309af6 100644 --- a/include/boost/log/attributes/attribute_value.hpp +++ b/include/boost/log/attributes/attribute_value.hpp @@ -98,7 +98,7 @@ public: /*! * \return The attribute value that refers to self implementation. */ - virtual attribute_value get_value() { return attribute_value(this); } + attribute_value get_value() BOOST_OVERRIDE { return attribute_value(this); } /*! * \return The attribute value type diff --git a/include/boost/log/attributes/attribute_value_impl.hpp b/include/boost/log/attributes/attribute_value_impl.hpp index e18015b..468d127 100644 --- a/include/boost/log/attributes/attribute_value_impl.hpp +++ b/include/boost/log/attributes/attribute_value_impl.hpp @@ -73,7 +73,7 @@ public: * * \return \c true if the value has been dispatched, \c false otherwise */ - virtual bool dispatch(type_dispatcher& dispatcher) + bool dispatch(type_dispatcher& dispatcher) BOOST_OVERRIDE { type_dispatcher::callback< value_type > callback = dispatcher.get_callback< value_type >(); if (callback) @@ -88,7 +88,7 @@ public: /*! * \return The attribute value type */ - typeindex::type_index get_type() const { return typeindex::type_id< value_type >(); } + typeindex::type_index get_type() const BOOST_OVERRIDE { return typeindex::type_id< value_type >(); } /*! * \return Reference to the contained value. diff --git a/include/boost/log/detail/attachable_sstream_buf.hpp b/include/boost/log/detail/attachable_sstream_buf.hpp index e196689..1077589 100644 --- a/include/boost/log/detail/attachable_sstream_buf.hpp +++ b/include/boost/log/detail/attachable_sstream_buf.hpp @@ -244,7 +244,7 @@ public: protected: //! Puts all buffered data to the string - int sync() + int sync() BOOST_OVERRIDE { char_type* pBase = this->pbase(); char_type* pPtr = this->pptr(); @@ -256,7 +256,7 @@ protected: return 0; } //! Puts an unbuffered character to the string - int_type overflow(int_type c) + int_type overflow(int_type c) BOOST_OVERRIDE { this_type::sync(); if (!traits_type::eq_int_type(c, traits_type::eof())) @@ -268,7 +268,7 @@ protected: return traits_type::not_eof(c); } //! Puts a character sequence to the string - std::streamsize xsputn(const char_type* s, std::streamsize n) + std::streamsize xsputn(const char_type* s, std::streamsize n) BOOST_OVERRIDE { this_type::sync(); return static_cast< std::streamsize >(this->append(s, static_cast< size_type >(n))); diff --git a/include/boost/log/detail/date_time_format_parser.hpp b/include/boost/log/detail/date_time_format_parser.hpp index 3219690..8d66d35 100644 --- a/include/boost/log/detail/date_time_format_parser.hpp +++ b/include/boost/log/detail/date_time_format_parser.hpp @@ -343,21 +343,21 @@ struct date_time_format_parser_callback : typedef CharT char_type; //! Destructor - virtual ~date_time_format_parser_callback() {} + ~date_time_format_parser_callback() BOOST_OVERRIDE {} /*! * \brief The function is called when the parser discovers a string literal in the format string * * \param lit The string of characters not interpreted as a placeholder */ - virtual void on_literal(iterator_range< const char_type* > const& lit) = 0; + void on_literal(iterator_range< const char_type* > const& lit) BOOST_OVERRIDE = 0; /*! * \brief The method is called when an unknown placeholder is found in the format string * * \param ph The placeholder with the leading percent sign */ - virtual void on_placeholder(iterator_range< const char_type* > const& ph) + void on_placeholder(iterator_range< const char_type* > const& ph) BOOST_OVERRIDE { // By default interpret all unrecognized placeholders as literals on_literal(ph); diff --git a/include/boost/log/exceptions.hpp b/include/boost/log/exceptions.hpp index 32d55d4..f129ea8 100644 --- a/include/boost/log/exceptions.hpp +++ b/include/boost/log/exceptions.hpp @@ -83,12 +83,12 @@ public: /*! * Destructor */ - ~bad_alloc() throw(); + ~bad_alloc() throw() BOOST_OVERRIDE; /*! * Error message accessor. */ - const char* what() const throw(); + const char* what() const throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, const char* descr); @@ -114,7 +114,7 @@ public: /*! * Destructor */ - ~capacity_limit_reached() throw(); + ~capacity_limit_reached() throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, const char* descr); @@ -140,7 +140,7 @@ public: /*! * Destructor */ - ~runtime_error() throw(); + ~runtime_error() throw() BOOST_OVERRIDE; }; /*! @@ -161,7 +161,7 @@ public: /*! * Destructor */ - ~missing_value() throw(); + ~missing_value() throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line); @@ -190,7 +190,7 @@ public: /*! * Destructor */ - ~invalid_type() throw(); + ~invalid_type() throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line); @@ -223,7 +223,7 @@ public: /*! * Destructor */ - ~invalid_value() throw(); + ~invalid_value() throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line); @@ -250,7 +250,7 @@ public: /*! * Destructor */ - ~parse_error() throw(); + ~parse_error() throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line); @@ -281,7 +281,7 @@ public: /*! * Destructor */ - ~conversion_error() throw(); + ~conversion_error() throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line); @@ -304,7 +304,7 @@ public: /*! * Destructor */ - ~system_error() throw(); + ~system_error() throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, const char* descr, int system_error_code); @@ -331,7 +331,7 @@ public: /*! * Destructor */ - ~logic_error() throw(); + ~logic_error() throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line, const char* descr); @@ -357,7 +357,7 @@ public: /*! * Destructor */ - ~odr_violation() throw(); + ~odr_violation() throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line); @@ -384,7 +384,7 @@ public: /*! * Destructor */ - ~unexpected_call() throw(); + ~unexpected_call() throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line); @@ -411,7 +411,7 @@ public: /*! * Destructor */ - ~setup_error() throw(); + ~setup_error() throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line); @@ -438,7 +438,7 @@ public: /*! * Destructor */ - ~limitation_error() throw(); + ~limitation_error() throw() BOOST_OVERRIDE; #ifndef BOOST_LOG_DOXYGEN_PASS static BOOST_LOG_NORETURN void throw_(const char* file, std::size_t line); diff --git a/include/boost/log/sinks/async_frontend.hpp b/include/boost/log/sinks/async_frontend.hpp index d7bfd30..97c2ec3 100644 --- a/include/boost/log/sinks/async_frontend.hpp +++ b/include/boost/log/sinks/async_frontend.hpp @@ -304,7 +304,7 @@ public: /*! * Destructor. Implicitly stops the dedicated feeding thread, if one is running. */ - ~asynchronous_sink() BOOST_NOEXCEPT + ~asynchronous_sink() BOOST_NOEXCEPT BOOST_OVERRIDE { try { @@ -328,7 +328,7 @@ public: /*! * Enqueues the log record to the backend */ - void consume(record_view const& rec) + void consume(record_view const& rec) BOOST_OVERRIDE { if (BOOST_UNLIKELY(m_FlushRequested.load(boost::memory_order_acquire))) { @@ -343,7 +343,7 @@ public: /*! * The method attempts to pass logging record to the backend */ - bool try_consume(record_view const& rec) + bool try_consume(record_view const& rec) BOOST_OVERRIDE { if (!m_FlushRequested.load(boost::memory_order_acquire)) { @@ -439,7 +439,7 @@ public: * Unlike \c feed_records, in case of ordering queueing the method also feeds records * that were enqueued during the ordering window, attempting to empty the queue completely. */ - void flush() + void flush() BOOST_OVERRIDE { unique_lock< frontend_mutex_type > lock(base_type::frontend_mutex()); if (m_FeedingThreadID != thread::id() || m_DedicatedFeedingThread.joinable()) diff --git a/include/boost/log/sinks/basic_sink_frontend.hpp b/include/boost/log/sinks/basic_sink_frontend.hpp index 3686bc5..e30c6a2 100644 --- a/include/boost/log/sinks/basic_sink_frontend.hpp +++ b/include/boost/log/sinks/basic_sink_frontend.hpp @@ -122,7 +122,7 @@ public: * * \param attrs A set of attribute values of a logging record */ - bool will_consume(attribute_value_set const& attrs) + bool will_consume(attribute_value_set const& attrs) BOOST_OVERRIDE { BOOST_LOG_EXPR_IF_MT(boost::log::aux::shared_lock_guard< mutex_type > lock(m_Mutex);) try diff --git a/include/boost/log/sinks/sync_frontend.hpp b/include/boost/log/sinks/sync_frontend.hpp index 6a927d0..ccf5c90 100644 --- a/include/boost/log/sinks/sync_frontend.hpp +++ b/include/boost/log/sinks/sync_frontend.hpp @@ -148,7 +148,7 @@ public: /*! * Passes the log record to the backend */ - void consume(record_view const& rec) + void consume(record_view const& rec) BOOST_OVERRIDE { base_type::feed_record(rec, m_BackendMutex, *m_pBackend); } @@ -156,7 +156,7 @@ public: /*! * The method attempts to pass logging record to the backend */ - bool try_consume(record_view const& rec) + bool try_consume(record_view const& rec) BOOST_OVERRIDE { return base_type::try_feed_record(rec, m_BackendMutex, *m_pBackend); } @@ -166,7 +166,7 @@ public: * may take considerable time to complete and may block both the calling thread and threads * attempting to put new records into the sink while this call is in progress. */ - void flush() + void flush() BOOST_OVERRIDE { base_type::flush_backend(m_BackendMutex, *m_pBackend); } diff --git a/include/boost/log/sources/severity_feature.hpp b/include/boost/log/sources/severity_feature.hpp index 101769b..83a9991 100644 --- a/include/boost/log/sources/severity_feature.hpp +++ b/include/boost/log/sources/severity_feature.hpp @@ -67,7 +67,7 @@ namespace aux { { public: //! The method dispatches the value to the given object - bool dispatch(type_dispatcher& dispatcher) + bool dispatch(type_dispatcher& dispatcher) BOOST_OVERRIDE { type_dispatcher::callback< value_type > callback = dispatcher.get_callback< value_type >(); if (callback) @@ -80,7 +80,7 @@ namespace aux { } //! The method is called when the attribute value is passed to another thread - intrusive_ptr< attribute_value::impl > detach_from_thread() + intrusive_ptr< attribute_value::impl > detach_from_thread() BOOST_OVERRIDE { #if !defined(BOOST_LOG_NO_THREADS) return new attributes::attribute_value_impl< value_type >( diff --git a/src/default_sink.hpp b/src/default_sink.hpp index bdcd3f4..ed2c033 100644 --- a/src/default_sink.hpp +++ b/src/default_sink.hpp @@ -56,10 +56,10 @@ private: public: default_sink(); - ~default_sink(); - bool will_consume(attribute_value_set const&); - void consume(record_view const& rec); - void flush(); + ~default_sink() BOOST_OVERRIDE; + bool will_consume(attribute_value_set const&) BOOST_OVERRIDE; + void consume(record_view const& rec) BOOST_OVERRIDE; + void flush() BOOST_OVERRIDE; }; } // namespace aux diff --git a/src/named_scope.cpp b/src/named_scope.cpp index fff80a1..176e91f 100644 --- a/src/named_scope.cpp +++ b/src/named_scope.cpp @@ -92,7 +92,7 @@ BOOST_LOG_ANONYMOUS_NAMESPACE { //! The method dispatches the value to the given object. It returns true if the //! object was capable to consume the real attribute value type and false otherwise. - bool dispatch(type_dispatcher& dispatcher) + bool dispatch(type_dispatcher& dispatcher) BOOST_OVERRIDE { type_dispatcher::callback< scope_stack > callback = dispatcher.get_callback< scope_stack >(); @@ -108,11 +108,11 @@ BOOST_LOG_ANONYMOUS_NAMESPACE { /*! * \return The attribute value type */ - typeindex::type_index get_type() const { return typeindex::type_id< scope_stack >(); } + typeindex::type_index get_type() const BOOST_OVERRIDE { return typeindex::type_id< scope_stack >(); } //! The method is called when the attribute value is passed to another thread (e.g. //! in case of asynchronous logging). The value should ensure it properly owns all thread-specific data. - intrusive_ptr< attribute_value::impl > detach_from_thread() + intrusive_ptr< attribute_value::impl > detach_from_thread() BOOST_OVERRIDE { if (!m_DetachedValue) { @@ -186,7 +186,7 @@ struct BOOST_SYMBOL_VISIBLE named_scope::impl : } //! The method returns the actual attribute value. It must not return NULL. - attribute_value get_value() + attribute_value get_value() BOOST_OVERRIDE { return attribute_value(new named_scope_value(&get_scope_list())); } diff --git a/src/setup/default_filter_factory.hpp b/src/setup/default_filter_factory.hpp index 455eb42..e5d55a6 100644 --- a/src/setup/default_filter_factory.hpp +++ b/src/setup/default_filter_factory.hpp @@ -70,20 +70,20 @@ public: typedef typename base_type::string_type string_type; //! The callback for equality relation filter - virtual filter on_equality_relation(attribute_name const& name, string_type const& arg); + filter on_equality_relation(attribute_name const& name, string_type const& arg) BOOST_OVERRIDE; //! The callback for inequality relation filter - virtual filter on_inequality_relation(attribute_name const& name, string_type const& arg); + filter on_inequality_relation(attribute_name const& name, string_type const& arg) BOOST_OVERRIDE; //! The callback for less relation filter - virtual filter on_less_relation(attribute_name const& name, string_type const& arg); + filter on_less_relation(attribute_name const& name, string_type const& arg) BOOST_OVERRIDE; //! The callback for greater relation filter - virtual filter on_greater_relation(attribute_name const& name, string_type const& arg); + filter on_greater_relation(attribute_name const& name, string_type const& arg) BOOST_OVERRIDE; //! The callback for less or equal relation filter - virtual filter on_less_or_equal_relation(attribute_name const& name, string_type const& arg); + filter on_less_or_equal_relation(attribute_name const& name, string_type const& arg) BOOST_OVERRIDE; //! The callback for greater or equal relation filter - virtual filter on_greater_or_equal_relation(attribute_name const& name, string_type const& arg); + filter on_greater_or_equal_relation(attribute_name const& name, string_type const& arg) BOOST_OVERRIDE; //! The callback for custom relation filter - virtual filter on_custom_relation(attribute_name const& name, string_type const& rel, string_type const& arg); + filter on_custom_relation(attribute_name const& name, string_type const& rel, string_type const& arg) BOOST_OVERRIDE; private: //! The function parses the argument value for a binary relation and constructs the corresponding filter diff --git a/src/setup/default_formatter_factory.hpp b/src/setup/default_formatter_factory.hpp index 6359b3b..8428137 100644 --- a/src/setup/default_formatter_factory.hpp +++ b/src/setup/default_formatter_factory.hpp @@ -45,7 +45,7 @@ public: typedef typename base_type::args_map args_map; //! The function creates a formatter for the specified attribute. - virtual formatter_type create_formatter(attribute_name const& name, args_map const& args); + formatter_type create_formatter(attribute_name const& name, args_map const& args) BOOST_OVERRIDE; }; } // namespace aux diff --git a/src/setup/init_from_settings.cpp b/src/setup/init_from_settings.cpp index 7b5b628..91c46ab 100644 --- a/src/setup/init_from_settings.cpp +++ b/src/setup/init_from_settings.cpp @@ -434,7 +434,7 @@ private: public: //! The function constructs a sink that writes log records to the console - shared_ptr< sinks::sink > create_sink(settings_section const& params) + shared_ptr< sinks::sink > create_sink(settings_section const& params) BOOST_OVERRIDE { return base_type::select_backend_character_type(params, impl()); } @@ -454,7 +454,7 @@ public: public: //! The function constructs a sink that writes log records to a text file - shared_ptr< sinks::sink > create_sink(settings_section const& params) + shared_ptr< sinks::sink > create_sink(settings_section const& params) BOOST_OVERRIDE { typedef sinks::text_file_backend backend_t; shared_ptr< backend_t > backend = boost::make_shared< backend_t >(); @@ -579,7 +579,7 @@ public: public: //! The function constructs a sink that writes log records to syslog - shared_ptr< sinks::sink > create_sink(settings_section const& params) + shared_ptr< sinks::sink > create_sink(settings_section const& params) BOOST_OVERRIDE { // Construct the backend typedef sinks::syslog_backend backend_t; diff --git a/src/syslog_backend.cpp b/src/syslog_backend.cpp index d4b5085..9ce19f4 100644 --- a/src/syslog_backend.cpp +++ b/src/syslog_backend.cpp @@ -194,7 +194,7 @@ struct syslog_backend::implementation::native : } //! The method sends the formatted message to the syslog host - void send(syslog::level lev, string_type const& formatted_message) + void send(syslog::level lev, string_type const& formatted_message) BOOST_OVERRIDE { int native_level; switch (lev) @@ -447,7 +447,7 @@ struct syslog_backend::implementation::udp_socket_based : } //! The method sends the formatted message to the syslog host - void send(syslog::level lev, string_type const& formatted_message) + void send(syslog::level lev, string_type const& formatted_message) BOOST_OVERRIDE { if (!m_pSocket.get()) { diff --git a/src/text_file_backend.cpp b/src/text_file_backend.cpp index f71f832..1fbf0c2 100644 --- a/src/text_file_backend.cpp +++ b/src/text_file_backend.cpp @@ -659,14 +659,14 @@ BOOST_LOG_ANONYMOUS_NAMESPACE { uintmax_t max_files); //! Destructor - ~file_collector(); + ~file_collector() BOOST_OVERRIDE; //! The function stores the specified file in the storage - void store_file(filesystem::path const& file_name); + void store_file(filesystem::path const& file_name) BOOST_OVERRIDE; //! Scans the target directory for the files that have already been stored uintmax_t scan_for_files( - file::scan_method method, filesystem::path const& pattern, unsigned int* counter); + file::scan_method method, filesystem::path const& pattern, unsigned int* counter) BOOST_OVERRIDE; //! The function updates storage restrictions void update(uintmax_t max_size, uintmax_t min_free_space, uintmax_t max_files); @@ -1345,7 +1345,7 @@ BOOST_LOG_API void text_file_backend::consume(record_view const& rec, string_typ { // The file stream is not operational. One possible reason is that there is no more free space // on the file system. In this case it is possible that this log record will fail to be written as well, - // leaving the newly creted file empty. Eventually this results in lots of empty log files. + // leaving the newly created file empty. Eventually this results in lots of empty log files. // We should take precautions to avoid this. https://svn.boost.org/trac/boost/ticket/11016 prev_file_name = m_pImpl->m_FileName; close_file(); diff --git a/src/threadsafe_queue.cpp b/src/threadsafe_queue.cpp index bbad463..1a16561 100644 --- a/src/threadsafe_queue.cpp +++ b/src/threadsafe_queue.cpp @@ -76,11 +76,11 @@ public: m_Head.node = m_Tail.node = first_node; } - ~threadsafe_queue_impl_generic() + ~threadsafe_queue_impl_generic() BOOST_OVERRIDE { } - node_base* reset_last_node() + node_base* reset_last_node() BOOST_OVERRIDE { BOOST_ASSERT(m_Head.node == m_Tail.node); node_base* p = m_Head.node; @@ -88,12 +88,12 @@ public: return p; } - bool unsafe_empty() + bool unsafe_empty() BOOST_OVERRIDE { return m_Head.node == m_Tail.node; } - void push(node_base* p) + void push(node_base* p) BOOST_OVERRIDE { set_next(p, NULL); exclusive_lock_guard< mutex_type > _(m_Tail.mutex); @@ -101,7 +101,7 @@ public: m_Tail.node = p; } - bool try_pop(node_base*& node_to_free, node_base*& node_with_value) + bool try_pop(node_base*& node_to_free, node_base*& node_with_value) BOOST_OVERRIDE { exclusive_lock_guard< mutex_type > _(m_Head.mutex); node_base* next = get_next(m_Head.node); diff --git a/src/timer.cpp b/src/timer.cpp index f9b4cdf..db55ea7 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -131,7 +131,7 @@ public: */ impl() : m_BaseTimePoint(utc_time_traits::get_clock()) {} - attribute_value get_value() + attribute_value get_value() BOOST_OVERRIDE { return attribute_value(new attribute_value_impl< value_type >( utc_time_traits::get_clock() - m_BaseTimePoint));