From 131402a92de9bbd5df60d5859c37c4820c60d6b9 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 25 Aug 2021 00:05:23 -0400 Subject: More various warnings (#958) * Committing clang-format changes * Fixed various -Wdouble-promotion warnings * Fixed -Wshadow warning for `optopt` conflict On macOS at least, there is a global various named `optopt` in unistd.h. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- src/H5ACprivate.h | 16 ++++++++-------- src/H5Cquery.c | 2 +- src/H5Pdxpl.c | 2 +- src/H5system.c | 24 ++++++++++++------------ test/cache_common.c | 2 +- test/enc_dec_plist.c | 4 ++-- test/fillval.c | 6 +++--- test/hyperslab.c | 6 +++--- test/set_extent.c | 4 ++-- test/tattr.c | 7 +++---- test/timer.c | 18 +++++++++--------- test/tmisc.c | 2 +- test/tvltypes.c | 8 ++++---- 13 files changed, 50 insertions(+), 51 deletions(-) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index b14194b..e9b8a47 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -275,24 +275,24 @@ typedef struct H5AC_proxy_entry_t { /* size_t min_size = */ ( 1 * 1024 * 1024), \ /* long int epoch_length = */ 50000, \ /* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \ - /* double lower_hr_threshold = */ 0.9f, \ - /* double increment = */ 2.0f, \ + /* double lower_hr_threshold = */ 0.9, \ + /* double increment = */ 2.0, \ /* hbool_t apply_max_increment = */ TRUE, \ /* size_t max_increment = */ (4 * 1024 * 1024), \ /* enum H5C_cache_flash_incr_mode */ \ /* flash_incr_mode = */ H5C_flash_incr__add_space, \ - /* double flash_multiple = */ 1.4f, \ - /* double flash_threshold = */ 0.25f, \ + /* double flash_multiple = */ 1.4, \ + /* double flash_threshold = */ 0.25, \ /* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold,\ - /* double upper_hr_threshold = */ 0.999f, \ - /* double decrement = */ 0.9f, \ + /* double upper_hr_threshold = */ 0.999, \ + /* double decrement = */ 0.9, \ /* hbool_t apply_max_decrement = */ TRUE, \ /* size_t max_decrement = */ (1 * 1024 * 1024), \ /* int epochs_before_eviction = */ 3, \ /* hbool_t apply_empty_reserve = */ TRUE, \ - /* double empty_reserve = */ 0.1f, \ + /* double empty_reserve = */ 0.1, \ /* size_t dirty_bytes_threshold = */ (256 * 1024), \ - /* int metadata_write_strategy = */ \ + /* int metadata_write_strategy = */ \ H5AC__DEFAULT_METADATA_WRITE_STRATEGY \ } #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Cquery.c b/src/H5Cquery.c index 6cf8ffc..710ce2a 100644 --- a/src/H5Cquery.c +++ b/src/H5Cquery.c @@ -201,7 +201,7 @@ H5C_get_cache_hit_rate(const H5C_t *cache_ptr, double *hit_rate_ptr) if (cache_ptr->cache_accesses > 0) *hit_rate_ptr = ((double)(cache_ptr->cache_hits)) / ((double)(cache_ptr->cache_accesses)); else - *hit_rate_ptr = 0.0f; + *hit_rate_ptr = 0.0; done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 5f83a1d..a0c38f8 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -68,7 +68,7 @@ #define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3]) #define H5D_XFER_BTREE_SPLIT_RATIO_DEF \ { \ - 0.1f, 0.5f, 0.9f \ + 0.1, 0.5, 0.9 \ } #define H5D_XFER_BTREE_SPLIT_RATIO_ENC H5P__dxfr_btree_split_ratio_enc #define H5D_XFER_BTREE_SPLIT_RATIO_DEC H5P__dxfr_btree_split_ratio_dec diff --git a/src/H5system.c b/src/H5system.c index eba8341..fe379ad 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -958,8 +958,8 @@ const char *H5_optarg; /* Flag argument (or value) */ int H5_get_option(int argc, const char **argv, const char *opts, const struct h5_long_options *l_opts) { - static int sp = 1; /* character index in current token */ - int optopt = '?'; /* option character passed back to user */ + static int sp = 1; /* character index in current token */ + int optchar = '?'; /* option character passed back to user */ if (sp == 1) { /* check for more flag-like tokens */ @@ -990,7 +990,7 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon for (i = 0; l_opts && l_opts[i].name; i++) { if (HDstrcmp(arg, l_opts[i].name) == 0) { /* we've found a matching long command line flag */ - optopt = l_opts[i].shortval; + optchar = l_opts[i].shortval; if (l_opts[i].has_arg != no_arg) { if (H5_optarg == NULL) { @@ -1003,7 +1003,7 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon if (H5_opterr) HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg); - optopt = '?'; + optchar = '?'; } } } @@ -1012,7 +1012,7 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon if (H5_opterr) HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg); - optopt = '?'; + optchar = '?'; } } break; @@ -1024,7 +1024,7 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon if (H5_opterr) HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg); - optopt = '?'; + optchar = '?'; } H5_optind++; @@ -1036,11 +1036,11 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon register char *cp; /* pointer into current token */ /* short command line option */ - optopt = argv[H5_optind][sp]; + optchar = argv[H5_optind][sp]; - if (optopt == ':' || (cp = HDstrchr(opts, optopt)) == 0) { + if (optchar == ':' || (cp = HDstrchr(opts, optchar)) == 0) { if (H5_opterr) - HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optopt); + HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optchar); /* if no chars left in this token, move to next token */ if (argv[H5_optind][++sp] == '\0') { @@ -1058,9 +1058,9 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon } else if (++H5_optind >= argc) { if (H5_opterr) - HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], optopt); + HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], optchar); - optopt = '?'; + optchar = '?'; } else { /* flag value is next token */ @@ -1098,5 +1098,5 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon } /* return the current flag character found */ - return optopt; + return optchar; } diff --git a/test/cache_common.c b/test/cache_common.c index 07c70f0..2d88e05 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -4994,7 +4994,7 @@ check_and_validate_cache_hit_rate(hid_t file_id, double *hit_rate_ptr, hbool_t d } else { - expected_hit_rate = 0.0F; + expected_hit_rate = 0.0; } result = H5Fget_mdc_hit_rate(file_id, &hit_rate); diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 9b4879e..60b229a 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -350,7 +350,7 @@ main(void) TESTING("DXPL Encoding/Decoding"); - if ((H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f)) < 0) + if ((H5Pset_btree_ratios(dxpl, 0.2, 0.6, 0.2)) < 0) FAIL_STACK_ERROR if ((H5Pset_hyper_vector_size(dxpl, 5)) < 0) FAIL_STACK_ERROR @@ -544,7 +544,7 @@ main(void) FAIL_STACK_ERROR if ((H5Pset_alignment(fapl, 2, 1024)) < 0) FAIL_STACK_ERROR - if ((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f)) < 0) + if ((H5Pset_cache(fapl, 1024, 128, 10485760, 0.3)) < 0) FAIL_STACK_ERROR if ((H5Pset_elink_file_cache_size(fapl, 10485760)) < 0) FAIL_STACK_ERROR diff --git a/test/fillval.c b/test/fillval.c index 4215c89..8de6ef1 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -1050,7 +1050,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_f for (u = 0; u < nelmts; u++) { buf_c[u].a = 1111.11F; buf_c[u].x = 2222; - buf_c[u].y = 3333.3333F; + buf_c[u].y = 3333.3333; buf_c[u].z = 'd'; } if (H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0) @@ -1304,7 +1304,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; HDmemset(&fill_ctype, 0, sizeof(fill_ctype)); - fill_ctype.y = 4444.4444F; + fill_ctype.y = 4444.4444; if (H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, @@ -1370,7 +1370,7 @@ test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout) if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) goto error; HDmemset(&fill_ctype, 0, sizeof(fill_ctype)); - fill_ctype.y = 4444.4444F; + fill_ctype.y = 4444.4444; if (H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0) goto error; nerrors += test_rdwr_cases(file, dcpl, "dset12", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, H5T_COMPOUND, diff --git a/test/hyperslab.c b/test/hyperslab.c index 1f57e3b..1c55259 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -585,10 +585,10 @@ test_multifill(size_t nx) for (i = 0; i < nx; i++) { src[i].left = 1111111; - src[i].mid = 12345.6789F; + src[i].mid = 12345.6789; src[i].right = 2222222; dst[i].left = 3333333; - dst[i].mid = 98765.4321F; + dst[i].mid = 98765.4321; dst[i].right = 4444444; } /* end for */ @@ -597,7 +597,7 @@ test_multifill(size_t nx) * over and over again. */ fill.left = 55555555; - fill.mid = 3.1415927F; + fill.mid = 3.1415927; fill.right = 66666666; src_stride = 0; diff --git a/test/set_extent.c b/test/set_extent.c index 156dd19..3078c2d 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -134,11 +134,11 @@ main(void) TEST_ERROR /* Set chunk cache so only part of the chunks can be cached on fapl */ - if (H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75F) < 0) + if (H5Pset_cache(fapl, 0, (size_t)8, 256 * sizeof(int), 0.75) < 0) TEST_ERROR /* Disable chunk caching on fapl2 */ - if (H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.0F) < 0) + if (H5Pset_cache(fapl2, 0, (size_t)0, (size_t)0, 0.0) < 0) TEST_ERROR /* Set the "use the latest version of the format" bounds for creating objects in the file */ diff --git a/test/tattr.c b/test/tattr.c index b602222..756e139 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -95,8 +95,7 @@ int attr_data2[ATTR2_DIM1][ATTR2_DIM2] = {{7614, -416}, {197814, -3}}; /* Test d #define ATTR3_DIM2 2 #define ATTR3_DIM3 2 double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = { - {{2.3F, -26.1F}, {0.123F, -10.0F}}, - {{973.23F, -0.91827F}, {2.0F, 23.0F}}}; /* Test data for 3rd attribute */ + {{2.3, -26.1}, {0.123, -10.0}}, {{973.23, -0.91827}, {2.0, 23.0}}}; /* Test data for 3rd attribute */ #define ATTR4_NAME "Attr4" #define ATTR4_RANK 2 @@ -113,8 +112,8 @@ struct attr4_struct { double d; char c; } attr_data4[ATTR4_DIM1][ATTR4_DIM2] = { - {{3, -26.1F, 'd'}, {-100000, 0.123F, '3'}}, - {{-23, 981724.2F, 'Q'}, {0, 2.0F, '\n'}}}; /* Test data for 4th attribute */ + {{3, -26.1, 'd'}, {-100000, 0.123, '3'}}, + {{-23, 981724.2, 'Q'}, {0, 2.0, '\n'}}}; /* Test data for 4th attribute */ #define ATTR5_NAME "Attr5" #define ATTR5_RANK 0 diff --git a/test/timer.c b/test/timer.c index bb474ca..11b7427 100644 --- a/test/timer.c +++ b/test/timer.c @@ -43,55 +43,55 @@ test_time_formatting(void) TESTING("Time string formats"); /* < 0, N/A */ - s = H5_timer_get_time_string(-1.0F); + s = H5_timer_get_time_string(-1.0); if (NULL == s || HDstrcmp(s, "N/A") != 0) TEST_ERROR; HDfree(s); /* 0 0 */ - s = H5_timer_get_time_string(0.0F); + s = H5_timer_get_time_string(0.0); if (NULL == s || HDstrcmp(s, "0.0 s") != 0) TEST_ERROR; HDfree(s); /* < 1 us nanoseconds */ - s = H5_timer_get_time_string(123.0E-9F); + s = H5_timer_get_time_string(123.0E-9); if (NULL == s || HDstrcmp(s, "123 ns") != 0) TEST_ERROR; HDfree(s); /* < 1 ms microseconds */ - s = H5_timer_get_time_string(23.456E-6F); + s = H5_timer_get_time_string(23.456E-6); if (NULL == s || HDstrcmp(s, "23.5 us") != 0) TEST_ERROR; HDfree(s); /* < 1 s milliseconds */ - s = H5_timer_get_time_string(4.56789E-3F); + s = H5_timer_get_time_string(4.56789E-3); if (NULL == s || HDstrcmp(s, "4.6 ms") != 0) TEST_ERROR; HDfree(s); /* < 1 min seconds */ - s = H5_timer_get_time_string(3.14F); + s = H5_timer_get_time_string(3.14); if (NULL == s || HDstrcmp(s, "3.14 s") != 0) TEST_ERROR; HDfree(s); /* < 1 hr mins, secs */ - s = H5_timer_get_time_string(2521.0F); + s = H5_timer_get_time_string(2521.0); if (NULL == s || HDstrcmp(s, "42 m 1 s") != 0) TEST_ERROR; HDfree(s); /* < 1 d hrs, mins, secs */ - s = H5_timer_get_time_string(9756.0F); + s = H5_timer_get_time_string(9756.0); if (NULL == s || HDstrcmp(s, "2 h 42 m 36 s") != 0) TEST_ERROR; HDfree(s); /* > 1 d days, hrs, mins, secs */ - s = H5_timer_get_time_string(280802.0F); + s = H5_timer_get_time_string(280802.0); if (NULL == s || HDstrcmp(s, "3 d 6 h 0 m 2 s") != 0) TEST_ERROR; HDfree(s); diff --git a/test/tmisc.c b/test/tmisc.c index 302da0d..b267330 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -5276,7 +5276,7 @@ test_misc28(void) * bytes). */ fapl = H5Pcreate(H5P_FILE_ACCESS); CHECK(fapl, FAIL, "H5Pcreate"); - ret = H5Pset_cache(fapl, MISC28_NSLOTS, MISC28_NSLOTS, MISC28_SIZE, 0.75F); + ret = H5Pset_cache(fapl, MISC28_NSLOTS, MISC28_NSLOTS, MISC28_SIZE, 0.75); CHECK(ret, FAIL, "H5Pset_cache"); /* Create the dcpl and set the chunk size */ diff --git a/test/tvltypes.c b/test/tvltypes.c index 50b2d7a..03a8ad3 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -2526,10 +2526,10 @@ test_vltypes_fill_value(void) hsize_t small_dims[] = {SPACE4_DIM_SMALL}; hsize_t large_dims[] = {SPACE4_DIM_LARGE}; size_t dset_elmts = 0; /* Number of elements in a particular dataset */ - const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", - 3, 4.0F, 100.0F, 1.0F, "liquid", "meter"}; - const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0F, 200.0F, 2.0F, "solid", "yard"}; - dtype1_struct * rbuf = NULL; /* Buffer for reading data */ + const dtype1_struct fill1 = {1, 2, "foobar", "", NULL, "\0", "dead", + 3, 4.0, 100.0, 1.0, "liquid", "meter"}; + const dtype1_struct wdata = {3, 4, "", NULL, "\0", "foo", "two", 6, 8.0, 200.0, 2.0, "solid", "yard"}; + dtype1_struct * rbuf = NULL; /* Buffer for reading data */ size_t mem_used = 0; /* Memory used during allocation */ H5D_layout_t layout; /* Dataset storage layout */ char dset_name1[64], dset_name2[64]; /* Dataset names */ -- cgit v0.12