0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-14 09:47:56 +08:00

Fix unused parameter and variable warnings.

Backported from zeromq/libzmq@00aeadd

It fixes the following warnings:

8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---
In file included from /path/to/src/mechanism.cpp:22:0:
/path/to/src/mechanism.hpp:49:36: warning: unused parameter 'msg_' [-Wunused-parameter]
         virtual int encode (msg_t *msg_) { return 0; }
                                    ^
/path/to/src/mechanism.hpp:51:36: warning: unused parameter 'msg_' [-Wunused-parameter]
         virtual int decode (msg_t *msg_) { return 0; }
                                    ^
/path/to/src/mechanism.cpp:126:51: warning: unused parameter 'name_' [-Wunused-parameter]
 int zmq::mechanism_t::property (const std::string name_,
                                                   ^
/path/to/src/mechanism.cpp:127:45: warning: unused parameter 'value_' [-Wunused-parameter]
                                 const void *value_, size_t length_)
                                             ^
/path/to/src/mechanism.cpp:127:60: warning: unused parameter 'length_' [-Wunused-parameter]
                                 const void *value_, size_t length_)
                                                            ^

/path/to/src/mechanism.cpp:127:60: warning: unused parameter 'length_' [-Wunused-parameter]
                                 const void *value_, size_t length_)
                                                            ^

In file included from /path/to/src/pipe.cpp:28:0:
/path/to/src/ypipe_conflate.hpp: In instantiation of 'bool zmq::ypipe_conflate_t<T, N>::unwrite(T*) [with T = zmq::msg_t; int N = 256]':
/path/to/src/pipe.cpp:489:1:   required from here
/path/to/src/ypipe_conflate.hpp:73:33: warning: unused parameter 'value_' [-Wunused-parameter]
         inline bool unwrite (T *value_)
                                 ^

/path/to/src/zmq_utils.cpp:178:30: warning: unused parameter 'z85_public_key' [-Wunused-parameter]
 int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key)
                              ^
/path/to/src/zmq_utils.cpp:178:52: warning: unused parameter 'z85_secret_key' [-Wunused-parameter]
 int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key)
                                                    ^

/path/to/tests/test_hwm.cpp:205:57: warning: unused parameter 'recv_hwm' [-Wunused-parameter]
 int test_inproc_bind_and_close_first (int send_hwm, int recv_hwm)
                                                         ^
[ 69%] Linking CXX executable bin/test_connect_resolve
/path/to/tests/test_disconnect_inproc.cpp:31:14: warning: unused parameter 'argc' [-Wunused-parameter]
 int main(int argc, char** argv) {
              ^
/path/to/tests/test_disconnect_inproc.cpp:31:27: warning: unused parameter 'argv' [-Wunused-parameter]
 int main(int argc, char** argv) {
                           ^

/path/to/tests/test_stream.cpp:39:81: warning: missing initializer for member 'zmtp_greeting_t::as_server' [-Wmissing-field-initializers]
     = { { 0xFF, 0, 0, 0, 0, 0, 0, 0, 1, 0x7F }, { 3, 0 }, { 'N', 'U', 'L', 'L'} };
                                                                                 ^
/path/to/tests/test_stream.cpp:39:81: warning: missing initializer for member 'zmtp_greeting_t::filler' [-Wmissing-field-initializers]
8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---8<---

# Conflicts:
#	src/stream.cpp
#	src/stream_engine.cpp
#	tests/test_stream_disconnect_notifications.cpp
This commit is contained in:
Jean-Christophe Fillion-Robin 2016-01-30 04:13:39 -05:00
parent 4055bbb01f
commit d2687e75b6
8 changed files with 13 additions and 12 deletions

View File

@ -123,8 +123,8 @@ int zmq::mechanism_t::parse_metadata (const unsigned char *ptr_,
return 0;
}
int zmq::mechanism_t::property (const std::string name_,
const void *value_, size_t length_)
int zmq::mechanism_t::property (const std::string /* name_ */,
const void * /* value_ */, size_t /* length_ */)
{
// Default implementation does not check
// property values and returns 0 to signal success.

View File

@ -46,9 +46,9 @@ namespace zmq
// Process the handshake command received from the peer.
virtual int process_handshake_command (msg_t *msg_) = 0;
virtual int encode (msg_t *msg_) { return 0; }
virtual int encode (msg_t *) { return 0; }
virtual int decode (msg_t *msg_) { return 0; }
virtual int decode (msg_t *) { return 0; }
// Notifies mechanism about availability of ZAP message.
virtual int zap_msg_available () { return 0; }

View File

@ -70,7 +70,7 @@ namespace zmq
#endif
// There are no incomplete items for conflate ypipe
inline bool unwrite (T *value_)
inline bool unwrite (T *)
{
return false;
}

View File

@ -190,12 +190,13 @@ int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key)
// Is there a sensible errno to set here?
if (rc)
return rc;
zmq_z85_encode (z85_public_key, public_key, 32);
zmq_z85_encode (z85_secret_key, secret_key, 32);
return 0;
#else // requires libsodium
(void) z85_public_key, (void) z85_secret_key;
errno = ENOTSUP;
return -1;
#endif

View File

@ -19,7 +19,7 @@
#include "testutil.hpp"
int main (int argc, char *argv [])
int main (int, char *[])
{
const char *bind_to = "tcp://127.0.0.1:5555";

View File

@ -28,7 +28,7 @@ memcpy(zmq_msg_data(&msg), data, size + 1);
int publicationsReceived = 0;
bool isSubscribed = false;
int main(int argc, char** argv) {
int main(int, char**) {
setup_test_environment();
void* context = zmq_ctx_new();
void* pubSocket;

View File

@ -202,7 +202,7 @@ int test_inproc_connect_and_close_first (int send_hwm, int recv_hwm)
return send_count;
}
int test_inproc_bind_and_close_first (int send_hwm, int recv_hwm)
int test_inproc_bind_and_close_first (int send_hwm, int /* recv_hwm */)
{
void *ctx = zmq_ctx_new ();
assert (ctx);

View File

@ -36,10 +36,10 @@ typedef struct {
// 8-byte size is set to 1 for backwards compatibility
static zmtp_greeting_t greeting
= { { 0xFF, 0, 0, 0, 0, 0, 0, 0, 1, 0x7F }, { 3, 0 }, { 'N', 'U', 'L', 'L'} };
= { { 0xFF, 0, 0, 0, 0, 0, 0, 0, 1, 0x7F }, { 3, 0 }, { 'N', 'U', 'L', 'L'}, 0, { 0 } };
static void
test_stream_to_dealer (void)
test_stream_to_dealer (void)
{
int rc;