From 4467497ec9a2c3d322207c1c7129fd646a7fa97e Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 11 Jan 2020 10:53:50 -0500 Subject: [PATCH] portability: fix printf formatting Use the C99 "%zu" escaping when emitting size_t variables. This fixes several compiler warnings (when (size_t) != (unsigned long long)). Signed-off-by: Jeff Squyres --- prov/mrail/src/mrail_ep.c | 3 ++- prov/rxm/src/rxm_ep.c | 5 +++-- prov/util/src/util_mr_cache.c | 19 ++++++++++--------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/prov/mrail/src/mrail_ep.c b/prov/mrail/src/mrail_ep.c index deaad5c8eca..cae3c004a8e 100644 --- a/prov/mrail/src/mrail_ep.c +++ b/prov/mrail/src/mrail_ep.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2018-2019 Intel Corporation, Inc. All rights reserved. + * Copyright (c) 2020 Cisco Systems, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -533,7 +534,7 @@ mrail_send_common(struct fid_ep *ep_fid, const struct iovec *iov, void **desc, if (total_len < mrail_ep->rails[rail].info->tx_attr->inject_size) flags |= FI_INJECT; - FI_DBG(&mrail_prov, FI_LOG_EP_DATA, "Posting send of length: %" PRIu64 + FI_DBG(&mrail_prov, FI_LOG_EP_DATA, "Posting send of length: %zu" " dest_addr: 0x%" PRIx64 " tag: 0x%" PRIx64 " seq: %d" " on rail: %d\n", len, dest_addr, tag, peer_info->seq_no - 1, rail); diff --git a/prov/rxm/src/rxm_ep.c b/prov/rxm/src/rxm_ep.c index 21d55aebdf9..6b49167aa74 100644 --- a/prov/rxm/src/rxm_ep.c +++ b/prov/rxm/src/rxm_ep.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2013-2016 Intel Corporation. All rights reserved. + * Copyright (c) 2020 Cisco Systems, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -909,7 +910,7 @@ rxm_ep_msg_inject_send(struct rxm_ep *rxm_ep, struct rxm_conn *rxm_conn, struct rxm_pkt *tx_pkt, size_t pkt_size, ofi_cntr_inc_func cntr_inc_func) { - FI_DBG(&rxm_prov, FI_LOG_EP_DATA, "Posting inject with length: %" PRIu64 + FI_DBG(&rxm_prov, FI_LOG_EP_DATA, "Posting inject with length: %zu" " tag: 0x%" PRIx64 "\n", pkt_size, tx_pkt->hdr.tag); assert((tx_pkt->hdr.flags & FI_REMOTE_CQ_DATA) || !tx_pkt->hdr.flags); @@ -925,7 +926,7 @@ static inline ssize_t rxm_ep_msg_normal_send(struct rxm_conn *rxm_conn, struct rxm_pkt *tx_pkt, size_t pkt_size, void *desc, void *context) { - FI_DBG(&rxm_prov, FI_LOG_EP_DATA, "Posting send with length: %" PRIu64 + FI_DBG(&rxm_prov, FI_LOG_EP_DATA, "Posting send with length: %zu" " tag: 0x%" PRIx64 "\n", pkt_size, tx_pkt->hdr.tag); assert((tx_pkt->hdr.flags & FI_REMOTE_CQ_DATA) || !tx_pkt->hdr.flags); diff --git a/prov/util/src/util_mr_cache.c b/prov/util/src/util_mr_cache.c index 64dd456b987..64b600367a6 100644 --- a/prov/util/src/util_mr_cache.c +++ b/prov/util/src/util_mr_cache.c @@ -2,6 +2,7 @@ * Copyright (c) 2016-2017 Cray Inc. All rights reserved. * Copyright (c) 2017-2019 Intel Corporation, Inc. All rights reserved. * Copyright (c) 2019 Amazon.com, Inc. or its affiliates. All rights reserved. + * Copyright (c) 2020 Cisco Systems, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -74,7 +75,7 @@ static int util_mr_find_overlap(struct ofi_rbmap *map, void *key, void *data) static void util_mr_free_entry(struct ofi_mr_cache *cache, struct ofi_mr_entry *entry) { - FI_DBG(cache->domain->prov, FI_LOG_MR, "free %p (len: %" PRIu64 ")\n", + FI_DBG(cache->domain->prov, FI_LOG_MR, "free %p (len: %zu)\n", entry->info.iov.iov_base, entry->info.iov.iov_len); assert(!entry->storage_context); @@ -135,7 +136,7 @@ static bool mr_cache_flush(struct ofi_mr_cache *cache) dlist_pop_front(&cache->lru_list, struct ofi_mr_entry, entry, lru_entry); dlist_init(&entry->lru_entry); - FI_DBG(cache->domain->prov, FI_LOG_MR, "flush %p (len: %" PRIu64 ")\n", + FI_DBG(cache->domain->prov, FI_LOG_MR, "flush %p (len: %zu)\n", entry->info.iov.iov_base, entry->info.iov.iov_len); util_mr_uncache_entry_storage(cache, entry); @@ -155,7 +156,7 @@ bool ofi_mr_cache_flush(struct ofi_mr_cache *cache) void ofi_mr_cache_delete(struct ofi_mr_cache *cache, struct ofi_mr_entry *entry) { - FI_DBG(cache->domain->prov, FI_LOG_MR, "delete %p (len: %" PRIu64 ")\n", + FI_DBG(cache->domain->prov, FI_LOG_MR, "delete %p (len: %zu)\n", entry->info.iov.iov_base, entry->info.iov.iov_len); pthread_mutex_lock(&cache->monitor->lock); @@ -179,7 +180,7 @@ util_mr_cache_create(struct ofi_mr_cache *cache, const struct iovec *iov, { int ret; - FI_DBG(cache->domain->prov, FI_LOG_MR, "create %p (len: %" PRIu64 ")\n", + FI_DBG(cache->domain->prov, FI_LOG_MR, "create %p (len: %zu)\n", iov->iov_base, iov->iov_len); *entry = ofi_buf_alloc(cache->entry_pool); @@ -239,7 +240,7 @@ util_mr_cache_merge(struct ofi_mr_cache *cache, const struct fi_mr_attr *attr, info.iov = *attr->mr_iov; do { FI_DBG(cache->domain->prov, FI_LOG_MR, - "merging %p (len: %" PRIu64 ") with %p (len: %" PRIu64 ")\n", + "merging %p (len: %zu) with %p (len: %zu)\n", info.iov.iov_base, info.iov.iov_len, old_entry->info.iov.iov_base, old_entry->info.iov.iov_len); old_info = &old_entry->info; @@ -248,7 +249,7 @@ util_mr_cache_merge(struct ofi_mr_cache *cache, const struct fi_mr_attr *attr, MAX(ofi_iov_end(&info.iov), ofi_iov_end(&old_info->iov))) + 1 - ((uintptr_t) MIN(info.iov.iov_base, old_info->iov.iov_base)); info.iov.iov_base = MIN(info.iov.iov_base, old_info->iov.iov_base); - FI_DBG(cache->domain->prov, FI_LOG_MR, "merged %p (len: %" PRIu64 ")\n", + FI_DBG(cache->domain->prov, FI_LOG_MR, "merged %p (len: %zu)\n", info.iov.iov_base, info.iov.iov_len); /* New entry will expand range of subscription */ @@ -268,7 +269,7 @@ int ofi_mr_cache_search(struct ofi_mr_cache *cache, const struct fi_mr_attr *att int ret = 0; assert(attr->iov_count == 1); - FI_DBG(cache->domain->prov, FI_LOG_MR, "search %p (len: %" PRIu64 ")\n", + FI_DBG(cache->domain->prov, FI_LOG_MR, "search %p (len: %zu)\n", attr->mr_iov->iov_base, attr->mr_iov->iov_len); pthread_mutex_lock(&cache->monitor->lock); @@ -312,7 +313,7 @@ struct ofi_mr_entry *ofi_mr_cache_find(struct ofi_mr_cache *cache, struct ofi_mr_entry *entry; assert(attr->iov_count == 1); - FI_DBG(cache->domain->prov, FI_LOG_MR, "find %p (len: %" PRIu64 ")\n", + FI_DBG(cache->domain->prov, FI_LOG_MR, "find %p (len: %zu)\n", attr->mr_iov->iov_base, attr->mr_iov->iov_len); pthread_mutex_lock(&cache->monitor->lock); @@ -344,7 +345,7 @@ int ofi_mr_cache_reg(struct ofi_mr_cache *cache, const struct fi_mr_attr *attr, int ret; assert(attr->iov_count == 1); - FI_DBG(cache->domain->prov, FI_LOG_MR, "reg %p (len: %" PRIu64 ")\n", + FI_DBG(cache->domain->prov, FI_LOG_MR, "reg %p (len: %zu)\n", attr->mr_iov->iov_base, attr->mr_iov->iov_len); pthread_mutex_lock(&cache->monitor->lock);