Resolve compile warnings

Thanks Andreas!
This commit is contained in:
Willem Toorop 2021-06-03 20:45:55 +02:00
parent 6dfbfa5dc5
commit 2a0114591a
34 changed files with 97 additions and 90 deletions

View File

@ -452,7 +452,7 @@ static inline int _gldns_custom_vsnprintf(char *str, size_t size, const char *fo
# define ATTR_UNUSED(x) x # define ATTR_UNUSED(x) x
#elif defined(__cplusplus) #elif defined(__cplusplus)
# define ATTR_UNUSED(x) # define ATTR_UNUSED(x)
#elif defined(HAVE_ATTR_UNUSED) #elif defined(__GNUC__)
# define ATTR_UNUSED(x) x __attribute__((unused)) # define ATTR_UNUSED(x) x __attribute__((unused))
#else /* !HAVE_ATTR_UNUSED */ #else /* !HAVE_ATTR_UNUSED */
# define ATTR_UNUSED(x) x # define ATTR_UNUSED(x) x

View File

@ -76,7 +76,7 @@ getdns_dict **response)
The getdns_general(3) and getdns_general_sync functions provide public entry The getdns_general(3) and getdns_general_sync functions provide public entry
points into the getdns API library to retrieve any valid responses to a query points into the getdns API library to retrieve any valid responses to a query
from the DNS (note that other namespaces in the context are not used). Most from the DNS (note that other namespaces in the context are not used). Most
typical use cases for applications are probably satisifed via calls to typical use cases for applications are probably satisfied via calls to
getdns_address(3) which would replace getaddrinfo(3). getdns_address(3) which would replace getaddrinfo(3).
.HP 3 .HP 3

View File

@ -1293,7 +1293,7 @@ transaction_id_cmp(const void *id1, const void *id2)
static void static void
NULL_update_callback( NULL_update_callback(
getdns_context *context, getdns_context_code_t code, void *userarg) getdns_context *context, getdns_context_code_t code, void *userarg)
{ (void)context; (void)code; (void)userarg; } { (void)context; (void)code; (void)userarg; /* unused parameters */ }
static int static int
netreq_expiry_cmp(const void *id1, const void *id2) netreq_expiry_cmp(const void *id1, const void *id2)
@ -3761,7 +3761,7 @@ uint32_t
getdns_context_get_num_pending_requests(const getdns_context* context, getdns_context_get_num_pending_requests(const getdns_context* context,
struct timeval* next_timeout) struct timeval* next_timeout)
{ {
(void)next_timeout; (void)next_timeout; /* unused parameter */
if (!context) if (!context)
return GETDNS_RETURN_INVALID_PARAMETER; return GETDNS_RETURN_INVALID_PARAMETER;
@ -4146,7 +4146,7 @@ getdns_context_set_use_threads(getdns_context* context, int use_threads) {
else else
r = ub_ctx_async(context->unbound_ctx, 0); r = ub_ctx_async(context->unbound_ctx, 0);
#else #else
(void)use_threads; (void)use_threads; /* unused parameter */
#endif #endif
return r == 0 ? GETDNS_RETURN_GOOD : GETDNS_RETURN_CONTEXT_UPDATE_FAIL; return r == 0 ? GETDNS_RETURN_GOOD : GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
} }
@ -5401,7 +5401,7 @@ getdns_context_set_tls_curves_list(
dispatch_updated(context, GETDNS_CONTEXT_CODE_TLS_CIPHER_LIST); dispatch_updated(context, GETDNS_CONTEXT_CODE_TLS_CIPHER_LIST);
return GETDNS_RETURN_GOOD; return GETDNS_RETURN_GOOD;
#else #else
(void)tls_curves_list; (void)tls_curves_list; /* unused parameter */
return GETDNS_RETURN_NOT_IMPLEMENTED; return GETDNS_RETURN_NOT_IMPLEMENTED;
#endif #endif
} }

View File

@ -122,7 +122,7 @@ getdns_convert_ulabel_to_alabel(const char *ulabel)
if (idn2_lookup_u8((uint8_t *)ulabel, &alabel, IDN2_TRANSITIONAL) == IDN2_OK) if (idn2_lookup_u8((uint8_t *)ulabel, &alabel, IDN2_TRANSITIONAL) == IDN2_OK)
return (char *)alabel; return (char *)alabel;
#else #else
(void)ulabel; (void)ulabel; /* unused parameter */
#endif #endif
return NULL; return NULL;
} }
@ -149,7 +149,7 @@ getdns_convert_alabel_to_ulabel(const char *alabel)
if (idn2_to_unicode_8z8z(alabel, &ulabel, 0) == IDN2_OK) if (idn2_to_unicode_8z8z(alabel, &ulabel, 0) == IDN2_OK)
return ulabel; return ulabel;
#else #else
(void)alabel; (void)alabel; /* unused parameter */
#endif #endif
return NULL; return NULL;
} }
@ -1901,8 +1901,8 @@ getdns_yaml2list(const char *str, getdns_list **list)
return GETDNS_RETURN_GENERIC_ERROR; return GETDNS_RETURN_GENERIC_ERROR;
} }
#else /* USE_YAML_CONFIG */ #else /* USE_YAML_CONFIG */
(void) str; (void) str; /* unused parameter */
(void) list; (void) list; /* unused parameter */
return GETDNS_RETURN_NOT_IMPLEMENTED; return GETDNS_RETURN_NOT_IMPLEMENTED;
#endif /* USE_YAML_CONFIG */ #endif /* USE_YAML_CONFIG */
} }
@ -1925,8 +1925,8 @@ getdns_yaml2bindata(const char *str, getdns_bindata **bindata)
return GETDNS_RETURN_GENERIC_ERROR; return GETDNS_RETURN_GENERIC_ERROR;
} }
#else /* USE_YAML_CONFIG */ #else /* USE_YAML_CONFIG */
(void) str; (void) str; /* unused parameter */
(void) bindata; (void) bindata; /* unused parameter */
return GETDNS_RETURN_NOT_IMPLEMENTED; return GETDNS_RETURN_NOT_IMPLEMENTED;
#endif /* USE_YAML_CONFIG */ #endif /* USE_YAML_CONFIG */
} }
@ -1949,8 +1949,8 @@ getdns_yaml2int(const char *str, uint32_t *value)
return GETDNS_RETURN_GENERIC_ERROR; return GETDNS_RETURN_GENERIC_ERROR;
} }
#else /* USE_YAML_CONFIG */ #else /* USE_YAML_CONFIG */
(void) str; (void) str; /* unused parameter */
(void) value; (void) value; /* unused parameter */
return GETDNS_RETURN_NOT_IMPLEMENTED; return GETDNS_RETURN_NOT_IMPLEMENTED;
#endif /* USE_YAML_CONFIG */ #endif /* USE_YAML_CONFIG */
} }

View File

@ -922,7 +922,7 @@ static getdns_dict *CD_extension(getdns_dns_req *dnsreq)
? dnssec_ok_checking_disabled_roadblock_avoidance ? dnssec_ok_checking_disabled_roadblock_avoidance
: dnssec_ok_checking_disabled_avoid_roadblocks; : dnssec_ok_checking_disabled_avoid_roadblocks;
#else #else
(void)dnsreq; (void)dnsreq; /* unused parameter */
return dnssec_ok_checking_disabled; return dnssec_ok_checking_disabled;
#endif #endif
} }

View File

@ -97,7 +97,7 @@ static void
getdns_libev_read_cb(struct ev_loop *l, struct ev_io *io, int revents) getdns_libev_read_cb(struct ev_loop *l, struct ev_io *io, int revents)
{ {
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)io->data; getdns_eventloop_event *el_ev = (getdns_eventloop_event *)io->data;
(void)l; (void)revents; (void)l; (void)revents; /* unused parameters */
assert(el_ev->read_cb); assert(el_ev->read_cb);
el_ev->read_cb(el_ev->userarg); el_ev->read_cb(el_ev->userarg);
} }
@ -106,7 +106,7 @@ static void
getdns_libev_write_cb(struct ev_loop *l, struct ev_io *io, int revents) getdns_libev_write_cb(struct ev_loop *l, struct ev_io *io, int revents)
{ {
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)io->data; getdns_eventloop_event *el_ev = (getdns_eventloop_event *)io->data;
(void)l; (void)revents; (void)l; (void)revents; /* unused parameters */
assert(el_ev->write_cb); assert(el_ev->write_cb);
el_ev->write_cb(el_ev->userarg); el_ev->write_cb(el_ev->userarg);
} }
@ -115,7 +115,7 @@ static void
getdns_libev_timeout_cb(struct ev_loop *l, struct ev_timer *timer, int revents) getdns_libev_timeout_cb(struct ev_loop *l, struct ev_timer *timer, int revents)
{ {
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)timer->data; getdns_eventloop_event *el_ev = (getdns_eventloop_event *)timer->data;
(void)l; (void)revents; (void)l; (void)revents; /* unused parameters */
assert(el_ev->timeout_cb); assert(el_ev->timeout_cb);
el_ev->timeout_cb(el_ev->userarg); el_ev->timeout_cb(el_ev->userarg);
} }

View File

@ -99,7 +99,7 @@ static getdns_return_t
getdns_libevent_clear(getdns_eventloop *loop, getdns_eventloop_event *el_ev) getdns_libevent_clear(getdns_eventloop *loop, getdns_eventloop_event *el_ev)
{ {
struct event *my_ev = (struct event *)el_ev->ev; struct event *my_ev = (struct event *)el_ev->ev;
(void)loop; (void)loop; /* unused parameter */
assert(my_ev); assert(my_ev);
@ -115,7 +115,7 @@ static void
getdns_libevent_callback(evutil_socket_t fd, short bits, void *arg) getdns_libevent_callback(evutil_socket_t fd, short bits, void *arg)
{ {
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)arg; getdns_eventloop_event *el_ev = (getdns_eventloop_event *)arg;
(void)fd; (void)fd; /* unused parameter */
if (bits & EV_READ) { if (bits & EV_READ) {
assert(el_ev->read_cb); assert(el_ev->read_cb);

View File

@ -103,7 +103,7 @@ getdns_libuv_clear(getdns_eventloop *loop, getdns_eventloop_event *el_ev)
poll_timer *my_ev = (poll_timer *)el_ev->ev; poll_timer *my_ev = (poll_timer *)el_ev->ev;
uv_poll_t *my_poll; uv_poll_t *my_poll;
uv_timer_t *my_timer; uv_timer_t *my_timer;
(void)loop; (void)loop; /* unused parameter */
assert(my_ev); assert(my_ev);
@ -165,7 +165,7 @@ getdns_libuv_timeout_cb(uv_timer_t *timer, int status)
{ {
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)timer->data; getdns_eventloop_event *el_ev = (getdns_eventloop_event *)timer->data;
#ifndef HAVE_NEW_UV_TIMER_CB #ifndef HAVE_NEW_UV_TIMER_CB
(void)status; (void)status; /* unused parameter */
#endif #endif
assert(el_ev->timeout_cb); assert(el_ev->timeout_cb);
DEBUG_UV("enter libuv_timeout_cb(el_ev = %p, el_ev->ev = %p)\n" DEBUG_UV("enter libuv_timeout_cb(el_ev = %p, el_ev->ev = %p)\n"

View File

@ -288,7 +288,7 @@ static void
poll_read_cb(int fd, getdns_eventloop_event *event) poll_read_cb(int fd, getdns_eventloop_event *event)
{ {
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG #if !defined(SCHED_DEBUG) || !SCHED_DEBUG
(void)fd; (void)fd; /* unused parameter */
#endif #endif
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event); DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event);
if (event && event->read_cb) if (event && event->read_cb)
@ -299,7 +299,7 @@ static void
poll_write_cb(int fd, getdns_eventloop_event *event) poll_write_cb(int fd, getdns_eventloop_event *event)
{ {
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG #if !defined(SCHED_DEBUG) || !SCHED_DEBUG
(void)fd; (void)fd; /* unused parameter */
#endif #endif
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event); DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event);
if (event && event->write_cb) if (event && event->write_cb)

View File

@ -154,14 +154,14 @@ select_eventloop_clear(getdns_eventloop *loop, getdns_eventloop_event *event)
static void static void
select_eventloop_cleanup(getdns_eventloop *loop) select_eventloop_cleanup(getdns_eventloop *loop)
{ {
(void)loop; (void)loop; /* unused parameter */
} }
static void static void
select_read_cb(int fd, getdns_eventloop_event *event) select_read_cb(int fd, getdns_eventloop_event *event)
{ {
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG #if !defined(SCHED_DEBUG) || !SCHED_DEBUG
(void)fd; (void)fd; /* unused parameter */
#endif #endif
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event); DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event);
event->read_cb(event->userarg); event->read_cb(event->userarg);
@ -171,7 +171,7 @@ static void
select_write_cb(int fd, getdns_eventloop_event *event) select_write_cb(int fd, getdns_eventloop_event *event)
{ {
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG #if !defined(SCHED_DEBUG) || !SCHED_DEBUG
(void)fd; (void)fd; /* unused parameter */
#endif #endif
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event); DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event);
event->write_cb(event->userarg); event->write_cb(event->userarg);
@ -181,7 +181,7 @@ static void
select_timeout_cb(int fd, getdns_eventloop_event *event) select_timeout_cb(int fd, getdns_eventloop_event *event)
{ {
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG #if !defined(SCHED_DEBUG) || !SCHED_DEBUG
(void)fd; (void)fd; /* unused parameter */
#endif #endif
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event); DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event);
event->timeout_cb(event->userarg); event->timeout_cb(event->userarg);
@ -309,7 +309,7 @@ _getdns_select_eventloop_init(struct mem_funcs *mf, _getdns_select_eventloop *lo
select_eventloop_run, select_eventloop_run,
select_eventloop_run_once select_eventloop_run_once
}; };
(void) mf; (void) mf; /* unused parameter */
(void) memset(loop, 0, sizeof(_getdns_select_eventloop)); (void) memset(loop, 0, sizeof(_getdns_select_eventloop));
loop->loop.vmt = &select_eventloop_vmt; loop->loop.vmt = &select_eventloop_vmt;
} }

View File

@ -256,7 +256,7 @@ static void
ub_resolve_event_callback(void* arg, int rcode, void *pkt, int pkt_len, ub_resolve_event_callback(void* arg, int rcode, void *pkt, int pkt_len,
int sec, char* why_bogus, int was_ratelimited) int sec, char* why_bogus, int was_ratelimited)
{ {
(void) was_ratelimited; (void) was_ratelimited; /* unused parameter */
#else #else
static void static void
ub_resolve_event_callback(void* arg, int rcode, void *pkt, int pkt_len, ub_resolve_event_callback(void* arg, int rcode, void *pkt, int pkt_len,

View File

@ -271,7 +271,7 @@ getdns_return_t _getdns_tls_context_free(struct mem_funcs* mfs, _getdns_tls_cont
void _getdns_tls_context_pinset_init(_getdns_tls_context* ctx) void _getdns_tls_context_pinset_init(_getdns_tls_context* ctx)
{ {
(void) ctx; (void) ctx; /* unused parameter */
} }
getdns_return_t _getdns_tls_context_set_min_max_tls_version(_getdns_tls_context* ctx, getdns_tls_version_t min, getdns_tls_version_t max) getdns_return_t _getdns_tls_context_set_min_max_tls_version(_getdns_tls_context* ctx, getdns_tls_version_t min, getdns_tls_version_t max)

View File

@ -97,8 +97,8 @@ static int _getdns_tls_verify_always_ok(int ok, X509_STORE_CTX *ctx)
strcpy(buf, "<unknown>"); strcpy(buf, "<unknown>");
DEBUG_STUB("DEBUG Cert verify: depth=%d verify=%d err=%d subject=%s errorstr=%s\n", depth, ok, err, buf, X509_verify_cert_error_string(err)); DEBUG_STUB("DEBUG Cert verify: depth=%d verify=%d err=%d subject=%s errorstr=%s\n", depth, ok, err, buf, X509_verify_cert_error_string(err));
# else /* defined(STUB_DEBUG) && STUB_DEBUG */ # else /* defined(STUB_DEBUG) && STUB_DEBUG */
(void)ok; (void)ok; /* unused parameter */
(void)ctx; (void)ctx; /* unused parameter */
# endif /* #else defined(STUB_DEBUG) && STUB_DEBUG */ # endif /* #else defined(STUB_DEBUG) && STUB_DEBUG */
return 1; return 1;
} }
@ -427,7 +427,7 @@ getdns_return_t _getdns_tls_context_set_min_max_tls_version(_getdns_tls_context*
* We've used TLSv1_2_client_method() creating the context, so * We've used TLSv1_2_client_method() creating the context, so
* error if they asked for anything other than TLS 1.2 or better. * error if they asked for anything other than TLS 1.2 or better.
*/ */
(void) ctx; (void) ctx; /* unused parameter */
if ((!min || min == GETDNS_TLS1_2) && !max) if ((!min || min == GETDNS_TLS1_2) && !max)
return GETDNS_RETURN_GOOD; return GETDNS_RETURN_GOOD;
@ -695,7 +695,7 @@ getdns_return_t _getdns_tls_connection_set_min_max_tls_version(_getdns_tls_conne
* We've used TLSv1_2_client_method() creating the context, so * We've used TLSv1_2_client_method() creating the context, so
* error if they asked for anything other than TLS 1.2 or better. * error if they asked for anything other than TLS 1.2 or better.
*/ */
(void) conn; (void) conn; /* unused parameter */
if ((!min || min == GETDNS_TLS1_2) && !max) if ((!min || min == GETDNS_TLS1_2) && !max)
return GETDNS_RETURN_GOOD; return GETDNS_RETURN_GOOD;
@ -914,7 +914,7 @@ getdns_return_t _getdns_tls_connection_set_host_pinset(_getdns_tls_connection* c
#if defined(HAVE_SSL_DANE_ENABLE) #if defined(HAVE_SSL_DANE_ENABLE)
int osr = SSL_dane_enable(conn->ssl, *auth_name ? auth_name : NULL); int osr = SSL_dane_enable(conn->ssl, *auth_name ? auth_name : NULL);
(void) osr; (void) osr; /* unused parameter */
DEBUG_STUB("%s %-35s: DEBUG: SSL_dane_enable(\"%s\") -> %d\n" DEBUG_STUB("%s %-35s: DEBUG: SSL_dane_enable(\"%s\") -> %d\n"
, STUB_DEBUG_SETUP_TLS, __FUNC__, auth_name, osr); , STUB_DEBUG_SETUP_TLS, __FUNC__, auth_name, osr);
SSL_set_verify(conn->ssl, SSL_VERIFY_PEER, _getdns_tls_verify_always_ok); SSL_set_verify(conn->ssl, SSL_VERIFY_PEER, _getdns_tls_verify_always_ok);
@ -940,7 +940,7 @@ getdns_return_t _getdns_tls_connection_set_host_pinset(_getdns_tls_connection* c
int osr = DANESSL_init(conn->ssl, int osr = DANESSL_init(conn->ssl,
*auth_name ? auth_name : NULL, *auth_name ? auth_name : NULL,
*auth_name ? auth_names : NULL); *auth_name ? auth_names : NULL);
(void) osr; (void) osr; /* unused parameter */
DEBUG_STUB("%s %-35s: DEBUG: DANESSL_init(\"%s\") -> %d\n" DEBUG_STUB("%s %-35s: DEBUG: DANESSL_init(\"%s\") -> %d\n"
, STUB_DEBUG_SETUP_TLS, __FUNC__, auth_name, osr); , STUB_DEBUG_SETUP_TLS, __FUNC__, auth_name, osr);
SSL_set_verify(conn->ssl, SSL_VERIFY_PEER, _getdns_tls_verify_always_ok); SSL_set_verify(conn->ssl, SSL_VERIFY_PEER, _getdns_tls_verify_always_ok);

View File

@ -484,7 +484,7 @@ void
_getdns_network_validate_tsig(getdns_network_req *req) _getdns_network_validate_tsig(getdns_network_req *req)
{ {
#if defined(HAVE_NSS) || defined(HAVE_NETTLE) #if defined(HAVE_NSS) || defined(HAVE_NETTLE)
(void)req; (void)req; /* unused parameter */
#else #else
_getdns_rr_iter rr_spc, *rr; _getdns_rr_iter rr_spc, *rr;
_getdns_rdf_iter rdf_spc, *rdf; _getdns_rdf_iter rdf_spc, *rdf;

View File

@ -47,7 +47,7 @@
static const uint8_t * static const uint8_t *
apl_n_rdf_end(const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf) apl_n_rdf_end(const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
{ {
(void)pkt; (void)pkt; /* unused parameter */
return rdf < pkt_end ? rdf + 1 : NULL; return rdf < pkt_end ? rdf + 1 : NULL;
} }
static getdns_return_t static getdns_return_t
@ -91,7 +91,7 @@ apl_afdpart_rdf_end(
const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf) const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
{ {
const uint8_t *end = rdf + (rdf[-1] & 0x7F); const uint8_t *end = rdf + (rdf[-1] & 0x7F);
(void)(pkt); (void)pkt; /* unused parameter */
return end <= pkt_end ? end : NULL; return end <= pkt_end ? end : NULL;
} }
static getdns_return_t static getdns_return_t
@ -217,6 +217,7 @@ ipseckey_gateway_2wire(
{ {
assert(rdf - 2 >= rdata && rdf[-2] > 0); assert(rdf - 2 >= rdata && rdf[-2] > 0);
(void)rdata; /* unused parameter */
switch (rdf[-2]) { switch (rdf[-2]) {
case 1: if (!value || value->size != 4) case 1: if (!value || value->size != 4)
return GETDNS_RETURN_INVALID_PARAMETER; return GETDNS_RETURN_INVALID_PARAMETER;
@ -280,7 +281,7 @@ static const uint8_t *
hip_pk_algorithm_rdf_end( hip_pk_algorithm_rdf_end(
const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf) const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
{ {
(void)(pkt); (void)pkt; /* unused parameter */
return rdf + 4 > pkt_end ? NULL return rdf + 4 > pkt_end ? NULL
: rdf + 4 + *rdf + gldns_read_uint16(rdf + 2) > pkt_end ? NULL : rdf + 4 + *rdf + gldns_read_uint16(rdf + 2) > pkt_end ? NULL
: rdf + 1; : rdf + 1;
@ -326,7 +327,7 @@ static _getdns_rdf_special hip_pk_algorithm = {
static const uint8_t * static const uint8_t *
hip_hit_rdf_end(const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf) hip_hit_rdf_end(const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
{ {
(void)(pkt); (void)pkt; /* unused parameter */
return rdf + 3 > pkt_end ? NULL return rdf + 3 > pkt_end ? NULL
: rdf + 3 + rdf[-1] + gldns_read_uint16(rdf + 1) > pkt_end ? NULL : rdf + 3 + rdf[-1] + gldns_read_uint16(rdf + 1) > pkt_end ? NULL
: rdf + 1; : rdf + 1;
@ -380,7 +381,7 @@ static const uint8_t *
hip_public_key_rdf_end( hip_public_key_rdf_end(
const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf) const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
{ {
(void)(pkt); (void)pkt; /* unused parameter */
return rdf + 2 > pkt_end ? NULL return rdf + 2 > pkt_end ? NULL
: rdf + 2 + rdf[-2] + gldns_read_uint16(rdf) > pkt_end ? NULL : rdf + 2 + rdf[-2] + gldns_read_uint16(rdf) > pkt_end ? NULL
: rdf + 2 + rdf[-2] + gldns_read_uint16(rdf); : rdf + 2 + rdf[-2] + gldns_read_uint16(rdf);
@ -434,7 +435,7 @@ static _getdns_rdf_special hip_public_key = {
static const uint8_t * static const uint8_t *
amtrelay_D_rdf_end(const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf) amtrelay_D_rdf_end(const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
{ {
(void)pkt; (void)pkt; /* unused parameter */
return rdf < pkt_end ? rdf + 1 : NULL; return rdf < pkt_end ? rdf + 1 : NULL;
} }
static getdns_return_t static getdns_return_t
@ -471,7 +472,8 @@ static const uint8_t *
amtrelay_rtype_rdf_end( amtrelay_rtype_rdf_end(
const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf) const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
{ {
(void)pkt; (void)pkt_end; (void)pkt; /* unused parameter */
(void)pkt_end; /* unused parameter */
return rdf; return rdf;
} }
static getdns_return_t static getdns_return_t
@ -581,6 +583,7 @@ amtrelay_relay_2wire(
{ {
assert(rdf - 1 >= rdata && (rdf[-1] & 0x7F) > 0); assert(rdf - 1 >= rdata && (rdf[-1] & 0x7F) > 0);
(void)rdata; /* unused parameter */
switch (rdf[-1] & 0x7F) { switch (rdf[-1] & 0x7F) {
case 1: if (!value || value->size != 4) case 1: if (!value || value->size != 4)
return GETDNS_RETURN_INVALID_PARAMETER; return GETDNS_RETURN_INVALID_PARAMETER;

View File

@ -505,7 +505,7 @@ tcp_connect(getdns_upstream *upstream, getdns_transport_list_t transport,
_getdns_socketerror() == _getdns_EWOULDBLOCK) _getdns_socketerror() == _getdns_EWOULDBLOCK)
return fd; return fd;
(void)transport; (void)transport; /* unused parameter */
#else /* USE_OSX_TCP_FASTOPEN */ #else /* USE_OSX_TCP_FASTOPEN */
/* Note that error detection is different with TFO. Since the handshake /* Note that error detection is different with TFO. Since the handshake
doesn't start till the sendto() lack of connection is often delayed until doesn't start till the sendto() lack of connection is often delayed until
@ -553,7 +553,7 @@ tcp_connect(getdns_upstream *upstream, getdns_transport_list_t transport,
"%-40s : Upstream : Could not setup TCP TFO\n", "%-40s : Upstream : Could not setup TCP TFO\n",
upstream->addr_str); upstream->addr_str);
# else # else
(void)transport; (void)transport; /* unused parameter */
# endif/* HAVE_DECL_TCP_FASTOPEN*/ # endif/* HAVE_DECL_TCP_FASTOPEN*/
# endif /* HAVE_DECL_TCP_FASTOPEN_CONNECT */ # endif /* HAVE_DECL_TCP_FASTOPEN_CONNECT */
#endif /* USE_OSX_TCP_FASTOPEN */ #endif /* USE_OSX_TCP_FASTOPEN */

View File

@ -154,7 +154,8 @@ getdns_sync_cb(getdns_context *context, getdns_callback_type_t callback_type,
getdns_dict *response, void *userarg, getdns_transaction_t transaction_id) getdns_dict *response, void *userarg, getdns_transaction_t transaction_id)
{ {
getdns_sync_data *data = (getdns_sync_data *)userarg; getdns_sync_data *data = (getdns_sync_data *)userarg;
(void)context; (void)callback_type; (void)transaction_id; (void)context; (void)callback_type; /* unused parameters */
(void)transaction_id; /* unused parameter */
assert(data); assert(data);

View File

@ -457,7 +457,7 @@
void *userarg, void *userarg,
getdns_transaction_t transaction_id) getdns_transaction_t transaction_id)
{ {
(void)context; (void)response; (void)userarg; (void)context; (void)response; (void)userarg; /* unused parameters */
callback_called++; callback_called++;
@ -491,7 +491,7 @@
*/ */
void verify_getdns_cancel_callback(struct extracted_response *ex_response) void verify_getdns_cancel_callback(struct extracted_response *ex_response)
{ {
(void)ex_response; (void)ex_response; /* unused parameter */
/* /*
* increment callback_called global to prove callback was called. * increment callback_called global to prove callback was called.
*/ */

View File

@ -349,7 +349,7 @@ void destroy_callbackfn(struct getdns_context *context,
void *userarg, void *userarg,
getdns_transaction_t transaction_id) { getdns_transaction_t transaction_id) {
int* flag = (int*)userarg; int* flag = (int*)userarg;
(void)callback_type; (void)transaction_id; (void)callback_type; (void)transaction_id; /* unused parameters */
*flag = 1; *flag = 1;
getdns_dict_destroy(response); getdns_dict_destroy(response);
getdns_context_destroy(context); getdns_context_destroy(context);
@ -369,7 +369,7 @@ void callbackfn(struct getdns_context *context,
{ {
typedef void (*fn_ptr)(struct extracted_response *ex_response); typedef void (*fn_ptr)(struct extracted_response *ex_response);
fn_ptr fn = ((fn_cont *)userarg)->fn; fn_ptr fn = ((fn_cont *)userarg)->fn;
(void)context; (void)transaction_id; (void)context; (void)transaction_id; /* unused parameters */
/* /*
* If userarg is NULL, either a negative test case * If userarg is NULL, either a negative test case
@ -409,7 +409,7 @@ void callbackfn(struct getdns_context *context,
void update_callbackfn(struct getdns_context *context, void update_callbackfn(struct getdns_context *context,
getdns_context_code_t changed_item) getdns_context_code_t changed_item)
{ {
(void)context; (void)context; /* unused parameter */
ck_assert_msg(changed_item == expected_changed_item, ck_assert_msg(changed_item == expected_changed_item,
"Expected changed_item == %d, got %d", "Expected changed_item == %d, got %d",
changed_item, expected_changed_item); changed_item, expected_changed_item);

View File

@ -271,7 +271,7 @@
void verify_getdns_context_destroy(struct extracted_response *ex_response) void verify_getdns_context_destroy(struct extracted_response *ex_response)
{ {
(void)ex_response; (void)ex_response; /* unused parameter */
/* /*
* Sleep for a second to make getdns_context_destroy() wait. * Sleep for a second to make getdns_context_destroy() wait.
*/ */

View File

@ -266,7 +266,7 @@ void timeout_3_cb(struct getdns_context *context,
getdns_callback_type_t callback_type, getdns_callback_type_t callback_type,
struct getdns_dict * response, struct getdns_dict * response,
void *userarg, getdns_transaction_t transaction_id) { void *userarg, getdns_transaction_t transaction_id) {
(void)response; (void)transaction_id; (void)response; (void)transaction_id; /* unused parameters */
timeout_thread_data *tdata = (timeout_thread_data*)userarg; timeout_thread_data *tdata = (timeout_thread_data*)userarg;
tdata->num_callbacks++; tdata->num_callbacks++;
if (callback_type == GETDNS_CALLBACK_TIMEOUT) { if (callback_type == GETDNS_CALLBACK_TIMEOUT) {

View File

@ -44,7 +44,8 @@
char *alabel = NULL; char *alabel = NULL;
ck_assert_msg( getdns_convert_alabel_to_ulabel( alabel ) == 0, ck_assert_msg( getdns_convert_alabel_to_ulabel( alabel ) == 0,
"Was not expecting %p from getdns_convert_alabel_to_ulabel()", getdns_convert_alabel_to_ulabel( alabel ) ); "Was not expecting %p from getdns_convert_alabel_to_ulabel()",
(void *)getdns_convert_alabel_to_ulabel( alabel ) );
} }
END_TEST END_TEST

View File

@ -45,7 +45,8 @@
ck_assert_msg(( getdns_convert_ulabel_to_alabel( ulabel ) == 0 ), ck_assert_msg(( getdns_convert_ulabel_to_alabel( ulabel ) == 0 ),
"Was not expecting %p from getdns_convert_ulabel_to_alabel()", getdns_convert_ulabel_to_alabel( ulabel ) ); "Was not expecting %p from getdns_convert_ulabel_to_alabel()",
(void *)getdns_convert_ulabel_to_alabel( ulabel ) );
} }
END_TEST END_TEST

View File

@ -47,7 +47,7 @@
ptr = getdns_display_ip_address(NULL); ptr = getdns_display_ip_address(NULL);
ck_assert_msg(ptr == NULL, "Expected retrieved bindata == NULL, got: %p", ck_assert_msg(ptr == NULL, "Expected retrieved bindata == NULL, got: %p",
ptr); (void *)ptr);
} }
END_TEST END_TEST
@ -64,7 +64,7 @@
ptr = getdns_display_ip_address(&bindata_of_ipv4_or_ipv6_address); ptr = getdns_display_ip_address(&bindata_of_ipv4_or_ipv6_address);
ck_assert_msg(ptr == NULL, "Expected pointer == NULL, got: %p", ck_assert_msg(ptr == NULL, "Expected pointer == NULL, got: %p",
ptr); (void *)ptr);
} }
END_TEST END_TEST

View File

@ -53,7 +53,7 @@
void run_event_loop_impl(struct getdns_context* context, void* eventloop) { void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
struct ev_loop* loop = (struct ev_loop*) eventloop; struct ev_loop* loop = (struct ev_loop*) eventloop;
(void)context; (void)context; /* unused parameter */
ev_run(loop, 0); ev_run(loop, 0);
} }

View File

@ -49,7 +49,7 @@
void run_event_loop_impl(struct getdns_context* context, void* eventloop) { void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
struct event_base* base = (struct event_base*) eventloop; struct event_base* base = (struct event_base*) eventloop;
(void)context; (void)context; /* unused parameter */
event_base_dispatch(base); event_base_dispatch(base);
} }

View File

@ -49,7 +49,7 @@
void run_event_loop_impl(struct getdns_context* context, void* eventloop) { void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
uv_loop_t* loop = (uv_loop_t*) eventloop; uv_loop_t* loop = (uv_loop_t*) eventloop;
(void)context; (void)context; /* unused parameter */
uv_run(loop, UV_RUN_DEFAULT); uv_run(loop, UV_RUN_DEFAULT);
} }

View File

@ -37,11 +37,11 @@
#include "getdns/getdns_extra.h" #include "getdns/getdns_extra.h"
void run_event_loop_impl(struct getdns_context* context, void* eventloop) { void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
(void)eventloop; (void)eventloop; /* unused parameter */
getdns_context_run(context); getdns_context_run(context);
} }
void* create_eventloop_impl(struct getdns_context* context) { void* create_eventloop_impl(struct getdns_context* context) {
(void)context; (void)context; /* unused parameter */
return NULL; return NULL;
} }

View File

@ -211,8 +211,8 @@ void transport_cb(struct getdns_context *context,
struct getdns_dict * response, struct getdns_dict * response,
void *userarg, getdns_transaction_t transaction_id) { void *userarg, getdns_transaction_t transaction_id) {
/* Don't really care about the answer*/ /* Don't really care about the answer*/
(void)context; (void)callback_type; (void)response; (void)context; (void)callback_type; (void)response; /* unused parameters */
(void)userarg; (void)transaction_id; (void)userarg; (void)transaction_id; /* unused parameters */
return; return;
} }

View File

@ -57,7 +57,7 @@ this_callbackfn(struct getdns_context *this_context,
struct getdns_dict *this_response, struct getdns_dict *this_response,
void *this_userarg, getdns_transaction_t this_transaction_id) void *this_userarg, getdns_transaction_t this_transaction_id)
{ {
(void)this_context; (void)this_userarg; (void)this_context; (void)this_userarg; /* unused parameters */
if (this_callback_type == GETDNS_CALLBACK_COMPLETE) { /* This is a callback with data */ if (this_callback_type == GETDNS_CALLBACK_COMPLETE) { /* This is a callback with data */
char *res = getdns_pretty_print_dict(this_response); char *res = getdns_pretty_print_dict(this_response);

View File

@ -366,7 +366,7 @@ void callback(getdns_context *context, getdns_callback_type_t callback_type,
getdns_dict *response, void *userarg, getdns_transaction_t trans_id) getdns_dict *response, void *userarg, getdns_transaction_t trans_id)
{ {
char *response_str; char *response_str;
(void)context; (void)userarg; (void)context; (void)userarg; /* unused parameters */
/* This is a callback with data */; /* This is a callback with data */;
if (response && !quiet && (response_str = json ? if (response && !quiet && (response_str = json ?
@ -1457,7 +1457,7 @@ static void request_cb(
if (qname_str != unknown_qname) if (qname_str != unknown_qname)
free(qname_str); free(qname_str);
#else #else
(void)transaction_id; (void)transaction_id; /* unused parameter */
#endif #endif
assert(msg); assert(msg);
@ -1556,8 +1556,8 @@ static void incoming_request_handler(getdns_context *context,
getdns_dict *rr; getdns_dict *rr;
uint32_t rr_type; uint32_t rr_type;
(void)callback_type; (void)callback_type; /* unused parameter */
(void)userarg; (void)userarg; /* unused parameter */
if (!query_extensions_spc && if (!query_extensions_spc &&
!(query_extensions_spc = getdns_dict_create())) !(query_extensions_spc = getdns_dict_create()))
@ -1757,7 +1757,7 @@ static void _getdns_query_log(void *userarg, uint64_t system,
gmtime_r(&tv.tv_sec, &tm); gmtime_r(&tv.tv_sec, &tm);
#endif #endif
strftime(buf, 10, "%H:%M:%S", &tm); strftime(buf, 10, "%H:%M:%S", &tm);
(void)userarg; (void)system; (void)level; (void)userarg; (void)system; (void)level; /* unused parameters */
(void) fprintf(stderr, "[%s.%.6d] UPSTREAM ", buf, (int)tv.tv_usec); (void) fprintf(stderr, "[%s.%.6d] UPSTREAM ", buf, (int)tv.tv_usec);
(void) vfprintf(stderr, fmt, ap); (void) vfprintf(stderr, fmt, ap);
} }

View File

@ -1569,10 +1569,10 @@ static void out_of_order_callback(getdns_context *context,
void *userarg, void *userarg,
getdns_transaction_t transaction_id) getdns_transaction_t transaction_id)
{ {
(void) context; (void) context; /* unused parameter */
(void) callback_type; (void) callback_type; /* unused parameter */
(void) response; (void) response; /* unused parameter */
(void) transaction_id; (void) transaction_id; /* unused parameter */
struct async_query *query = (struct async_query *) userarg; struct async_query *query = (struct async_query *) userarg;
static unsigned callback_no; static unsigned callback_no;
@ -1717,7 +1717,7 @@ int main(int ac, char *av[])
bool use_tcp = false; bool use_tcp = false;
bool use_tls = false; bool use_tls = false;
(void) ac; (void) ac; /* unused parameter */
test_info.errout = stderr; test_info.errout = stderr;
atexit(exit_tidy); atexit(exit_tidy);

View File

@ -122,13 +122,13 @@ typedef struct my_event {
static void my_event_base_free(struct ub_event_base* base) static void my_event_base_free(struct ub_event_base* base)
{ {
/* We don't allocate our event base, so no need to free */ /* We don't allocate our event base, so no need to free */
(void)base; (void)base; /* unused parameter */
return; return;
} }
static int my_event_base_dispatch(struct ub_event_base* base) static int my_event_base_dispatch(struct ub_event_base* base)
{ {
(void)base; (void)base; /* unused parameter */
/* We run the event loop extension for which this ub_event_base is an /* We run the event loop extension for which this ub_event_base is an
* interface ourselfs, so no need to let libunbound call dispatch. * interface ourselfs, so no need to let libunbound call dispatch.
*/ */
@ -138,7 +138,7 @@ static int my_event_base_dispatch(struct ub_event_base* base)
static int my_event_base_loopexit(struct ub_event_base* base, struct timeval* tv) static int my_event_base_loopexit(struct ub_event_base* base, struct timeval* tv)
{ {
(void)tv; (void)tv; /* unused parameter */
/* Not sure when this will be called. But it is of no influence as we /* Not sure when this will be called. But it is of no influence as we
* run the event loop ourself. * run the event loop ourself.
*/ */
@ -353,7 +353,7 @@ static int my_timer_del(struct ub_event* ev)
static int my_signal_add(struct ub_event* ub_ev, struct timeval* tv) static int my_signal_add(struct ub_event* ub_ev, struct timeval* tv)
{ {
(void)ub_ev; (void)tv; (void)ub_ev; (void)tv; /* unused parameters */
/* Only unbound daaemon workers use signals */ /* Only unbound daaemon workers use signals */
DEBUG_SCHED("UB_LOOP ERROR: signal_add()\n"); DEBUG_SCHED("UB_LOOP ERROR: signal_add()\n");
return -1; return -1;
@ -361,7 +361,7 @@ static int my_signal_add(struct ub_event* ub_ev, struct timeval* tv)
static int my_signal_del(struct ub_event* ub_ev) static int my_signal_del(struct ub_event* ub_ev)
{ {
(void)ub_ev; (void)ub_ev; /* unused parameter */
/* Only unbound daaemon workers use signals */ /* Only unbound daaemon workers use signals */
DEBUG_SCHED("UB_LOOP ERROR: signal_del()\n"); DEBUG_SCHED("UB_LOOP ERROR: signal_del()\n");
return -1; return -1;
@ -370,13 +370,13 @@ static int my_signal_del(struct ub_event* ub_ev)
static void my_winsock_unregister_wsaevent(struct ub_event* ev) static void my_winsock_unregister_wsaevent(struct ub_event* ev)
{ {
/* wsa events don't get registered with libunbound */ /* wsa events don't get registered with libunbound */
(void)ev; (void)ev; /* unused parameter */
} }
static void my_winsock_tcp_wouldblock(struct ub_event* ev, int bits) static void my_winsock_tcp_wouldblock(struct ub_event* ev, int bits)
{ {
#ifndef USE_WINSOCK #ifndef USE_WINSOCK
(void)ev; (void)bits; (void)ev; (void)bits; /* unused parameters */
#else #else
if (bits & UB_EV_READ) if (bits & UB_EV_READ)
AS_MY_EVENT(ev)->read_wouldblock = 1; AS_MY_EVENT(ev)->read_wouldblock = 1;
@ -434,7 +434,7 @@ static struct ub_event* my_signal_new(struct ub_event_base* base, int fd,
void (*cb)(int, short, void*), void* arg) void (*cb)(int, short, void*), void* arg)
{ {
/* Not applicable, because in unbound used in the daemon only */ /* Not applicable, because in unbound used in the daemon only */
(void)base; (void)fd; (void)cb; (void)arg; (void)base; (void)fd; (void)cb; (void)arg; /* unused parameters */
return NULL; return NULL;
} }
@ -442,7 +442,7 @@ static struct ub_event* my_winsock_register_wsaevent(struct ub_event_base *b,
void* wsaevent, void (*cb)(int, short, void*), void* arg) void* wsaevent, void (*cb)(int, short, void*), void* arg)
{ {
/* Not applicable, because in unbound used for tubes only */ /* Not applicable, because in unbound used for tubes only */
(void)b; (void)wsaevent; (void)cb; (void)arg; (void)b; (void)wsaevent; (void)cb; (void)arg; /* unused parameters */
return NULL; return NULL;
} }

View File

@ -299,9 +299,10 @@ _getdns_rr_iter2rr_dict_canonical(
} }
} else if (rdf->rdd_pos->type == GETDNS_RDF_SPECIAL) } else if (rdf->rdd_pos->type == GETDNS_RDF_SPECIAL)
val_type = wf_special; val_type = wf_special;
else else {
assert(((val_type = wf_int), 0)); val_type = wf_int;
assert(0);
}
if (! rdf->rdd_repeat) { if (! rdf->rdd_repeat) {
switch (val_type) { switch (val_type) {
case wf_int: case wf_int:
@ -1408,7 +1409,7 @@ getdns_return_t
getdns_apply_network_result(getdns_network_req* netreq, getdns_apply_network_result(getdns_network_req* netreq,
int rcode, void *pkt, int pkt_len, int sec, char* why_bogus) int rcode, void *pkt, int pkt_len, int sec, char* why_bogus)
{ {
(void)why_bogus; (void)why_bogus; /* unused parameter */
netreq->dnssec_status = sec == 0 ? GETDNS_DNSSEC_INSECURE netreq->dnssec_status = sec == 0 ? GETDNS_DNSSEC_INSECURE
: sec == 2 ? GETDNS_DNSSEC_SECURE : sec == 2 ? GETDNS_DNSSEC_SECURE