From 589700ccfeabf5e380d3ab6b0bdad46f64f8a111 Mon Sep 17 00:00:00 2001 From: Nehal Patel Date: Tue, 3 Oct 2023 09:28:49 -0700 Subject: [PATCH] Fix unused variable and parameter warnings --- src/ip.cpp | 3 +++ src/zmq.cpp | 2 ++ tests/test_bind_fuzzer.cpp | 3 +++ tests/test_bind_null_fuzzer.cpp | 2 ++ tests/test_connect_fuzzer.cpp | 3 +++ tests/test_connect_null_fuzzer.cpp | 3 +++ tests/test_poller.cpp | 1 + tests/test_reconnect_options.cpp | 2 ++ tests/test_socks.cpp | 1 + tests/test_spec_dealer.cpp | 1 + tests/test_spec_pushpull.cpp | 1 + unittests/unittest_curve_encoding.cpp | 2 ++ unittests/unittest_mtrie.cpp | 3 +++ 13 files changed, 27 insertions(+) diff --git a/src/ip.cpp b/src/ip.cpp index e4c941e1eb..9d20f92074 100644 --- a/src/ip.cpp +++ b/src/ip.cpp @@ -210,6 +210,9 @@ void zmq::set_socket_priority (fd_t s_, int priority_) setsockopt (s_, SOL_SOCKET, SO_PRIORITY, reinterpret_cast (&priority_), sizeof (priority_)); errno_assert (rc == 0); +#else + LIBZMQ_UNUSED(s_); + LIBZMQ_UNUSED(priority_); #endif } diff --git a/src/zmq.cpp b/src/zmq.cpp index c6d35f3401..15c9c3bbf7 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -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; diff --git a/tests/test_bind_fuzzer.cpp b/tests/test_bind_fuzzer.cpp index b99000d45e..64c54a115c 100644 --- a/tests/test_bind_fuzzer.cpp +++ b/tests/test_bind_fuzzer.cpp @@ -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 (); diff --git a/tests/test_bind_null_fuzzer.cpp b/tests/test_bind_null_fuzzer.cpp index ca3c0c69d7..87c85a05bb 100644 --- a/tests/test_bind_null_fuzzer.cpp +++ b/tests/test_bind_null_fuzzer.cpp @@ -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 (); diff --git a/tests/test_connect_fuzzer.cpp b/tests/test_connect_fuzzer.cpp index 296ee9ca0d..5b421b6d55 100644 --- a/tests/test_connect_fuzzer.cpp +++ b/tests/test_connect_fuzzer.cpp @@ -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 (); diff --git a/tests/test_connect_null_fuzzer.cpp b/tests/test_connect_null_fuzzer.cpp index 30d92b0a6f..cb05777fa4 100644 --- a/tests/test_connect_null_fuzzer.cpp +++ b/tests/test_connect_null_fuzzer.cpp @@ -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 (); diff --git a/tests/test_poller.cpp b/tests/test_poller.cpp index cc5723c832..6df1062c42 100644 --- a/tests/test_poller.cpp +++ b/tests/test_poller.cpp @@ -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 diff --git a/tests/test_reconnect_options.cpp b/tests/test_reconnect_options.cpp index 7eaa781299..af34934b72 100644 --- a/tests/test_reconnect_options.cpp +++ b/tests/test_reconnect_options.cpp @@ -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? @@ -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); diff --git a/tests/test_socks.cpp b/tests/test_socks.cpp index 1c27054472..33e9e3963e 100644 --- a/tests/test_socks.cpp +++ b/tests/test_socks.cpp @@ -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); diff --git a/tests/test_spec_dealer.cpp b/tests/test_spec_dealer.cpp index ea055ce47d..5304ca5433 100644 --- a/tests/test_spec_dealer.cpp +++ b/tests/test_spec_dealer.cpp @@ -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; diff --git a/tests/test_spec_pushpull.cpp b/tests/test_spec_pushpull.cpp index b8baba8267..267a93c64e 100644 --- a/tests/test_spec_pushpull.cpp +++ b/tests/test_spec_pushpull.cpp @@ -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; diff --git a/unittests/unittest_curve_encoding.cpp b/unittests/unittest_curve_encoding.cpp index 6285850437..8d34abc3aa 100644 --- a/unittests/unittest_curve_encoding.cpp +++ b/unittests/unittest_curve_encoding.cpp @@ -67,6 +67,8 @@ void test_roundtrip (zmq::msg_t *msg_) TEST_ASSERT_EQUAL_UINT8_ARRAY (&original[0], msg_->data (), original.size ()); } +#else + LIBZMQ_UNUSED (msg_); #endif } diff --git a/unittests/unittest_mtrie.cpp b/unittests/unittest_mtrie.cpp index dbf71c7de8..1b9768773c 100644 --- a/unittests/unittest_mtrie.cpp +++ b/unittests/unittest_mtrie.cpp @@ -385,6 +385,9 @@ void check_count (zmq::generic_mtrie_t::prefix_t data_, size_t len_, int *count_) { + LIBZMQ_UNUSED (data_); + LIBZMQ_UNUSED (len_); + --(*count_); TEST_ASSERT_GREATER_OR_EQUAL (0, *count_); }