Skip to content

Commit

Permalink
Fix usage of several HDfprintf format specifiers after HDfprintf remo…
Browse files Browse the repository at this point in the history
…val (HDFGroup#1324)
  • Loading branch information
jhendersonHDF committed Apr 13, 2022
1 parent 635d6d1 commit caf5bc5
Show file tree
Hide file tree
Showing 10 changed files with 228 additions and 136 deletions.
2 changes: 1 addition & 1 deletion src/H5FAdblkpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts)
FUNC_ENTER_PACKAGE

#ifdef H5FA_DEBUG
HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr);
HDfprintf(stderr, "%s: Called, addr = " H5_PRINTF_HADDR_FMT "\n", FUNC, addr);
#endif /* H5FA_DEBUG */

/* Sanity check */
Expand Down
4 changes: 2 additions & 2 deletions src/H5FAprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ H5_DLL herr_t H5FA_patch_file(H5FA_t *fa, H5F_t *f);
H5_DLL herr_t H5FA_get_stats(const H5FA_t *ea, H5FA_stat_t *stats);

/* Debugging routines */
#ifdef H5FA_DEBUGGING
#endif /* H5FA_DEBUGGING */
#ifdef H5FA_DEBUG
#endif /* H5FA_DEBUG */

#endif /* H5FAprivate_H */
17 changes: 10 additions & 7 deletions src/H5FDspace.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr

FUNC_ENTER_PACKAGE
#ifdef H5FD_ALLOC_DEBUG
HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size);
HDfprintf(stderr, "%s: type = %u, size = " H5_PRINTF_HSIZE_FMT "\n", FUNC, (unsigned)type, size);
#endif /* H5FD_ALLOC_DEBUG */

/* check args */
Expand Down Expand Up @@ -211,7 +211,7 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr

done:
#ifdef H5FD_ALLOC_DEBUG
HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value);
HDfprintf(stderr, "%s: ret_value = " H5_PRINTF_HADDR_FMT "\n", FUNC, ret_value);
#endif /* H5FD_ALLOC_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__alloc_real() */
Expand Down Expand Up @@ -287,7 +287,8 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size)
HDassert(size > 0);

#ifdef H5FD_ALLOC_DEBUG
HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type, addr, size);
HDfprintf(stderr, "%s: type = %u, addr = " H5_PRINTF_HADDR_FMT ", size = " H5_PRINTF_HSIZE_FMT "\n",
FUNC, (unsigned)type, addr, size);
#endif /* H5FD_ALLOC_DEBUG */

/* Sanity checking */
Expand Down Expand Up @@ -317,11 +318,11 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size)

eoa = file->cls->get_eoa(file, type);
#ifdef H5FD_ALLOC_DEBUG
HDfprintf(stderr, "%s: eoa = %a\n", FUNC, eoa);
HDfprintf(stderr, "%s: eoa = " H5_PRINTF_HADDR_FMT "\n", FUNC, eoa);
#endif /* H5FD_ALLOC_DEBUG */
if (eoa == (addr + size)) {
#ifdef H5FD_ALLOC_DEBUG
HDfprintf(stderr, "%s: Reducing file size to = %a\n", FUNC, addr);
HDfprintf(stderr, "%s: Reducing file size to = " H5_PRINTF_HADDR_FMT "\n", FUNC, addr);
#endif /* H5FD_ALLOC_DEBUG */
if (file->cls->set_eoa(file, type, addr) < 0)
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "set end of space allocation request failed")
Expand All @@ -330,8 +331,10 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size)
else {
/* leak memory */
#ifdef H5FD_ALLOC_DEBUG
HDfprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type,
addr, size);
HDfprintf(stderr,
"%s: LEAKED MEMORY!!! type = %u, addr = " H5_PRINTF_HADDR_FMT
", size = " H5_PRINTF_HSIZE_FMT "\n",
FUNC, (unsigned)type, addr, size);
#endif /* H5FD_ALLOC_DEBUG */
} /* end else */

Expand Down
45 changes: 27 additions & 18 deletions src/H5FS.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_create, uint16_t
/* Set the return value */
ret_value = fspace;
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: fspace = %p, fspace->addr = %a\n", FUNC, fspace, fspace->addr);
HDfprintf(stderr, "%s: fspace = %p, fspace->addr = " H5_PRINTF_HADDR_FMT "\n", FUNC, (void *)fspace,
fspace->addr);
#endif /* H5FS_DEBUG */

done:
Expand All @@ -155,7 +156,7 @@ H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_create, uint16_t
HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space header")

#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value);
HDfprintf(stderr, "%s: Leaving, ret_value = %p\n", FUNC, (void *)ret_value);
#endif /* H5FS_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS_create() */
Expand Down Expand Up @@ -183,8 +184,8 @@ H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class

FUNC_ENTER_NOAPI(NULL)
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: Opening free space manager, fs_addr = %a, nclasses = %Zu\n", FUNC, fs_addr,
nclasses);
HDfprintf(stderr, "%s: Opening free space manager, fs_addr = " H5_PRINTF_HADDR_FMT ", nclasses = %Zu\n",
FUNC, fs_addr, nclasses);
#endif /* H5FS_DEBUG */

/* Check arguments. */
Expand All @@ -204,10 +205,11 @@ H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class
(fspace = (H5FS_t *)H5AC_protect(f, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space header")
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr);
HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size);
HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", FUNC, fspace->alloc_sect_size);
HDfprintf(stderr, "%s: fspace->sinfo = %p\n", FUNC, fspace->sinfo);
HDfprintf(stderr, "%s: fspace->sect_addr = " H5_PRINTF_HADDR_FMT "\n", FUNC, fspace->sect_addr);
HDfprintf(stderr, "%s: fspace->sect_size = " H5_PRINTF_HSIZE_FMT "\n", FUNC, fspace->sect_size);
HDfprintf(stderr, "%s: fspace->alloc_sect_size = " H5_PRINTF_HSIZE_FMT "\n", FUNC,
fspace->alloc_sect_size);
HDfprintf(stderr, "%s: fspace->sinfo = %p\n", FUNC, (void *)fspace->sinfo);
HDfprintf(stderr, "%s: fspace->rc = %u\n", FUNC, fspace->rc);
#endif /* H5FS_DEBUG */

Expand Down Expand Up @@ -251,7 +253,8 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr)

FUNC_ENTER_NOAPI(FAIL)
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = %a\n", FUNC, fs_addr);
HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = " H5_PRINTF_HADDR_FMT "\n", FUNC,
fs_addr);
#endif /* H5FS_DEBUG */

/* Check arguments. */
Expand Down Expand Up @@ -321,7 +324,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr)

/* Delete serialized section storage, if there are any */
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr);
HDfprintf(stderr, "%s: fspace->sect_addr = " H5_PRINTF_HADDR_FMT "\n", FUNC, fspace->sect_addr);
#endif /* H5FS_DEBUG */
if (fspace->serial_sect_count > 0) {
unsigned sinfo_status = 0; /* Free space section info's status in the metadata cache */
Expand Down Expand Up @@ -407,20 +410,24 @@ H5FS_close(H5F_t *f, H5FS_t *fspace)
HDassert(f);
HDassert(fspace);
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: Entering, fspace = %p, fspace->addr = %a, fspace->sinfo = %p\n", FUNC, fspace,
fspace->addr, fspace->sinfo);
HDfprintf(stderr,
"%s: Entering, fspace = %p, fspace->addr = " H5_PRINTF_HADDR_FMT ", fspace->sinfo = %p\n",
FUNC, (void *)fspace, fspace->addr, (void *)fspace->sinfo);
#endif /* H5FS_DEBUG */

/* Check if section info is valid */
/* (i.e. the header "owns" the section info and it's not in the cache) */
if (fspace->sinfo) {
#ifdef H5FS_DEBUG
HDfprintf(stderr,
"%s: fspace->tot_sect_count = %Hu, fspace->serial_sect_count = %Hu, fspace->sect_addr = "
"%a, fspace->rc = %u\n",
"%s: fspace->tot_sect_count = " H5_PRINTF_HSIZE_FMT
", fspace->serial_sect_count = " H5_PRINTF_HSIZE_FMT
", fspace->sect_addr = " H5_PRINTF_HADDR_FMT ", fspace->rc = %u\n",
FUNC, fspace->tot_sect_count, fspace->serial_sect_count, fspace->sect_addr, fspace->rc);
HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC,
fspace->alloc_sect_size, fspace->sect_size);
HDfprintf(stderr,
"%s: fspace->alloc_sect_size = " H5_PRINTF_HSIZE_FMT
", fspace->sect_size = " H5_PRINTF_HSIZE_FMT "\n",
FUNC, fspace->alloc_sect_size, fspace->sect_size);
#endif /* H5FS_DEBUG */
/* If there are sections to serialize, update them */
/* (if the free space manager is persistent) */
Expand Down Expand Up @@ -709,7 +716,8 @@ H5FS__incr(H5FS_t *fspace)

FUNC_ENTER_PACKAGE
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc);
HDfprintf(stderr, "%s: Entering, fpace->addr = " H5_PRINTF_HADDR_FMT ", fspace->rc = %u\n", FUNC,
fspace->addr, fspace->rc);
#endif /* H5FS_DEBUG */

/*
Expand Down Expand Up @@ -748,7 +756,8 @@ H5FS__decr(H5FS_t *fspace)

FUNC_ENTER_PACKAGE
#ifdef H5FS_DEBUG
HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc);
HDfprintf(stderr, "%s: Entering, fpace->addr = " H5_PRINTF_HADDR_FMT ", fspace->rc = %u\n", FUNC,
fspace->addr, fspace->rc);
#endif /* H5FS_DEBUG */

/*
Expand Down
71 changes: 46 additions & 25 deletions src/H5FSsection.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace)
HDassert(f);
HDassert(fspace);
#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr);
HDfprintf(stderr, "%s: fspace->addr = " H5_PRINTF_HADDR_FMT "\n", FUNC, fspace->addr);
#endif /* H5FS_SINFO_DEBUG */

/* Allocate the free space header */
Expand All @@ -136,7 +136,8 @@ H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace)
sinfo->sect_off_size = (fspace->max_sect_addr + 7) / 8;
sinfo->sect_len_size = H5VM_limit_enc_size((uint64_t)fspace->max_sect_size);
#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr, "%s: fspace->max_sect_size = %Hu\n", FUNC, fspace->max_sect_size);
HDfprintf(stderr, "%s: fspace->max_sect_size = " H5_PRINTF_HSIZE_FMT "\n", FUNC,
fspace->max_sect_size);
HDfprintf(stderr, "%s: fspace->max_sect_addr = %u\n", FUNC, fspace->max_sect_addr);
HDfprintf(stderr, "%s: sinfo->nbins = %u\n", FUNC, sinfo->nbins);
HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", FUNC,
Expand Down Expand Up @@ -200,10 +201,14 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode)
FUNC_ENTER_STATIC

#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC,
fspace->addr, fspace->sinfo, fspace->sect_addr);
HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC,
fspace->alloc_sect_size, fspace->sect_size);
HDfprintf(stderr,
"%s: Called, fspace->addr = " H5_PRINTF_HADDR_FMT
", fspace->sinfo = %p, fspace->sect_addr = " H5_PRINTF_HADDR_FMT "\n",
FUNC, fspace->addr, (void *)fspace->sinfo, fspace->sect_addr);
HDfprintf(stderr,
"%s: fspace->alloc_sect_size = " H5_PRINTF_HSIZE_FMT
", fspace->sect_size = " H5_PRINTF_HSIZE_FMT "\n",
FUNC, fspace->alloc_sect_size, fspace->sect_size);
#endif /* H5FS_SINFO_DEBUG */

/* Check arguments. */
Expand Down Expand Up @@ -251,8 +256,9 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode)
HDassert(H5F_addr_defined(fspace->addr));

#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n", FUNC,
fspace->sect_addr);
HDfprintf(stderr,
"%s: Reading in existing sections, fspace->sect_addr = " H5_PRINTF_HADDR_FMT "\n",
FUNC, fspace->sect_addr);
#endif /* H5FS_SINFO_DEBUG */
/* Protect the free space sections */
cache_udata.f = f;
Expand Down Expand Up @@ -289,10 +295,14 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode)

done:
#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC,
fspace->addr, fspace->sinfo, fspace->sect_addr);
HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC,
fspace->alloc_sect_size, fspace->sect_size);
HDfprintf(stderr,
"%s: Leaving, fspace->addr = " H5_PRINTF_HADDR_FMT
", fspace->sinfo = %p, fspace->sect_addr = " H5_PRINTF_HADDR_FMT "\n",
FUNC, fspace->addr, (void *)fspace->sinfo, fspace->sect_addr);
HDfprintf(stderr,
"%s: fspace->alloc_sect_size = " H5_PRINTF_HSIZE_FMT
", fspace->sect_size = " H5_PRINTF_HSIZE_FMT "\n",
FUNC, fspace->alloc_sect_size, fspace->sect_size);
#endif /* H5FS_SINFO_DEBUG */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5FS__sinfo_lock() */
Expand All @@ -317,14 +327,18 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified)

FUNC_ENTER_STATIC
#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr, "%s: Called, modified = %t, fspace->addr = %a, fspace->sect_addr = %a\n", FUNC,
modified, fspace->addr, fspace->sect_addr);
HDfprintf(stderr,
"%s: Called, modified = %d, fspace->addr = " H5_PRINTF_HADDR_FMT
", fspace->sect_addr = " H5_PRINTF_HADDR_FMT "\n",
FUNC, modified, fspace->addr, fspace->sect_addr);
HDfprintf(
stderr,
"%s: fspace->sinfo_lock_count = %u, fspace->sinfo_modified = %t, fspace->sinfo_protected = %t\n",
"%s: fspace->sinfo_lock_count = %u, fspace->sinfo_modified = %d, fspace->sinfo_protected = %d\n",
FUNC, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected);
HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC,
fspace->alloc_sect_size, fspace->sect_size);
HDfprintf(stderr,
"%s: fspace->alloc_sect_size = " H5_PRINTF_HSIZE_FMT
", fspace->sect_size = " H5_PRINTF_HSIZE_FMT "\n",
FUNC, fspace->alloc_sect_size, fspace->sect_size);
#endif /* H5FS_SINFO_DEBUG */

/* Check arguments. */
Expand Down Expand Up @@ -451,7 +465,8 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified)

#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr,
"%s: Freeing section info on disk, old_sect_addr = %a, old_alloc_sect_size = %Hu\n",
"%s: Freeing section info on disk, old_sect_addr = " H5_PRINTF_HADDR_FMT
", old_alloc_sect_size = " H5_PRINTF_HSIZE_FMT "\n",
FUNC, old_sect_addr, old_alloc_sect_size);
#endif /* H5FS_SINFO_DEBUG */
/* Release space for section info in file */
Expand Down Expand Up @@ -1304,7 +1319,8 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag
FUNC_ENTER_NOAPI(FAIL)

#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr, "%s: *sect = {%a, %Hu, %u, %s}\n", FUNC, sect->addr, sect->size, sect->type,
HDfprintf(stderr, "%s: *sect = {" H5_PRINTF_HADDR_FMT ", " H5_PRINTF_HSIZE_FMT ", %u, %s}\n", FUNC,
sect->addr, sect->size, sect->type,
(sect->state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED"));
#endif /* H5FS_SINFO_DEBUG */

Expand Down Expand Up @@ -1345,7 +1361,7 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag
HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list")

#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space);
HDfprintf(stderr, "%s: fspace->tot_space = " H5_PRINTF_HSIZE_FMT "\n", FUNC, fspace->tot_space);
#endif /* H5FS_SINFO_DEBUG */
/* Mark free space sections as changed */
/* (if adding sections while deserializing sections, don't set the flag) */
Expand Down Expand Up @@ -1390,8 +1406,10 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize
FUNC_ENTER_NOAPI(FAIL)

#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr, "%s: addr = %a, size = %Hu, extra_requested = %hu\n", FUNC, addr, size,
extra_requested);
HDfprintf(stderr,
"%s: addr = " H5_PRINTF_HADDR_FMT ", size = " H5_PRINTF_HSIZE_FMT
", extra_requested = " H5_PRINTF_HSIZE_FMT "\n",
FUNC, addr, size, extra_requested);
#endif /* H5FS_SINFO_DEBUG */

/* Check arguments. */
Expand All @@ -1403,9 +1421,12 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize

/* Check for any sections on free space list */
#ifdef H5FS_SINFO_DEBUG
HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count);
HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", FUNC, fspace->serial_sect_count);
HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_sect_count);
HDfprintf(stderr, "%s: fspace->tot_sect_count = " H5_PRINTF_HSIZE_FMT "\n", FUNC,
fspace->tot_sect_count);
HDfprintf(stderr, "%s: fspace->serial_sect_count = " H5_PRINTF_HSIZE_FMT "\n", FUNC,
fspace->serial_sect_count);
HDfprintf(stderr, "%s: fspace->ghost_sect_count = " H5_PRINTF_HSIZE_FMT "\n", FUNC,
fspace->ghost_sect_count);
#endif /* H5FS_SINFO_DEBUG */
if (fspace->tot_sect_count > 0) {
H5FS_section_info_t *sect; /* Temporary free space section */
Expand Down
Loading

0 comments on commit caf5bc5

Please sign in to comment.