Skip to content
Browse files

Warnings fixed in nanocat

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
  • Loading branch information...
1 parent 98badb6 commit 24b4718f9b5c69dd3494f6802493d2c7f62de622 @tailhook tailhook committed with sustrik Nov 20, 2013
Showing with 213 additions and 139 deletions.
  1. +7 −5 perf/inproc_lat.c
  2. +5 −3 perf/inproc_thr.c
  3. +2 −2 perf/local_lat.c
  4. +1 −1 perf/local_thr.c
  5. +3 −3 perf/remote_lat.c
  6. +1 −1 perf/remote_thr.c
  7. +2 −1 src/aio/timer.c
  8. +6 −5 src/aio/usock_posix.inc
  9. +2 −1 src/aio/worker_posix.inc
  10. +3 −1 src/core/device.c
  11. +4 −2 src/core/ep.c
  12. +2 −1 src/core/epbase.c
  13. +5 −4 src/core/global.c
  14. +1 −1 src/core/sock.c
  15. +2 −1 src/core/sockbase.c
  16. +7 −4 src/protocols/bus/xbus.c
  17. +7 −4 src/protocols/pair/xpair.c
  18. +11 −6 src/protocols/pipeline/xpull.c
  19. +9 −5 src/protocols/pipeline/xpush.c
  20. +10 −6 src/protocols/pubsub/pub.c
  21. +6 −3 src/protocols/pubsub/sub.c
  22. +3 −2 src/protocols/reqrep/req.c
  23. +9 −6 src/protocols/reqrep/xrep.c
  24. +7 −4 src/protocols/reqrep/xreq.c
  25. +3 −2 src/protocols/survey/surveyor.c
  26. +7 −4 src/protocols/survey/xrespondent.c
  27. +7 −4 src/protocols/survey/xsurveyor.c
  28. +4 −3 src/protocols/utils/dist.c
  29. +2 −1 src/protocols/utils/excl.c
  30. +5 −4 src/protocols/utils/priolist.c
  31. +2 −1 src/transports/inproc/cinproc.c
  32. +2 −1 src/transports/inproc/sinproc.c
  33. +3 −2 src/transports/ipc/aipc.c
  34. +3 −2 src/transports/ipc/cipc.c
  35. +3 −2 src/transports/ipc/sipc.c
  36. +3 −2 src/transports/tcp/atcp.c
  37. +3 −2 src/transports/tcp/ctcp.c
  38. +3 −2 src/transports/tcp/stcp.c
  39. +3 −2 src/transports/utils/dns_getaddrinfo_a.inc
  40. +3 −2 src/transports/utils/streamhdr.c
  41. +2 −2 src/utils/chunk.c
  42. +1 −1 src/utils/chunkref.c
  43. +4 −3 src/utils/clock.c
  44. +4 −3 src/utils/list.c
  45. +2 −1 tests/block.c
  46. +4 −3 tests/device.c
  47. +2 −1 tests/inproc_shutdown.c
  48. +2 −3 tests/ipc_shutdown.c
  49. +2 −2 tests/msg.c
  50. +3 −2 tests/poll.c
  51. +3 −2 tests/tcp_shutdown.c
  52. +1 −1 tests/term.c
  53. +10 −6 tests/testutil.h
  54. +2 −1 tools/nanocat.c
View
12 perf/inproc_lat.c
@@ -23,6 +23,8 @@
#include "../src/nn.h"
#include "../src/pair.h"
+#include "../src/utils/attr.h"
+
#include "../src/utils/err.c"
#include "../src/utils/thread.c"
#include "../src/utils/sleep.c"
@@ -36,7 +38,7 @@
static size_t message_size;
static int roundtrip_count;
-void worker (void *arg)
+void worker (NN_UNUSED void *arg)
{
int rc;
int s;
@@ -53,9 +55,9 @@ void worker (void *arg)
for (i = 0; i != roundtrip_count; i++) {
rc = nn_recv (s, buf, message_size, 0);
- assert (rc == message_size);
+ assert (rc == (int)message_size);
rc = nn_send (s, buf, message_size, 0);
- assert (rc == message_size);
+ assert (rc == (int)message_size);
}
free (buf);
@@ -99,9 +101,9 @@ int main (int argc, char *argv [])
for (i = 0; i != roundtrip_count; i++) {
rc = nn_send (s, buf, message_size, 0);
- assert (rc == message_size);
+ assert (rc == (int)message_size);
rc = nn_recv (s, buf, message_size, 0);
- assert (rc == message_size);
+ assert (rc == (int)message_size);
}
elapsed = nn_stopwatch_term (&stopwatch);
View
8 perf/inproc_thr.c
@@ -23,6 +23,8 @@
#include "../src/nn.h"
#include "../src/pair.h"
+#include "../src/utils/attr.h"
+
#include "../src/utils/err.c"
#include "../src/utils/thread.c"
#include "../src/utils/stopwatch.c"
@@ -35,7 +37,7 @@
static size_t message_size;
static int message_count;
-void worker (void *arg)
+void worker (NN_UNUSED void *arg)
{
int rc;
int s;
@@ -56,7 +58,7 @@ void worker (void *arg)
for (i = 0; i != message_count; i++) {
rc = nn_send (s, buf, message_size, 0);
- assert (rc == message_size);
+ assert (rc == (int)message_size);
}
free (buf);
@@ -102,7 +104,7 @@ int main (int argc, char *argv [])
for (i = 0; i != message_count; i++) {
rc = nn_recv (s, buf, message_size, 0);
- assert (rc == message_size);
+ assert (rc == (int)message_size);
}
elapsed = nn_stopwatch_term (&stopwatch);
View
4 perf/local_lat.c
@@ -63,9 +63,9 @@ int main (int argc, char *argv [])
for (i = 0; i != rts; i++) {
nbytes = nn_recv (s, buf, sz, 0);
- assert (nbytes == sz);
+ assert (nbytes == (int)sz);
nbytes = nn_send (s, buf, sz, 0);
- assert (nbytes == sz);
+ assert (nbytes == (int)sz);
}
free (buf);
View
2 perf/local_thr.c
@@ -66,7 +66,7 @@ int main (int argc, char *argv [])
nn_stopwatch_init (&sw);
for (i = 0; i != count; i++) {
nbytes = nn_recv (s, buf, sz, 0);
- assert (nbytes == sz);
+ assert (nbytes == (int)sz);
}
total = nn_stopwatch_term (&sw);
if (total == 0)
View
6 perf/remote_lat.c
@@ -45,7 +45,7 @@ int main (int argc, char *argv [])
struct nn_stopwatch sw;
uint64_t total;
double lat;
-
+
if (argc != 4) {
printf ("usage: remote_lat <connect-to> <msg-size> <roundtrips>\n");
@@ -70,9 +70,9 @@ int main (int argc, char *argv [])
nn_stopwatch_init (&sw);
for (i = 0; i != rts; i++) {
nbytes = nn_send (s, buf, sz, 0);
- assert (nbytes == sz);
+ assert (nbytes == (int)sz);
nbytes = nn_recv (s, buf, sz, 0);
- assert (nbytes == sz);
+ assert (nbytes == (int)sz);
}
total = nn_stopwatch_term (&sw);
View
2 perf/remote_thr.c
@@ -61,7 +61,7 @@ int main (int argc, char *argv [])
for (i = 0; i != count; i++) {
nbytes = nn_send (s, buf, sz, 0);
- assert (nbytes == sz);
+ assert (nbytes == (int)sz);
}
free (buf);
View
3 src/aio/timer.c
@@ -26,6 +26,7 @@
#include "../utils/cont.h"
#include "../utils/fast.h"
#include "../utils/err.h"
+#include "../utils/attr.h"
/* Timer state reflects the state as seen by the user thread. It says nothing
about the state of affairs in the worker thread. */
@@ -87,7 +88,7 @@ void nn_timer_stop (struct nn_timer *self)
}
static void nn_timer_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_timer *timer;
View
11 src/aio/usock_posix.inc
@@ -26,6 +26,7 @@
#include "../utils/cont.h"
#include "../utils/fast.h"
#include "../utils/err.h"
+#include "../utils/attr.h"
#include <string.h>
#include <unistd.h>
@@ -504,7 +505,7 @@ static int nn_internal_tasks (struct nn_usock *usock, int src, int type)
}
static void nn_usock_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_usock *usock;
@@ -570,7 +571,7 @@ finish3:
}
static void nn_usock_handler (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
int rc;
struct nn_usock *usock;
@@ -1004,10 +1005,10 @@ static int nn_usock_send_raw (struct nn_usock *self, struct msghdr *hdr)
/* Some bytes were sent. Adjust the iovecs accordingly. */
while (nbytes) {
- if (nbytes >= hdr->msg_iov->iov_len) {
+ if (nbytes >= (ssize_t)hdr->msg_iov->iov_len) {
--hdr->msg_iovlen;
if (!hdr->msg_iovlen) {
- nn_assert (nbytes == hdr->msg_iov->iov_len);
+ nn_assert (nbytes == (ssize_t)hdr->msg_iov->iov_len);
return 0;
}
nbytes -= hdr->msg_iov->iov_len;
@@ -1093,7 +1094,7 @@ static int nn_usock_recv_raw (struct nn_usock *self, void *buf, size_t *len)
self->in.batch_len = nbytes;
self->in.batch_pos = 0;
if (nbytes) {
- sz = nbytes > length ? length : nbytes;
+ sz = nbytes > (ssize_t)length ? length : (size_t)nbytes;
memcpy (buf, self->in.batch, sz);
length -= sz;
self->in.batch_pos += sz;
View
3 src/aio/worker_posix.inc
@@ -26,6 +26,7 @@
#include "../utils/err.h"
#include "../utils/fast.h"
#include "../utils/cont.h"
+#include "../utils/attr.h"
/* Private functions. */
static void nn_worker_routine (void *arg);
@@ -37,7 +38,7 @@ void nn_worker_fd_init (struct nn_worker_fd *self, int src,
self->owner = owner;
}
-void nn_worker_fd_term (struct nn_worker_fd *self)
+void nn_worker_fd_term (NN_UNUSED struct nn_worker_fd *self)
{
}
View
4 src/core/device.c
@@ -25,6 +25,7 @@
#include "../utils/err.h"
#include "../utils/fast.h"
#include "../utils/fd.h"
+#include "../utils/attr.h"
#include <string.h>
@@ -316,7 +317,8 @@ static int nn_device_twoway (int s1, nn_fd s1rcv, nn_fd s1snd,
#error
#endif
-static int nn_device_oneway (int s1, nn_fd s1rcv, int s2, nn_fd s2snd)
+static int nn_device_oneway (int s1, NN_UNUSED nn_fd s1rcv,
+ int s2, NN_UNUSED nn_fd s2snd)
{
int rc;
View
6 src/core/ep.c
@@ -29,6 +29,7 @@
#include "../utils/err.h"
#include "../utils/cont.h"
#include "../utils/fast.h"
+#include "../utils/attr.h"
#include <string.h>
@@ -142,7 +143,7 @@ int nn_ep_ispeer (struct nn_ep *self, int socktype)
static void nn_ep_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_ep *ep;
@@ -165,7 +166,8 @@ static void nn_ep_shutdown (struct nn_fsm *self, int src, int type,
}
-static void nn_ep_handler (struct nn_fsm *self, int src, int type, void *srcptr)
+static void nn_ep_handler (struct nn_fsm *self, int src, int type,
+ NN_UNUSED void *srcptr)
{
struct nn_ep *ep;
View
3 src/core/epbase.c
@@ -24,6 +24,7 @@
#include "ep.h"
#include "sock.h"
+#include "../utils/attr.h"
void nn_epbase_init (struct nn_epbase *self,
const struct nn_epbase_vfptr *vfptr, void *hint)
@@ -32,7 +33,7 @@ void nn_epbase_init (struct nn_epbase *self,
self->ep = (struct nn_ep*) hint;
}
-void nn_epbase_term (struct nn_epbase *self)
+void nn_epbase_term (NN_UNUSED struct nn_epbase *self)
{
}
View
9 src/core/global.c
@@ -41,6 +41,7 @@
#include "../utils/glock.h"
#include "../utils/chunk.h"
#include "../utils/msg.h"
+#include "../utils/attr.h"
#include "../transports/inproc/inproc.h"
#include "../transports/ipc/ipc.h"
@@ -907,7 +908,7 @@ static void nn_global_submit_counter (int i, struct nn_sock *s,
self.hostname, self.appname, i, name,
timebuf, value);
}
- nn_assert (len < sizeof(buf));
+ nn_assert (len < (int)sizeof(buf));
(void) nn_send (self.statistics_socket, buf, len, NN_DONTWAIT);
}
}
@@ -948,7 +949,7 @@ static void nn_global_submit_level (int i, struct nn_sock *s,
self.hostname, self.appname, i, name,
timebuf, value);
}
- nn_assert (len < sizeof(buf));
+ nn_assert (len < (int)sizeof(buf));
(void) nn_send (self.statistics_socket, buf, len, NN_DONTWAIT);
}
}
@@ -1139,7 +1140,7 @@ struct nn_pool *nn_global_getpool ()
}
static void nn_global_handler (struct nn_fsm *self,
- int src, int type, void *srcptr)
+ int src, int type, NN_UNUSED void *srcptr)
{
struct nn_global *global;
@@ -1207,7 +1208,7 @@ static void nn_global_handler (struct nn_fsm *self,
}
static void nn_global_shutdown (struct nn_fsm *self,
- int src, int type, void *srcptr)
+ NN_UNUSED int src, NN_UNUSED int type, NN_UNUSED void *srcptr)
{
struct nn_global *global;
View
2 src/core/sock.c
@@ -1037,7 +1037,7 @@ void nn_sock_stat_increment (struct nn_sock *self, int name, int increment)
break;
case NN_STAT_CURRENT_SND_PRIORITY:
/* This is an exception, we don't want to increment priority */
- nn_assert(increment > 0 && increment <= 16 || increment == -1);
+ nn_assert((increment > 0 && increment <= 16) || increment == -1);
self->statistics.current_snd_priority = increment;
break;
case NN_STAT_CURRENT_EP_ERRORS:
View
3 src/core/sockbase.c
@@ -25,6 +25,7 @@
#include "sock.h"
#include "../utils/err.h"
+#include "../utils/attr.h"
void nn_sockbase_init (struct nn_sockbase *self,
const struct nn_sockbase_vfptr *vfptr, void *hint)
@@ -33,7 +34,7 @@ void nn_sockbase_init (struct nn_sockbase *self,
self->sock = (struct nn_sock*) hint;
}
-void nn_sockbase_term (struct nn_sockbase *self)
+void nn_sockbase_term (NN_UNUSED struct nn_sockbase *self)
{
}
View
11 src/protocols/bus/xbus.c
@@ -31,6 +31,7 @@
#include "../../utils/alloc.h"
#include "../../utils/list.h"
#include "../../utils/int.h"
+#include "../../utils/attr.h"
#include <stddef.h>
#include <string.h>
@@ -190,14 +191,16 @@ int nn_xbus_recv (struct nn_sockbase *self, struct nn_msg *msg)
return 0;
}
-int nn_xbus_setopt (struct nn_sockbase *self, int level, int option,
- const void *optval, size_t optvallen)
+int nn_xbus_setopt (NN_UNUSED struct nn_sockbase *self, NN_UNUSED int level,
+ NN_UNUSED int option,
+ NN_UNUSED const void *optval, NN_UNUSED size_t optvallen)
{
return -ENOPROTOOPT;
}
-int nn_xbus_getopt (struct nn_sockbase *self, int level, int option,
- void *optval, size_t *optvallen)
+int nn_xbus_getopt (NN_UNUSED struct nn_sockbase *self, NN_UNUSED int level,
+ NN_UNUSED int option,
+ NN_UNUSED void *optval, NN_UNUSED size_t *optvallen)
{
return -ENOPROTOOPT;
}
View
11 src/protocols/pair/xpair.c
@@ -32,6 +32,7 @@
#include "../../utils/fast.h"
#include "../../utils/alloc.h"
#include "../../utils/list.h"
+#include "../../utils/attr.h"
struct nn_xpair {
struct nn_sockbase sockbase;
@@ -145,14 +146,16 @@ static int nn_xpair_recv (struct nn_sockbase *self, struct nn_msg *msg)
return rc < 0 ? rc : 0;
}
-static int nn_xpair_setopt (struct nn_sockbase *self, int level, int option,
- const void *optval, size_t optvallen)
+static int nn_xpair_setopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED const void *optval, NN_UNUSED size_t optvallen)
{
return -ENOPROTOOPT;
}
-static int nn_xpair_getopt (struct nn_sockbase *self, int level, int option,
- void *optval, size_t *optvallen)
+static int nn_xpair_getopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED void *optval, NN_UNUSED size_t *optvallen)
{
return -ENOPROTOOPT;
}
View
17 src/protocols/pipeline/xpull.c
@@ -33,6 +33,7 @@
#include "../../utils/fast.h"
#include "../../utils/alloc.h"
#include "../../utils/list.h"
+#include "../../utils/attr.h"
struct nn_xpull_data {
struct nn_fq_data fq;
@@ -123,7 +124,8 @@ static void nn_xpull_rm (struct nn_sockbase *self, struct nn_pipe *pipe)
nn_free (data);
}
-static void nn_xpull_in (struct nn_sockbase *self, struct nn_pipe *pipe)
+static void nn_xpull_in (NN_UNUSED struct nn_sockbase *self,
+ struct nn_pipe *pipe)
{
struct nn_xpull *xpull;
struct nn_xpull_data *data;
@@ -133,7 +135,8 @@ static void nn_xpull_in (struct nn_sockbase *self, struct nn_pipe *pipe)
nn_fq_in (&xpull->fq, pipe, &data->fq);
}
-static void nn_xpull_out (struct nn_sockbase *self, struct nn_pipe *pipe)
+static void nn_xpull_out (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED struct nn_pipe *pipe)
{
/* We are not going to send any messages, so there's no point is
maintaining a list of pipes ready for sending. */
@@ -156,14 +159,16 @@ static int nn_xpull_recv (struct nn_sockbase *self, struct nn_msg *msg)
return rc < 0 ? rc : 0;
}
-static int nn_xpull_setopt (struct nn_sockbase *self, int level, int option,
- const void *optval, size_t optvallen)
+static int nn_xpull_setopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED const void *optval, NN_UNUSED size_t optvallen)
{
return -ENOPROTOOPT;
}
-static int nn_xpull_getopt (struct nn_sockbase *self, int level, int option,
- void *optval, size_t *optvallen)
+static int nn_xpull_getopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED void *optval, NN_UNUSED size_t *optvallen)
{
return -ENOPROTOOPT;
}
View
14 src/protocols/pipeline/xpush.c
@@ -32,6 +32,7 @@
#include "../../utils/fast.h"
#include "../../utils/alloc.h"
#include "../../utils/list.h"
+#include "../../utils/attr.h"
struct nn_xpush_data {
struct nn_lb_data lb;
@@ -133,7 +134,8 @@ static void nn_xpush_rm (struct nn_sockbase *self, struct nn_pipe *pipe)
nn_lb_get_priority (&xpush->lb));
}
-static void nn_xpush_in (struct nn_sockbase *self, struct nn_pipe *pipe)
+static void nn_xpush_in (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED struct nn_pipe *pipe)
{
/* We are not going to receive any messages, so there's no need to store
the list of inbound pipes. */
@@ -163,14 +165,16 @@ static int nn_xpush_send (struct nn_sockbase *self, struct nn_msg *msg)
msg, NULL);
}
-static int nn_xpush_setopt (struct nn_sockbase *self, int level, int option,
- const void *optval, size_t optvallen)
+static int nn_xpush_setopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED const void *optval, NN_UNUSED size_t optvallen)
{
return -ENOPROTOOPT;
}
-static int nn_xpush_getopt (struct nn_sockbase *self, int level, int option,
- void *optval, size_t *optvallen)
+static int nn_xpush_getopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED void *optval, NN_UNUSED size_t *optvallen)
{
return -ENOPROTOOPT;
}
View
16 src/protocols/pubsub/pub.c
@@ -32,6 +32,7 @@
#include "../../utils/fast.h"
#include "../../utils/alloc.h"
#include "../../utils/list.h"
+#include "../../utils/attr.h"
#include <stddef.h>
@@ -130,7 +131,8 @@ static void nn_pub_rm (struct nn_sockbase *self, struct nn_pipe *pipe)
nn_free (data);
}
-static void nn_pub_in (struct nn_sockbase *self, struct nn_pipe *pipe)
+static void nn_pub_in (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED struct nn_pipe *pipe)
{
/* We shouldn't get any messages from subscribers. */
nn_assert (0);
@@ -147,7 +149,7 @@ static void nn_pub_out (struct nn_sockbase *self, struct nn_pipe *pipe)
nn_dist_out (&pub->outpipes, pipe, &data->item);
}
-static int nn_pub_events (struct nn_sockbase *self)
+static int nn_pub_events (NN_UNUSED struct nn_sockbase *self)
{
return NN_SOCKBASE_EVENT_OUT;
}
@@ -158,14 +160,16 @@ static int nn_pub_send (struct nn_sockbase *self, struct nn_msg *msg)
msg, NULL);
}
-static int nn_pub_setopt (struct nn_sockbase *self, int level, int option,
- const void *optval, size_t optvallen)
+static int nn_pub_setopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED const void *optval, NN_UNUSED size_t optvallen)
{
return -ENOPROTOOPT;
}
-static int nn_pub_getopt (struct nn_sockbase *self, int level, int option,
- void *optval, size_t *optvallen)
+static int nn_pub_getopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED void *optval, NN_UNUSED size_t *optvallen)
{
return -ENOPROTOOPT;
}
View
9 src/protocols/pubsub/sub.c
@@ -34,6 +34,7 @@
#include "../../utils/fast.h"
#include "../../utils/alloc.h"
#include "../../utils/list.h"
+#include "../../utils/attr.h"
struct nn_sub_data {
struct nn_fq_data fq;
@@ -137,7 +138,8 @@ static void nn_sub_in (struct nn_sockbase *self, struct nn_pipe *pipe)
nn_fq_in (&sub->fq, pipe, &data->fq);
}
-static void nn_sub_out (struct nn_sockbase *self, struct nn_pipe *pipe)
+static void nn_sub_out (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED struct nn_pipe *pipe)
{
/* We are not going to send any messages until subscription forwarding
is implemented, so there's no point is maintaining a list of pipes
@@ -202,8 +204,9 @@ static int nn_sub_setopt (struct nn_sockbase *self, int level, int option,
return -ENOPROTOOPT;
}
-static int nn_sub_getopt (struct nn_sockbase *self, int level, int option,
- void *optval, size_t *optvallen)
+static int nn_sub_getopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED void *optval, NN_UNUSED size_t *optvallen)
{
return -ENOPROTOOPT;
}
View
5 src/protocols/reqrep/req.c
@@ -36,6 +36,7 @@
#include "../../utils/wire.h"
#include "../../utils/list.h"
#include "../../utils/int.h"
+#include "../../utils/attr.h"
#include <stddef.h>
#include <string.h>
@@ -367,7 +368,7 @@ static int nn_req_getopt (struct nn_sockbase *self, int level, int option,
}
static void nn_req_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_req *req;
@@ -390,7 +391,7 @@ static void nn_req_shutdown (struct nn_fsm *self, int src, int type,
}
static void nn_req_handler (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_req *req;
View
15 src/protocols/reqrep/xrep.c
@@ -32,6 +32,7 @@
#include "../../utils/random.h"
#include "../../utils/wire.h"
#include "../../utils/list.h"
+#include "../../utils/attr.h"
#include <string.h>
@@ -126,11 +127,11 @@ void nn_xrep_in (struct nn_sockbase *self, struct nn_pipe *pipe)
xrep = nn_cont (self, struct nn_xrep, sockbase);
data = nn_pipe_getdata (pipe);
-
+
nn_fq_in (&xrep->inpipes, pipe, &data->initem);
}
-void nn_xrep_out (struct nn_sockbase *self, struct nn_pipe *pipe)
+void nn_xrep_out (NN_UNUSED struct nn_sockbase *self, struct nn_pipe *pipe)
{
struct nn_xrep_data *data;
@@ -238,14 +239,16 @@ int nn_xrep_recv (struct nn_sockbase *self, struct nn_msg *msg)
return 0;
}
-int nn_xrep_setopt (struct nn_sockbase *self, int level, int option,
- const void *optval, size_t optvallen)
+int nn_xrep_setopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED const void *optval, NN_UNUSED size_t optvallen)
{
return -ENOPROTOOPT;
}
-int nn_xrep_getopt (struct nn_sockbase *self, int level, int option,
- void *optval, size_t *optvallen)
+int nn_xrep_getopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED void *optval, NN_UNUSED size_t *optvallen)
{
return -ENOPROTOOPT;
}
View
11 src/protocols/reqrep/xreq.c
@@ -30,6 +30,7 @@
#include "../../utils/fast.h"
#include "../../utils/alloc.h"
#include "../../utils/list.h"
+#include "../../utils/attr.h"
struct nn_xreq_data {
struct nn_lb_data lb;
@@ -197,14 +198,16 @@ int nn_xreq_recv (struct nn_sockbase *self, struct nn_msg *msg)
return 0;
}
-int nn_xreq_setopt (struct nn_sockbase *self, int level, int option,
- const void *optval, size_t optvallen)
+int nn_xreq_setopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED const void *optval, NN_UNUSED size_t optvallen)
{
return -ENOPROTOOPT;
}
-int nn_xreq_getopt (struct nn_sockbase *self, int level, int option,
- void *optval, size_t *optvallen)
+int nn_xreq_getopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED void *optval, NN_UNUSED size_t *optvallen)
{
return -ENOPROTOOPT;
}
View
5 src/protocols/survey/surveyor.c
@@ -37,6 +37,7 @@
#include "../../utils/random.h"
#include "../../utils/list.h"
#include "../../utils/int.h"
+#include "../../utils/attr.h"
#include <string.h>
@@ -303,7 +304,7 @@ static int nn_surveyor_getopt (struct nn_sockbase *self, int level, int option,
}
static void nn_surveyor_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_surveyor *surveyor;
@@ -326,7 +327,7 @@ static void nn_surveyor_shutdown (struct nn_fsm *self, int src, int type,
}
static void nn_surveyor_handler (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
int rc;
struct nn_surveyor *surveyor;
View
11 src/protocols/survey/xrespondent.c
@@ -30,6 +30,7 @@
#include "../../utils/fast.h"
#include "../../utils/alloc.h"
#include "../../utils/list.h"
+#include "../../utils/attr.h"
/* Private functions. */
static void nn_xrespondent_destroy (struct nn_sockbase *self);
@@ -146,14 +147,16 @@ int nn_xrespondent_recv (struct nn_sockbase *self, struct nn_msg *msg)
return 0;
}
-int nn_xrespondent_setopt (struct nn_sockbase *self, int level, int option,
- const void *optval, size_t optvallen)
+int nn_xrespondent_setopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED const void *optval, NN_UNUSED size_t optvallen)
{
return -ENOPROTOOPT;
}
-int nn_xrespondent_getopt (struct nn_sockbase *self, int level, int option,
- void *optval, size_t *optvallen)
+int nn_xrespondent_getopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED void *optval, NN_UNUSED size_t *optvallen)
{
return -ENOPROTOOPT;
}
View
11 src/protocols/survey/xsurveyor.c
@@ -31,6 +31,7 @@
#include "../../utils/list.h"
#include "../../utils/alloc.h"
#include "../../utils/list.h"
+#include "../../utils/attr.h"
#include <stddef.h>
@@ -178,14 +179,16 @@ int nn_xsurveyor_recv (struct nn_sockbase *self, struct nn_msg *msg)
return 0;
}
-int nn_xsurveyor_setopt (struct nn_sockbase *self, int level, int option,
- const void *optval, size_t optvallen)
+int nn_xsurveyor_setopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED const void *optval, NN_UNUSED size_t optvallen)
{
return -ENOPROTOOPT;
}
-int nn_xsurveyor_getopt (struct nn_sockbase *self, int level, int option,
- void *optval, size_t *optvallen)
+int nn_xsurveyor_getopt (NN_UNUSED struct nn_sockbase *self,
+ NN_UNUSED int level, NN_UNUSED int option,
+ NN_UNUSED void *optval, NN_UNUSED size_t *optvallen)
{
return -ENOPROTOOPT;
}
View
7 src/protocols/utils/dist.c
@@ -25,6 +25,7 @@
#include "../../utils/err.h"
#include "../../utils/cont.h"
#include "../../utils/fast.h"
+#include "../../utils/attr.h"
#include <stddef.h>
@@ -40,14 +41,14 @@ void nn_dist_term (struct nn_dist *self)
nn_list_term (&self->pipes);
}
-void nn_dist_add (struct nn_dist *self, struct nn_pipe *pipe,
+void nn_dist_add (NN_UNUSED struct nn_dist *self, struct nn_pipe *pipe,
struct nn_dist_data *data)
{
data->pipe = pipe;
nn_list_item_init (&data->item);
}
-void nn_dist_rm (struct nn_dist *self, struct nn_pipe *pipe,
+void nn_dist_rm (struct nn_dist *self, NN_UNUSED struct nn_pipe *pipe,
struct nn_dist_data *data)
{
if (nn_list_item_isinlist (&data->item)) {
@@ -57,7 +58,7 @@ void nn_dist_rm (struct nn_dist *self, struct nn_pipe *pipe,
nn_list_item_term (&data->item);
}
-void nn_dist_out (struct nn_dist *self, struct nn_pipe *pipe,
+void nn_dist_out (struct nn_dist *self, NN_UNUSED struct nn_pipe *pipe,
struct nn_dist_data *data)
{
++self->count;
View
3 src/protocols/utils/excl.c
@@ -24,6 +24,7 @@
#include "../../utils/fast.h"
#include "../../utils/err.h"
+#include "../../utils/attr.h"
void nn_excl_init (struct nn_excl *self)
{
@@ -51,7 +52,7 @@ int nn_excl_add (struct nn_excl *self, struct nn_pipe *pipe)
return 0;
}
-void nn_excl_rm (struct nn_excl *self, struct nn_pipe *pipe)
+void nn_excl_rm (struct nn_excl *self, NN_UNUSED struct nn_pipe *pipe)
{
nn_assert (self->pipe);
self->pipe = NULL;
View
9 src/protocols/utils/priolist.c
@@ -26,6 +26,7 @@
#include "../../utils/cont.h"
#include "../../utils/fast.h"
#include "../../utils/err.h"
+#include "../../utils/attr.h"
#include <stddef.h>
@@ -48,15 +49,15 @@ void nn_priolist_term (struct nn_priolist *self)
nn_list_term (&self->slots [i].pipes);
}
-void nn_priolist_add (struct nn_priolist *self, struct nn_pipe *pipe,
+void nn_priolist_add (NN_UNUSED struct nn_priolist *self, struct nn_pipe *pipe,
struct nn_priolist_data *data, int priority)
{
data->pipe = pipe;
data->priority = priority;
nn_list_item_init (&data->item);
}
-void nn_priolist_rm (struct nn_priolist *self, struct nn_pipe *pipe,
+void nn_priolist_rm (struct nn_priolist *self, NN_UNUSED struct nn_pipe *pipe,
struct nn_priolist_data *data)
{
struct nn_priolist_slot *slot;
@@ -101,8 +102,8 @@ void nn_priolist_rm (struct nn_priolist *self, struct nn_pipe *pipe,
}
}
-void nn_priolist_activate (struct nn_priolist *self, struct nn_pipe *pipe,
- struct nn_priolist_data *data)
+void nn_priolist_activate (struct nn_priolist *self,
+ NN_UNUSED struct nn_pipe *pipe, struct nn_priolist_data *data)
{
struct nn_priolist_slot *slot;
View
3 src/transports/inproc/cinproc.c
@@ -28,6 +28,7 @@
#include "../../utils/err.h"
#include "../../utils/cont.h"
#include "../../utils/alloc.h"
+#include "../../utils/attr.h"
#include <stddef.h>
@@ -117,7 +118,7 @@ static void nn_cinproc_connect (struct nn_ins_item *self,
}
static void nn_cinproc_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_cinproc *cinproc;
View
3 src/transports/inproc/sinproc.c
@@ -24,6 +24,7 @@
#include "../../utils/err.h"
#include "../../utils/cont.h"
+#include "../../utils/attr.h"
#include <stddef.h>
@@ -198,7 +199,7 @@ static int nn_sinproc_recv (struct nn_pipebase *self, struct nn_msg *msg)
return NN_PIPEBASE_PARSED;
}
static void nn_sinproc_shutdown_events (struct nn_sinproc *self, int src,
- int type, void *srcptr)
+ int type, NN_UNUSED void *srcptr)
{
/* ******************************* */
/* Any-state events */
View
5 src/transports/ipc/aipc.c
@@ -26,6 +26,7 @@
#include "../../utils/err.h"
#include "../../utils/cont.h"
+#include "../../utils/attr.h"
#define NN_AIPC_STATE_IDLE 1
#define NN_AIPC_STATE_ACCEPTING 2
@@ -100,7 +101,7 @@ void nn_aipc_stop (struct nn_aipc *self)
}
static void nn_aipc_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_aipc *aipc;
@@ -139,7 +140,7 @@ static void nn_aipc_shutdown (struct nn_fsm *self, int src, int type,
}
static void nn_aipc_handler (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_aipc *aipc;
int val;
View
5 src/transports/ipc/cipc.c
@@ -34,6 +34,7 @@
#include "../../utils/cont.h"
#include "../../utils/alloc.h"
#include "../../utils/fast.h"
+#include "../../utils/attr.h"
#include <string.h>
#include <unistd.h>
@@ -154,7 +155,7 @@ static void nn_cipc_destroy (struct nn_epbase *self)
}
static void nn_cipc_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_cipc *cipc;
@@ -189,7 +190,7 @@ static void nn_cipc_shutdown (struct nn_fsm *self, int src, int type,
}
static void nn_cipc_handler (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_cipc *cipc;
View
5 src/transports/ipc/sipc.c
@@ -29,6 +29,7 @@
#include "../../utils/fast.h"
#include "../../utils/wire.h"
#include "../../utils/int.h"
+#include "../../utils/attr.h"
/* Types of messages passed via IPC transport. */
#define NN_SIPC_MSG_NORMAL 1
@@ -177,7 +178,7 @@ static int nn_sipc_recv (struct nn_pipebase *self, struct nn_msg *msg)
}
static void nn_sipc_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_sipc *sipc;
@@ -205,7 +206,7 @@ static void nn_sipc_shutdown (struct nn_fsm *self, int src, int type,
}
static void nn_sipc_handler (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
int rc;
struct nn_sipc *sipc;
View
5 src/transports/tcp/atcp.c
@@ -24,6 +24,7 @@
#include "../../utils/err.h"
#include "../../utils/cont.h"
+#include "../../utils/attr.h"
#define NN_ATCP_STATE_IDLE 1
#define NN_ATCP_STATE_ACCEPTING 2
@@ -98,7 +99,7 @@ void nn_atcp_stop (struct nn_atcp *self)
}
static void nn_atcp_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_atcp *atcp;
@@ -137,7 +138,7 @@ static void nn_atcp_shutdown (struct nn_fsm *self, int src, int type,
}
static void nn_atcp_handler (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_atcp *atcp;
int val;
View
5 src/transports/tcp/ctcp.c
@@ -39,6 +39,7 @@
#include "../../utils/alloc.h"
#include "../../utils/fast.h"
#include "../../utils/int.h"
+#include "../../utils/attr.h"
#include <string.h>
@@ -233,7 +234,7 @@ static void nn_ctcp_destroy (struct nn_epbase *self)
}
static void nn_ctcp_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_ctcp *ctcp;
@@ -270,7 +271,7 @@ static void nn_ctcp_shutdown (struct nn_fsm *self, int src, int type,
}
static void nn_ctcp_handler (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_ctcp *ctcp;
View
5 src/transports/tcp/stcp.c
@@ -27,6 +27,7 @@
#include "../../utils/fast.h"
#include "../../utils/wire.h"
#include "../../utils/int.h"
+#include "../../utils/attr.h"
/* States of the object as a whole. */
#define NN_STCP_STATE_IDLE 1
@@ -170,7 +171,7 @@ static int nn_stcp_recv (struct nn_pipebase *self, struct nn_msg *msg)
}
static void nn_stcp_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_stcp *stcp;
@@ -198,7 +199,7 @@ static void nn_stcp_shutdown (struct nn_fsm *self, int src, int type,
}
static void nn_stcp_handler (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
int rc;
struct nn_stcp *stcp;
View
5 src/transports/utils/dns_getaddrinfo_a.inc
@@ -24,6 +24,7 @@
#include "../../utils/err.h"
#include "../../utils/cont.h"
+#include "../../utils/attr.h"
#include "../../aio/ctx.h"
@@ -156,7 +157,7 @@ static void nn_dns_notify (union sigval sval)
}
static void nn_dns_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
int rc;
struct nn_dns *dns;
@@ -195,7 +196,7 @@ static void nn_dns_shutdown (struct nn_fsm *self, int src, int type,
}
static void nn_dns_handler (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_dns *dns;
View
5 src/transports/utils/streamhdr.c
@@ -28,6 +28,7 @@
#include "../../utils/cont.h"
#include "../../utils/fast.h"
#include "../../utils/wire.h"
+#include "../../utils/attr.h"
#include <stddef.h>
#include <string.h>
@@ -111,7 +112,7 @@ void nn_streamhdr_stop (struct nn_streamhdr *self)
}
static void nn_streamhdr_shutdown (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_streamhdr *streamhdr;
@@ -133,7 +134,7 @@ static void nn_streamhdr_shutdown (struct nn_fsm *self, int src, int type,
}
static void nn_streamhdr_handler (struct nn_fsm *self, int src, int type,
- void *srcptr)
+ NN_UNUSED void *srcptr)
{
struct nn_streamhdr *streamhdr;
struct nn_iovec iovec;
View
4 src/utils/chunk.c
@@ -101,7 +101,7 @@ void nn_chunk_free (void *p)
/* Decrement the reference count. Actual deallocation happens only if
it drops to zero. */
if (nn_atomic_dec (&self->refcount, 1) <= 1) {
-
+
/* Mark chunk as deallocated. */
nn_putl ((uint8_t*) (((uint32_t*) p) - 1), NN_CHUNK_TAG_DEALLOCATED);
@@ -136,7 +136,7 @@ void *nn_chunk_trim (void *p, size_t n)
self = nn_chunk_getptr (p);
/* Sanity check. We cannot trim more bytes than there are in the chunk. */
- nn_assert (n >= 0 && n <= self->size);
+ nn_assert (n <= self->size);
/* Adjust the chunk header. */
p = ((uint8_t*) p) + n;
View
2 src/utils/chunkref.c
@@ -96,7 +96,7 @@ void *nn_chunkref_getchunk (struct nn_chunkref *self)
void nn_chunkref_mv (struct nn_chunkref *dst, struct nn_chunkref *src)
{
memcpy (dst, src, src->ref [0] == 0xff ?
- sizeof (struct nn_chunkref_chunk) : src->ref [0] + 1);
+ (int)sizeof (struct nn_chunkref_chunk) : src->ref [0] + 1);
}
void nn_chunkref_cp (struct nn_chunkref *dst, struct nn_chunkref *src)
View
7 src/utils/clock.c
@@ -34,6 +34,7 @@
#include "clock.h"
#include "fast.h"
#include "err.h"
+#include "attr.h"
/* 1 millisecond expressed in CPU ticks. The value is chosen is such a way that
it works pretty well for CPU frequencies above 500MHz. */
@@ -77,7 +78,7 @@ static uint64_t nn_clock_time ()
QueryPerformanceFrequency (&tps);
QueryPerformanceCounter (&time);
- tpms = (double) (tps.QuadPart / 1000);
+ tpms = (double) (tps.QuadPart / 1000);
return (uint64_t) (time.QuadPart / tpms);
#elif defined NN_HAVE_OSX
@@ -91,7 +92,7 @@ static uint64_t nn_clock_time ()
ticks = mach_absolute_time ();
return ticks * nn_clock_timebase_info.numer /
nn_clock_timebase_info.denom / 1000000;
-
+
#elif defined NN_HAVE_CLOCK_MONOTONIC
int rc;
@@ -125,7 +126,7 @@ void nn_clock_init (struct nn_clock *self)
self->last_time = nn_clock_time ();
}
-void nn_clock_term (struct nn_clock *self)
+void nn_clock_term (NN_UNUSED struct nn_clock *self)
{
}
View
7 src/utils/list.c
@@ -24,6 +24,7 @@
#include "list.h"
#include "err.h"
+#include "attr.h"
void nn_list_init (struct nn_list *self)
{
@@ -47,7 +48,7 @@ struct nn_list_item *nn_list_begin (struct nn_list *self)
return self->first;
}
-struct nn_list_item *nn_list_end (struct nn_list *self)
+struct nn_list_item *nn_list_end (NN_UNUSED struct nn_list *self)
{
return NULL;
}
@@ -61,7 +62,7 @@ struct nn_list_item *nn_list_prev (struct nn_list *self,
return it->prev;
}
-struct nn_list_item *nn_list_next (struct nn_list *self,
+struct nn_list_item *nn_list_next (NN_UNUSED struct nn_list *self,
struct nn_list_item *it)
{
nn_assert (it->next != NN_LIST_NOTINLIST);
@@ -82,7 +83,7 @@ void nn_list_insert (struct nn_list *self, struct nn_list_item *item,
if (!self->first || self->first == it)
self->first = item;
if (!it)
- self->last = item;
+ self->last = item;
}
struct nn_list_item *nn_list_erase (struct nn_list *self,
View
3 tests/block.c
@@ -24,6 +24,7 @@
#include "../src/pair.h"
#include "testutil.h"
+#include "../src/utils/attr.h"
#include "../src/utils/thread.c"
/* This test checks whether blocking on send/recv works as expected. */
@@ -33,7 +34,7 @@
int sc;
int sb;
-void worker (void *arg)
+void worker (NN_UNUSED void *arg)
{
/* Wait 0.1 sec for the main thread to block. */
nn_sleep (100);
View
7 tests/device.c
@@ -28,6 +28,7 @@
#include "../src/inproc.h"
#include "testutil.h"
+#include "../src/utils/attr.h"
#include "../src/utils/thread.c"
#define SOCKET_ADDRESS_A "inproc://a"
@@ -36,7 +37,7 @@
#define SOCKET_ADDRESS_D "inproc://d"
#define SOCKET_ADDRESS_E "inproc://e"
-void device1 (void *arg)
+void device1 (NN_UNUSED void *arg)
{
int rc;
int deva;
@@ -57,7 +58,7 @@ void device1 (void *arg)
test_close (deva);
}
-void device2 (void *arg)
+void device2 (NN_UNUSED void *arg)
{
int rc;
int devc;
@@ -78,7 +79,7 @@ void device2 (void *arg)
test_close (devc);
}
-void device3 (void *arg)
+void device3 (NN_UNUSED void *arg)
{
int rc;
int deve;
View
3 tests/inproc_shutdown.c
@@ -26,14 +26,15 @@
#include "../src/inproc.h"
#include "testutil.h"
+#include "../src/utils/attr.h"
#include "../src/utils/thread.c"
/* Stress test the inproc transport. */
#define THREAD_COUNT 100
#define SOCKET_ADDRESS "inproc://test"
-static void routine (void *arg)
+static void routine (NN_UNUSED void *arg)
{
int s;
View
5 tests/ipc_shutdown.c
@@ -37,7 +37,7 @@
volatile int active;
-static void routine (void *arg)
+static void routine (NN_UNUSED void *arg)
{
int s;
@@ -49,9 +49,8 @@ static void routine (void *arg)
test_close (s);
}
-static void routine2 (void *arg)
+static void routine2 (NN_UNUSED void *arg)
{
- int rc;
int s;
int i;
View
4 tests/msg.c
@@ -103,7 +103,7 @@ int main ()
sc = test_socket (AF_SP, NN_PAIR);
test_connect (sc, SOCKET_ADDRESS_TCP);
- for (i = 0; i < sizeof (longdata); ++i)
+ for (i = 0; i < (int) sizeof (longdata); ++i)
longdata[i] = '0' + (i % 10);
longdata [sizeof (longdata) - 1] = 0;
test_send (sb, longdata);
@@ -112,7 +112,7 @@ int main ()
errno_assert (rc >= 0);
nn_assert (rc == sizeof (longdata) - 1);
nn_assert (buf2);
- for (i = 0; i < sizeof (longdata) - 1; ++i)
+ for (i = 0; i < (int) sizeof (longdata) - 1; ++i)
nn_assert (buf2 [i] == longdata [i]);
rc = nn_freemsg (buf2);
errno_assert (rc == 0);
View
5 tests/poll.c
@@ -25,6 +25,7 @@
#include "../src/inproc.h"
#include "testutil.h"
+#include "../src/utils/attr.h"
#include "../src/utils/thread.c"
#if defined NN_HAVE_WINDOWS
@@ -39,13 +40,13 @@
int sc;
-void routine1 (void *arg)
+void routine1 (NN_UNUSED void *arg)
{
nn_sleep (10);
test_send (sc, "ABC");
}
-void routine2 (void *arg)
+void routine2 (NN_UNUSED void *arg)
{
nn_sleep (10);
nn_term ();
View
5 tests/tcp_shutdown.c
@@ -27,6 +27,7 @@
#include "../src/tcp.h"
#include "testutil.h"
+#include "../src/utils/attr.h"
#include "../src/utils/thread.c"
/* Stress test the TCP transport. */
@@ -37,7 +38,7 @@
volatile int active;
-static void routine (void *arg)
+static void routine (NN_UNUSED void *arg)
{
int rc;
int s;
@@ -50,7 +51,7 @@ static void routine (void *arg)
test_close (s);
}
-static void routine2 (void *arg)
+static void routine2 (NN_UNUSED void *arg)
{
int rc;
int s;
View
2 tests/term.c
@@ -26,7 +26,7 @@
#include "../src/utils/thread.c"
#include "testutil.h"
-static void worker (void *arg)
+static void worker (NN_UNUSED void *arg)
{
int rc;
int s;
View
16 tests/testutil.h
@@ -23,6 +23,7 @@
#ifndef TESTUTIL_H_INCLUDED
#define TESTUTIL_H_INCLUDED
+#include "../src/utils/attr.h"
#include "../src/utils/err.c"
#include "../src/utils/sleep.c"
@@ -55,7 +56,8 @@ static int test_socket_impl (char *file, int line, int family, int protocol)
return sock;
}
-static int test_connect_impl (char *file, int line, int sock, char *address)
+static int NN_UNUSED test_connect_impl (char *file, int line,
+ int sock, char *address)
{
int rc;
@@ -70,7 +72,8 @@ static int test_connect_impl (char *file, int line, int sock, char *address)
return rc;
}
-static int test_bind_impl (char *file, int line, int sock, char *address)
+static int NN_UNUSED test_bind_impl (char *file, int line,
+ int sock, char *address)
{
int rc;
@@ -98,7 +101,8 @@ static void test_close_impl (char *file, int line, int sock)
}
}
-static void test_send_impl (char *file, int line, int sock, char *data)
+static void NN_UNUSED test_send_impl (char *file, int line,
+ int sock, char *data)
{
size_t data_len;
int rc;
@@ -112,15 +116,15 @@ static void test_send_impl (char *file, int line, int sock, char *data)
(int) errno, file, line);
nn_err_abort ();
}
- if (rc != data_len) {
+ if (rc != (int)data_len) {
fprintf (stderr, "Data to send is truncated: %d != %d (%s:%d)\n",
rc, (int) data_len,
file, line);
nn_err_abort ();
}
}
-static void test_recv_impl (char *file, int line, int sock, char *data)
+static void NN_UNUSED test_recv_impl (char *file, int line, int sock, char *data)
{
size_t data_len;
int rc;
@@ -139,7 +143,7 @@ static void test_recv_impl (char *file, int line, int sock, char *data)
(int) errno, file, line);
nn_err_abort ();
}
- if (rc != data_len) {
+ if (rc != (int)data_len) {
fprintf (stderr, "Received data has wrong length: %d != %d (%s:%d)\n",
rc, (int) data_len,
file, line);
View
3 tools/nanocat.c
@@ -601,7 +601,7 @@ int main (int argc, char **argv)
/* socket_name */ NULL,
/* send_delay */ 0.f,
/* send_interval */ -1.f,
- /* data_to_send */ {NULL, 0},
+ /* data_to_send */ {NULL, 0, 0},
/* echo_format */ NN_NO_ECHO
};
@@ -642,4 +642,5 @@ int main (int argc, char **argv)
nn_close (sock);
nn_free_options(&nn_cli, &options);
+ return 0;
}

0 comments on commit 24b4718

Please sign in to comment.
Something went wrong with that request. Please try again.