From 8307eb5f55b4c2f5ac744fe3ac384025bea1e8b4 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 2 Nov 2015 13:44:47 -0700 Subject: [PATCH] build: enable missing function declaration warning This helps weed out functions that should be static, functions that are not declared in public header files, and .c files that don't include their .h interface headers. Change-Id: Ie39f83ad4b320847e4a938bd1d4d0b4fa21c2ffa Signed-off-by: Daniel Verkamp --- examples/nvme/perf/perf.c | 2 +- lib/memory/vtophys.c | 2 +- lib/util/file.c | 2 + mk/spdk.common.mk | 2 +- test/lib/nvme/unit/nvme_c/nvme_ut.c | 8 ++-- .../nvme/unit/nvme_ctrlr_c/nvme_ctrlr_ut.c | 2 +- .../unit/nvme_ctrlr_cmd_c/nvme_ctrlr_cmd_ut.c | 28 +++++++------- .../nvme/unit/nvme_ns_cmd_c/nvme_ns_cmd_ut.c | 16 ++++---- .../nvme/unit/nvme_qpair_c/nvme_qpair_ut.c | 38 ++++++++----------- 9 files changed, 47 insertions(+), 53 deletions(-) diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index 8d6f5588f..f37b0fb5e 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -291,7 +291,7 @@ aio_check_io(struct ns_entry *entry) } #endif /* HAVE_LIBAIO */ -void task_ctor(struct rte_mempool *mp, void *arg, void *__task, unsigned id) +static void task_ctor(struct rte_mempool *mp, void *arg, void *__task, unsigned id) { struct perf_task *task = __task; task->buf = rte_malloc(NULL, g_io_size_bytes, 0x200); diff --git a/lib/memory/vtophys.c b/lib/memory/vtophys.c index f85466270..6cec9a106 100644 --- a/lib/memory/vtophys.c +++ b/lib/memory/vtophys.c @@ -127,7 +127,7 @@ vtophys_get_map(uint64_t vfn_2mb) return map_2mb; } -uint64_t +static uint64_t vtophys_get_pfn_2mb(uint64_t vfn_2mb) { uintptr_t vaddr, paddr; diff --git a/lib/util/file.c b/lib/util/file.c index e736da5ce..07fb7157c 100644 --- a/lib/util/file.c +++ b/lib/util/file.c @@ -31,6 +31,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "spdk/file.h" + #include #include #include diff --git a/mk/spdk.common.mk b/mk/spdk.common.mk index 866920a9d..b5987033a 100644 --- a/mk/spdk.common.mk +++ b/mk/spdk.common.mk @@ -43,7 +43,7 @@ endif OS := $(shell uname) -COMMON_CFLAGS = -g $(C_OPT) -Wall -Wextra -Wno-unused-parameter -Werror -fno-strict-aliasing -march=native -m64 -I$(SPDK_ROOT_DIR)/include +COMMON_CFLAGS = -g $(C_OPT) -Wall -Wextra -Wno-unused-parameter -Wmissing-declarations -Werror -fno-strict-aliasing -march=native -m64 -I$(SPDK_ROOT_DIR)/include COMMON_CFLAGS += -Wformat -Wformat-security -Wformat-nonliteral diff --git a/test/lib/nvme/unit/nvme_c/nvme_ut.c b/test/lib/nvme/unit/nvme_c/nvme_ut.c index 65d60de93..4d9b0adfd 100644 --- a/test/lib/nvme/unit/nvme_c/nvme_ut.c +++ b/test/lib/nvme/unit/nvme_c/nvme_ut.c @@ -69,7 +69,7 @@ nvme_ctrlr_start(struct nvme_controller *ctrlr) return 0; } -void prepare_for_test(uint32_t max_io_queues) +static void prepare_for_test(uint32_t max_io_queues) { struct nvme_driver *driver = &g_nvme_driver; @@ -86,7 +86,7 @@ void prepare_for_test(uint32_t max_io_queues) threads_fail = 0; } -void * +static void * nvme_thread(void *arg) { int rc; @@ -108,7 +108,7 @@ nvme_thread(void *arg) pthread_exit(NULL); } -void +static void test1(void) { struct nvme_driver *driver = &g_nvme_driver; @@ -136,7 +136,7 @@ test1(void) CU_ASSERT(driver->ioq_index_pool_next == 0); } -void +static void test2(void) { int num_threads = 16; diff --git a/test/lib/nvme/unit/nvme_ctrlr_c/nvme_ctrlr_ut.c b/test/lib/nvme/unit/nvme_ctrlr_c/nvme_ctrlr_ut.c index 11d452827..22fc2d1c3 100644 --- a/test/lib/nvme/unit/nvme_ctrlr_c/nvme_ctrlr_ut.c +++ b/test/lib/nvme/unit/nvme_ctrlr_c/nvme_ctrlr_ut.c @@ -163,7 +163,7 @@ nvme_allocate_request(void *payload, uint32_t payload_size, return req; } -void +static void test_nvme_ctrlr_fail(void) { struct nvme_controller ctrlr = {}; diff --git a/test/lib/nvme/unit/nvme_ctrlr_cmd_c/nvme_ctrlr_cmd_ut.c b/test/lib/nvme/unit/nvme_ctrlr_cmd_c/nvme_ctrlr_cmd_ut.c index 4332628a7..c0737f25d 100644 --- a/test/lib/nvme/unit/nvme_ctrlr_cmd_c/nvme_ctrlr_cmd_ut.c +++ b/test/lib/nvme/unit/nvme_ctrlr_cmd_c/nvme_ctrlr_cmd_ut.c @@ -55,7 +55,7 @@ uint16_t abort_sqid = 1; typedef void (*verify_request_fn_t)(struct nvme_request *req); verify_request_fn_t verify_fn; -void verify_firmware_log_page(struct nvme_request *req) +static void verify_firmware_log_page(struct nvme_request *req) { uint32_t temp_cdw10; @@ -67,7 +67,7 @@ void verify_firmware_log_page(struct nvme_request *req) CU_ASSERT(req->cmd.cdw10 == temp_cdw10); } -void verify_health_log_page(struct nvme_request *req) +static void verify_health_log_page(struct nvme_request *req) { uint32_t temp_cdw10; @@ -79,7 +79,7 @@ void verify_health_log_page(struct nvme_request *req) CU_ASSERT(req->cmd.cdw10 == temp_cdw10); } -void verify_error_log_page(struct nvme_request *req) +static void verify_error_log_page(struct nvme_request *req) { uint32_t temp_cdw10; @@ -91,27 +91,27 @@ void verify_error_log_page(struct nvme_request *req) CU_ASSERT(req->cmd.cdw10 == temp_cdw10); } -void verify_set_feature_cmd(struct nvme_request *req) +static void verify_set_feature_cmd(struct nvme_request *req) { CU_ASSERT(req->cmd.opc == NVME_OPC_SET_FEATURES); CU_ASSERT(req->cmd.cdw10 == feature); CU_ASSERT(req->cmd.cdw11 == feature_cdw11); } -void verify_get_feature_cmd(struct nvme_request *req) +static void verify_get_feature_cmd(struct nvme_request *req) { CU_ASSERT(req->cmd.opc == NVME_OPC_GET_FEATURES); CU_ASSERT(req->cmd.cdw10 == get_feature); CU_ASSERT(req->cmd.cdw11 == get_feature_cdw11); } -void verify_abort_cmd(struct nvme_request *req) +static void verify_abort_cmd(struct nvme_request *req) { CU_ASSERT(req->cmd.opc == NVME_OPC_ABORT); CU_ASSERT(req->cmd.cdw10 == (((uint32_t)abort_cid << 16) | abort_sqid)); } -void verify_io_raw_cmd(struct nvme_request *req) +static void verify_io_raw_cmd(struct nvme_request *req) { struct nvme_command command = {}; @@ -159,7 +159,7 @@ nvme_ctrlr_submit_admin_request(struct nvme_controller *ctrlr, struct nvme_reque } -void +static void test_firmware_get_log_page() { struct nvme_controller ctrlr = {}; @@ -170,7 +170,7 @@ test_firmware_get_log_page() nvme_ctrlr_cmd_get_firmware_page(&ctrlr, &payload, NULL, NULL); } -void +static void test_health_get_log_page() { struct nvme_controller ctrlr = {}; @@ -181,7 +181,7 @@ test_health_get_log_page() nvme_ctrlr_cmd_get_health_information_page(&ctrlr, health_log_nsid, &payload, NULL, NULL); } -void +static void test_error_get_log_page() { struct nvme_controller ctrlr = {}; @@ -196,7 +196,7 @@ test_error_get_log_page() nvme_ctrlr_cmd_get_error_page(&ctrlr, &payload, error_num_entries, NULL, NULL); } -void +static void test_set_feature_cmd() { struct nvme_controller ctrlr = {}; @@ -207,7 +207,7 @@ test_set_feature_cmd() } -void +static void test_get_feature_cmd() { struct nvme_controller ctrlr = {}; @@ -217,7 +217,7 @@ test_get_feature_cmd() nvme_ctrlr_cmd_get_feature(&ctrlr, get_feature, get_feature_cdw11, NULL, 0, NULL, NULL); } -void +static void test_abort_cmd() { struct nvme_controller ctrlr = {}; @@ -227,7 +227,7 @@ test_abort_cmd() nvme_ctrlr_cmd_abort(&ctrlr, abort_cid, abort_sqid, NULL, NULL); } -void +static void test_io_raw_cmd() { struct nvme_controller ctrlr = {}; diff --git a/test/lib/nvme/unit/nvme_ns_cmd_c/nvme_ns_cmd_ut.c b/test/lib/nvme/unit/nvme_ns_cmd_c/nvme_ns_cmd_ut.c index a0ac9632f..872f16e29 100644 --- a/test/lib/nvme/unit/nvme_ns_cmd_c/nvme_ns_cmd_ut.c +++ b/test/lib/nvme/unit/nvme_ns_cmd_c/nvme_ns_cmd_ut.c @@ -86,7 +86,7 @@ nvme_ctrlr_submit_io_request(struct nvme_controller *ctrlr, g_request = req; } -void +static void prepare_for_test(struct nvme_namespace *ns, struct nvme_controller *ctrlr, uint32_t sector_size, uint32_t max_xfer_size, uint32_t stripe_size) @@ -102,7 +102,7 @@ prepare_for_test(struct nvme_namespace *ns, struct nvme_controller *ctrlr, g_request = NULL; } -void +static void nvme_cmd_interpret_rw(const struct nvme_command *cmd, uint64_t *lba, uint32_t *num_blocks) { @@ -110,7 +110,7 @@ nvme_cmd_interpret_rw(const struct nvme_command *cmd, *num_blocks = (cmd->cdw12 & 0xFFFFu) + 1; } -void +static void split_test(void) { struct nvme_namespace ns; @@ -139,7 +139,7 @@ split_test(void) nvme_free_request(g_request); } -void +static void split_test2(void) { struct nvme_namespace ns; @@ -192,7 +192,7 @@ split_test2(void) nvme_free_request(g_request); } -void +static void split_test3(void) { struct nvme_namespace ns; @@ -247,7 +247,7 @@ split_test3(void) nvme_free_request(g_request); } -void +static void split_test4(void) { struct nvme_namespace ns; @@ -313,7 +313,7 @@ split_test4(void) nvme_free_request(g_request); } -void +static void test_nvme_ns_cmd_flush(void) { struct nvme_namespace ns; @@ -330,7 +330,7 @@ test_nvme_ns_cmd_flush(void) nvme_free_request(g_request); } -void +static void test_nvme_ns_cmd_deallocate(void) { struct nvme_namespace ns; diff --git a/test/lib/nvme/unit/nvme_qpair_c/nvme_qpair_ut.c b/test/lib/nvme/unit/nvme_qpair_c/nvme_qpair_ut.c index 1d314e4cc..bd67cba37 100644 --- a/test/lib/nvme/unit/nvme_qpair_c/nvme_qpair_ut.c +++ b/test/lib/nvme/unit/nvme_qpair_c/nvme_qpair_ut.c @@ -55,14 +55,6 @@ uint64_t nvme_vtophys(void *buf) } } -void nvme_dump_completion(struct nvme_completion *cpl) -{ -} - -void prepare_for_test(void) -{ -} - struct nvme_request * nvme_allocate_request(void *payload, uint32_t payload_size, nvme_cb_fn_t cb_fn, void *cb_arg) @@ -107,7 +99,7 @@ nvme_free_request(struct nvme_request *req) nvme_dealloc_request(req); } -void +static void test1(void) { struct nvme_qpair qpair = {}; @@ -128,7 +120,7 @@ test1(void) CU_ASSERT(strstr(outbuf, "IDENTIFY") != NULL); } -void +static void test2(void) { struct nvme_qpair qpair = {}; @@ -149,7 +141,7 @@ test2(void) CU_ASSERT(strstr(outbuf, "DATASET MANAGEMENT") != NULL); } -void +static void prepare_submit_request_test(struct nvme_qpair *qpair, struct nvme_controller *ctrlr, struct nvme_registers *regs) @@ -164,25 +156,25 @@ prepare_submit_request_test(struct nvme_qpair *qpair, fail_vtophys = false; } -void +static void cleanup_submit_request_test(struct nvme_qpair *qpair) { nvme_qpair_destroy(qpair); } -void +static void expected_success_callback(void *arg, const struct nvme_completion *cpl) { CU_ASSERT(!nvme_completion_is_error(cpl)); } -void +static void expected_failure_callback(void *arg, const struct nvme_completion *cpl) { CU_ASSERT(nvme_completion_is_error(cpl)); } -void +static void test3(void) { struct nvme_qpair qpair = {}; @@ -205,7 +197,7 @@ test3(void) nvme_free_request(req); } -void +static void test4(void) { struct nvme_qpair qpair = {}; @@ -238,7 +230,7 @@ test4(void) cleanup_submit_request_test(&qpair); } -void +static void test_ctrlr_failed(void) { struct nvme_qpair qpair = {}; @@ -272,7 +264,7 @@ test_ctrlr_failed(void) cleanup_submit_request_test(&qpair); } -void struct_packing(void) +static void struct_packing(void) { /* ctrlr is the first field in nvme_qpair after the fields * that are used in the I/O path. Make sure the I/O path fields @@ -281,7 +273,7 @@ void struct_packing(void) CU_ASSERT(offsetof(struct nvme_qpair, ctrlr) <= 128); } -void test_nvme_qpair_fail(void) +static void test_nvme_qpair_fail(void) { struct nvme_qpair qpair = {}; struct nvme_request *req = NULL; @@ -311,7 +303,7 @@ void test_nvme_qpair_fail(void) cleanup_submit_request_test(&qpair); } -void test_nvme_qpair_process_completions(void) +static void test_nvme_qpair_process_completions(void) { struct nvme_qpair qpair = {}; struct nvme_controller ctrlr = {}; @@ -325,7 +317,7 @@ void test_nvme_qpair_process_completions(void) cleanup_submit_request_test(&qpair); } -void test_nvme_qpair_destroy(void) +static void test_nvme_qpair_destroy(void) { struct nvme_qpair qpair = {}; struct nvme_controller ctrlr = {}; @@ -346,7 +338,7 @@ void test_nvme_qpair_destroy(void) nvme_qpair_destroy(&qpair); } -void test_nvme_completion_is_retry(void) +static void test_nvme_completion_is_retry(void) { struct nvme_completion cpl = {}; @@ -407,7 +399,7 @@ void test_nvme_completion_is_retry(void) CU_ASSERT_FALSE(nvme_completion_is_retry(&cpl)); } -void +static void test_get_status_string(void) { const char *status_string;