From bdc455937736a0f17c111a3308b2f8d82baae1d2 Mon Sep 17 00:00:00 2001 From: Christopher Kohlhoff Date: Tue, 22 Mar 2011 09:53:46 +1100 Subject: [PATCH] Fix shadow variable warnings with g++ 4.6. --- asio/include/asio/detail/dev_poll_reactor.hpp | 2 +- asio/include/asio/detail/epoll_reactor.hpp | 2 +- asio/include/asio/detail/impl/dev_poll_reactor.ipp | 4 ++-- asio/include/asio/detail/impl/epoll_reactor.ipp | 4 ++-- asio/include/asio/detail/impl/kqueue_reactor.ipp | 4 ++-- asio/include/asio/detail/impl/resolver_service_base.ipp | 4 ++-- asio/include/asio/detail/impl/select_reactor.ipp | 4 ++-- asio/include/asio/detail/impl/service_registry.ipp | 8 ++++---- asio/include/asio/detail/impl/signal_set_service.ipp | 7 ++++--- asio/include/asio/detail/kqueue_reactor.hpp | 2 +- asio/include/asio/detail/resolver_service_base.hpp | 3 ++- asio/include/asio/detail/select_reactor.hpp | 2 +- asio/include/asio/detail/service_registry.hpp | 2 +- asio/include/asio/detail/signal_set_service.hpp | 3 ++- 14 files changed, 27 insertions(+), 24 deletions(-) diff --git a/asio/include/asio/detail/dev_poll_reactor.hpp b/asio/include/asio/detail/dev_poll_reactor.hpp index d232de2c..cdeb9235 100644 --- a/asio/include/asio/detail/dev_poll_reactor.hpp +++ b/asio/include/asio/detail/dev_poll_reactor.hpp @@ -65,7 +65,7 @@ public: // Recreate internal descriptors following a fork. ASIO_DECL void fork_service( - asio::io_service::fork_event event); + asio::io_service::fork_event fork_ev); // Initialise the task. ASIO_DECL void init_task(); diff --git a/asio/include/asio/detail/epoll_reactor.hpp b/asio/include/asio/detail/epoll_reactor.hpp index f0431832..418d3e74 100644 --- a/asio/include/asio/detail/epoll_reactor.hpp +++ b/asio/include/asio/detail/epoll_reactor.hpp @@ -72,7 +72,7 @@ public: // Recreate internal descriptors following a fork. ASIO_DECL void fork_service( - asio::io_service::fork_event event); + asio::io_service::fork_event fork_ev); // Initialise the task. ASIO_DECL void init_task(); diff --git a/asio/include/asio/detail/impl/dev_poll_reactor.ipp b/asio/include/asio/detail/impl/dev_poll_reactor.ipp index 6041241f..06d89ea7 100644 --- a/asio/include/asio/detail/impl/dev_poll_reactor.ipp +++ b/asio/include/asio/detail/impl/dev_poll_reactor.ipp @@ -86,9 +86,9 @@ private: short events_; }; -void dev_poll_reactor::fork_service(asio::io_service::fork_event event) +void dev_poll_reactor::fork_service(asio::io_service::fork_event fork_ev) { - if (event == asio::io_service::fork_child) + if (fork_ev == asio::io_service::fork_child) { detail::mutex::scoped_lock lock(mutex_); diff --git a/asio/include/asio/detail/impl/epoll_reactor.ipp b/asio/include/asio/detail/impl/epoll_reactor.ipp index f4b4261e..22f567a8 100644 --- a/asio/include/asio/detail/impl/epoll_reactor.ipp +++ b/asio/include/asio/detail/impl/epoll_reactor.ipp @@ -86,9 +86,9 @@ void epoll_reactor::shutdown_service() timer_queues_.get_all_timers(ops); } -void epoll_reactor::fork_service(asio::io_service::fork_event event) +void epoll_reactor::fork_service(asio::io_service::fork_event fork_ev) { - if (event == asio::io_service::fork_child) + if (fork_ev == asio::io_service::fork_child) { if (epoll_fd_ != -1) ::close(epoll_fd_); diff --git a/asio/include/asio/detail/impl/kqueue_reactor.ipp b/asio/include/asio/detail/impl/kqueue_reactor.ipp index e57f6caf..f0cdf73d 100644 --- a/asio/include/asio/detail/impl/kqueue_reactor.ipp +++ b/asio/include/asio/detail/impl/kqueue_reactor.ipp @@ -76,9 +76,9 @@ void kqueue_reactor::shutdown_service() timer_queues_.get_all_timers(ops); } -void kqueue_reactor::fork_service(asio::io_service::fork_event event) +void kqueue_reactor::fork_service(asio::io_service::fork_event fork_ev) { - if (event == asio::io_service::fork_child) + if (fork_ev == asio::io_service::fork_child) { // The kqueue descriptor is automatically closed in the child. kqueue_fd_ = -1; diff --git a/asio/include/asio/detail/impl/resolver_service_base.ipp b/asio/include/asio/detail/impl/resolver_service_base.ipp index e05f260e..20873c05 100644 --- a/asio/include/asio/detail/impl/resolver_service_base.ipp +++ b/asio/include/asio/detail/impl/resolver_service_base.ipp @@ -65,11 +65,11 @@ void resolver_service_base::shutdown_service() } void resolver_service_base::fork_service( - asio::io_service::fork_event event) + asio::io_service::fork_event fork_ev) { if (work_thread_.get()) { - if (event == asio::io_service::fork_prepare) + if (fork_ev == asio::io_service::fork_prepare) { work_io_service_->stop(); work_thread_->join(); diff --git a/asio/include/asio/detail/impl/select_reactor.ipp b/asio/include/asio/detail/impl/select_reactor.ipp index e06770c7..f4e03141 100644 --- a/asio/include/asio/detail/impl/select_reactor.ipp +++ b/asio/include/asio/detail/impl/select_reactor.ipp @@ -83,9 +83,9 @@ void select_reactor::shutdown_service() timer_queues_.get_all_timers(ops); } -void select_reactor::fork_service(asio::io_service::fork_event event) +void select_reactor::fork_service(asio::io_service::fork_event fork_ev) { - if (event == asio::io_service::fork_child) + if (fork_ev == asio::io_service::fork_child) interrupter_.recreate(); } diff --git a/asio/include/asio/detail/impl/service_registry.ipp b/asio/include/asio/detail/impl/service_registry.ipp index 1d667f1d..d68b97e3 100644 --- a/asio/include/asio/detail/impl/service_registry.ipp +++ b/asio/include/asio/detail/impl/service_registry.ipp @@ -52,7 +52,7 @@ service_registry::~service_registry() } } -void service_registry::notify_fork(asio::io_service::fork_event event) +void service_registry::notify_fork(asio::io_service::fork_event fork_ev) { // Make a copy of all of the services while holding the lock. We don't want // to hold the lock while calling into each service, as it may try to call @@ -73,12 +73,12 @@ void service_registry::notify_fork(asio::io_service::fork_event event) // services in the vector. For the other events we want to go in the other // direction. std::size_t num_services = services.size(); - if (event == asio::io_service::fork_prepare) + if (fork_ev == asio::io_service::fork_prepare) for (std::size_t i = 0; i < num_services; ++i) - services[i]->fork_service(event); + services[i]->fork_service(fork_ev); else for (std::size_t i = num_services; i > 0; --i) - services[i - 1]->fork_service(event); + services[i - 1]->fork_service(fork_ev); } void service_registry::init_key(asio::io_service::service::key& key, diff --git a/asio/include/asio/detail/impl/signal_set_service.ipp b/asio/include/asio/detail/impl/signal_set_service.ipp index a4d623c5..b378030e 100644 --- a/asio/include/asio/detail/impl/signal_set_service.ipp +++ b/asio/include/asio/detail/impl/signal_set_service.ipp @@ -145,13 +145,14 @@ void signal_set_service::shutdown_service() } } -void signal_set_service::fork_service(asio::io_service::fork_event event) +void signal_set_service::fork_service( + asio::io_service::fork_event fork_ev) { #if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) signal_state* state = get_signal_state(); static_mutex::scoped_lock lock(state->mutex_); - switch (event) + switch (fork_ev) { case asio::io_service::fork_prepare: reactor_.deregister_internal_descriptor( @@ -178,7 +179,7 @@ void signal_set_service::fork_service(asio::io_service::fork_event event) break; } #else // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) - (void)event; + (void)fork_ev; #endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) } diff --git a/asio/include/asio/detail/kqueue_reactor.hpp b/asio/include/asio/detail/kqueue_reactor.hpp index 16b9b2ee..472a5823 100644 --- a/asio/include/asio/detail/kqueue_reactor.hpp +++ b/asio/include/asio/detail/kqueue_reactor.hpp @@ -83,7 +83,7 @@ public: // Recreate internal descriptors following a fork. ASIO_DECL void fork_service( - asio::io_service::fork_event event); + asio::io_service::fork_event fork_ev); // Initialise the task. ASIO_DECL void init_task(); diff --git a/asio/include/asio/detail/resolver_service_base.hpp b/asio/include/asio/detail/resolver_service_base.hpp index ab4d2f52..0f591166 100644 --- a/asio/include/asio/detail/resolver_service_base.hpp +++ b/asio/include/asio/detail/resolver_service_base.hpp @@ -48,7 +48,8 @@ public: ASIO_DECL void shutdown_service(); // Perform any fork-related housekeeping. - ASIO_DECL void fork_service(asio::io_service::fork_event event); + ASIO_DECL void fork_service( + asio::io_service::fork_event fork_ev); // Construct a new resolver implementation. ASIO_DECL void construct(implementation_type& impl); diff --git a/asio/include/asio/detail/select_reactor.hpp b/asio/include/asio/detail/select_reactor.hpp index 414c14f3..a4fcd62e 100644 --- a/asio/include/asio/detail/select_reactor.hpp +++ b/asio/include/asio/detail/select_reactor.hpp @@ -74,7 +74,7 @@ public: // Recreate internal descriptors following a fork. ASIO_DECL void fork_service( - asio::io_service::fork_event event); + asio::io_service::fork_event fork_ev); // 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/service_registry.hpp b/asio/include/asio/detail/service_registry.hpp index 0a0c1a00..c215fb6f 100644 --- a/asio/include/asio/detail/service_registry.hpp +++ b/asio/include/asio/detail/service_registry.hpp @@ -58,7 +58,7 @@ public: ASIO_DECL ~service_registry(); // Notify all services of a fork event. - ASIO_DECL void notify_fork(asio::io_service::fork_event event); + ASIO_DECL void notify_fork(asio::io_service::fork_event fork_ev); // Get the service object corresponding to the specified service type. Will // create a new service object automatically if no such object already diff --git a/asio/include/asio/detail/signal_set_service.hpp b/asio/include/asio/detail/signal_set_service.hpp index 7fc477e6..77356ea5 100644 --- a/asio/include/asio/detail/signal_set_service.hpp +++ b/asio/include/asio/detail/signal_set_service.hpp @@ -116,7 +116,8 @@ public: ASIO_DECL void shutdown_service(); // Perform fork-related housekeeping. - ASIO_DECL void fork_service(asio::io_service::fork_event event); + ASIO_DECL void fork_service( + asio::io_service::fork_event fork_ev); // Construct a new signal_set implementation. ASIO_DECL void construct(implementation_type& impl);