diff options
author | Sean McBride <sean@rogue-research.com> | 2022-06-22 16:16:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-22 16:16:30 (GMT) |
commit | 8b2e7b32b5b9987938ebf6936205f324bc5050b8 (patch) | |
tree | 17062db1b0521cbe22e759c5083b216ae6c62437 /test | |
parent | 55f4cc0caa69d65c505e926fb7b2568ab1a76c58 (diff) | |
download | hdf5-8b2e7b32b5b9987938ebf6936205f324bc5050b8.zip hdf5-8b2e7b32b5b9987938ebf6936205f324bc5050b8.tar.gz hdf5-8b2e7b32b5b9987938ebf6936205f324bc5050b8.tar.bz2 |
Various warning fixes (#1812)
* Fixed -Wreserved-id-macro warnings from header include guards
* Removed all __int64 and LL suffix stuff now that C99 is minimum requirement
* Rename `H5FD_CTL__` to `H5FD_CTL_` to fix -Wreserved-id-macro warnings
Double underscore is reserved in C++ and this public header should be C++ compatible.
* Never define __STDC_FORMAT_MACROS anymore
Defining it causes a -Wreserved-id-macro.
Happily, according to the C++11 standard:
"The macros defined by <stdint> are provided unconditionally. In particular, the symbols __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS (mentioned in C99 footnotes 219, 220, and 222) play no role in C++."
https://cplusplus.github.io/LWG/issue984
So looks like it's not necessary to define it with reasonably new toolchains.
* Fixed some -Wunused-macros warnings, removed dead code
* Fixed all -Wdouble-promotion warnings in C++ files
* Fixed remaining -Wsuggest-destructor-override warnings
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/dt_arith.c | 24 | ||||
-rw-r--r-- | test/tconfig.c | 5 | ||||
-rw-r--r-- | test/vfd.c | 48 |
3 files changed, 36 insertions, 41 deletions
diff --git a/test/dt_arith.c b/test/dt_arith.c index 3601b95..ae48045 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -2462,11 +2462,11 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) break; case INT_LLONG: HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)aligned)); + HDfprintf(stdout, " %29lld\n", *((long long *)aligned)); break; case INT_ULLONG: HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)aligned)); + HDfprintf(stdout, " %29llu\n", *((unsigned long long *)aligned)); break; case FLT_FLOAT: case FLT_DOUBLE: @@ -2516,11 +2516,11 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) break; case INT_LLONG: HDmemcpy(aligned, buf + j * sizeof(long long), sizeof(long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)aligned)); + HDfprintf(stdout, " %29lld\n", *((long long *)aligned)); break; case INT_ULLONG: HDmemcpy(aligned, buf + j * sizeof(long long), sizeof(unsigned long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)aligned)); + HDfprintf(stdout, " %29llu\n", *((unsigned long long *)aligned)); break; case FLT_FLOAT: case FLT_DOUBLE: @@ -2561,10 +2561,10 @@ test_conv_int_1(const char *name, hid_t src, hid_t dst) HDprintf(" %29lu\n", *((unsigned long *)((void *)hw))); break; case INT_LLONG: - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)((void *)hw))); + HDfprintf(stdout, " %29lld\n", *((long long *)((void *)hw))); break; case INT_ULLONG: - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)((void *)hw))); + HDfprintf(stdout, " %29llu\n", *((unsigned long long *)((void *)hw))); break; case FLT_FLOAT: case FLT_DOUBLE: @@ -4398,11 +4398,11 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) break; case INT_LLONG: HDmemcpy(aligned, saved + j * sizeof(long long), sizeof(long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)aligned)); + HDfprintf(stdout, " %29lld\n", *((long long *)aligned)); break; case INT_ULLONG: HDmemcpy(aligned, saved + j * sizeof(unsigned long long), sizeof(unsigned long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)aligned)); + HDfprintf(stdout, " %29llu\n", *((unsigned long long *)aligned)); break; case FLT_FLOAT: HDmemcpy(aligned, saved + j * sizeof(float), sizeof(float)); @@ -4461,11 +4461,11 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) break; case INT_LLONG: HDmemcpy(aligned, buf + j * sizeof(long long), sizeof(long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)aligned)); + HDfprintf(stdout, " %29lld\n", *((long long *)aligned)); break; case INT_ULLONG: HDmemcpy(aligned, buf + j * sizeof(unsigned long long), sizeof(unsigned long long)); - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)aligned)); + HDfprintf(stdout, " %29llu\n", *((unsigned long long *)aligned)); break; case FLT_FLOAT: HDmemcpy(aligned, buf + j * sizeof(float), sizeof(float)); @@ -4515,10 +4515,10 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst) HDprintf(" %29lu\n", *((unsigned long *)((void *)hw))); break; case INT_LLONG: - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "d\n", *((long long *)((void *)hw))); + HDfprintf(stdout, " %29lld\n", *((long long *)((void *)hw))); break; case INT_ULLONG: - HDfprintf(stdout, " %29" H5_PRINTF_LL_WIDTH "u\n", *((unsigned long long *)((void *)hw))); + HDfprintf(stdout, " %29llu\n", *((unsigned long long *)((void *)hw))); break; case FLT_FLOAT: HDprintf(" %29f\n", (double)*((float *)((void *)hw))); diff --git a/test/tconfig.c b/test/tconfig.c index 8bd625f..8cffd54 100644 --- a/test/tconfig.c +++ b/test/tconfig.c @@ -161,11 +161,6 @@ test_config_ctypes(void) vrfy_cint_type(int_least64_t, uint_least64_t, H5_SIZEOF_INT_LEAST64_T); #endif - /* pseudo standard basic types */ -#if H5_SIZEOF___INT64 > 0 - vrfy_cint_type(__int64, unsigned __int64, H5_SIZEOF___INT64); -#endif - #if H5_SIZEOF_OFF_T > 0 vrfy_ctype(off_t, H5_SIZEOF_OFF_T); #endif @@ -3581,12 +3581,12 @@ H5FD__ctl_test_vfd_ctl(H5FD_t H5_ATTR_UNUSED *_file, uint64_t op_code, uint64_t switch (op_code) { /* Op code for testing purposes */ - case H5FD_CTL__TEST_OPCODE: + case H5FD_CTL_TEST_OPCODE: break; /* Unknown op code */ default: - if (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG) + if (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG) ret_value = FAIL; break; } @@ -3660,8 +3660,8 @@ run_ctl_test(uint64_t op_code, uint64_t flags, ctl_test_opc_type opc_type, hid_t char filename[1024]; /* Check for a few ctl function flags */ - fail_if_unknown = (flags & H5FD_CTL__FAIL_IF_UNKNOWN_FLAG); - routing_flag_set = (flags & H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG); + fail_if_unknown = (flags & H5FD_CTL_FAIL_IF_UNKNOWN_FLAG); + routing_flag_set = (flags & H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG); /* Determine if the top-level VFD is a passthrough VFD */ if ((driver_id = H5Pget_driver(fapl_id)) < 0) @@ -3761,7 +3761,7 @@ test_ctl(void) TESTING_2("known op code to terminal VFD (without fail on unknown flag)"); - op_code = H5FD_CTL__TEST_OPCODE; + op_code = H5FD_CTL_TEST_OPCODE; flags = 0; /* H5FDctl call should succeed normally */ @@ -3772,8 +3772,8 @@ test_ctl(void) TESTING_2("known op code to terminal VFD (with fail on unknown flag)"); - op_code = H5FD_CTL__TEST_OPCODE; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + op_code = H5FD_CTL_TEST_OPCODE; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG; /* H5FDctl call should succeed normally */ if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) @@ -3783,8 +3783,8 @@ test_ctl(void) TESTING_2("known op code to terminal VFD (without fail on unknown flag/route to terminal VFD)"); - op_code = H5FD_CTL__TEST_OPCODE; - flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + op_code = H5FD_CTL_TEST_OPCODE; + flags = H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* H5FDctl call should succeed normally */ if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) @@ -3794,8 +3794,8 @@ test_ctl(void) TESTING_2("known op code to terminal VFD (with fail on unknown flag/route to terminal VFD)"); - op_code = H5FD_CTL__TEST_OPCODE; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + op_code = H5FD_CTL_TEST_OPCODE; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* H5FDctl call should succeed normally */ if (run_ctl_test(op_code, flags, CTL_OPC_KNOWN_TERMINAL, fapl_id) < 0) @@ -3817,7 +3817,7 @@ test_ctl(void) TESTING_2("unknown op code to terminal VFD (with fail on unknown flag)"); op_code = H5FD_CTL_OPC_RESERVED; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG; /* H5FDctl call should fail due to 'fail if unknown' flag being specified */ if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) @@ -3828,7 +3828,7 @@ test_ctl(void) TESTING_2("unknown op code to terminal VFD (without fail on unknown flag/route to terminal VFD)"); op_code = H5FD_CTL_OPC_RESERVED; - flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + flags = H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* H5FDctl call should silently ignore unknown op code and succeed */ if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) @@ -3839,7 +3839,7 @@ test_ctl(void) TESTING_2("unknown op code to terminal VFD (with fail on unknown flag/route to terminal VFD)"); op_code = H5FD_CTL_OPC_RESERVED; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* H5FDctl call should fail due to 'fail if unknown' flag being specified */ if (run_ctl_test(op_code, flags, CTL_OPC_UNKNOWN, fapl_id) < 0) @@ -3870,7 +3870,7 @@ test_ctl(void) TESTING_2("known op code through passthrough VFD to terminal VFD (without fail on unknown flag/no " "routing flag)"); - op_code = H5FD_CTL__TEST_OPCODE; + op_code = H5FD_CTL_TEST_OPCODE; flags = 0; /* @@ -3886,8 +3886,8 @@ test_ctl(void) TESTING_2( "known op code through passthrough VFD to terminal VFD (with fail on unknown flag/no routing flag)"); - op_code = H5FD_CTL__TEST_OPCODE; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + op_code = H5FD_CTL_TEST_OPCODE; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG; /* * H5FDctl call should fail since op code is unknown to @@ -3903,8 +3903,8 @@ test_ctl(void) TESTING_2("known op code through passthrough VFD to terminal VFD (without fail on unknown flag/route to " "terminal VFD)"); - op_code = H5FD_CTL__TEST_OPCODE; - flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + op_code = H5FD_CTL_TEST_OPCODE; + flags = H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* * H5Dctl call should succeed since the passthrough VFD @@ -3919,8 +3919,8 @@ test_ctl(void) TESTING_2("known op code through passthrough VFD to terminal VFD (with fail on unknown flag/route to " "terminal VFD)"); - op_code = H5FD_CTL__TEST_OPCODE; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + op_code = H5FD_CTL_TEST_OPCODE; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* * H5Dctl call should succeed since the passthrough VFD @@ -3950,7 +3950,7 @@ test_ctl(void) TESTING_2("unknown op code to passthrough VFD (with fail on unknown flag)"); op_code = H5FD_CTL_OPC_RESERVED; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG; /* * H5FDctl call should fail since op code is unknown to @@ -3965,7 +3965,7 @@ test_ctl(void) TESTING_2("unknown op code to passthrough VFD (without fail on unknown flag/route to terminal VFD)"); op_code = H5FD_CTL_OPC_RESERVED; - flags = H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + flags = H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* * H5Dctl call should succeed since the passthrough VFD @@ -3983,7 +3983,7 @@ test_ctl(void) TESTING_2("unknown op code to passthrough VFD (with fail on unknown flag/route to terminal VFD)"); op_code = H5FD_CTL_OPC_RESERVED; - flags = H5FD_CTL__FAIL_IF_UNKNOWN_FLAG | H5FD_CTL__ROUTE_TO_TERMINAL_VFD_FLAG; + flags = H5FD_CTL_FAIL_IF_UNKNOWN_FLAG | H5FD_CTL_ROUTE_TO_TERMINAL_VFD_FLAG; /* * H5Dctl call should fail since the passthrough VFD |