Skip to content

Commit

Permalink
Problem: unused variables warnings
Browse files Browse the repository at this point in the history
Solution: fix them
  • Loading branch information
nehalkpatel committed Oct 4, 2023
1 parent de5ee18 commit 8cdc4ed
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/ip.cpp
Expand Up @@ -210,6 +210,9 @@ void zmq::set_socket_priority (fd_t s_, int priority_)
setsockopt (s_, SOL_SOCKET, SO_PRIORITY,
reinterpret_cast<char *> (&priority_), sizeof (priority_));
errno_assert (rc == 0);
#else
LIBZMQ_UNUSED (s_);
LIBZMQ_UNUSED (priority_);
#endif
}

Expand Down
2 changes: 2 additions & 0 deletions src/zmq.cpp
Expand Up @@ -1739,6 +1739,8 @@ int zmq_proxy_steerable (void *frontend_,
void *capture_,
void *control_)
{
LIBZMQ_UNUSED (capture_);
LIBZMQ_UNUSED (control_);
if (!frontend_ || !backend_) {
errno = EFAULT;
return -1;
Expand Down
3 changes: 3 additions & 0 deletions src/zmtp_engine.cpp
Expand Up @@ -371,6 +371,9 @@ bool zmq::zmtp_engine_t::handshake_v3_x (const bool downgrade_sub_)
error (protocol_error);
return false;
}
#ifndef ZMQ_HAVE_CURVE
LIBZMQ_UNUSED (downgrade_sub_);
#endif
_next_msg = &zmtp_engine_t::next_handshake_command;
_process_msg = &zmtp_engine_t::process_handshake_command;

Expand Down
3 changes: 3 additions & 0 deletions tests/test_bind_fuzzer.cpp
Expand Up @@ -59,6 +59,9 @@ void test_bind_fuzzer ()

int main (int argc, char **argv)
{
LIBZMQ_UNUSED (argc);
LIBZMQ_UNUSED (argv);

setup_test_environment ();

UNITY_BEGIN ();
Expand Down
2 changes: 2 additions & 0 deletions tests/test_bind_null_fuzzer.cpp
Expand Up @@ -76,6 +76,8 @@ void test_bind_null_fuzzer ()

int main (int argc, char **argv)
{
LIBZMQ_UNUSED (argc);
LIBZMQ_UNUSED (argv);
setup_test_environment ();

UNITY_BEGIN ();
Expand Down
3 changes: 3 additions & 0 deletions tests/test_connect_fuzzer.cpp
Expand Up @@ -46,6 +46,9 @@ void test_connect_fuzzer ()

int main (int argc, char **argv)
{
LIBZMQ_UNUSED (argc);
LIBZMQ_UNUSED (argv);

setup_test_environment ();

UNITY_BEGIN ();
Expand Down
3 changes: 3 additions & 0 deletions tests/test_connect_null_fuzzer.cpp
Expand Up @@ -81,6 +81,9 @@ void test_connect_null_fuzzer ()

int main (int argc, char **argv)
{
LIBZMQ_UNUSED (argc);
LIBZMQ_UNUSED (argv);

setup_test_environment ();

UNITY_BEGIN ();
Expand Down
1 change: 1 addition & 0 deletions tests/test_poller.cpp
Expand Up @@ -297,6 +297,7 @@ void call_poller_wait_all_null_event_fails_event_count_nonzero (void *poller_)

void call_poller_wait_all_null_event_fails_event_count_zero (void *poller_)
{
LIBZMQ_UNUSED (poller_);
#if 0
// TODO this causes an assertion, which is not consistent if the number
// of events may be 0, the pointer should be allowed to by NULL in that
Expand Down
2 changes: 2 additions & 0 deletions tests/test_reconnect_options.cpp
Expand Up @@ -49,6 +49,7 @@ void reconnect_default ()
int rc = get_monitor_event_with_timeout (sub_mon, &event, &event_address,
2 * 1000);
assert (rc == -1);
LIBZMQ_UNUSED (rc);

// Close sub
// TODO why does this use zero_linger?
Expand Down Expand Up @@ -102,6 +103,7 @@ void reconnect_success ()
int rc = get_monitor_event_with_timeout (sub_mon, &event, &event_address,
SETTLE_TIME);
assert (rc == -1);
LIBZMQ_UNUSED (rc);

// Now re-bind pub socket and wait for re-connect
pub = test_context_socket (ZMQ_PUB);
Expand Down
1 change: 1 addition & 0 deletions tests/test_socks.cpp
Expand Up @@ -77,6 +77,7 @@ int remote_connect (int socket, uint32_t addr, uint16_t port)
void *setup_socks_server (char *socks_server_address,
int socks_server_address_len)
{
LIBZMQ_UNUSED (socks_server_address_len);
fprintf (stderr, "socks_server: setup socks server\n");
int server_fd =
bind_socket_resolve_port ("127.0.0.1", "0", socks_server_address);
Expand Down
1 change: 1 addition & 0 deletions tests/test_spec_dealer.cpp
Expand Up @@ -141,6 +141,7 @@ void test_destroy_queue_on_disconnect (const char *bind_address_)
// SHALL block on sending, or return a suitable error, when it has no connected peers.
void test_block_on_send_no_peers (const char *bind_address_)
{
LIBZMQ_UNUSED (bind_address_);
void *sc = test_context_socket (ZMQ_DEALER);

int timeout = 250;
Expand Down
1 change: 1 addition & 0 deletions tests/test_spec_pushpull.cpp
Expand Up @@ -126,6 +126,7 @@ void test_pull_fair_queue_in (const char *bind_address_)
// available peers.
void test_push_block_on_send_no_peers (const char *bind_address_)
{
LIBZMQ_UNUSED (bind_address_);
void *sc = test_context_socket (ZMQ_PUSH);

int timeout = 250;
Expand Down
8 changes: 4 additions & 4 deletions unittests/unittest_curve_encoding.cpp
Expand Up @@ -31,11 +31,9 @@ void test_roundtrip (zmq::msg_t *msg_)
+ msg_->size ());

zmq::curve_encoding_t encoding_client ("CurveZMQMESSAGEC",
"CurveZMQMESSAGES",
false);
"CurveZMQMESSAGES", false);
zmq::curve_encoding_t encoding_server ("CurveZMQMESSAGES",
"CurveZMQMESSAGEC",
false);
"CurveZMQMESSAGEC", false);

uint8_t client_public[32];
uint8_t client_secret[32];
Expand Down Expand Up @@ -67,6 +65,8 @@ void test_roundtrip (zmq::msg_t *msg_)
TEST_ASSERT_EQUAL_UINT8_ARRAY (&original[0], msg_->data (),
original.size ());
}
#else
LIBZMQ_UNUSED (msg_);
#endif
}

Expand Down
3 changes: 3 additions & 0 deletions unittests/unittest_mtrie.cpp
Expand Up @@ -385,6 +385,9 @@ void check_count (zmq::generic_mtrie_t<int>::prefix_t data_,
size_t len_,
int *count_)
{
LIBZMQ_UNUSED (data_);
LIBZMQ_UNUSED (len_);

--(*count_);
TEST_ASSERT_GREATER_OR_EQUAL (0, *count_);
}
Expand Down

0 comments on commit 8cdc4ed

Please sign in to comment.