build: enable signed-vs-unsigned compare warning

Change-Id: I93f069241cb74b3ec7d272bc390998372c376b16
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2015-11-02 12:58:19 -07:00
parent f79a334e33
commit a945f60c79
11 changed files with 22 additions and 17 deletions

View File

@ -93,7 +93,7 @@ get_feature(struct nvme_controller *ctrlr, uint8_t fid)
static void
get_features(struct nvme_controller *ctrlr)
{
int i;
size_t i;
uint8_t features_to_get[] = {
NVME_FEAT_ARBITRATION,

View File

@ -56,7 +56,8 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller *ctrlr)
{
struct nvme_qpair *qpair;
union nvme_cap_lo_register cap_lo;
int i, num_entries, num_trackers, rc;
uint32_t i, num_entries, num_trackers;
int rc;
if (ctrlr->ioq != NULL) {
/*
@ -112,7 +113,7 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller *ctrlr)
static void
nvme_ctrlr_fail(struct nvme_controller *ctrlr)
{
int i;
uint32_t i;
ctrlr->is_failed = true;
nvme_qpair_fail(&ctrlr->adminq);
@ -261,7 +262,8 @@ nvme_ctrlr_enable(struct nvme_controller *ctrlr)
int
nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr)
{
int i, rc;
uint32_t i;
int rc;
union nvme_cc_register cc;
cc.raw = nvme_mmio_read_4(ctrlr, cc.raw);
@ -396,7 +398,7 @@ nvme_ctrlr_create_qpairs(struct nvme_controller *ctrlr)
{
struct nvme_completion_poll_status status;
struct nvme_qpair *qpair;
int i;
uint32_t i;
if (nvme_ctrlr_construct_io_qpairs(ctrlr)) {
nvme_printf(ctrlr, "nvme_ctrlr_construct_io_qpairs failed!\n");
@ -687,7 +689,7 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, void *devhandle)
void
nvme_ctrlr_destruct(struct nvme_controller *ctrlr)
{
int i;
uint32_t i;
nvme_ctrlr_disable(ctrlr);
nvme_ctrlr_shutdown(ctrlr);

View File

@ -261,12 +261,12 @@ nvme_ctrlr_cmd_get_error_page(struct nvme_controller *ctrlr,
nvme_assert(num_entries > 0, ("%s called with num_entries==0\n", __func__));
/* Controller's error log page entries is 0-based. */
nvme_assert(num_entries <= (ctrlr->cdata.elpe + 1),
nvme_assert(num_entries <= (ctrlr->cdata.elpe + 1u),
("%s called with num_entries=%d but (elpe+1)=%d\n", __func__,
num_entries, ctrlr->cdata.elpe + 1));
if (num_entries > (ctrlr->cdata.elpe + 1))
num_entries = ctrlr->cdata.elpe + 1;
if (num_entries > (ctrlr->cdata.elpe + 1u))
num_entries = ctrlr->cdata.elpe + 1u;
nvme_ctrlr_cmd_get_log_page(ctrlr, NVME_LOG_ERROR,
NVME_GLOBAL_NAMESPACE_TAG, payload, sizeof(*payload) * num_entries,

View File

@ -99,6 +99,7 @@ nvme_malloc(const char *tag, size_t size, unsigned align, uint64_t *phys_addr)
* Return the physical address for the specified virtual address.
*/
#define nvme_vtophys(buf) vtophys(buf)
#define NVME_VTOPHYS_ERROR VTOPHYS_ERROR
extern struct rte_mempool *request_mempool;

View File

@ -709,7 +709,7 @@ nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req)
*/
phys_addr = nvme_vtophys(req->u.payload);
if (phys_addr == -1) {
if (phys_addr == NVME_VTOPHYS_ERROR) {
_nvme_fail_request_bad_vtophys(qpair, tr);
return;
}
@ -731,7 +731,7 @@ nvme_qpair_submit_request(struct nvme_qpair *qpair, struct nvme_request *req)
while (cur_nseg < nseg) {
seg_addr = req->u.payload + cur_nseg * PAGE_SIZE - unaligned;
phys_addr = nvme_vtophys(seg_addr);
if (phys_addr == -1) {
if (phys_addr == NVME_VTOPHYS_ERROR) {
_nvme_fail_request_bad_vtophys(qpair, tr);
return;
}

View File

@ -63,7 +63,7 @@ sprintf_alloc(const char *format, ...)
* If vsnprintf() returned a count within our current buffer size, we are done.
* The count does not include the \0 terminator, so rc == bufsize is not OK.
*/
if (rc >= 0 && rc < bufsize) {
if (rc >= 0 && (size_t)rc < bufsize) {
return buf;
}

View File

@ -43,7 +43,7 @@ endif
OS := $(shell uname)
COMMON_CFLAGS = -g $(C_OPT) -Wall -Werror -fno-strict-aliasing -march=native -m64 -I$(SPDK_ROOT_DIR)/include
COMMON_CFLAGS = -g $(C_OPT) -Wall -Wsign-compare -Werror -fno-strict-aliasing -march=native -m64 -I$(SPDK_ROOT_DIR)/include
COMMON_CFLAGS += -Wformat -Wformat-security -Wformat-nonliteral

View File

@ -62,7 +62,7 @@ vtophys_negative_test()
if (p == NULL)
continue;
if (vtophys(p) != -1) {
if (vtophys(p) != VTOPHYS_ERROR) {
rc = -1;
printf("Err: VA=%p is mapped to a huge_page,\n", p);
free(p);
@ -94,7 +94,7 @@ vtophys_positive_test()
if (p == NULL)
continue;
if (vtophys(p) == -1) {
if (vtophys(p) == VTOPHYS_ERROR) {
rc = -1;
printf("Err: VA=%p is not mapped to a huge_page,\n", p);
rte_free(p);

View File

@ -108,7 +108,7 @@ void verify_get_feature_cmd(struct nvme_request *req)
void verify_abort_cmd(struct nvme_request *req)
{
CU_ASSERT(req->cmd.opc == NVME_OPC_ABORT);
CU_ASSERT(req->cmd.cdw10 == ((abort_cid << 16) | abort_sqid));
CU_ASSERT(req->cmd.cdw10 == (((uint32_t)abort_cid << 16) | abort_sqid));
}
void verify_io_raw_cmd(struct nvme_request *req)

View File

@ -65,6 +65,8 @@ do \
while (0)
uint64_t nvme_vtophys(void *buf);
#define NVME_VTOPHYS_ERROR (0xFFFFFFFFFFFFFFFFULL)
#define nvme_alloc_request(bufp) \
do \
{ \

View File

@ -347,7 +347,7 @@ test_nvme_ns_cmd_deallocate(void)
nvme_ns_cmd_deallocate(&ns, payload, num_ranges, cb_fn, cb_arg);
CU_ASSERT(g_request->cmd.opc == NVME_OPC_DATASET_MANAGEMENT);
CU_ASSERT(g_request->cmd.nsid == ns.id);
CU_ASSERT(g_request->cmd.cdw10 == num_ranges - 1);
CU_ASSERT(g_request->cmd.cdw10 == num_ranges - 1u);
CU_ASSERT(g_request->cmd.cdw11 == NVME_DSM_ATTR_DEALLOCATE);
free(payload);
nvme_free_request(g_request);