Skip to content

Commit

Permalink
Merge pull request #415 from Quuxplusone/unused-parameters
Browse files Browse the repository at this point in the history
Silence all "unused parameter" warnings from Clang.
  • Loading branch information
hintjens committed Aug 27, 2012
2 parents f6fe600 + 08f6a9e commit c959f52
Show file tree
Hide file tree
Showing 43 changed files with 119 additions and 56 deletions.
4 changes: 2 additions & 2 deletions src/blob.hpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ namespace std


static char_type static char_type
to_char_type(const int_type& __c) to_char_type(const int_type& __c)
{ return char_type(); } { return char_type(__c); }


static int_type static int_type
to_int_type(const char_type& __c) { return int_type(); } to_int_type(const char_type& __c) { return int_type(__c); }


static bool static bool
eq_int_type(const int_type& __c1, const int_type& __c2) eq_int_type(const int_type& __c1, const int_type& __c2)
Expand Down
6 changes: 6 additions & 0 deletions src/dealer.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ zmq::dealer_t::~dealer_t ()


void zmq::dealer_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_) void zmq::dealer_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_)
{ {
// icanhasall_ is unused
(void) icanhasall_;

zmq_assert (pipe_); zmq_assert (pipe_);
fq.attach (pipe_); fq.attach (pipe_);
lb.attach (pipe_); lb.attach (pipe_);
Expand All @@ -59,6 +62,9 @@ int zmq::dealer_t::xsend (msg_t *msg_, int flags_)


int zmq::dealer_t::xrecv (msg_t *msg_, int flags_) int zmq::dealer_t::xrecv (msg_t *msg_, int flags_)
{ {
// flags_ is unused
(void)flags_;

// If there is a prefetched message, return it. // If there is a prefetched message, return it.
if (prefetched) { if (prefetched) {
int rc = msg_->move (prefetched_msg); int rc = msg_->move (prefetched_msg);
Expand Down
3 changes: 3 additions & 0 deletions src/dist.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ int zmq::dist_t::send_to_matching (msg_t *msg_, int flags_)


void zmq::dist_t::distribute (msg_t *msg_, int flags_) void zmq::dist_t::distribute (msg_t *msg_, int flags_)
{ {
// flags_ is unused
(void)flags_;

// If there are no matching pipes available, simply drop the message. // If there are no matching pipes available, simply drop the message.
if (matching == 0) { if (matching == 0) {
int rc = msg_->close (); int rc = msg_->close ();
Expand Down
1 change: 1 addition & 0 deletions src/err.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ void zmq::zmq_abort(const char *errmsg_)
extra_info [0] = (ULONG_PTR) errmsg_; extra_info [0] = (ULONG_PTR) errmsg_;
RaiseException (0x40000015, EXCEPTION_NONCONTINUABLE, 1, extra_info); RaiseException (0x40000015, EXCEPTION_NONCONTINUABLE, 1, extra_info);
#else #else
(void)errmsg_;
abort (); abort ();
#endif #endif
} }
Expand Down
2 changes: 1 addition & 1 deletion src/io_object.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void zmq::io_object_t::out_event ()
zmq_assert (false); zmq_assert (false);
} }


void zmq::io_object_t::timer_event (int id_) void zmq::io_object_t::timer_event (int)
{ {
zmq_assert (false); zmq_assert (false);
} }
2 changes: 1 addition & 1 deletion src/io_thread.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void zmq::io_thread_t::out_event ()
zmq_assert (false); zmq_assert (false);
} }


void zmq::io_thread_t::timer_event (int id_) void zmq::io_thread_t::timer_event (int)
{ {
// No timers here. This function is never called. // No timers here. This function is never called.
zmq_assert (false); zmq_assert (false);
Expand Down
3 changes: 3 additions & 0 deletions src/lb.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ void zmq::lb_t::activated (pipe_t *pipe_)


int zmq::lb_t::send (msg_t *msg_, int flags_) int zmq::lb_t::send (msg_t *msg_, int flags_)
{ {
// flags_ is unused
(void)flags_;

// Drop the message if required. If we are at the end of the message // Drop the message if required. If we are at the end of the message
// switch back to non-dropping mode. // switch back to non-dropping mode.
if (dropping) { if (dropping) {
Expand Down
16 changes: 8 additions & 8 deletions src/object.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -316,17 +316,17 @@ void zmq::object_t::process_plug ()
zmq_assert (false); zmq_assert (false);
} }


void zmq::object_t::process_own (own_t *object_) void zmq::object_t::process_own (own_t *)
{ {
zmq_assert (false); zmq_assert (false);
} }


void zmq::object_t::process_attach (i_engine *engine_) void zmq::object_t::process_attach (i_engine *)
{ {
zmq_assert (false); zmq_assert (false);
} }


void zmq::object_t::process_bind (pipe_t *pipe_) void zmq::object_t::process_bind (pipe_t *)
{ {
zmq_assert (false); zmq_assert (false);
} }
Expand All @@ -336,12 +336,12 @@ void zmq::object_t::process_activate_read ()
zmq_assert (false); zmq_assert (false);
} }


void zmq::object_t::process_activate_write (uint64_t msgs_read_) void zmq::object_t::process_activate_write (uint64_t)
{ {
zmq_assert (false); zmq_assert (false);
} }


void zmq::object_t::process_hiccup (void *pipe_) void zmq::object_t::process_hiccup (void *)
{ {
zmq_assert (false); zmq_assert (false);
} }
Expand All @@ -356,12 +356,12 @@ void zmq::object_t::process_pipe_term_ack ()
zmq_assert (false); zmq_assert (false);
} }


void zmq::object_t::process_term_req (own_t *object_) void zmq::object_t::process_term_req (own_t *)
{ {
zmq_assert (false); zmq_assert (false);
} }


void zmq::object_t::process_term (int linger_) void zmq::object_t::process_term (int)
{ {
zmq_assert (false); zmq_assert (false);
} }
Expand All @@ -371,7 +371,7 @@ void zmq::object_t::process_term_ack ()
zmq_assert (false); zmq_assert (false);
} }


void zmq::object_t::process_reap (class socket_base_t *socket_) void zmq::object_t::process_reap (class socket_base_t *)
{ {
zmq_assert (false); zmq_assert (false);
} }
Expand Down
10 changes: 8 additions & 2 deletions src/pair.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ zmq::pair_t::~pair_t ()


void zmq::pair_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_) void zmq::pair_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_)
{ {
// icanhasall_ is unused
(void)icanhasall_;

zmq_assert (pipe_ != NULL); zmq_assert (pipe_ != NULL);


// ZMQ_PAIR socket can only be connected to a single peer. // ZMQ_PAIR socket can only be connected to a single peer.
Expand All @@ -54,13 +57,13 @@ void zmq::pair_t::xterminated (pipe_t *pipe_)
pipe = NULL; pipe = NULL;
} }


void zmq::pair_t::xread_activated (pipe_t *pipe_) void zmq::pair_t::xread_activated (pipe_t *)
{ {
// There's just one pipe. No lists of active and inactive pipes. // There's just one pipe. No lists of active and inactive pipes.
// There's nothing to do here. // There's nothing to do here.
} }


void zmq::pair_t::xwrite_activated (pipe_t *pipe_) void zmq::pair_t::xwrite_activated (pipe_t *)
{ {
// There's just one pipe. No lists of active and inactive pipes. // There's just one pipe. No lists of active and inactive pipes.
// There's nothing to do here. // There's nothing to do here.
Expand All @@ -85,6 +88,9 @@ int zmq::pair_t::xsend (msg_t *msg_, int flags_)


int zmq::pair_t::xrecv (msg_t *msg_, int flags_) int zmq::pair_t::xrecv (msg_t *msg_, int flags_)
{ {
// flags_ is unused
(void)flags_;

// Deallocate old content of the message. // Deallocate old content of the message.
int rc = msg_->close (); int rc = msg_->close ();
errno_assert (rc == 0); errno_assert (rc == 0);
Expand Down
2 changes: 1 addition & 1 deletion src/pub.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ zmq::pub_t::~pub_t ()
{ {
} }


int zmq::pub_t::xrecv (class msg_t *msg_, int flags_) int zmq::pub_t::xrecv (class msg_t *, int)
{ {
// Messages cannot be received from PUB socket. // Messages cannot be received from PUB socket.
errno = ENOTSUP; errno = ENOTSUP;
Expand Down
6 changes: 6 additions & 0 deletions src/pull.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ zmq::pull_t::~pull_t ()


void zmq::pull_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_) void zmq::pull_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_)
{ {
// icanhasall_ is unused
(void)icanhasall_;

zmq_assert (pipe_); zmq_assert (pipe_);
fq.attach (pipe_); fq.attach (pipe_);
} }
Expand All @@ -52,6 +55,9 @@ void zmq::pull_t::xterminated (pipe_t *pipe_)


int zmq::pull_t::xrecv (msg_t *msg_, int flags_) int zmq::pull_t::xrecv (msg_t *msg_, int flags_)
{ {
// flags_ is unused
(void)flags_;

return fq.recv (msg_); return fq.recv (msg_);
} }


Expand Down
3 changes: 3 additions & 0 deletions src/push.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ zmq::push_t::~push_t ()


void zmq::push_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_) void zmq::push_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_)
{ {
// icanhasall_ is unused
(void)icanhasall_;

zmq_assert (pipe_); zmq_assert (pipe_);
lb.attach (pipe_); lb.attach (pipe_);
} }
Expand Down
2 changes: 1 addition & 1 deletion src/reaper.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void zmq::reaper_t::out_event ()
zmq_assert (false); zmq_assert (false);
} }


void zmq::reaper_t::timer_event (int id_) void zmq::reaper_t::timer_event (int)
{ {
zmq_assert (false); zmq_assert (false);
} }
Expand Down
9 changes: 9 additions & 0 deletions src/router.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ zmq::router_t::~router_t ()


void zmq::router_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_) void zmq::router_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_)
{ {
// icanhasall_ is unused
(void)icanhasall_;

zmq_assert (pipe_); zmq_assert (pipe_);


bool identity_ok = identify_peer (pipe_); bool identity_ok = identify_peer (pipe_);
Expand Down Expand Up @@ -128,6 +131,9 @@ void zmq::router_t::xwrite_activated (pipe_t *pipe_)


int zmq::router_t::xsend (msg_t *msg_, int flags_) int zmq::router_t::xsend (msg_t *msg_, int flags_)
{ {
// flags_ is unused
(void)flags_;

// If this is the first part of the message it's the ID of the // If this is the first part of the message it's the ID of the
// peer to send the message to. // peer to send the message to.
if (!more_out) { if (!more_out) {
Expand Down Expand Up @@ -193,6 +199,9 @@ int zmq::router_t::xsend (msg_t *msg_, int flags_)


int zmq::router_t::xrecv (msg_t *msg_, int flags_) int zmq::router_t::xrecv (msg_t *msg_, int flags_)
{ {
// flags_ is unused
(void)flags_;

if (prefetched) { if (prefetched) {
if (!identity_sent) { if (!identity_sent) {
int rc = msg_->move (prefetched_id); int rc = msg_->move (prefetched_id);
Expand Down
2 changes: 1 addition & 1 deletion src/session_base.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ void zmq::session_base_t::write_activated (pipe_t *pipe_)
engine->activate_in (); engine->activate_in ();
} }


void zmq::session_base_t::hiccuped (pipe_t *pipe_) void zmq::session_base_t::hiccuped (pipe_t *)
{ {
// Hiccups are always sent from session to socket, not the other // Hiccups are always sent from session to socket, not the other
// way round. // way round.
Expand Down
15 changes: 7 additions & 8 deletions src/socket_base.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -874,8 +874,7 @@ void zmq::socket_base_t::process_destroy ()
destroyed = true; destroyed = true;
} }


int zmq::socket_base_t::xsetsockopt (int option_, const void *optval_, int zmq::socket_base_t::xsetsockopt (int, const void *, size_t)
size_t optvallen_)
{ {
errno = EINVAL; errno = EINVAL;
return -1; return -1;
Expand All @@ -886,7 +885,7 @@ bool zmq::socket_base_t::xhas_out ()
return false; return false;
} }


int zmq::socket_base_t::xsend (msg_t *msg_, int flags_) int zmq::socket_base_t::xsend (msg_t *, int)
{ {
errno = ENOTSUP; errno = ENOTSUP;
return -1; return -1;
Expand All @@ -897,22 +896,22 @@ bool zmq::socket_base_t::xhas_in ()
return false; return false;
} }


int zmq::socket_base_t::xrecv (msg_t *msg_, int flags_) int zmq::socket_base_t::xrecv (msg_t *, int)
{ {
errno = ENOTSUP; errno = ENOTSUP;
return -1; return -1;
} }


void zmq::socket_base_t::xread_activated (pipe_t *pipe_) void zmq::socket_base_t::xread_activated (pipe_t *)
{ {
zmq_assert (false); zmq_assert (false);
} }
void zmq::socket_base_t::xwrite_activated (pipe_t *pipe_) void zmq::socket_base_t::xwrite_activated (pipe_t *)
{ {
zmq_assert (false); zmq_assert (false);
} }


void zmq::socket_base_t::xhiccuped (pipe_t *pipe_) void zmq::socket_base_t::xhiccuped (pipe_t *)
{ {
zmq_assert (false); zmq_assert (false);
} }
Expand All @@ -932,7 +931,7 @@ void zmq::socket_base_t::out_event ()
zmq_assert (false); zmq_assert (false);
} }


void zmq::socket_base_t::timer_event (int id_) void zmq::socket_base_t::timer_event (int)
{ {
zmq_assert (false); zmq_assert (false);
} }
Expand Down
2 changes: 1 addition & 1 deletion src/sub.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int zmq::sub_t::xsetsockopt (int option_, const void *optval_,
return rc; return rc;
} }


int zmq::sub_t::xsend (msg_t *msg_, int flags_) int zmq::sub_t::xsend (msg_t *, int)
{ {
// Overload the XSUB's send. // Overload the XSUB's send.
errno = ENOTSUP; errno = ENOTSUP;
Expand Down
9 changes: 9 additions & 0 deletions src/tcp.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ void zmq::tune_tcp_socket (fd_t s_)


void zmq::tune_tcp_keepalives (fd_t s_, int keepalive_, int keepalive_cnt_, int keepalive_idle_, int keepalive_intvl_) void zmq::tune_tcp_keepalives (fd_t s_, int keepalive_, int keepalive_cnt_, int keepalive_idle_, int keepalive_intvl_)
{ {
// These options are used only under certain #ifdefs below.
(void)keepalive_;
(void)keepalive_cnt_;
(void)keepalive_idle_;
(void)keepalive_intvl_;

// If none of the #ifdefs apply, then s_ is unused.
(void)s_;

// Tuning TCP keep-alives if platform allows it // Tuning TCP keep-alives if platform allows it
// All values = -1 means skip and leave it for OS // All values = -1 means skip and leave it for OS
#ifdef ZMQ_HAVE_SO_KEEPALIVE #ifdef ZMQ_HAVE_SO_KEEPALIVE
Expand Down
4 changes: 2 additions & 2 deletions src/tcp_address.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ zmq::tcp_address_mask_t::tcp_address_mask_t () :
address_mask = -1; address_mask = -1;
} }


const int zmq::tcp_address_mask_t::mask () const int zmq::tcp_address_mask_t::mask () const
{ {
return address_mask; return address_mask;
} }
Expand Down Expand Up @@ -574,7 +574,7 @@ int zmq::tcp_address_mask_t::to_string (std::string &addr_)
return 0; return 0;
} }


const bool zmq::tcp_address_mask_t::match_address (const struct sockaddr *ss, const socklen_t ss_len) const bool zmq::tcp_address_mask_t::match_address (const struct sockaddr *ss, const socklen_t ss_len) const
{ {
zmq_assert (address_mask != -1 && ss != NULL && ss_len >= (socklen_t) sizeof (struct sockaddr)); zmq_assert (address_mask != -1 && ss != NULL && ss_len >= (socklen_t) sizeof (struct sockaddr));


Expand Down
4 changes: 2 additions & 2 deletions src/tcp_address.hpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ namespace zmq
// The opposite to resolve() // The opposite to resolve()
int to_string (std::string &addr_); int to_string (std::string &addr_);


const int mask () const; int mask () const;


const bool match_address (const struct sockaddr *ss, const socklen_t ss_len) const; bool match_address (const struct sockaddr *ss, const socklen_t ss_len) const;


private: private:


Expand Down
2 changes: 1 addition & 1 deletion src/tcp_listener.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ zmq::fd_t zmq::tcp_listener_t::accept ()
// Accept one connection and deal with different failure modes. // Accept one connection and deal with different failure modes.
zmq_assert (s != retired_fd); zmq_assert (s != retired_fd);


struct sockaddr_storage ss = {0}; struct sockaddr_storage ss = {};
#ifdef ZMQ_HAVE_HPUX #ifdef ZMQ_HAVE_HPUX
int ss_len = sizeof (ss); int ss_len = sizeof (ss);
#else #else
Expand Down
3 changes: 3 additions & 0 deletions src/xpub.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ bool zmq::xpub_t::xhas_out ()


int zmq::xpub_t::xrecv (msg_t *msg_, int flags_) int zmq::xpub_t::xrecv (msg_t *msg_, int flags_)
{ {
// flags_ is unused
(void)flags_;

// If there is at least one // If there is at least one
if (pending.empty ()) { if (pending.empty ()) {
errno = EAGAIN; errno = EAGAIN;
Expand Down
Loading

0 comments on commit c959f52

Please sign in to comment.