place a ZMQ_UNUSED macro and replace all unused variables with ZMQ_UNUSED macro

Backported from zeromq/libzmq@bff2284

# Conflicts:
#	src/client.cpp
#	src/server.cpp
This commit is contained in:
Jean-Christophe Fillion-Robin 2016-01-30 03:42:29 -05:00
parent 1206dc46cb
commit 9df7ed0740
10 changed files with 23 additions and 24 deletions

View File

@ -407,6 +407,12 @@ ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, char *string);
/* Deprecated method */
ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend);
/******************************************************************************/
/* 0MQ General */
/******************************************************************************/
#define ZMQ_UNUSED(object) (void)object
#undef ZMQ_EXPORT
#ifdef __cplusplus

View File

@ -34,8 +34,7 @@ zmq::dealer_t::~dealer_t ()
void zmq::dealer_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
{
// subscribe_to_all_ is unused
(void) subscribe_to_all_;
ZMQ_UNUSED(subscribe_to_all_);
zmq_assert (pipe_);

View File

@ -36,8 +36,7 @@ zmq::pair_t::~pair_t ()
void zmq::pair_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
{
// subscribe_to_all_ is unused
(void)subscribe_to_all_;
ZMQ_UNUSED(subscribe_to_all_);
zmq_assert (pipe_ != NULL);

View File

@ -34,8 +34,7 @@ zmq::pull_t::~pull_t ()
void zmq::pull_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
{
// subscribe_to_all_ is unused
(void)subscribe_to_all_;
ZMQ_UNUSED(subscribe_to_all_);
zmq_assert (pipe_);
fq.attach (pipe_);

View File

@ -34,8 +34,8 @@ zmq::push_t::~push_t ()
void zmq::push_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
{
// subscribe_to_all_ is unused
(void)subscribe_to_all_;
ZMQ_UNUSED(subscribe_to_all_);
// Don't delay pipe termination as there is no one
// to receive the delimiter.
pipe_->set_nodelay ();

View File

@ -55,8 +55,7 @@ zmq::router_t::~router_t ()
void zmq::router_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
{
// subscribe_to_all_ is unused
(void)subscribe_to_all_;
ZMQ_UNUSED(subscribe_to_all_);
zmq_assert (pipe_);

View File

@ -48,8 +48,7 @@ zmq::stream_t::~stream_t ()
void zmq::stream_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
{
// subscribe_to_all_ is unused
(void)subscribe_to_all_;
ZMQ_UNUSED(subscribe_to_all_);
zmq_assert (pipe_);

View File

@ -84,13 +84,13 @@ void zmq::set_tcp_receive_buffer (fd_t sockfd_, int bufsize_)
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_;
ZMQ_UNUSED(keepalive_);
ZMQ_UNUSED(keepalive_cnt_);
ZMQ_UNUSED(keepalive_idle_);
ZMQ_UNUSED(keepalive_intvl_);
// If none of the #ifdefs apply, then s_ is unused.
(void)s_;
ZMQ_UNUSED(s_);
// Tuning TCP keep-alives if platform allows it
// All values = -1 means skip and leave it for OS

View File

@ -53,7 +53,7 @@
int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_)
{
// TODO: Unused parameter, IPv6 support not implemented for Solaris.
(void) ipv6_;
ZMQ_UNUSED(ipv6_);
// Create a socket.
int fd = open_socket (AF_INET, SOCK_DGRAM, 0);
@ -117,7 +117,7 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_)
int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_)
{
// TODO: Unused parameter, IPv6 support not implemented for AIX or HP/UX.
(void) ipv6_;
ZMQ_UNUSED(ipv6_);
// Create a socket.
int sd = open_socket (AF_INET, SOCK_DGRAM, 0);
@ -195,9 +195,8 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_)
// This is true especially of Windows.
int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv6_)
{
// All unused parameters.
(void) nic_;
(void) ipv6_;
ZMQ_UNUSED(nic_);
ZMQ_UNUSED(ipv6_);
errno = ENODEV;
return -1;

View File

@ -45,8 +45,7 @@ zmq::xsub_t::~xsub_t ()
void zmq::xsub_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
{
// subscribe_to_all_ is unused
(void) subscribe_to_all_;
ZMQ_UNUSED(subscribe_to_all_);
zmq_assert (pipe_);
fq.attach (pipe_);