Skip to content

Commit

Permalink
portability: fix printf formatting
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jsquyres committed Jan 13, 2020
1 parent 6aad83e commit 4467497
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion prov/mrail/src/mrail_ep.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);

Expand Down
5 changes: 3 additions & 2 deletions prov/rxm/src/rxm_ep.c
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
19 changes: 10 additions & 9 deletions prov/util/src/util_mr_cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand All @@ -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 */
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4467497

Please sign in to comment.