diff options
author | David Young <dyoung@hdfgroup.org> | 2020-09-28 19:42:18 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-09-28 19:42:18 (GMT) |
commit | 14851e3b82a9b116153f9505654faf2f60e1abe2 (patch) | |
tree | 4ab01f77f124bad03f76338e70b6e2b3f0fb01e5 /src/H5FAdbg.c | |
parent | 8ee8b7abb55bc8d901e31b3eef9ba35abb352814 (diff) | |
parent | c0fbc5c086566d5d3c1d1ef26baa81a53d59fc08 (diff) | |
download | hdf5-14851e3b82a9b116153f9505654faf2f60e1abe2.zip hdf5-14851e3b82a9b116153f9505654faf2f60e1abe2.tar.gz hdf5-14851e3b82a9b116153f9505654faf2f60e1abe2.tar.bz2 |
Merge pull request #2650 in HDFFV/hdf5 from ~DYOUNG/werror:rebased-fprintf-experiment to develop
* commit 'c0fbc5c086566d5d3c1d1ef26baa81a53d59fc08': (24 commits)
Use the right format string, "%zu", for size_t.
Repair more format strings.
Fix a bunch of format string errors reported by Larry.
Fix some HDfprintf compilation errors: use the right format strings ("zu", PRIuHSIZE), avoid casting some printf arguments, pass the right number of arguments.
Test the format string "ll" before "l", "L", and "q", like the ./configure script does. This ought to fix the compilation failure in test/dt_arith.c that Allen told me about:
Cast a non-void pointer to void pointer for "%p".
Use PRIu32 and "zu" formats. Delete some casts from `size_t`.
I'm taking a guess that this code intended to point the 2-digit wide hexadecimal octet values, not 2 character-wide pointers to the bytes. The %02p format, which is a GNU-ism, disagreed with GCC 8.3.0 and the option flags we use.
%08p is not portable, it's a GNU-ism. Use %8p, instead. Squashes a GCC error.
Add format string macros PRI[doxX]HID for hid_t and use PRIdHID.
Use HDva_copy() and introduce a bunch of compatbility format-string constants for uppercase hexadecimal strings, `PRIX...`. Should fix the VS2010 errors that Allen mentioned:
Always #define HDfprintf as fprintf in this header. I believe this will fix the Windows build error that Allen reported.
Provide an HDvasprintf implementation only if it isn't #defined. This should fix the mingw compilation issue that Allen reported.
Fix va_list usage in the vasprintf(3) implementation.
Promote format-string warnings to errors.
Use the portable `-eq` operator instead of the bash-ism `==`. Fixes the tests on NetBSD, where /bin/sh != bash.
Restore a literal percent sign ("%%") that I accidentally deleted.
Fix code that made GCC complain about a NULL or `unsigned char *` arguments for "%s".
Take pains to provide UINT64_MAX in all conditions.
Correct a couple of format strings.
...
Diffstat (limited to 'src/H5FAdbg.c')
-rw-r--r-- | src/H5FAdbg.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/H5FAdbg.c b/src/H5FAdbg.c index b578cf2..af4616c 100644 --- a/src/H5FAdbg.c +++ b/src/H5FAdbg.c @@ -123,13 +123,13 @@ H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Header size:", hdr->size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Raw Element Size:", (unsigned)hdr->cparam.raw_elmt_size); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Native Element Size (on this platform):", hdr->cparam.cls->nat_elmt_size); @@ -138,10 +138,10 @@ H5FA__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, "Max. # of elements in data block page:", (unsigned)((size_t)1 << hdr->cparam.max_dblk_page_nelmts_bits)); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of elements in Fixed Array:", hdr->stats.nelmts); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Fixed Array Data Block Address:", hdr->dblk_addr); CATCH @@ -207,13 +207,13 @@ H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Print the values */ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Array class ID:", hdr->cparam.cls->name); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Address of Data Block:", dblock->addr); - HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth, "Data Block size:", dblock->size); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, "Address of Data Block:", dblock->addr); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Data Block size:", dblock->size); + HDfprintf(stream, "%*s%-*s %" PRIuHSIZE "\n", indent, "", fwidth, "Number of elements in Data Block:", hdr->cparam.nelmts); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Number of pages in Data Block:", dblock->npages); - HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, + HDfprintf(stream, "%*s%-*s %zu\n", indent, "", fwidth, "Number of elements per Data Block page:", dblock->dblk_page_nelmts); if(dblock->npages) { /* paging */ @@ -230,8 +230,8 @@ H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, /* Read and print each page's elements in the data block */ for(page_idx = 0; page_idx < dblock->npages; page_idx++) { if(!H5VM_bit_get(dblock->dblk_page_init, page_idx)) { - HDfprintf(stream, "%*s%-*s %Hu %s\n", indent, "", fwidth, - "Page %Zu:", page_idx, "empty"); + HDfprintf(stream, "%*s%-*s %zu %s\n", indent, "", fwidth, + "Page %zu:", page_idx, "empty"); } /* end if */ else { /* get the page */ @@ -245,7 +245,7 @@ H5FA__dblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, if(NULL == (dblk_page = H5FA__dblk_page_protect(hdr, dblk_page_addr, dblk_page_nelmts, H5AC__READ_ONLY_FLAG))) H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr) - HDfprintf(stream, "%*sElements in page %Zu:\n", indent, "", page_idx); + HDfprintf(stream, "%*sElements in page %zu:\n", indent, "", page_idx); for(u = 0; u < dblk_page_nelmts; u++) { /* Call the class's 'debug' callback */ if((hdr->cparam.cls->debug)(stream, (indent + 3), MAX(0, (fwidth - 3)), (hsize_t)u, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * u)) < 0) |