Problem: unused variables warnings

Solution: fix them
This commit is contained in:
Nehal Patel 2023-10-04 01:51:43 -07:00 committed by GitHub
parent de5ee18203
commit 8cdc4ed71a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 32 additions and 4 deletions

View File

@ -210,6 +210,9 @@ void zmq::set_socket_priority (fd_t s_, int priority_)
setsockopt (s_, SOL_SOCKET, SO_PRIORITY, setsockopt (s_, SOL_SOCKET, SO_PRIORITY,
reinterpret_cast<char *> (&priority_), sizeof (priority_)); reinterpret_cast<char *> (&priority_), sizeof (priority_));
errno_assert (rc == 0); errno_assert (rc == 0);
#else
LIBZMQ_UNUSED (s_);
LIBZMQ_UNUSED (priority_);
#endif #endif
} }

View File

@ -1739,6 +1739,8 @@ int zmq_proxy_steerable (void *frontend_,
void *capture_, void *capture_,
void *control_) void *control_)
{ {
LIBZMQ_UNUSED (capture_);
LIBZMQ_UNUSED (control_);
if (!frontend_ || !backend_) { if (!frontend_ || !backend_) {
errno = EFAULT; errno = EFAULT;
return -1; return -1;

View File

@ -371,6 +371,9 @@ bool zmq::zmtp_engine_t::handshake_v3_x (const bool downgrade_sub_)
error (protocol_error); error (protocol_error);
return false; return false;
} }
#ifndef ZMQ_HAVE_CURVE
LIBZMQ_UNUSED (downgrade_sub_);
#endif
_next_msg = &zmtp_engine_t::next_handshake_command; _next_msg = &zmtp_engine_t::next_handshake_command;
_process_msg = &zmtp_engine_t::process_handshake_command; _process_msg = &zmtp_engine_t::process_handshake_command;

View File

@ -59,6 +59,9 @@ void test_bind_fuzzer ()
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
LIBZMQ_UNUSED (argc);
LIBZMQ_UNUSED (argv);
setup_test_environment (); setup_test_environment ();
UNITY_BEGIN (); UNITY_BEGIN ();

View File

@ -76,6 +76,8 @@ void test_bind_null_fuzzer ()
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
LIBZMQ_UNUSED (argc);
LIBZMQ_UNUSED (argv);
setup_test_environment (); setup_test_environment ();
UNITY_BEGIN (); UNITY_BEGIN ();

View File

@ -46,6 +46,9 @@ void test_connect_fuzzer ()
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
LIBZMQ_UNUSED (argc);
LIBZMQ_UNUSED (argv);
setup_test_environment (); setup_test_environment ();
UNITY_BEGIN (); UNITY_BEGIN ();

View File

@ -81,6 +81,9 @@ void test_connect_null_fuzzer ()
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
LIBZMQ_UNUSED (argc);
LIBZMQ_UNUSED (argv);
setup_test_environment (); setup_test_environment ();
UNITY_BEGIN (); UNITY_BEGIN ();

View File

@ -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_) void call_poller_wait_all_null_event_fails_event_count_zero (void *poller_)
{ {
LIBZMQ_UNUSED (poller_);
#if 0 #if 0
// TODO this causes an assertion, which is not consistent if the number // 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 // of events may be 0, the pointer should be allowed to by NULL in that

View File

@ -49,6 +49,7 @@ void reconnect_default ()
int rc = get_monitor_event_with_timeout (sub_mon, &event, &event_address, int rc = get_monitor_event_with_timeout (sub_mon, &event, &event_address,
2 * 1000); 2 * 1000);
assert (rc == -1); assert (rc == -1);
LIBZMQ_UNUSED (rc);
// Close sub // Close sub
// TODO why does this use zero_linger? // TODO why does this use zero_linger?
@ -102,6 +103,7 @@ void reconnect_success ()
int rc = get_monitor_event_with_timeout (sub_mon, &event, &event_address, int rc = get_monitor_event_with_timeout (sub_mon, &event, &event_address,
SETTLE_TIME); SETTLE_TIME);
assert (rc == -1); assert (rc == -1);
LIBZMQ_UNUSED (rc);
// Now re-bind pub socket and wait for re-connect // Now re-bind pub socket and wait for re-connect
pub = test_context_socket (ZMQ_PUB); pub = test_context_socket (ZMQ_PUB);

View File

@ -77,6 +77,7 @@ int remote_connect (int socket, uint32_t addr, uint16_t port)
void *setup_socks_server (char *socks_server_address, void *setup_socks_server (char *socks_server_address,
int socks_server_address_len) int socks_server_address_len)
{ {
LIBZMQ_UNUSED (socks_server_address_len);
fprintf (stderr, "socks_server: setup socks server\n"); fprintf (stderr, "socks_server: setup socks server\n");
int server_fd = int server_fd =
bind_socket_resolve_port ("127.0.0.1", "0", socks_server_address); bind_socket_resolve_port ("127.0.0.1", "0", socks_server_address);

View File

@ -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. // 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_) void test_block_on_send_no_peers (const char *bind_address_)
{ {
LIBZMQ_UNUSED (bind_address_);
void *sc = test_context_socket (ZMQ_DEALER); void *sc = test_context_socket (ZMQ_DEALER);
int timeout = 250; int timeout = 250;

View File

@ -126,6 +126,7 @@ void test_pull_fair_queue_in (const char *bind_address_)
// available peers. // available peers.
void test_push_block_on_send_no_peers (const char *bind_address_) void test_push_block_on_send_no_peers (const char *bind_address_)
{ {
LIBZMQ_UNUSED (bind_address_);
void *sc = test_context_socket (ZMQ_PUSH); void *sc = test_context_socket (ZMQ_PUSH);
int timeout = 250; int timeout = 250;

View File

@ -31,11 +31,9 @@ void test_roundtrip (zmq::msg_t *msg_)
+ msg_->size ()); + msg_->size ());
zmq::curve_encoding_t encoding_client ("CurveZMQMESSAGEC", zmq::curve_encoding_t encoding_client ("CurveZMQMESSAGEC",
"CurveZMQMESSAGES", "CurveZMQMESSAGES", false);
false);
zmq::curve_encoding_t encoding_server ("CurveZMQMESSAGES", zmq::curve_encoding_t encoding_server ("CurveZMQMESSAGES",
"CurveZMQMESSAGEC", "CurveZMQMESSAGEC", false);
false);
uint8_t client_public[32]; uint8_t client_public[32];
uint8_t client_secret[32]; uint8_t client_secret[32];
@ -67,6 +65,8 @@ void test_roundtrip (zmq::msg_t *msg_)
TEST_ASSERT_EQUAL_UINT8_ARRAY (&original[0], msg_->data (), TEST_ASSERT_EQUAL_UINT8_ARRAY (&original[0], msg_->data (),
original.size ()); original.size ());
} }
#else
LIBZMQ_UNUSED (msg_);
#endif #endif
} }

View File

@ -385,6 +385,9 @@ void check_count (zmq::generic_mtrie_t<int>::prefix_t data_,
size_t len_, size_t len_,
int *count_) int *count_)
{ {
LIBZMQ_UNUSED (data_);
LIBZMQ_UNUSED (len_);
--(*count_); --(*count_);
TEST_ASSERT_GREATER_OR_EQUAL (0, *count_); TEST_ASSERT_GREATER_OR_EQUAL (0, *count_);
} }