mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-14 09:47:56 +08:00
Merge pull request #3832 from stac47/fix_unused_variable
Fix unused-variable warning in perf/proxy_thr.cpp
This commit is contained in:
commit
66ee3ee46c
14
RELICENSE/lstacul.md
Normal file
14
RELICENSE/lstacul.md
Normal file
@ -0,0 +1,14 @@
|
||||
# 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 @@
|
||||
#define TEST_ASSERT_SUCCESS_ERRNO(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 size_t message_size = 0;
|
||||
@ -238,7 +246,7 @@ static void proxy_thread_main (void *pvoid)
|
||||
if (ep != NULL) {
|
||||
assert (strlen (ep) > 5);
|
||||
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)
|
||||
int optval = 1;
|
||||
rc =
|
||||
zmq_setsockopt (backend_xpub, ZMQ_XPUB_NODROP, &optval, sizeof (optval));
|
||||
assert (rc == 0);
|
||||
ASSERT_EXPR_SAFE (rc == 0);
|
||||
|
||||
set_hwm (backend_xpub);
|
||||
|
||||
@ -262,7 +270,7 @@ static void proxy_thread_main (void *pvoid)
|
||||
if (ep != NULL) {
|
||||
assert (strlen (ep) > 5);
|
||||
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)
|
||||
|
||||
// Bind CONTROL
|
||||
rc = zmq_bind (control_rep, cfg->control_endpoint);
|
||||
assert (rc == 0);
|
||||
ASSERT_EXPR_SAFE (rc == 0);
|
||||
|
||||
// Start proxying!
|
||||
|
||||
@ -298,12 +306,12 @@ void terminate_proxy (const proxy_hwm_cfg_t *cfg)
|
||||
|
||||
// Connect CONTROL-REQ: a socket to which send commands
|
||||
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
|
||||
|
||||
rc = zmq_send (control_req, "TERMINATE", 9, 0);
|
||||
assert (rc == 9);
|
||||
ASSERT_EXPR_SAFE (rc == 9);
|
||||
|
||||
zmq_close (control_req);
|
||||
}
|
||||
@ -327,7 +335,7 @@ int main (int argc, char *argv[])
|
||||
assert (context);
|
||||
|
||||
int rv = zmq_ctx_set (context, ZMQ_IO_THREADS, 4);
|
||||
assert (rv == 0);
|
||||
ASSERT_EXPR_SAFE (rv == 0);
|
||||
|
||||
// START ALL SECONDARY THREADS
|
||||
|
||||
@ -395,7 +403,7 @@ int main (int argc, char *argv[])
|
||||
zmq_threadclose (proxy);
|
||||
|
||||
int rc = zmq_ctx_term (context);
|
||||
assert (rc == 0);
|
||||
ASSERT_EXPR_SAFE (rc == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user