From 2f54773a6eab8ff5e4e447f9dd717b7e17db96cf Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 23 Apr 2024 03:43:12 +1000 Subject: [PATCH] Added C++11 override qualifiers to overridden virtual member functions. --- asio/include/asio/basic_streambuf.hpp | 4 ++-- asio/include/asio/cancellation_signal.hpp | 4 ++-- .../asio/detail/deadline_timer_service.hpp | 2 +- asio/include/asio/detail/epoll_reactor.hpp | 8 +++---- asio/include/asio/detail/null_reactor.hpp | 6 ++--- .../asio/detail/posix_serial_port_service.hpp | 2 +- asio/include/asio/detail/posix_thread.hpp | 2 +- .../detail/reactive_descriptor_service.hpp | 2 +- .../asio/detail/reactive_socket_service.hpp | 2 +- asio/include/asio/detail/resolver_service.hpp | 4 ++-- asio/include/asio/detail/scheduler.hpp | 2 +- asio/include/asio/detail/select_reactor.hpp | 4 ++-- .../asio/detail/signal_set_service.hpp | 4 ++-- .../asio/detail/strand_executor_service.hpp | 2 +- asio/include/asio/detail/strand_service.hpp | 2 +- asio/include/asio/detail/timer_queue.hpp | 10 ++++---- .../asio/detail/win_iocp_file_service.hpp | 2 +- .../asio/detail/win_iocp_handle_service.hpp | 2 +- .../asio/detail/win_iocp_io_context.hpp | 2 +- .../detail/win_iocp_serial_port_service.hpp | 2 +- .../asio/detail/win_iocp_socket_service.hpp | 2 +- .../asio/detail/win_object_handle_service.hpp | 2 +- asio/include/asio/execution/bad_executor.hpp | 2 +- asio/include/asio/executor.hpp | 2 +- asio/include/asio/impl/error.ipp | 12 +++++----- asio/include/asio/impl/error_code.ipp | 4 ++-- asio/include/asio/impl/executor.hpp | 24 +++++++++---------- asio/include/asio/io_context.hpp | 4 ++-- asio/include/asio/ip/bad_address_cast.hpp | 2 +- asio/include/asio/multiple_exceptions.hpp | 2 +- 30 files changed, 62 insertions(+), 62 deletions(-) diff --git a/asio/include/asio/basic_streambuf.hpp b/asio/include/asio/basic_streambuf.hpp index 0450811dca..17cc4a38e3 100644 --- a/asio/include/asio/basic_streambuf.hpp +++ b/asio/include/asio/basic_streambuf.hpp @@ -260,7 +260,7 @@ class basic_streambuf /** * Behaves according to the specification of @c std::streambuf::underflow(). */ - int_type underflow() + int_type underflow() override { if (gptr() < pptr()) { @@ -280,7 +280,7 @@ class basic_streambuf * the character to the input sequence would require the condition * size() > max_size() to be true. */ - int_type overflow(int_type c) + int_type overflow(int_type c) override { if (!traits_type::eq_int_type(c, traits_type::eof())) { diff --git a/asio/include/asio/cancellation_signal.hpp b/asio/include/asio/cancellation_signal.hpp index 43540ac3b0..d15cfae70c 100644 --- a/asio/include/asio/cancellation_signal.hpp +++ b/asio/include/asio/cancellation_signal.hpp @@ -50,12 +50,12 @@ class cancellation_handler { } - void call(cancellation_type_t type) + void call(cancellation_type_t type) override { handler_(type); } - std::pair destroy() noexcept + std::pair destroy() noexcept override { std::pair mem(this, size_); this->cancellation_handler::~cancellation_handler(); diff --git a/asio/include/asio/detail/deadline_timer_service.hpp b/asio/include/asio/detail/deadline_timer_service.hpp index bd99a6e910..b552bcef9d 100644 --- a/asio/include/asio/detail/deadline_timer_service.hpp +++ b/asio/include/asio/detail/deadline_timer_service.hpp @@ -81,7 +81,7 @@ class deadline_timer_service } // Destroy all user-defined handler objects owned by the service. - void shutdown() + void shutdown() override { } diff --git a/asio/include/asio/detail/epoll_reactor.hpp b/asio/include/asio/detail/epoll_reactor.hpp index 212767a760..0fb6e91797 100644 --- a/asio/include/asio/detail/epoll_reactor.hpp +++ b/asio/include/asio/detail/epoll_reactor.hpp @@ -90,11 +90,11 @@ class epoll_reactor ASIO_DECL ~epoll_reactor(); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Recreate internal descriptors following a fork. ASIO_DECL void notify_fork( - asio::execution_context::fork_event fork_ev); + asio::execution_context::fork_event fork_ev) override; // Initialise the task. ASIO_DECL void init_task(); @@ -206,10 +206,10 @@ class epoll_reactor typename timer_queue::per_timer_data& source); // Run epoll once until interrupted or events are ready to be dispatched. - ASIO_DECL void run(long usec, op_queue& ops); + ASIO_DECL void run(long usec, op_queue& ops) override; // Interrupt the select loop. - ASIO_DECL void interrupt(); + ASIO_DECL void interrupt() override; private: // The hint to pass to epoll_create to size its data structures. diff --git a/asio/include/asio/detail/null_reactor.hpp b/asio/include/asio/detail/null_reactor.hpp index 128f2b4532..147dc85cb7 100644 --- a/asio/include/asio/detail/null_reactor.hpp +++ b/asio/include/asio/detail/null_reactor.hpp @@ -56,17 +56,17 @@ class null_reactor } // Destroy all user-defined handler objects owned by the service. - void shutdown() + void shutdown() override { } // No-op because should never be called. - void run(long /*usec*/, op_queue& /*ops*/) + void run(long /*usec*/, op_queue& /*ops*/) override { } // No-op. - void interrupt() + void interrupt() override { } }; diff --git a/asio/include/asio/detail/posix_serial_port_service.hpp b/asio/include/asio/detail/posix_serial_port_service.hpp index 7930954984..9fa02bdbe9 100644 --- a/asio/include/asio/detail/posix_serial_port_service.hpp +++ b/asio/include/asio/detail/posix_serial_port_service.hpp @@ -58,7 +58,7 @@ class posix_serial_port_service : ASIO_DECL posix_serial_port_service(execution_context& context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Construct a new serial port implementation. void construct(implementation_type& impl) diff --git a/asio/include/asio/detail/posix_thread.hpp b/asio/include/asio/detail/posix_thread.hpp index 9085a0b4a7..dcee575c75 100644 --- a/asio/include/asio/detail/posix_thread.hpp +++ b/asio/include/asio/detail/posix_thread.hpp @@ -80,7 +80,7 @@ class posix_thread { } - virtual void run() + virtual void run() override { f_(); } diff --git a/asio/include/asio/detail/reactive_descriptor_service.hpp b/asio/include/asio/detail/reactive_descriptor_service.hpp index f7c7e86916..a9f7841281 100644 --- a/asio/include/asio/detail/reactive_descriptor_service.hpp +++ b/asio/include/asio/detail/reactive_descriptor_service.hpp @@ -82,7 +82,7 @@ class reactive_descriptor_service : ASIO_DECL reactive_descriptor_service(execution_context& context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Construct a new descriptor implementation. ASIO_DECL void construct(implementation_type& impl); diff --git a/asio/include/asio/detail/reactive_socket_service.hpp b/asio/include/asio/detail/reactive_socket_service.hpp index c828e7f1f2..76f4f355fb 100644 --- a/asio/include/asio/detail/reactive_socket_service.hpp +++ b/asio/include/asio/detail/reactive_socket_service.hpp @@ -82,7 +82,7 @@ class reactive_socket_service : } // Destroy all user-defined handler objects owned by the service. - void shutdown() + void shutdown() override { this->base_shutdown(); } diff --git a/asio/include/asio/detail/resolver_service.hpp b/asio/include/asio/detail/resolver_service.hpp index 2d1fe22b62..25a2f94205 100644 --- a/asio/include/asio/detail/resolver_service.hpp +++ b/asio/include/asio/detail/resolver_service.hpp @@ -59,13 +59,13 @@ class resolver_service : } // Destroy all user-defined handler objects owned by the service. - void shutdown() + void shutdown() override { this->base_shutdown(); } // Perform any fork-related housekeeping. - void notify_fork(execution_context::fork_event fork_ev) + void notify_fork(execution_context::fork_event fork_ev) override { this->base_notify_fork(fork_ev); } diff --git a/asio/include/asio/detail/scheduler.hpp b/asio/include/asio/detail/scheduler.hpp index a73ec141eb..394040aba9 100644 --- a/asio/include/asio/detail/scheduler.hpp +++ b/asio/include/asio/detail/scheduler.hpp @@ -56,7 +56,7 @@ class scheduler ASIO_DECL ~scheduler(); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Initialise the task, if required. ASIO_DECL void init_task(); diff --git a/asio/include/asio/detail/select_reactor.hpp b/asio/include/asio/detail/select_reactor.hpp index 7fe647b7e6..a45d85d203 100644 --- a/asio/include/asio/detail/select_reactor.hpp +++ b/asio/include/asio/detail/select_reactor.hpp @@ -74,11 +74,11 @@ class select_reactor ASIO_DECL ~select_reactor(); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Recreate internal descriptors following a fork. ASIO_DECL void notify_fork( - asio::execution_context::fork_event fork_ev); + asio::execution_context::fork_event fork_ev) override; // Initialise the task, but only if the reactor is not in its own thread. ASIO_DECL void init_task(); diff --git a/asio/include/asio/detail/signal_set_service.hpp b/asio/include/asio/detail/signal_set_service.hpp index 142ff43851..57df262f5c 100644 --- a/asio/include/asio/detail/signal_set_service.hpp +++ b/asio/include/asio/detail/signal_set_service.hpp @@ -128,11 +128,11 @@ class signal_set_service : ASIO_DECL ~signal_set_service(); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Perform fork-related housekeeping. ASIO_DECL void notify_fork( - asio::execution_context::fork_event fork_ev); + asio::execution_context::fork_event fork_ev) override; // Construct a new signal_set implementation. ASIO_DECL void construct(implementation_type& impl); diff --git a/asio/include/asio/detail/strand_executor_service.hpp b/asio/include/asio/detail/strand_executor_service.hpp index 45536ed536..71cd0c0686 100644 --- a/asio/include/asio/detail/strand_executor_service.hpp +++ b/asio/include/asio/detail/strand_executor_service.hpp @@ -82,7 +82,7 @@ class strand_executor_service ASIO_DECL explicit strand_executor_service(execution_context& context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Create a new strand_executor implementation. ASIO_DECL implementation_type create_implementation(); diff --git a/asio/include/asio/detail/strand_service.hpp b/asio/include/asio/detail/strand_service.hpp index 084eb0b306..1ff514ba3e 100644 --- a/asio/include/asio/detail/strand_service.hpp +++ b/asio/include/asio/detail/strand_service.hpp @@ -78,7 +78,7 @@ class strand_service ASIO_DECL explicit strand_service(asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Construct a new strand implementation. ASIO_DECL void construct(implementation_type& impl); diff --git a/asio/include/asio/detail/timer_queue.hpp b/asio/include/asio/detail/timer_queue.hpp index 843f3614da..b68d781247 100644 --- a/asio/include/asio/detail/timer_queue.hpp +++ b/asio/include/asio/detail/timer_queue.hpp @@ -112,13 +112,13 @@ class timer_queue } // Whether there are no timers in the queue. - virtual bool empty() const + virtual bool empty() const override { return timers_ == 0; } // Get the time for the timer that is earliest in the queue. - virtual long wait_duration_msec(long max_duration) const + virtual long wait_duration_msec(long max_duration) const override { if (heap_.empty()) return max_duration; @@ -130,7 +130,7 @@ class timer_queue } // Get the time for the timer that is earliest in the queue. - virtual long wait_duration_usec(long max_duration) const + virtual long wait_duration_usec(long max_duration) const override { if (heap_.empty()) return max_duration; @@ -142,7 +142,7 @@ class timer_queue } // Dequeue all timers not later than the current time. - virtual void get_ready_timers(op_queue& ops) + virtual void get_ready_timers(op_queue& ops) override { if (!heap_.empty()) { @@ -162,7 +162,7 @@ class timer_queue } // Dequeue all timers. - virtual void get_all_timers(op_queue& ops) + virtual void get_all_timers(op_queue& ops) override { while (timers_) { diff --git a/asio/include/asio/detail/win_iocp_file_service.hpp b/asio/include/asio/detail/win_iocp_file_service.hpp index f10a8d3cdf..898455f636 100644 --- a/asio/include/asio/detail/win_iocp_file_service.hpp +++ b/asio/include/asio/detail/win_iocp_file_service.hpp @@ -54,7 +54,7 @@ class win_iocp_file_service : ASIO_DECL win_iocp_file_service(execution_context& context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Construct a new file implementation. void construct(implementation_type& impl) diff --git a/asio/include/asio/detail/win_iocp_handle_service.hpp b/asio/include/asio/detail/win_iocp_handle_service.hpp index 9e2486b4b7..ea30ffa881 100644 --- a/asio/include/asio/detail/win_iocp_handle_service.hpp +++ b/asio/include/asio/detail/win_iocp_handle_service.hpp @@ -79,7 +79,7 @@ class win_iocp_handle_service : ASIO_DECL win_iocp_handle_service(execution_context& context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Construct a new handle implementation. ASIO_DECL void construct(implementation_type& impl); diff --git a/asio/include/asio/detail/win_iocp_io_context.hpp b/asio/include/asio/detail/win_iocp_io_context.hpp index 1de94df785..bd5156a5d7 100644 --- a/asio/include/asio/detail/win_iocp_io_context.hpp +++ b/asio/include/asio/detail/win_iocp_io_context.hpp @@ -54,7 +54,7 @@ class win_iocp_io_context ASIO_DECL ~win_iocp_io_context(); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Initialise the task. Nothing to do here. void init_task() diff --git a/asio/include/asio/detail/win_iocp_serial_port_service.hpp b/asio/include/asio/detail/win_iocp_serial_port_service.hpp index e0e12e91d5..b18fe184ec 100644 --- a/asio/include/asio/detail/win_iocp_serial_port_service.hpp +++ b/asio/include/asio/detail/win_iocp_serial_port_service.hpp @@ -45,7 +45,7 @@ class win_iocp_serial_port_service : ASIO_DECL win_iocp_serial_port_service(execution_context& context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Construct a new serial port implementation. void construct(implementation_type& impl) diff --git a/asio/include/asio/detail/win_iocp_socket_service.hpp b/asio/include/asio/detail/win_iocp_socket_service.hpp index faeaffa4c3..dc77f08ff7 100644 --- a/asio/include/asio/detail/win_iocp_socket_service.hpp +++ b/asio/include/asio/detail/win_iocp_socket_service.hpp @@ -136,7 +136,7 @@ class win_iocp_socket_service : } // Destroy all user-defined handler objects owned by the service. - void shutdown() + void shutdown() override { this->base_shutdown(); } diff --git a/asio/include/asio/detail/win_object_handle_service.hpp b/asio/include/asio/detail/win_object_handle_service.hpp index 8e01b72f4f..1cf6f47fb8 100644 --- a/asio/include/asio/detail/win_object_handle_service.hpp +++ b/asio/include/asio/detail/win_object_handle_service.hpp @@ -87,7 +87,7 @@ class win_object_handle_service : ASIO_DECL win_object_handle_service(execution_context& context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown(); + ASIO_DECL void shutdown() override; // Construct a new handle implementation. ASIO_DECL void construct(implementation_type& impl); diff --git a/asio/include/asio/execution/bad_executor.hpp b/asio/include/asio/execution/bad_executor.hpp index 791951684f..2f7c1d099f 100644 --- a/asio/include/asio/execution/bad_executor.hpp +++ b/asio/include/asio/execution/bad_executor.hpp @@ -31,7 +31,7 @@ class bad_executor ASIO_DECL bad_executor() noexcept; /// Obtain message associated with exception. - ASIO_DECL virtual const char* what() const noexcept; + ASIO_DECL virtual const char* what() const noexcept override; }; } // namespace execution diff --git a/asio/include/asio/executor.hpp b/asio/include/asio/executor.hpp index c056525460..01adea6cf2 100644 --- a/asio/include/asio/executor.hpp +++ b/asio/include/asio/executor.hpp @@ -41,7 +41,7 @@ class bad_executor /// Obtain message associated with exception. ASIO_DECL virtual const char* what() const - noexcept; + noexcept override; }; /// Polymorphic wrapper for executors. diff --git a/asio/include/asio/impl/error.ipp b/asio/include/asio/impl/error.ipp index b564a8c68e..c302501e95 100644 --- a/asio/include/asio/impl/error.ipp +++ b/asio/include/asio/impl/error.ipp @@ -31,12 +31,12 @@ namespace detail { class netdb_category : public asio::error_category { public: - const char* name() const noexcept + const char* name() const noexcept override { return "asio.netdb"; } - std::string message(int value) const + std::string message(int value) const override { if (value == error::host_not_found) return "Host not found (authoritative)"; @@ -63,12 +63,12 @@ namespace detail { class addrinfo_category : public asio::error_category { public: - const char* name() const noexcept + const char* name() const noexcept override { return "asio.addrinfo"; } - std::string message(int value) const + std::string message(int value) const override { if (value == error::service_not_found) return "Service not found"; @@ -93,12 +93,12 @@ namespace detail { class misc_category : public asio::error_category { public: - const char* name() const noexcept + const char* name() const noexcept override { return "asio.misc"; } - std::string message(int value) const + std::string message(int value) const override { if (value == error::already_open) return "Already open"; diff --git a/asio/include/asio/impl/error_code.ipp b/asio/include/asio/impl/error_code.ipp index caeb1967ca..591390d210 100644 --- a/asio/include/asio/impl/error_code.ipp +++ b/asio/include/asio/impl/error_code.ipp @@ -37,12 +37,12 @@ namespace detail { class system_category : public error_category { public: - const char* name() const noexcept + const char* name() const noexcept override { return "asio.system"; } - std::string message(int value) const + std::string message(int value) const override { #if defined(ASIO_WINDOWS_RUNTIME) || defined(ASIO_WINDOWS_APP) std::wstring wmsg(128, wchar_t()); diff --git a/asio/include/asio/impl/executor.hpp b/asio/include/asio/impl/executor.hpp index 8bf76ccd18..d6c5bf0881 100644 --- a/asio/include/asio/impl/executor.hpp +++ b/asio/include/asio/impl/executor.hpp @@ -183,64 +183,64 @@ class executor::impl { } - impl_base* clone() const noexcept + impl_base* clone() const noexcept override { return const_cast(static_cast(this)); } - void destroy() noexcept + void destroy() noexcept override { } - void on_work_started() noexcept + void on_work_started() noexcept override { executor_.on_work_started(); } - void on_work_finished() noexcept + void on_work_finished() noexcept override { executor_.on_work_finished(); } - execution_context& context() noexcept + execution_context& context() noexcept override { return executor_.context(); } - void dispatch(function&& f) + void dispatch(function&& f) override { executor_.dispatch(static_cast(f), std::allocator()); } - void post(function&& f) + void post(function&& f) override { executor_.post(static_cast(f), std::allocator()); } - void defer(function&& f) + void defer(function&& f) override { executor_.defer(static_cast(f), std::allocator()); } - type_id_result_type target_type() const noexcept + type_id_result_type target_type() const noexcept override { return type_id(); } - void* target() noexcept + void* target() noexcept override { return &executor_; } - const void* target() const noexcept + const void* target() const noexcept override { return &executor_; } - bool equals(const impl_base* e) const noexcept + bool equals(const impl_base* e) const noexcept override { return this == e; } diff --git a/asio/include/asio/io_context.hpp b/asio/include/asio/io_context.hpp index 5de125685f..b1a98368a4 100644 --- a/asio/include/asio/io_context.hpp +++ b/asio/include/asio/io_context.hpp @@ -1157,7 +1157,7 @@ class io_context::service private: /// Destroy all user-defined handler objects owned by the service. - ASIO_DECL virtual void shutdown(); + ASIO_DECL virtual void shutdown() override; #if !defined(ASIO_NO_DEPRECATED) /// (Deprecated: Use shutdown().) Destroy all user-defined handler objects @@ -1172,7 +1172,7 @@ class io_context::service * implement it if necessary. The default implementation does nothing. */ ASIO_DECL virtual void notify_fork( - execution_context::fork_event event); + execution_context::fork_event event) override; #if !defined(ASIO_NO_DEPRECATED) /// (Deprecated: Use notify_fork().) Handle notification of a fork-related diff --git a/asio/include/asio/ip/bad_address_cast.hpp b/asio/include/asio/ip/bad_address_cast.hpp index 3d242f0704..7b68145ccf 100644 --- a/asio/include/asio/ip/bad_address_cast.hpp +++ b/asio/include/asio/ip/bad_address_cast.hpp @@ -49,7 +49,7 @@ class bad_address_cast : virtual ~bad_address_cast() noexcept {} /// Get the message associated with the exception. - virtual const char* what() const noexcept + virtual const char* what() const noexcept override { return "bad address cast"; } diff --git a/asio/include/asio/multiple_exceptions.hpp b/asio/include/asio/multiple_exceptions.hpp index 2fd0455a91..e232b987de 100644 --- a/asio/include/asio/multiple_exceptions.hpp +++ b/asio/include/asio/multiple_exceptions.hpp @@ -32,7 +32,7 @@ class multiple_exceptions /// Obtain message associated with exception. ASIO_DECL virtual const char* what() const - noexcept; + noexcept override; /// Obtain a pointer to the first exception. ASIO_DECL std::exception_ptr first_exception() const;