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 /tools/test | |
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 'tools/test')
-rw-r--r-- | tools/test/h5repack/h5repack.sh.in | 2 | ||||
-rw-r--r-- | tools/test/perform/chunk_cache.c | 8 | ||||
-rw-r--r-- | tools/test/perform/perf.c | 4 | ||||
-rw-r--r-- | tools/test/perform/sio_engine.c | 2 | ||||
-rw-r--r-- | tools/test/perform/sio_perf.c | 4 | ||||
-rw-r--r-- | tools/test/perform/sio_standalone.h | 2 |
6 files changed, 11 insertions, 11 deletions
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 18e6d86..a95a22e 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -689,7 +689,7 @@ DIFFFAIL() $RUNSERIAL $H5DIFF_BIN -q "$@" ) RET=$? - if [ $RET == 0 ] ; then + if [ $RET -eq 0 ] ; then echo "*FAILED*" nerrors="`expr $nerrors + 1`" else diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c index d7c56af..d8af390 100644 --- a/tools/test/perform/chunk_cache.c +++ b/tools/test/perform/chunk_cache.c @@ -258,9 +258,9 @@ static int check_partial_chunks_perf(hid_t file) end_t = H5_get_time(); if((end_t - start_t) > (double)0.0f) - printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global); + printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %zu\n", (end_t -start_t), nbytes_global); else - printf("1. Partial chunks: no total read time because timer is not available; number of bytes being read from file is %lu\n", nbytes_global); + printf("1. Partial chunks: no total read time because timer is not available; number of bytes being read from file is %zu\n", nbytes_global); H5Dclose (dataset); H5Sclose (filespace); @@ -332,9 +332,9 @@ static int check_hash_value_perf(hid_t file) end_t = H5_get_time(); if((end_t - start_t) > (double)0.0f) - printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global); + printf("2. Hash value: total read time is %lf; number of bytes being read from file is %zu\n", (end_t -start_t), nbytes_global); else - printf("2. Hash value: no total read time because timer is not available; number of bytes being read from file is %lu\n", nbytes_global); + printf("2. Hash value: no total read time because timer is not available; number of bytes being read from file is %zu\n", nbytes_global); H5Dclose (dataset); H5Sclose (filespace); diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c index 364836f..5b78c52 100644 --- a/tools/test/perform/perf.c +++ b/tools/test/perform/perf.c @@ -317,7 +317,7 @@ int main(int argc, char **argv) VRFY((ret >= 0), "H5Dwrite dataset1 succeeded", !H5FATAL); - if (ret < 0) HDfprintf(stderr, "node %d, read error, loc = %Ld: %s\n", + if (ret < 0) HDfprintf(stderr, "node %d, read error, loc = %" PRId64 ": %s\n", mynod, mynod*opt_block, strerror(myerrno)); /* if the user wanted to check correctness, compare the write @@ -440,7 +440,7 @@ parse_args(int argc, char **argv) opt_threshold = (hsize_t)HDatoi(p + 1); } HDfprintf(stdout, - "alignment/threshold=%Hu/%Hu\n", + "alignment/threshold=%" PRIuHSIZE "/%" PRIuHSIZE "\n", opt_alignment, opt_threshold); break; case '2': /* use 2-files, i.e., split file driver */ diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c index 19b450f..2e61e74 100644 --- a/tools/test/perform/sio_engine.c +++ b/tools/test/perform/sio_engine.c @@ -785,7 +785,7 @@ do_read(results *res, file_descr *fd, parameters *parms, void *buffer) /* Allocate data verification buffer */ if(NULL == (buffer2 = (char *)malloc(linear_buf_size))) { - HDfprintf(stderr, "malloc for data verification buffer size (%Zu) failed\n", linear_buf_size); + HDfprintf(stderr, "malloc for data verification buffer size (%zu) failed\n", linear_buf_size); GOTOERROR(FAIL); } /* end if */ diff --git a/tools/test/perform/sio_perf.c b/tools/test/perform/sio_perf.c index d2eb3fc..0656e94 100644 --- a/tools/test/perform/sio_perf.c +++ b/tools/test/perform/sio_perf.c @@ -867,9 +867,9 @@ report_parameters(struct options *opts) HDfprintf(output, "\n"); if(opts->page_size) { - HDfprintf(output, "Page Aggregation Enabled. Page size = %ld\n", opts->page_size); + HDfprintf(output, "Page Aggregation Enabled. Page size = %zu\n", opts->page_size); if(opts->page_buffer_size) - HDfprintf(output, "Page Buffering Enabled. Page Buffer size = %ld\n", opts->page_buffer_size); + HDfprintf(output, "Page Buffering Enabled. Page Buffer size = %zu\n", opts->page_buffer_size); else HDfprintf(output, "Page Buffering Disabled\n"); } diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index 99e13bc..74a6245 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -151,7 +151,7 @@ #define HDfopen(S,M) fopen(S,M) #define HDfork() fork() #define HDfpathconf(F,N) fpathconf(F,N) -H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); +#define HDfprintf fprintf #define HDfputc(C,F) fputc(C,F) #define HDfputs(S,F) fputs(S,F) #define HDfread(M,Z,N,F) fread(M,Z,N,F) |