From 6486892de56485f8ec7cf9070363a7b13da4e408 Mon Sep 17 00:00:00 2001 From: David Young Date: Thu, 24 Sep 2020 16:34:51 -0500 Subject: Fix some HDfprintf compilation errors: use the right format strings ("zu", PRIuHSIZE), avoid casting some printf arguments, pass the right number of arguments. --- testpar/t_2Gio.c | 7 ++++--- testpar/t_bigio.c | 35 ++++++++++++++++++++++------------- testpar/t_cache_image.c | 12 ++++++++---- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/testpar/t_2Gio.c b/testpar/t_2Gio.c index 54ea546..d44c7c7 100644 --- a/testpar/t_2Gio.c +++ b/testpar/t_2Gio.c @@ -585,7 +585,8 @@ static int MpioTest2G( MPI_Comm comm ) MPI_Comm_rank(comm, &mpi_rank); if(mpi_rank == 0) { - HDprintf("Using %d process on dataset shape [%llu, %llu, %llu]\n", + HDprintf("Using %d process on dataset shape " + "[%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE "]\n", mpi_size, shape[0], shape[1], shape[2]); } @@ -613,7 +614,7 @@ static int MpioTest2G( MPI_Comm comm ) tot_size_bytes *= shape[i]; } if(mpi_rank == 0) { - HDprintf("Dataset of %llu bytes\n", tot_size_bytes); + HDprintf("Dataset of %zu bytes\n", tot_size_bytes); } filespace = H5Screate_simple(3, shape, NULL); VRFY((filespace >= 0), "H5Screate_simple succeeded"); @@ -691,7 +692,7 @@ static int MpioTest2G( MPI_Comm comm ) H5Fclose(file_id); free(data); - HDprintf("Proc %d - MpioTest2G test succeeded\n", mpi_rank, data_size_bytes); + HDprintf("Proc %d - MpioTest2G test succeeded\n", mpi_rank); if (mpi_rank == 0) HDremove(FILENAME[1]); diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c index f86852a..22a924d 100644 --- a/testpar/t_bigio.c +++ b/testpar/t_bigio.c @@ -143,10 +143,14 @@ void point_set(hsize_t start[], } if(VERBOSE_MED) { - HDprintf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total datapoints=%lu\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], - (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1], - (unsigned long)(block[0] * block[1] * count[0] * count[1])); + HDprintf("start[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "count[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "stride[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "block[]=(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "total datapoints=%" PRIuHSIZE "\n", + start[0], start[1], count[0], count[1], + stride[0], stride[1], block[0], block[1], + block[0] * block[1] * count[0] * count[1]); k = 0; for(i = 0; i < num_points ; i++) { HDprintf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); @@ -167,15 +171,15 @@ dataset_print(hsize_t start[], hsize_t block[], B_DATATYPE * dataset) /* print the column heading */ HDprintf("%-8s", "Cols:"); for (j=0; j < block[1]; j++){ - HDprintf("%3lu ", (unsigned long)(start[1]+j)); + HDprintf("%3" PRIuHSIZE " ", start[1] + j); } HDprintf("\n"); /* print the slab data */ for (i=0; i < block[0]; i++){ - HDprintf("Row %2lu: ", (unsigned long)(i+start[0])); + HDprintf("Row %2" PRIuHSIZE ": ", i + start[0]); for (j=0; j < block[1]; j++){ - HDprintf("%llu ", *dataptr++); + HDprintf("%" PRIuHSIZE " ", *dataptr++); } HDprintf("\n"); } @@ -194,9 +198,12 @@ verify_data(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], /* print it if VERBOSE_MED */ if(VERBOSE_MED) { HDprintf("verify_data dumping:::\n"); - HDprintf("start(%lu, %lu), count(%lu, %lu), stride(%lu, %lu), block(%lu, %lu)\n", - (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], - (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1]); + HDprintf("start(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "count(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "stride(%" PRIuHSIZE ", %" PRIuHSIZE "), " + "block(%" PRIuHSIZE ", %" PRIuHSIZE ")\n", + start[0], start[1], count[0], count[1], + stride[0], stride[1], block[0], block[1]); HDprintf("original values:\n"); dataset_print(start, block, original); HDprintf("compared values:\n"); @@ -208,9 +215,11 @@ verify_data(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], for (j=0; j < block[1]; j++){ if(*dataset != *original){ if(vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){ - HDprintf("Dataset Verify failed at [%lu][%lu](row %lu, col %lu): expect %llu, got %llu\n", - (unsigned long)i, (unsigned long)j, - (unsigned long)(i+start[0]), (unsigned long)(j+start[1]), + HDprintf("Dataset Verify failed at [%" PRIuHSIZE "][%" PRIuHSIZE "]" + "(row %" PRIuHSIZE ", col %" PRIuHSIZE "): " + "expect %" PRIuHSIZE ", got %" PRIuHSIZE "\n", + i, j, + i + start[0], j + start[1], *(original), *(dataset)); } dataset++; diff --git a/testpar/t_cache_image.c b/testpar/t_cache_image.c index 14e3d10..6877d63 100644 --- a/testpar/t_cache_image.c +++ b/testpar/t_cache_image.c @@ -3340,8 +3340,10 @@ verify_cache_image_RO(int file_name_id, int md_write_strat, int mpi_rank) H5_FAILED(); - if ( show_progress ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", failure_mssg); + if ( show_progress ) { + HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", fcn_name, + failure_mssg); + } } } @@ -3638,8 +3640,10 @@ verify_cache_image_RW(int file_name_id, int md_write_strat, int mpi_rank) H5_FAILED(); - if ( show_progress ) - HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", failure_mssg); + if ( show_progress ) { + HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n", fcn_name, + failure_mssg); + } } } -- cgit v0.12