Skip to content

Commit

Permalink
Resolve compile warnings
Browse files Browse the repository at this point in the history
Thanks Andreas!
  • Loading branch information
wtoorop committed Jun 3, 2021
1 parent 6dfbfa5 commit 2a01145
Show file tree
Hide file tree
Showing 34 changed files with 97 additions and 90 deletions.
2 changes: 1 addition & 1 deletion cmake/include/cmakeconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ static inline int _gldns_custom_vsnprintf(char *str, size_t size, const char *fo
# define ATTR_UNUSED(x) x
#elif defined(__cplusplus)
# define ATTR_UNUSED(x)
#elif defined(HAVE_ATTR_UNUSED)
#elif defined(__GNUC__)
# define ATTR_UNUSED(x) x __attribute__((unused))
#else /* !HAVE_ATTR_UNUSED */
# define ATTR_UNUSED(x) x
Expand Down
2 changes: 1 addition & 1 deletion doc/getdns_general.3.in
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ getdns_dict **response)
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
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).

.HP 3
Expand Down
8 changes: 4 additions & 4 deletions src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ transaction_id_cmp(const void *id1, const void *id2)
static void
NULL_update_callback(
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
netreq_expiry_cmp(const void *id1, const void *id2)
Expand Down Expand Up @@ -3761,7 +3761,7 @@ uint32_t
getdns_context_get_num_pending_requests(const getdns_context* context,
struct timeval* next_timeout)
{
(void)next_timeout;
(void)next_timeout; /* unused parameter */

if (!context)
return GETDNS_RETURN_INVALID_PARAMETER;
Expand Down Expand Up @@ -4146,7 +4146,7 @@ getdns_context_set_use_threads(getdns_context* context, int use_threads) {
else
r = ub_ctx_async(context->unbound_ctx, 0);
#else
(void)use_threads;
(void)use_threads; /* unused parameter */
#endif
return r == 0 ? GETDNS_RETURN_GOOD : GETDNS_RETURN_CONTEXT_UPDATE_FAIL;
}
Expand Down Expand Up @@ -5401,7 +5401,7 @@ getdns_context_set_tls_curves_list(
dispatch_updated(context, GETDNS_CONTEXT_CODE_TLS_CIPHER_LIST);
return GETDNS_RETURN_GOOD;
#else
(void)tls_curves_list;
(void)tls_curves_list; /* unused parameter */
return GETDNS_RETURN_NOT_IMPLEMENTED;
#endif
}
Expand Down
16 changes: 8 additions & 8 deletions src/convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ getdns_convert_ulabel_to_alabel(const char *ulabel)
if (idn2_lookup_u8((uint8_t *)ulabel, &alabel, IDN2_TRANSITIONAL) == IDN2_OK)
return (char *)alabel;
#else
(void)ulabel;
(void)ulabel; /* unused parameter */
#endif
return NULL;
}
Expand All @@ -149,7 +149,7 @@ getdns_convert_alabel_to_ulabel(const char *alabel)
if (idn2_to_unicode_8z8z(alabel, &ulabel, 0) == IDN2_OK)
return ulabel;
#else
(void)alabel;
(void)alabel; /* unused parameter */
#endif
return NULL;
}
Expand Down Expand Up @@ -1901,8 +1901,8 @@ getdns_yaml2list(const char *str, getdns_list **list)
return GETDNS_RETURN_GENERIC_ERROR;
}
#else /* USE_YAML_CONFIG */
(void) str;
(void) list;
(void) str; /* unused parameter */
(void) list; /* unused parameter */
return GETDNS_RETURN_NOT_IMPLEMENTED;
#endif /* USE_YAML_CONFIG */
}
Expand All @@ -1925,8 +1925,8 @@ getdns_yaml2bindata(const char *str, getdns_bindata **bindata)
return GETDNS_RETURN_GENERIC_ERROR;
}
#else /* USE_YAML_CONFIG */
(void) str;
(void) bindata;
(void) str; /* unused parameter */
(void) bindata; /* unused parameter */
return GETDNS_RETURN_NOT_IMPLEMENTED;
#endif /* USE_YAML_CONFIG */
}
Expand All @@ -1949,8 +1949,8 @@ getdns_yaml2int(const char *str, uint32_t *value)
return GETDNS_RETURN_GENERIC_ERROR;
}
#else /* USE_YAML_CONFIG */
(void) str;
(void) value;
(void) str; /* unused parameter */
(void) value; /* unused parameter */
return GETDNS_RETURN_NOT_IMPLEMENTED;
#endif /* USE_YAML_CONFIG */
}
Expand Down
2 changes: 1 addition & 1 deletion src/dnssec.c
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@ static getdns_dict *CD_extension(getdns_dns_req *dnsreq)
? dnssec_ok_checking_disabled_roadblock_avoidance
: dnssec_ok_checking_disabled_avoid_roadblocks;
#else
(void)dnsreq;
(void)dnsreq; /* unused parameter */
return dnssec_ok_checking_disabled;
#endif
}
Expand Down
6 changes: 3 additions & 3 deletions src/extension/libev.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static void
getdns_libev_read_cb(struct ev_loop *l, struct ev_io *io, int revents)
{
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);
el_ev->read_cb(el_ev->userarg);
}
Expand All @@ -106,7 +106,7 @@ static void
getdns_libev_write_cb(struct ev_loop *l, struct ev_io *io, int revents)
{
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);
el_ev->write_cb(el_ev->userarg);
}
Expand All @@ -115,7 +115,7 @@ static void
getdns_libev_timeout_cb(struct ev_loop *l, struct ev_timer *timer, int revents)
{
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);
el_ev->timeout_cb(el_ev->userarg);
}
Expand Down
4 changes: 2 additions & 2 deletions src/extension/libevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static getdns_return_t
getdns_libevent_clear(getdns_eventloop *loop, getdns_eventloop_event *el_ev)
{
struct event *my_ev = (struct event *)el_ev->ev;
(void)loop;
(void)loop; /* unused parameter */

assert(my_ev);

Expand All @@ -115,7 +115,7 @@ static void
getdns_libevent_callback(evutil_socket_t fd, short bits, void *arg)
{
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)arg;
(void)fd;
(void)fd; /* unused parameter */

if (bits & EV_READ) {
assert(el_ev->read_cb);
Expand Down
4 changes: 2 additions & 2 deletions src/extension/libuv.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ getdns_libuv_clear(getdns_eventloop *loop, getdns_eventloop_event *el_ev)
poll_timer *my_ev = (poll_timer *)el_ev->ev;
uv_poll_t *my_poll;
uv_timer_t *my_timer;
(void)loop;
(void)loop; /* unused parameter */

assert(my_ev);

Expand Down Expand Up @@ -165,7 +165,7 @@ getdns_libuv_timeout_cb(uv_timer_t *timer, int status)
{
getdns_eventloop_event *el_ev = (getdns_eventloop_event *)timer->data;
#ifndef HAVE_NEW_UV_TIMER_CB
(void)status;
(void)status; /* unused parameter */
#endif
assert(el_ev->timeout_cb);
DEBUG_UV("enter libuv_timeout_cb(el_ev = %p, el_ev->ev = %p)\n"
Expand Down
4 changes: 2 additions & 2 deletions src/extension/poll_eventloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ static void
poll_read_cb(int fd, getdns_eventloop_event *event)
{
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG
(void)fd;
(void)fd; /* unused parameter */
#endif
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event);
if (event && event->read_cb)
Expand All @@ -299,7 +299,7 @@ static void
poll_write_cb(int fd, getdns_eventloop_event *event)
{
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG
(void)fd;
(void)fd; /* unused parameter */
#endif
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event);
if (event && event->write_cb)
Expand Down
10 changes: 5 additions & 5 deletions src/extension/select_eventloop.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ select_eventloop_clear(getdns_eventloop *loop, getdns_eventloop_event *event)
static void
select_eventloop_cleanup(getdns_eventloop *loop)
{
(void)loop;
(void)loop; /* unused parameter */
}

static void
select_read_cb(int fd, getdns_eventloop_event *event)
{
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG
(void)fd;
(void)fd; /* unused parameter */
#endif
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event);
event->read_cb(event->userarg);
Expand All @@ -171,7 +171,7 @@ static void
select_write_cb(int fd, getdns_eventloop_event *event)
{
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG
(void)fd;
(void)fd; /* unused parameter */
#endif
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event);
event->write_cb(event->userarg);
Expand All @@ -181,7 +181,7 @@ static void
select_timeout_cb(int fd, getdns_eventloop_event *event)
{
#if !defined(SCHED_DEBUG) || !SCHED_DEBUG
(void)fd;
(void)fd; /* unused parameter */
#endif
DEBUG_SCHED( "%s(fd: %d, event: %p)\n", __FUNC__, fd, (void *)event);
event->timeout_cb(event->userarg);
Expand Down Expand Up @@ -309,7 +309,7 @@ _getdns_select_eventloop_init(struct mem_funcs *mf, _getdns_select_eventloop *lo
select_eventloop_run,
select_eventloop_run_once
};
(void) mf;
(void) mf; /* unused parameter */
(void) memset(loop, 0, sizeof(_getdns_select_eventloop));
loop->loop.vmt = &select_eventloop_vmt;
}
2 changes: 1 addition & 1 deletion src/general.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static void
ub_resolve_event_callback(void* arg, int rcode, void *pkt, int pkt_len,
int sec, char* why_bogus, int was_ratelimited)
{
(void) was_ratelimited;
(void) was_ratelimited; /* unused parameter */
#else
static void
ub_resolve_event_callback(void* arg, int rcode, void *pkt, int pkt_len,
Expand Down
2 changes: 1 addition & 1 deletion src/gnutls/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) 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)
Expand Down
12 changes: 6 additions & 6 deletions src/openssl/tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ static int _getdns_tls_verify_always_ok(int ok, X509_STORE_CTX *ctx)
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));
# else /* defined(STUB_DEBUG) && STUB_DEBUG */
(void)ok;
(void)ctx;
(void)ok; /* unused parameter */
(void)ctx; /* unused parameter */
# endif /* #else defined(STUB_DEBUG) && STUB_DEBUG */
return 1;
}
Expand Down Expand Up @@ -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
* 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)
return GETDNS_RETURN_GOOD;

Expand Down Expand Up @@ -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
* 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)
return GETDNS_RETURN_GOOD;

Expand Down Expand Up @@ -914,7 +914,7 @@ getdns_return_t _getdns_tls_connection_set_host_pinset(_getdns_tls_connection* c

#if defined(HAVE_SSL_DANE_ENABLE)
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"
, STUB_DEBUG_SETUP_TLS, __FUNC__, auth_name, osr);
SSL_set_verify(conn->ssl, SSL_VERIFY_PEER, _getdns_tls_verify_always_ok);
Expand All @@ -940,7 +940,7 @@ getdns_return_t _getdns_tls_connection_set_host_pinset(_getdns_tls_connection* c
int osr = DANESSL_init(conn->ssl,
*auth_name ? auth_name : NULL,
*auth_name ? auth_names : NULL);
(void) osr;
(void) osr; /* unused parameter */
DEBUG_STUB("%s %-35s: DEBUG: DANESSL_init(\"%s\") -> %d\n"
, STUB_DEBUG_SETUP_TLS, __FUNC__, auth_name, osr);
SSL_set_verify(conn->ssl, SSL_VERIFY_PEER, _getdns_tls_verify_always_ok);
Expand Down
2 changes: 1 addition & 1 deletion src/request-internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ void
_getdns_network_validate_tsig(getdns_network_req *req)
{
#if defined(HAVE_NSS) || defined(HAVE_NETTLE)
(void)req;
(void)req; /* unused parameter */
#else
_getdns_rr_iter rr_spc, *rr;
_getdns_rdf_iter rdf_spc, *rdf;
Expand Down
17 changes: 10 additions & 7 deletions src/rr-dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
static const uint8_t *
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;
}
static getdns_return_t
Expand Down Expand Up @@ -91,7 +91,7 @@ apl_afdpart_rdf_end(
const uint8_t *pkt, const uint8_t *pkt_end, const uint8_t *rdf)
{
const uint8_t *end = rdf + (rdf[-1] & 0x7F);
(void)(pkt);
(void)pkt; /* unused parameter */
return end <= pkt_end ? end : NULL;
}
static getdns_return_t
Expand Down Expand Up @@ -217,6 +217,7 @@ ipseckey_gateway_2wire(
{
assert(rdf - 2 >= rdata && rdf[-2] > 0);

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

(void)rdata; /* unused parameter */
switch (rdf[-1] & 0x7F) {
case 1: if (!value || value->size != 4)
return GETDNS_RETURN_INVALID_PARAMETER;
Expand Down
Loading

0 comments on commit 2a01145

Please sign in to comment.