Unit test fixes for CFLAGS=-Wextra

This commit is contained in:
Willem Toorop 2016-12-08 14:39:38 +01:00
parent 473da8966b
commit a5748be5fb
14 changed files with 22 additions and 6 deletions

View File

@ -75,7 +75,7 @@
int
main (int argc, char** argv)
main ()
{
int number_failed;
SRunner *sr ;

View File

@ -451,6 +451,8 @@
void *userarg,
getdns_transaction_t transaction_id)
{
(void)context; (void)response; (void)userarg;
callback_called++;
if(callback_type == GETDNS_CALLBACK_CANCEL)
@ -483,6 +485,7 @@
*/
void verify_getdns_cancel_callback(struct extracted_response *ex_response)
{
(void)ex_response;
/*
* increment callback_called global to prove callback was called.
*/

View File

@ -320,6 +320,7 @@ void destroy_callbackfn(struct getdns_context *context,
void *userarg,
getdns_transaction_t transaction_id) {
int* flag = (int*)userarg;
(void)callback_type; (void)transaction_id;
*flag = 1;
getdns_dict_destroy(response);
getdns_context_destroy(context);
@ -339,6 +340,7 @@ void callbackfn(struct getdns_context *context,
{
typedef void (*fn_ptr)(struct extracted_response *ex_response);
fn_ptr fn = userarg;
(void)context; (void)transaction_id;
/*
* If userarg is NULL, either a negative test case
@ -378,7 +380,7 @@ void callbackfn(struct getdns_context *context,
void update_callbackfn(struct getdns_context *context,
getdns_context_code_t changed_item)
{
(void)context;
ck_assert_msg(changed_item == expected_changed_item,
"Expected changed_item == %d, got %d",
changed_item, expected_changed_item);

View File

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

View File

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

View File

@ -79,7 +79,7 @@
struct getdns_list *answer = NULL;
char *keys[3] = { "ten", "eleven", "twelve" };
uint32_t values[3] = { 10, 11, 12 };
int i;
size_t i;
size_t length;
struct getdns_bindata *key = NULL;
char string_buffer[20] = "";

View File

@ -46,6 +46,7 @@
void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
struct ev_loop* loop = (struct ev_loop*) eventloop;
(void)context;
ev_run(loop, 0);
}

View File

@ -42,6 +42,7 @@
void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
struct event_base* base = (struct event_base*) eventloop;
(void)context;
event_base_dispatch(base);
}

View File

@ -42,6 +42,7 @@
void run_event_loop_impl(struct getdns_context* context, void* eventloop) {
uv_loop_t* loop = (uv_loop_t*) eventloop;
(void)context;
uv_run(loop, UV_RUN_DEFAULT);
}

View File

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

View File

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

View File

@ -214,7 +214,7 @@ tst_getnames(void)
size_t index;
size_t llen;
uint32_t ansint;
int i;
size_t i;
getdns_return_t result;
getdns_data_type dtype;
struct getdns_dict *dict = NULL;
@ -508,7 +508,7 @@ tst_create(void)
* runs unit tests against list management routines
*/
int
main(int argc, char *argv[])
main()
{
tstmsg_prog_begin("tests_dict");

View File

@ -404,7 +404,7 @@ tst_create(void)
* runs unit tests against list management routines
*/
int
main(int argc, char *argv[])
main()
{
tstmsg_prog_begin("tests_list");

View File

@ -57,6 +57,8 @@ this_callbackfn(struct getdns_context *this_context,
struct getdns_dict *this_response,
void *this_userarg, getdns_transaction_t this_transaction_id)
{
(void)this_context; (void)this_userarg;
if (this_callback_type == GETDNS_CALLBACK_COMPLETE) { /* This is a callback with data */
char *res = getdns_pretty_print_dict(this_response);
fprintf(stdout, "%s\n", res);