Opened 13 years ago

Closed 11 years ago

#3905 closed Bugs (fixed)

asio boost headers fail with g++-4.3.2 and -Wshadow -Werror

Reported by: logicle@… Owned by: chris_kohlhoff
Milestone: To Be Determined Component: asio
Version: Boost 1.42.0 Severity: Cosmetic
Keywords: Cc:

Description

All of my asio dependent code builds fine as long as I suppress gcc's warnings. One of the warning flags that causes a problem is -Wshadow. I think using the io_service_pool from the asio documentation's examples is sufficient to reproduce this problem. Just be sure to add -Werror and -Wshadow with a recent g++ and the build should fail in asio headers.

boost-1.42/include/boost/asio/detail/hash_map.hpp:150: error: declaration of 'end' shadows a member of 'this'
boost-1.42/include/boost/asio/detail/service_base.hpp:37: error: declaration of 'io_service' shadows a member of 'this'
boost-1.42/include/boost/asio/detail/reactor_op_queue.hpp:329: error: declaration of 'descriptor' shadows a member of 'this'
boost-1.42/include/boost/asio/detail/epoll_reactor.hpp:655: error: declaration of 'interrupt' shadows a member of 'this'
boost-1.42/include/boost/asio/basic_io_object.hpp:72: error: declaration of 'io_service' shadows a member of 'this'
boost-1.42/include/boost/asio/detail/deadline_timer_service.hpp:151: error: declaration of 'boost::system::error_code ec' shadows a parameter
boost-1.42/include/boost/asio/serial_port_service.hpp:88: error: declaration of 'io_service' shadows a member of 'this'
boost-1.42/include/boost/asio/basic_streambuf.hpp:136: error: declaration of 'max_size' shadows a member of 'this'
boost-1.42/include/boost/asio/detail/buffered_stream_storage.hpp:43: error: declaration of 'capacity' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/address_v6.hpp:68: error: declaration of 'scope_id' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/basic_endpoint.hpp:95: error: declaration of 'protocol' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/basic_endpoint.hpp:190: error: declaration of 'size' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/basic_resolver_entry.hpp:55: error: declaration of 'service_name' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/basic_resolver_entry.hpp:55: error: declaration of 'host_name' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/basic_resolver_entry.hpp:55: error: declaration of 'endpoint' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/basic_resolver_query.hpp:52: error: declaration of 'service_name' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/basic_resolver_query.hpp:71: error: declaration of 'service_name' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/basic_resolver_query.hpp:88: error: declaration of 'service_name' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/basic_resolver_query.hpp:88: error: declaration of 'host_name' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/basic_resolver_query.hpp:107: error: declaration of 'service_name' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/basic_resolver_query.hpp:107: error: declaration of 'host_name' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/icmp.hpp:105: error: declaration of 'family' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/icmp.hpp:105: error: declaration of 'protocol' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/tcp.hpp:149: error: declaration of 'family' shadows a member of 'this'
boost-1.42/include/boost/asio/ip/udp.hpp:105: error: declaration of 'family' shadows a member of 'this'
boost-1.42/include/boost/asio/local/basic_endpoint.hpp:83: error: declaration of 'path' shadows a member of 'this'
boost-1.42/include/boost/asio/local/basic_endpoint.hpp:90: error: declaration of 'path' shadows a member of 'this'
boost-1.42/include/boost/asio/local/basic_endpoint.hpp:136: error: declaration of 'size' shadows a member of 'this'
boost-1.42/include/boost/asio/local/basic_endpoint.hpp:216: error: declaration of 'path' shadows a member of 'this'
boost-1.42/include/boost/asio/posix/stream_descriptor_service.hpp:103: error: declaration of 'io_service' shadows a member of 'this'
boost-1.42/include/boost/asio/impl/read_until.ipp:379: error: declaration of 'boost::system::error_code ec' shadows a parameter
boost-1.42/include/boost/asio/impl/read_until.ipp:711: error: declaration of 'boost::system::error_code ec' shadows a parameter
boost-1.42/include/boost/asio/impl/read_until.ipp:880: error: declaration of 'boost::system::error_code ec' shadows a parameter
boost-1.42/include/boost/asio/detail/strand_service.hpp:289: error: declaration of 'io_service' shadows a member of 'this'

and so on ...

Change History (4)

comment:1 by Justin Randall <logicle@…>, 13 years ago

After grabbing the trunk at 59528 from subversion, I've made local modifications to address the problem. They are all cosmetic, mostly changing names. The new names could probably be better.

Output of svn diff from boost/asio:

Index: basic_socket.hpp
===================================================================
--- basic_socket.hpp    (revision 59528)
+++ basic_socket.hpp    (working copy)
@@ -63,8 +63,8 @@
    * @param io_service The io_service object that the socket will use to
    * dispatch handlers for any asynchronous operations performed on the socket.
    */
-  explicit basic_socket(boost::asio::io_service& io_service)
-    : basic_io_object<SocketService>(io_service)
+  explicit basic_socket(boost::asio::io_service& ioservice)
+    : basic_io_object<SocketService>(ioservice)
   {
   }

@@ -103,9 +103,9 @@
    *
    * @throws boost::system::system_error Thrown on failure.
    */
-  basic_socket(boost::asio::io_service& io_service,
+  basic_socket(boost::asio::io_service& ioservice,
       const endpoint_type& endpoint)
-    : basic_io_object<SocketService>(io_service)
+    : basic_io_object<SocketService>(ioservice)
   {
     boost::system::error_code ec;
     this->service.open(this->implementation, endpoint.protocol(), ec);
Index: basic_io_object.hpp
===================================================================
--- basic_io_object.hpp (revision 59528)
+++ basic_io_object.hpp (working copy)
@@ -68,8 +68,8 @@
    * Performs:
    * @code service.construct(implementation); @endcode
    */
-  explicit basic_io_object(boost::asio::io_service& io_service)
-    : service(boost::asio::use_service<IoObjectService>(io_service))
+  explicit basic_io_object(boost::asio::io_service& io_srv)
+    : service(boost::asio::use_service<IoObjectService>(io_srv))
   {
     service.construct(implementation);
   }
Index: serial_port_service.hpp
===================================================================
--- serial_port_service.hpp     (revision 59528)
+++ serial_port_service.hpp     (working copy)
@@ -84,9 +84,9 @@
 #endif

   /// Construct a new serial port service for the specified io_service.
-  explicit serial_port_service(boost::asio::io_service& io_service)
-    : boost::asio::detail::service_base<serial_port_service>(io_service),
-      service_impl_(boost::asio::use_service<service_impl_type>(io_service))
+  explicit serial_port_service(boost::asio::io_service& io_srv)
+    : boost::asio::detail::service_base<serial_port_service>(io_srv),
+      service_impl_(boost::asio::use_service<service_impl_type>(io_srv))
   {
   }

Index: local/basic_endpoint.hpp
===================================================================
--- local/basic_endpoint.hpp    (revision 59528)
+++ local/basic_endpoint.hpp    (working copy)
@@ -79,16 +79,16 @@
   }

   /// Construct an endpoint using the specified path name.
-  basic_endpoint(const char* path)
+  basic_endpoint(const char* pathname)
   {
     using namespace std; // For strlen.
-    init(path, strlen(path));
+    init(path, strlen(pathname));
   }

   /// Construct an endpoint using the specified path name.
-  basic_endpoint(const std::string& path)
+  basic_endpoint(const std::string& pathname)
   {
-    init(path.data(), path.length());
+    init(path.data(), pathname.length());
   }

   /// Copy constructor.
@@ -132,20 +132,20 @@
   }

   /// Set the underlying size of the endpoint in the native type.
-  void resize(std::size_t size)
+  void resize(std::size_t s)
   {
-    if (size > sizeof(boost::asio::detail::sockaddr_un_type))
+    if (s > sizeof(boost::asio::detail::sockaddr_un_type))
     {
       boost::system::system_error e(boost::asio::error::invalid_argument);
       boost::throw_exception(e);
     }
-    else if (size == 0)
+    else if (s == 0)
     {
       path_length_ = 0;
     }
     else
     {
-      path_length_ = size
+      path_length_ = s
         - offsetof(boost::asio::detail::sockaddr_un_type, sun_path);

       // The path returned by the operating system may be NUL-terminated.
@@ -212,7 +212,7 @@
   std::size_t path_length_;

   // Initialise with a specified path.
-  void init(const char* path, std::size_t path_length)
+  void init(const char* pathname, std::size_t path_length)
   {
     if (path_length > sizeof(data_.local.sun_path) - 1)
     {
@@ -224,7 +224,7 @@
     using namespace std; // For memcpy.
     data_.local = boost::asio::detail::sockaddr_un_type();
     data_.local.sun_family = AF_UNIX;
-    memcpy(data_.local.sun_path, path, path_length);
+    memcpy(data_.local.sun_path, pathname, path_length);
     path_length_ = path_length;

     // NUL-terminate normal path names. Names that start with a NUL are in the
Index: basic_stream_socket.hpp
===================================================================
--- basic_stream_socket.hpp     (revision 59528)
+++ basic_stream_socket.hpp     (working copy)
@@ -66,8 +66,8 @@
    * @param io_service The io_service object that the stream socket will use to
    * dispatch handlers for any asynchronous operations performed on the socket.
    */
-  explicit basic_stream_socket(boost::asio::io_service& io_service)
-    : basic_socket<Protocol, StreamSocketService>(io_service)
+  explicit basic_stream_socket(boost::asio::io_service& ioservice)
+    : basic_socket<Protocol, StreamSocketService>(ioservice)
   {
   }

Index: datagram_socket_service.hpp
===================================================================
--- datagram_socket_service.hpp (revision 59528)
+++ datagram_socket_service.hpp (working copy)
@@ -100,10 +100,10 @@
 #endif

   /// Construct a new datagram socket service for the specified io_service.
-  explicit datagram_socket_service(boost::asio::io_service& io_service)
+  explicit datagram_socket_service(boost::asio::io_service& ioservice)
     : boost::asio::detail::service_base<
-        datagram_socket_service<Protocol> >(io_service),
-      service_impl_(boost::asio::use_service<service_impl_type>(io_service))
+        datagram_socket_service<Protocol> >(ioservice),
+      service_impl_(boost::asio::use_service<service_impl_type>(ioservice))
   {
   }

Index: basic_socket_acceptor.hpp
===================================================================
--- basic_socket_acceptor.hpp   (revision 59528)
+++ basic_socket_acceptor.hpp   (working copy)
@@ -73,8 +73,8 @@
    * dispatch handlers for any asynchronous operations performed on the
    * acceptor.
    */
-  explicit basic_socket_acceptor(boost::asio::io_service& io_service)
-    : basic_io_object<SocketAcceptorService>(io_service)
+  explicit basic_socket_acceptor(boost::asio::io_service& ioservice)
+    : basic_io_object<SocketAcceptorService>(ioservice)
   {
   }

Index: impl/read_until.ipp
===================================================================
--- impl/read_until.ipp (revision 59528)
+++ impl/read_until.ipp (working copy)
@@ -376,8 +376,8 @@
       if (streambuf_.size() == streambuf_.max_size())
       {
         std::size_t bytes = 0;
-        boost::system::error_code ec(error::not_found);
-        handler_(ec, bytes);
+        boost::system::error_code errc(error::not_found);
+        handler_(errc, bytes);
         return;
       }

@@ -708,8 +708,8 @@
       if (streambuf_.size() == streambuf_.max_size())
       {
         std::size_t bytes = 0;
-        boost::system::error_code ec(error::not_found);
-        handler_(ec, bytes);
+        boost::system::error_code errc(error::not_found);
+        handler_(errc, bytes);
         return;
       }

@@ -877,8 +877,8 @@
       if (streambuf_.size() == streambuf_.max_size())
       {
         std::size_t bytes = 0;
-        boost::system::error_code ec(error::not_found);
-        handler_(ec, bytes);
+        boost::system::error_code errc(error::not_found);
+        handler_(errc, bytes);
         return;
       }

Index: impl/io_service.ipp
===================================================================
--- impl/io_service.ipp (revision 59528)
+++ impl/io_service.ipp (working copy)
@@ -147,8 +147,8 @@
   return detail::wrapped_handler<io_service&, Handler>(*this, handler);
 }

-inline io_service::work::work(boost::asio::io_service& io_service)
-  : io_service_(io_service)
+inline io_service::work::work(boost::asio::io_service& io_srv)
+  : io_service_(io_srv)
 {
   io_service_.impl_.work_started();
 }
Index: detail/reactive_socket_service.hpp
===================================================================
--- detail/reactive_socket_service.hpp  (revision 59528)
+++ detail/reactive_socket_service.hpp  (working copy)
@@ -105,10 +105,10 @@
   enum { max_buffers = 64 < max_iov_len ? 64 : max_iov_len };

   // Constructor.
-  reactive_socket_service(boost::asio::io_service& io_service)
+  reactive_socket_service(boost::asio::io_service& ioservice)
     : boost::asio::detail::service_base<
-        reactive_socket_service<Protocol, Reactor> >(io_service),
-      reactor_(boost::asio::use_service<Reactor>(io_service))
+        reactive_socket_service<Protocol, Reactor> >(ioservice),
+      reactor_(boost::asio::use_service<Reactor>(ioservice))
   {
     reactor_.init_task();
   }
Index: detail/strand_service.hpp
===================================================================
--- detail/strand_service.hpp   (revision 59528)
+++ detail/strand_service.hpp   (working copy)
@@ -285,8 +285,8 @@
   };

   // Construct a new strand service for the specified io_service.
-  explicit strand_service(boost::asio::io_service& io_service)
-    : boost::asio::detail::service_base<strand_service>(io_service),
+  explicit strand_service(boost::asio::io_service& ioservice)
+    : boost::asio::detail::service_base<strand_service>(ioservice),
       mutex_(),
       salt_(0)
   {
Index: detail/hash_map.hpp
===================================================================
--- detail/hash_map.hpp (revision 59528)
+++ detail/hash_map.hpp (working copy)
@@ -104,9 +104,9 @@
     iterator it = buckets_[bucket].first;
     if (it == values_.end())
       return values_.end();
-    iterator end = buckets_[bucket].last;
-    ++end;
-    while (it != end)
+    iterator endit = buckets_[bucket].last;
+    ++endit;
+    while (it != endit)
     {
       if (it->first == k)
         return it;
@@ -122,9 +122,9 @@
     const_iterator it = buckets_[bucket].first;
     if (it == values_.end())
       return it;
-    const_iterator end = buckets_[bucket].last;
-    ++end;
-    while (it != end)
+    const_iterator endit = buckets_[bucket].last;
+    ++endit;
+    while (it != endit)
     {
       if (it->first == k)
         return it;
@@ -147,15 +147,15 @@
       ++size_;
       return std::pair<iterator, bool>(buckets_[bucket].last, true);
     }
-    iterator end = buckets_[bucket].last;
-    ++end;
-    while (it != end)
+    iterator endit = buckets_[bucket].last;
+    ++endit;
+    while (it != endit)
     {
       if (it->first == v.first)
         return std::pair<iterator, bool>(it, false);
       ++it;
     }
-    buckets_[bucket].last = values_insert(end, v);
+    buckets_[bucket].last = values_insert(endit, v);
     ++size_;
     return std::pair<iterator, bool>(buckets_[bucket].last, true);
   }
@@ -218,19 +218,19 @@
     if (num_buckets == buckets_.size())
       return;

-    iterator end = values_.end();
+    iterator endit = values_.end();

     // Update number of buckets and initialise all buckets to empty.
     buckets_.resize(num_buckets);
     for (std::size_t i = 0; i < buckets_.size(); ++i)
-      buckets_[i].first = buckets_[i].last = end;
+      buckets_[i].first = buckets_[i].last = endit;

     // Put all values back into the hash.
     iterator iter = values_.begin();
-    while (iter != end)
+    while (iter != endit)
     {
       std::size_t bucket = calculate_hash_value(iter->first) % buckets_.size();
-      if (buckets_[bucket].last == end)
+      if (buckets_[bucket].last == endit)
       {
         buckets_[bucket].first = buckets_[bucket].last = iter++;
       }
Index: detail/buffered_stream_storage.hpp
===================================================================
--- detail/buffered_stream_storage.hpp  (revision 59528)
+++ detail/buffered_stream_storage.hpp  (working copy)
@@ -39,10 +39,10 @@
   typedef std::size_t size_type;

   // Constructor.
-  explicit buffered_stream_storage(std::size_t capacity)
+  explicit buffered_stream_storage(std::size_t cap)
     : begin_offset_(0),
       end_offset_(0),
-      buffer_(capacity)
+      buffer_(cap)
   {
   }

Index: detail/deadline_timer_service.hpp
===================================================================
--- detail/deadline_timer_service.hpp   (revision 59528)
+++ detail/deadline_timer_service.hpp   (working copy)
@@ -148,8 +148,8 @@
       ::timeval tv;
       tv.tv_sec = timeout.total_seconds();
       tv.tv_usec = timeout.total_microseconds() % 1000000;
-      boost::system::error_code ec;
-      socket_ops::select(0, 0, 0, 0, &tv, ec);
+      boost::system::error_code errc;
+      socket_ops::select(0, 0, 0, 0, &tv, errc);
       now = Time_Traits::now();
     }
     ec = boost::system::error_code();
Index: detail/epoll_reactor.hpp
===================================================================
--- detail/epoll_reactor.hpp    (revision 59528)
+++ detail/epoll_reactor.hpp    (working copy)
@@ -62,8 +62,8 @@
   };

   // Constructor.
-  epoll_reactor(boost::asio::io_service& io_service)
-    : boost::asio::detail::service_base<epoll_reactor<Own_Thread> >(io_service),
+  epoll_reactor(boost::asio::io_service& ioservice)
+    : boost::asio::detail::service_base<epoll_reactor<Own_Thread> >(ioservice),
       mutex_(),
       epoll_fd_(do_epoll_create()),
       wait_in_progress_(false),
@@ -650,12 +650,12 @@
   // Cancel all operations associated with the given descriptor. The do_cancel
   // function of the handler objects will be invoked. This function does not
   // acquire the epoll_reactor's mutex.
-  void cancel_ops_unlocked(socket_type descriptor)
+  void cancel_ops_unlocked(socket_type socketdescriptor)
   {
-    bool interrupt = read_op_queue_.cancel_operations(descriptor);
-    interrupt = write_op_queue_.cancel_operations(descriptor) || interrupt;
-    interrupt = except_op_queue_.cancel_operations(descriptor) || interrupt;
-    if (interrupt)
+    bool intr = read_op_queue_.cancel_operations(socketdescriptor);
+    intr = write_op_queue_.cancel_operations(socketdescriptor) || intr;
+    intr = except_op_queue_.cancel_operations(socketdescriptor) || intr;
+    if (intr)
       interrupter_.interrupt();
   }

Index: detail/reactor_op_queue.hpp
===================================================================
--- detail/reactor_op_queue.hpp (revision 59528)
+++ detail/reactor_op_queue.hpp (working copy)
@@ -325,11 +325,11 @@

     // Construct an operation for the given descriptor.
     op_base(perform_func_type perform_func, complete_func_type complete_func,
-        destroy_func_type destroy_func, Descriptor descriptor)
+        destroy_func_type destroy_func, Descriptor desc)
       : perform_func_(perform_func),
         complete_func_(complete_func),
         destroy_func_(destroy_func),
-        descriptor_(descriptor),
+        descriptor_(desc),
         result_(),
         bytes_transferred_(0),
         next_(0)
@@ -373,9 +373,9 @@
   {
   public:
     // Constructor.
-    op(Descriptor descriptor, Operation operation)
+    op(Descriptor socketdescriptor, Operation operation)
       : op_base(&op<Operation>::do_perform, &op<Operation>::do_complete,
-          &op<Operation>::do_destroy, descriptor),
+          &op<Operation>::do_destroy, socketdescriptor),
         operation_(operation)
     {
     }
Index: detail/reactive_descriptor_service.hpp
===================================================================
--- detail/reactive_descriptor_service.hpp      (revision 59528)
+++ detail/reactive_descriptor_service.hpp      (working copy)
@@ -77,10 +77,10 @@
   enum { max_buffers = 64 < max_iov_len ? 64 : max_iov_len };

   // Constructor.
-  reactive_descriptor_service(boost::asio::io_service& io_service)
+  reactive_descriptor_service(boost::asio::io_service& ioservice)
     : boost::asio::detail::service_base<
-        reactive_descriptor_service<Reactor> >(io_service),
-      reactor_(boost::asio::use_service<Reactor>(io_service))
+        reactive_descriptor_service<Reactor> >(ioservice),
+      reactor_(boost::asio::use_service<Reactor>(ioservice))
   {
     reactor_.init_task();
   }
Index: detail/resolver_service.hpp
===================================================================
--- detail/resolver_service.hpp (revision 59528)
+++ detail/resolver_service.hpp (working copy)
@@ -85,9 +85,9 @@
   typedef typename Protocol::resolver_iterator iterator_type;

   // Constructor.
-  resolver_service(boost::asio::io_service& io_service)
+  resolver_service(boost::asio::io_service& ioservice)
     : boost::asio::detail::service_base<
-        resolver_service<Protocol> >(io_service),
+        resolver_service<Protocol> >(ioservice),
       mutex_(),
       work_io_service_(new boost::asio::io_service),
       work_(new boost::asio::io_service::work(*work_io_service_)),
Index: detail/service_base.hpp
===================================================================
--- detail/service_base.hpp     (revision 59528)
+++ detail/service_base.hpp     (working copy)
@@ -33,8 +33,8 @@
   static boost::asio::detail::service_id<Type> id;

   // Constructor.
-  service_base(boost::asio::io_service& io_service)
-    : boost::asio::io_service::service(io_service)
+  service_base(boost::asio::io_service& ioservice)
+    : boost::asio::io_service::service(ioservice)
   {
   }
 };
Index: detail/task_io_service.hpp
===================================================================
--- detail/task_io_service.hpp  (revision 59528)
+++ detail/task_io_service.hpp  (working copy)
@@ -41,8 +41,8 @@
 {
 public:
   // Constructor.
-  task_io_service(boost::asio::io_service& io_service)
-    : boost::asio::detail::service_base<task_io_service<Task> >(io_service),
+  task_io_service(boost::asio::io_service& ioservice)
+    : boost::asio::detail::service_base<task_io_service<Task> >(ioservice),
       mutex_(),
       task_(0),
       task_interrupted_(true),
Index: detail/reactive_serial_port_service.hpp
===================================================================
--- detail/reactive_serial_port_service.hpp     (revision 59528)
+++ detail/reactive_serial_port_service.hpp     (working copy)
@@ -52,11 +52,11 @@
   typedef typename reactive_descriptor_service<Reactor>::implementation_type
     implementation_type;

-  reactive_serial_port_service(boost::asio::io_service& io_service)
+  reactive_serial_port_service(boost::asio::io_service& ioservice)
     : boost::asio::detail::service_base<
-        reactive_serial_port_service>(io_service),
+        reactive_serial_port_service>(ioservice),
       descriptor_service_(boost::asio::use_service<
-          reactive_descriptor_service<Reactor> >(io_service))
+          reactive_descriptor_service<Reactor> >(ioservice))
   {
   }

Index: basic_datagram_socket.hpp
===================================================================
--- basic_datagram_socket.hpp   (revision 59528)
+++ basic_datagram_socket.hpp   (working copy)
@@ -102,9 +102,9 @@
    *
    * @throws boost::system::system_error Thrown on failure.
    */
-  basic_datagram_socket(boost::asio::io_service& io_service,
+  basic_datagram_socket(boost::asio::io_service& ioservice,
       const endpoint_type& endpoint)
-    : basic_socket<Protocol, DatagramSocketService>(io_service, endpoint)
+    : basic_socket<Protocol, DatagramSocketService>(ioservice, endpoint)
   {
   }

Index: basic_streambuf.hpp
===================================================================
--- basic_streambuf.hpp (revision 59528)
+++ basic_streambuf.hpp (working copy)
@@ -131,9 +131,9 @@
    * of the streambuf's input sequence is 0.
    */
   explicit basic_streambuf(
-      std::size_t max_size = (std::numeric_limits<std::size_t>::max)(),
+      std::size_t max_sz = (std::numeric_limits<std::size_t>::max)(),
       const Allocator& allocator = Allocator())
-    : max_size_(max_size),
+    : max_size_(max_sz),
       buffer_(allocator)
   {
     std::size_t pend = (std::min<std::size_t>)(max_size_, buffer_delta);
Index: strand.hpp
===================================================================
--- strand.hpp  (revision 59528)
+++ strand.hpp  (working copy)
@@ -87,9 +87,9 @@
    * @param io_service The io_service object that the strand will use to
    * dispatch handlers that are ready to be run.
    */
-  explicit strand(boost::asio::io_service& io_service)
+  explicit strand(boost::asio::io_service& ioservice)
     : service_(boost::asio::use_service<
-        boost::asio::detail::strand_service>(io_service))
+        boost::asio::detail::strand_service>(ioservice))
   {
     service_.construct(impl_);
   }
Index: posix/stream_descriptor_service.hpp
===================================================================
--- posix/stream_descriptor_service.hpp (revision 59528)
+++ posix/stream_descriptor_service.hpp (working copy)
@@ -99,9 +99,9 @@
 #endif

   /// Construct a new stream descriptor service for the specified io_service.
-  explicit stream_descriptor_service(boost::asio::io_service& io_service)
-    : boost::asio::detail::service_base<stream_descriptor_service>(io_service),
-      service_impl_(boost::asio::use_service<service_impl_type>(io_service))
+  explicit stream_descriptor_service(boost::asio::io_service& ioservice)
+    : boost::asio::detail::service_base<stream_descriptor_service>(ioservice),
+      service_impl_(boost::asio::use_service<service_impl_type>(ioservice))
   {
   }

Index: ip/address_v6.hpp
===================================================================
--- ip/address_v6.hpp   (revision 59528)
+++ ip/address_v6.hpp   (working copy)
@@ -64,8 +64,8 @@
   }

   /// Construct an address from raw bytes and scope ID.
-  explicit address_v6(const bytes_type& bytes, unsigned long scope_id = 0)
-    : scope_id_(scope_id)
+  explicit address_v6(const bytes_type& bytes, unsigned long scope = 0)
+    : scope_id_(scope)
   {
 #if UCHAR_MAX > 0xFF
     for (std::size_t i = 0; i < bytes.size(); ++i)
Index: ip/basic_resolver.hpp
===================================================================
--- ip/basic_resolver.hpp       (revision 59528)
+++ ip/basic_resolver.hpp       (working copy)
@@ -60,8 +60,8 @@
    * @param io_service The io_service object that the resolver will use to
    * dispatch handlers for any asynchronous operations performed on the timer.
    */
-  explicit basic_resolver(boost::asio::io_service& io_service)
-    : basic_io_object<ResolverService>(io_service)
+  explicit basic_resolver(boost::asio::io_service& ioservice)
+    : basic_io_object<ResolverService>(ioservice)
   {
   }

Index: ip/basic_endpoint.hpp
===================================================================
--- ip/basic_endpoint.hpp       (revision 59528)
+++ ip/basic_endpoint.hpp       (working copy)
@@ -91,11 +91,11 @@
    * boost::asio::ip::udp::endpoint ep(boost::asio::ip::udp::v6(), 9876);
    * @endcode
    */
-  basic_endpoint(const InternetProtocol& protocol, unsigned short port_num)
+  basic_endpoint(const InternetProtocol& proto, unsigned short port_num)
     : data_()
   {
     using namespace std; // For memcpy.
-    if (protocol.family() == PF_INET)
+    if (proto.family() == PF_INET)
     {
       data_.v4.sin_family = AF_INET;
       data_.v4.sin_port =
@@ -186,9 +186,9 @@
   }

   /// Set the underlying size of the endpoint in the native type.
-  void resize(std::size_t size)
+  void resize(std::size_t s)
   {
-    if (size > sizeof(boost::asio::detail::sockaddr_storage_type))
+    if (s > sizeof(boost::asio::detail::sockaddr_storage_type))
     {
       boost::system::system_error e(boost::asio::error::invalid_argument);
       boost::throw_exception(e);
Index: ip/resolver_service.hpp
===================================================================
--- ip/resolver_service.hpp     (revision 59528)
+++ ip/resolver_service.hpp     (working copy)
@@ -68,10 +68,10 @@
 #endif

   /// Construct a new resolver service for the specified io_service.
-  explicit resolver_service(boost::asio::io_service& io_service)
+  explicit resolver_service(boost::asio::io_service& ioservice)
     : boost::asio::detail::service_base<
-        resolver_service<InternetProtocol> >(io_service),
-      service_impl_(boost::asio::use_service<service_impl_type>(io_service))
+        resolver_service<InternetProtocol> >(ioservice),
+      service_impl_(boost::asio::use_service<service_impl_type>(ioservice))
   {
   }

Index: ip/basic_resolver_entry.hpp
===================================================================
--- ip/basic_resolver_entry.hpp (revision 59528)
+++ ip/basic_resolver_entry.hpp (working copy)
@@ -50,11 +50,11 @@
   }

   /// Construct with specified endpoint, host name and service name.
-  basic_resolver_entry(const endpoint_type& endpoint,
-      const std::string& host_name, const std::string& service_name)
-    : endpoint_(endpoint),
-      host_name_(host_name),
-      service_name_(service_name)
+  basic_resolver_entry(const endpoint_type& endp,
+      const std::string& hostname, const std::string& servicename)
+    : endpoint_(endp),
+      host_name_(hostname),
+      service_name_(servicename)
   {
   }

Index: ip/tcp.hpp
===================================================================
--- ip/tcp.hpp  (revision 59528)
+++ ip/tcp.hpp  (working copy)
@@ -145,8 +145,8 @@

 private:
   // Construct with a specific family.
-  explicit tcp(int family)
-    : family_(family)
+  explicit tcp(int fam)
+    : family_(fam)
   {
   }

Index: ip/basic_resolver_query.hpp
===================================================================
--- ip/basic_resolver_query.hpp (revision 59528)
+++ ip/basic_resolver_query.hpp (working copy)
@@ -47,11 +47,11 @@
   typedef InternetProtocol protocol_type;

   /// Construct with specified service name for any protocol.
-  basic_resolver_query(const std::string& service_name,
+  basic_resolver_query(const std::string& servicename,
       int flags = passive | address_configured)
     : hints_(),
       host_name_(),
-      service_name_(service_name)
+      service_name_(servicename)
   {
     typename InternetProtocol::endpoint endpoint;
     hints_.ai_flags = flags;
@@ -66,11 +66,11 @@

   /// Construct with specified service name for a given protocol.
   basic_resolver_query(const protocol_type& protocol,
-      const std::string& service_name,
+      const std::string& servicename,
       int flags = passive | address_configured)
     : hints_(),
       host_name_(),
-      service_name_(service_name)
+      service_name_(servicename)
   {
     hints_.ai_flags = flags;
     hints_.ai_family = protocol.family();
@@ -83,11 +83,11 @@
   }

   /// Construct with specified host name and service name for any protocol.
-  basic_resolver_query(const std::string& host_name,
-      const std::string& service_name, int flags = address_configured)
+  basic_resolver_query(const std::string& hostname,
+      const std::string& servicename, int flags = address_configured)
     : hints_(),
-      host_name_(host_name),
-      service_name_(service_name)
+      host_name_(hostname),
+      service_name_(servicename)
   {
     typename InternetProtocol::endpoint endpoint;
     hints_.ai_flags = flags;
@@ -102,11 +102,11 @@

   /// Construct with specified host name and service name for a given protocol.
   basic_resolver_query(const protocol_type& protocol,
-      const std::string& host_name, const std::string& service_name,
+      const std::string& hostname, const std::string& servicename,
       int flags = address_configured)
     : hints_(),
-      host_name_(host_name),
-      service_name_(service_name)
+      host_name_(hostname),
+      service_name_(servicename)
   {
     hints_.ai_flags = flags;
     hints_.ai_family = protocol.family();
Index: ip/udp.hpp
===================================================================
--- ip/udp.hpp  (revision 59528)
+++ ip/udp.hpp  (working copy)
@@ -101,8 +101,8 @@

 private:
   // Construct with a specific family.
-  explicit udp(int family)
-    : family_(family)
+  explicit udp(int fam)
+    : family_(fam)
   {
   }

Index: ip/icmp.hpp
===================================================================
--- ip/icmp.hpp (revision 59528)
+++ ip/icmp.hpp (working copy)
@@ -101,9 +101,9 @@

 private:
   // Construct with a specific family.
-  explicit icmp(int protocol, int family)
-    : protocol_(protocol),
-      family_(family)
+  explicit icmp(int proto, int fam)
+    : protocol_(proto),
+      family_(fam)
   {
   }

Index: stream_socket_service.hpp
===================================================================
--- stream_socket_service.hpp   (revision 59528)
+++ stream_socket_service.hpp   (working copy)
@@ -100,10 +100,10 @@
 #endif

   /// Construct a new stream socket service for the specified io_service.
-  explicit stream_socket_service(boost::asio::io_service& io_service)
+  explicit stream_socket_service(boost::asio::io_service& ioservice)
     : boost::asio::detail::service_base<
-        stream_socket_service<Protocol> >(io_service),
-      service_impl_(boost::asio::use_service<service_impl_type>(io_service))
+        stream_socket_service<Protocol> >(ioservice),
+      service_impl_(boost::asio::use_service<service_impl_type>(ioservice))
   {
   }

Index: socket_acceptor_service.hpp
===================================================================
--- socket_acceptor_service.hpp (revision 59528)
+++ socket_acceptor_service.hpp (working copy)
@@ -96,10 +96,10 @@
 #endif

   /// Construct a new socket acceptor service for the specified io_service.
-  explicit socket_acceptor_service(boost::asio::io_service& io_service)
+  explicit socket_acceptor_service(boost::asio::io_service& ioservice)
     : boost::asio::detail::service_base<
-        socket_acceptor_service<Protocol> >(io_service),
-      service_impl_(boost::asio::use_service<service_impl_type>(io_service))
+        socket_acceptor_service<Protocol> >(ioservice),
+      service_impl_(boost::asio::use_service<service_impl_type>(ioservice))
   {
   }

After making these local changes, asio code compiles fine for me.

comment:2 by chris_kohlhoff, 13 years ago

Milestone: Boost 1.43.0To Be Determined
Severity: ProblemCosmetic

Will look at this once I finally remove the deprecated member functions named 'io_service()'.

comment:3 by chris_kohlhoff, 12 years ago

(In [69194]) Changes for asio version 1.5.0:

  • Added support for timeouts on socket iostreams, such as ip::tcp::iostream. A timeout is set by calling expires_at() or expires_from_now() to establish a deadline. Any socket operations which occur past the deadline will put the iostream into a bad state.
  • Added a new error() member function to socket iostreams, for retrieving the error code from the most recent system call.
  • Added a new basic_deadline_timer::cancel_one() function. This function lets you cancel a single waiting handler on a timer. Handlers are cancelled in FIFO order.
  • Added a new transfer_exactly() completion condition. This can be used to send or receive a specified number of bytes even if the total size of the buffer (or buffer sequence) is larger.
  • Added new free functions connect() and async_connect(). These operations try each endpoint in a list until the socket is successfully connected.
  • Extended the buffer_size() function so that it works for buffer sequences in addition to individual buffers.
  • Added a new buffer_copy() function that can be used to copy the raw bytes between individual buffers and buffer sequences.
  • Added new non-throwing overloads of read(), read_at(), write() and write_at() that do not require a completion condition.
  • Added friendlier compiler errors for when a completion handler does not meet the necessary type requirements. When C++0x is available (currently supported for g++ 4.5 or later, and MSVC 10), static_assert is also used to generate an informative error message. Checking may be disabled by defining BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS.
  • Made the is_loopback(), is_unspecified() and is_multicast() functions consistently available across the ip::address, ip::address_v4 and ip::address_v6 classes. Refs #3939.
  • Added new non_blocking() functions for managing the non-blocking behaviour of a socket or descriptor. The io_control() commands named non_blocking_io are now deprecated in favour of these new functions.
  • Added new native_non_blocking() functions for managing the non-blocking mode of the underlying socket or descriptor. These functions are intended to allow the encapsulation of arbitrary non-blocking system calls as asynchronous operations, in a way that is transparent to the user of the socket object. The functions have no effect on the behaviour of the synchronous operations of the socket or descriptor. Refs #3307.
  • Added the io_control() member function for socket acceptors. Refs #3297.
  • For consistency with the C++0x standard library, deprecated the native_type typedefs in favour of native_handle_type, and the native() member functions in favour of native_handle().
  • Added a release() member function to posix descriptors. This function releases ownership of the underlying native descriptor to the caller. Refs #3900.
  • Added support for sequenced packet sockets (SOCK_SEQPACKET).
  • Added a new io_service::stopped() function that can be used to determine whether the io_service has stopped (i.e. a reset() call is needed prior to any further calls to run(), run_one(), poll() or poll_one()).
  • Reduced the copying of handler function objects.
  • Added support for C++0x move construction to further reduce copying of handler objects. Move support is enabled when compiling in -std=c++0x mode on g++ 4.5 or higher, or when using MSVC10.
  • Removed the dependency on OS-provided macros for the well-known IPv4 and IPv6 addresses. This should eliminate the annoying "missing braces around initializer" warnings. Refs #3741.
  • Reduced the size of ip::basic_endpoint<> objects (such as ip::tcp::endpoint and ip::udp::endpoint).
  • Changed the reactor backends to assume that any descriptors or sockets added using assign() may have been dup()-ed, and so require explicit deregistration from the reactor. Refs #4971.
  • Changed the SSL error category to return error strings from the OpenSSL library.
  • Changed the separate compilation support such that, to use Asio's SSL capabilities, you should also include 'asio/ssl/impl/src.hpp in one source file in your program.
  • Removed the deprecated member functions named io_service(). The get_io_service() member functions should be used instead.
  • Removed the deprecated typedefs resolver_query and resolver_iterator from the ip::tcp, ip::udp and ip::icmp classes.
  • Fixed a compile error on some versions of g++ due to anonymous enums. Refs #4883.
  • Added an explicit cast to the FIONBIO constant to int to suppress a compiler warning on some platforms. Refs #5128.
  • Fixed warnings reported by g++'s -Wshadow compiler option. Refs #3905.

comment:4 by chris_kohlhoff, 11 years ago

Resolution: fixed
Status: newclosed

Fixed on release branch as of [72428].

Note: See TracTickets for help on using tickets.