Commit f0b0e80d authored by Laurent Stacul's avatar Laurent Stacul Committed by Laurent Stacul

Fix unused-variable warning in perf/proxy_thr.cpp

parent c7e99cdc
# Permission to Relicense under MPLv2
This is a statement by Laurent Stacul
that grants permission to relicense its copyrights in the libzmq C++
library (ZeroMQ) under the Mozilla Public License v2 (MPLv2).
A portion of the commits made by the Github handle "stac47", with
commit author "Laurent Stacul <laurent.stacul@gmail.com>", are copyright of
Laurent Stacul .
This document hereby grants the libzmq project team to relicense libzmq,
including all past, present and future contributions of the author listed above.
Laurent Stacul
2020/02/21
...@@ -74,6 +74,14 @@ ...@@ -74,6 +74,14 @@
#define TEST_ASSERT_SUCCESS_ERRNO(expr) \ #define TEST_ASSERT_SUCCESS_ERRNO(expr) \
test_assert_success_message_errno_helper (expr, NULL, #expr) test_assert_success_message_errno_helper (expr, NULL, #expr)
// This macro is used to avoid-variable warning. If used with an expression,
// the sizeof is not evaluated to avoid polluting the assembly code.
#ifdef NDEBUG
#define ASSERT_EXPR_SAFE(x) do { (void)sizeof(x);} while (0)
#else
#define ASSERT_EXPR_SAFE(x) assert(x)
#endif
static uint64_t message_count = 0; static uint64_t message_count = 0;
static size_t message_size = 0; static size_t message_size = 0;
...@@ -238,7 +246,7 @@ static void proxy_thread_main (void *pvoid) ...@@ -238,7 +246,7 @@ static void proxy_thread_main (void *pvoid)
if (ep != NULL) { if (ep != NULL) {
assert (strlen (ep) > 5); assert (strlen (ep) > 5);
rc = zmq_bind (frontend_xsub, ep); rc = zmq_bind (frontend_xsub, ep);
assert (rc == 0); ASSERT_EXPR_SAFE (rc == 0);
} }
} }
...@@ -252,7 +260,7 @@ static void proxy_thread_main (void *pvoid) ...@@ -252,7 +260,7 @@ static void proxy_thread_main (void *pvoid)
int optval = 1; int optval = 1;
rc = rc =
zmq_setsockopt (backend_xpub, ZMQ_XPUB_NODROP, &optval, sizeof (optval)); zmq_setsockopt (backend_xpub, ZMQ_XPUB_NODROP, &optval, sizeof (optval));
assert (rc == 0); ASSERT_EXPR_SAFE (rc == 0);
set_hwm (backend_xpub); set_hwm (backend_xpub);
...@@ -262,7 +270,7 @@ static void proxy_thread_main (void *pvoid) ...@@ -262,7 +270,7 @@ static void proxy_thread_main (void *pvoid)
if (ep != NULL) { if (ep != NULL) {
assert (strlen (ep) > 5); assert (strlen (ep) > 5);
rc = zmq_bind (backend_xpub, ep); rc = zmq_bind (backend_xpub, ep);
assert (rc == 0); ASSERT_EXPR_SAFE (rc == 0);
} }
} }
...@@ -275,7 +283,7 @@ static void proxy_thread_main (void *pvoid) ...@@ -275,7 +283,7 @@ static void proxy_thread_main (void *pvoid)
// Bind CONTROL // Bind CONTROL
rc = zmq_bind (control_rep, cfg->control_endpoint); rc = zmq_bind (control_rep, cfg->control_endpoint);
assert (rc == 0); ASSERT_EXPR_SAFE (rc == 0);
// Start proxying! // Start proxying!
...@@ -298,12 +306,12 @@ void terminate_proxy (const proxy_hwm_cfg_t *cfg) ...@@ -298,12 +306,12 @@ void terminate_proxy (const proxy_hwm_cfg_t *cfg)
// Connect CONTROL-REQ: a socket to which send commands // Connect CONTROL-REQ: a socket to which send commands
int rc = zmq_connect (control_req, cfg->control_endpoint); int rc = zmq_connect (control_req, cfg->control_endpoint);
assert (rc == 0); ASSERT_EXPR_SAFE (rc == 0);
// Ask the proxy to exit: the subscriber has received all messages // Ask the proxy to exit: the subscriber has received all messages
rc = zmq_send (control_req, "TERMINATE", 9, 0); rc = zmq_send (control_req, "TERMINATE", 9, 0);
assert (rc == 9); ASSERT_EXPR_SAFE (rc == 9);
zmq_close (control_req); zmq_close (control_req);
} }
...@@ -327,7 +335,7 @@ int main (int argc, char *argv[]) ...@@ -327,7 +335,7 @@ int main (int argc, char *argv[])
assert (context); assert (context);
int rv = zmq_ctx_set (context, ZMQ_IO_THREADS, 4); int rv = zmq_ctx_set (context, ZMQ_IO_THREADS, 4);
assert (rv == 0); ASSERT_EXPR_SAFE (rv == 0);
// START ALL SECONDARY THREADS // START ALL SECONDARY THREADS
...@@ -395,7 +403,7 @@ int main (int argc, char *argv[]) ...@@ -395,7 +403,7 @@ int main (int argc, char *argv[])
zmq_threadclose (proxy); zmq_threadclose (proxy);
int rc = zmq_ctx_term (context); int rc = zmq_ctx_term (context);
assert (rc == 0); ASSERT_EXPR_SAFE (rc == 0);
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment