Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unused variable and parameter warnings #4596

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/ip.cpp
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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