From a69ff231f196a6a9e7fec83ff62918b9f8488706 Mon Sep 17 00:00:00 2001 From: William Brown Date: Jan 11 2017 02:28:22 +0000 Subject: Ticket 78 - Unused parameter warnings Bug Description: Clean up unused parameter warnings so that we don't obscure real compiler errors. Fix Description: Add __attribute__((unused)) where needed. https://pagure.io/nunc-stans/issue/78 Author: wibrown Review by: nhosoi (Thanks!) --- diff --git a/ns_event_fw_tevent.c b/ns_event_fw_tevent.c index 0fe97f7..08a0781 100644 --- a/ns_event_fw_tevent.c +++ b/ns_event_fw_tevent.c @@ -60,7 +60,7 @@ static void ns_event_fw_timer_event_done(ns_event_fw_ctx_t *ns_event_fw_ctx, ns_ static void ns_event_fw_signal_event_done(ns_event_fw_ctx_t *ns_event_fw_ctx, ns_job_t *job); static void -tevent_logger_cb(void *context, enum tevent_debug_level level, const char *fmt, va_list ap) +tevent_logger_cb(void *context __attribute__((unused)), enum tevent_debug_level level, const char *fmt, va_list ap) { int priority = 0; char *msg = NULL; @@ -95,7 +95,7 @@ event_flags_to_type(uint16_t flags) is triggered - this "maps" the event library interface to our nspr/thrpool interface */ static void -fd_event_cb(struct tevent_context *ev, struct tevent_fd *fde, +fd_event_cb(struct tevent_context *ev __attribute__((unused)), struct tevent_fd *fde __attribute__((unused)), uint16_t flags, void *arg) { ns_job_t *job = (ns_job_t *)arg; @@ -114,8 +114,8 @@ fd_event_cb(struct tevent_context *ev, struct tevent_fd *fde, is triggered - this "maps" the event library interface to our nspr/thrpool interface */ static void -timer_event_cb(struct tevent_context *ev, struct tevent_timer *te, - struct timeval current_time, void *arg) +timer_event_cb(struct tevent_context *ev __attribute__((unused)), struct tevent_timer *te __attribute__((unused)), + struct timeval current_time __attribute__((unused)), void *arg) { ns_job_t *job = (ns_job_t *)arg; @@ -133,8 +133,8 @@ timer_event_cb(struct tevent_context *ev, struct tevent_timer *te, is triggered - this "maps" the event library interface to our nspr/thrpool interface */ static void -signal_event_cb(struct tevent_context *ev, struct tevent_signal *se, - int signum, int count, void *siginfo, void *arg) +signal_event_cb(struct tevent_context *ev __attribute__((unused)), struct tevent_signal *se __attribute__((unused)), + int signum, int count __attribute__((unused)), void *siginfo __attribute__((unused)), void *arg) { ns_job_t *job = (ns_job_t *)arg; @@ -181,7 +181,7 @@ ns_event_fw_destroy(ns_event_fw_ctx_t *ns_event_fw_ctx_t) */ static void ns_event_fw_io_event_remove( - ns_event_fw_ctx_t *ns_event_fw_ctx, + ns_event_fw_ctx_t *ns_event_fw_ctx __attribute__((unused)), ns_job_t *job ) { @@ -201,7 +201,7 @@ ns_event_fw_io_event_done( static void ns_event_fw_timer_event_done( - ns_event_fw_ctx_t *ns_event_fw_ctx, + ns_event_fw_ctx_t *ns_event_fw_ctx __attribute__((unused)), ns_job_t *job ) { @@ -211,7 +211,7 @@ ns_event_fw_timer_event_done( static void ns_event_fw_signal_event_done( - ns_event_fw_ctx_t *ns_event_fw_ctx, + ns_event_fw_ctx_t *ns_event_fw_ctx __attribute__((unused)), ns_job_t *job ) { diff --git a/tests/cmocka/stress_test.c b/tests/cmocka/stress_test.c index 2870775..a75144e 100644 --- a/tests/cmocka/stress_test.c +++ b/tests/cmocka/stress_test.c @@ -418,7 +418,7 @@ client_create_work(struct ns_job_t *job) PR_Sleep(PR_SecondsToInterval(1)); clock_gettime(CLOCK_MONOTONIC, &ts); printf("BEGIN: %ld.%ld\n", ts.tv_sec, ts.tv_nsec); - for (PRUint64 i = 0; i < jobs; i++) { + for (PRInt32 i = 0; i < jobs; i++) { ns_add_job(ns_job_get_tp(job), NS_JOB_NONE|NS_JOB_THREAD, client_initiate_connection_cb, NULL, NULL); } ns_job_done(job); @@ -427,7 +427,7 @@ client_create_work(struct ns_job_t *job) } static void -ns_stress_test(void **state) +ns_stress_test(void **state __attribute__((unused))) { /* Setup both thread pools. */ @@ -496,7 +496,7 @@ ns_stress_test(void **state) ns_add_timeout_job(ctp, &timeout, NS_JOB_NONE|NS_JOB_THREAD, test_client_shutdown, stp, &final_job); /* While true, add connect / write jobs */ - for (PRUint64 i = 0; i < client_thread_count; i++) { + for (PRInt32 i = 0; i < client_thread_count; i++) { ns_add_job(ctp, NS_JOB_NONE|NS_JOB_THREAD, client_create_work, NULL, NULL); } diff --git a/tests/cmocka/test.c b/tests/cmocka/test.c index 648ed7f..ab85ca7 100644 --- a/tests/cmocka/test.c +++ b/tests/cmocka/test.c @@ -62,7 +62,7 @@ static PRLock *cb_lock = NULL; static PRCondVar *cb_cond = NULL; void -ns_test_logger(int priority, const char *fmt, va_list varg) +ns_test_logger(int priority __attribute__((unused)), const char *fmt, va_list varg) { // Should we do anything with priority? vprintf(fmt, varg); @@ -75,7 +75,6 @@ ns_test_setup(void **state) /* Ensure that we can create a new nunc-stans instance. */ struct ns_thrpool_t *tp = NULL; struct ns_thrpool_config ns_config; - struct ns_job_t *listen_job = NULL; /* Reset the callback check */ cb_check = 0; /* Create the cond var the CB check will use. */ @@ -110,7 +109,7 @@ ns_test_teardown(void **state) } static void -ns_init_test_job_cb(struct ns_job_t *job) +ns_init_test_job_cb(struct ns_job_t *job __attribute__((unused))) { cb_check += 1; PR_Lock(cb_lock); @@ -133,7 +132,7 @@ ns_init_disarm_job_cb(struct ns_job_t *job) } static void -ns_init_do_nothing_cb(struct ns_job_t *job) +ns_init_do_nothing_cb(struct ns_job_t *job __attribute__((unused))) { /* I mean it, do nothing! */ return;