From 460ee73a642db71872efa8e5c51dcf5aee554790 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Mon, 11 Jul 2022 08:29:46 -0700 Subject: Adds format attribute to additional functions (#1868) * Adds format attribute to (s|p)io_perf code * Added gcc format attribute to additional test code * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- test/h5test.h | 2 +- test/testhdf5.h | 4 ++-- tools/src/h5perf/pio_perf.c | 10 +++++----- tools/src/h5perf/sio_perf.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/h5test.h b/test/h5test.h index 9d7d303..052f6b5 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -220,7 +220,7 @@ H5TEST_DLL void h5_reset(void); H5TEST_DLL void h5_restore_err(void); H5TEST_DLL void h5_show_hostname(void); H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl); -H5TEST_DLL int print_func(const char *format, ...); +H5TEST_DLL int print_func(const char *format, ...) H5_ATTR_FORMAT(printf, 1, 2); H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_copy_name); H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void); diff --git a/test/testhdf5.h b/test/testhdf5.h index c5b8246..d5c2d21 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -56,7 +56,7 @@ { \ if (VERBOSE_HI) { \ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \ - __FILE__, (ret)); \ + __FILE__, ((const void *)ret)); \ } \ if (!(ret)) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", (where), (int)__LINE__, \ @@ -70,7 +70,7 @@ { \ if (VERBOSE_HI) { \ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \ - __FILE__, (ret)); \ + __FILE__, ((const void *)ret)); \ } \ if (ret) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", (where), \ diff --git a/tools/src/h5perf/pio_perf.c b/tools/src/h5perf/pio_perf.c index 7ebbefa..2e82dd4 100644 --- a/tools/src/h5perf/pio_perf.c +++ b/tools/src/h5perf/pio_perf.c @@ -199,7 +199,7 @@ static int destroy_comm_world(void); static void output_results(const struct options *options, const char *name, minmax *table, int table_size, off_t data_size); static void output_times(const struct options *options, const char *name, minmax *table, int table_size); -static void output_report(const char *fmt, ...); +static void output_report(const char *fmt, ...) H5_ATTR_FORMAT(printf, 1, 2); static void print_indent(int indent); static void usage(const char *prog); static void report_parameters(struct options *opts); @@ -346,7 +346,7 @@ run_test_loop(struct options *opts) /* only processes doing PIO will run the tests */ if (doing_pio) { - output_report("Number of processors = %ld\n", parms.num_procs); + output_report("Number of processors = %d\n", parms.num_procs); /* multiply the xfer buffer size by 2 for each loop iteration */ for (buf_size = opts->min_xfer_size; buf_size <= opts->max_xfer_size; buf_size <<= 1) { @@ -1059,14 +1059,14 @@ output_times(const struct options *opts, const char *name, minmax *table, int ta /* Note: The maximum throughput uses the minimum amount of time & vice versa */ print_indent(4); - output_report("Minimum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, (total_mm.min)); + output_report("Minimum Accumulated Time using %ld file(s): %7.5f s\n", opts->num_files, (total_mm.min)); print_indent(4); - output_report("Average Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, + output_report("Average Accumulated Time using %ld file(s): %7.5f s\n", opts->num_files, (total_mm.sum / total_mm.num)); print_indent(4); - output_report("Maximum Accumulated Time using %d file(s): %7.5f s\n", opts->num_files, (total_mm.max)); + output_report("Maximum Accumulated Time using %ld file(s): %7.5f s\n", opts->num_files, (total_mm.max)); } /* diff --git a/tools/src/h5perf/sio_perf.c b/tools/src/h5perf/sio_perf.c index 5432d6c..6da073a 100644 --- a/tools/src/h5perf/sio_perf.c +++ b/tools/src/h5perf/sio_perf.c @@ -172,7 +172,7 @@ static void get_minmax(minmax *mm, double val); static void accumulate_minmax_stuff(const minmax *mm, int count, minmax *total_mm); static void output_results(const struct options *options, const char *name, minmax *table, int table_size, off_t data_size); -static void output_report(const char *fmt, ...); +static void output_report(const char *fmt, ...) H5_ATTR_FORMAT(printf, 1, 2); static void print_indent(int indent); static void usage(const char *prog); static void report_parameters(struct options *opts); -- cgit v0.12