Skip to content

Commit

Permalink
Suppress float16 suffix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
derobins committed Oct 19, 2024
1 parent 57cc93e commit b5c95a0
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/dt_arith.c
Original file line number Diff line number Diff line change
Expand Up @@ -2966,6 +2966,7 @@ test_conv_flt_1_hw_conv_from_flt(void *hw_dst, unsigned char *src_buf, size_t id
#ifdef H5_HAVE__FLOAT16
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
H5_GCC_DIAG_OFF("c11-c23-compat")

*((H5__Float16 *)hw_dst) = (H5__Float16)aligned;

Expand All @@ -2975,6 +2976,7 @@ test_conv_flt_1_hw_conv_from_flt(void *hw_dst, unsigned char *src_buf, size_t id
else if (fabsf(aligned) < (float)FLT16_MIN)
ret = 2;

H5_GCC_DIAG_ON("c11-c23-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
break;
#endif
Expand Down Expand Up @@ -3046,6 +3048,7 @@ test_conv_flt_1_hw_conv_from_double(void *hw_dst, unsigned char *src_buf, size_t
#ifdef H5_HAVE__FLOAT16
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
H5_GCC_DIAG_OFF("c11-c23-compat")

*((H5__Float16 *)hw_dst) = (H5__Float16)aligned;

Expand All @@ -3055,6 +3058,7 @@ test_conv_flt_1_hw_conv_from_double(void *hw_dst, unsigned char *src_buf, size_t
else if (fabs(aligned) < (double)FLT16_MIN)
ret = 2;

H5_GCC_DIAG_ON("c11-c23-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
break;
#endif
Expand Down Expand Up @@ -3132,6 +3136,7 @@ test_conv_flt_1_hw_conv_from_ldouble(void *hw_dst, unsigned char *src_buf, size_
#ifdef H5_HAVE__FLOAT16
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
H5_GCC_DIAG_OFF("c11-c23-compat")

*((H5__Float16 *)hw_dst) = (H5__Float16)aligned;

Expand All @@ -3141,6 +3146,7 @@ test_conv_flt_1_hw_conv_from_ldouble(void *hw_dst, unsigned char *src_buf, size_
else if (fabsl(aligned) < (long double)FLT16_MIN)
ret = 2;

H5_GCC_DIAG_ON("c11-c23-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
break;
#endif
Expand Down Expand Up @@ -3394,6 +3400,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
#ifdef H5_HAVE__FLOAT16
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
H5_GCC_DIAG_OFF("c11-c23-compat")
/* Suppress warning about float conversion in macro code path
* that sets H5__Float16 multiply = 100000000;, which shouldn't
* happen due to the small value of FLT16_MAX_10_EXP.
Expand All @@ -3402,6 +3409,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
INIT_FP_NORM(H5__Float16, FLT16_MAX, FLT16_MIN, FLT16_MAX_10_EXP, FLT16_MIN_10_EXP, src_size,
dst_size, buf, saved, nelmts);
H5_GCC_CLANG_DIAG_ON("float-conversion")
H5_GCC_DIAG_ON("c11-c23-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
#else
assert(0 && "Should not reach this point!");
Expand Down Expand Up @@ -3638,6 +3646,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)

/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
H5_GCC_DIAG_OFF("c11-c23-compat")
#ifdef H5_HAVE_FABSF16
if (underflow && fabsf16(x) <= FLT16_MIN && fabsf16(hw_half) <= FLT16_MIN)
continue; /* all underflowed, no error */
Expand All @@ -3646,6 +3655,7 @@ test_conv_flt_1(const char *name, int run_test, hid_t src, hid_t dst)
fabsf((float)hw_half) <= (float)FLT16_MIN)
continue; /* all underflowed, no error */
#endif
H5_GCC_DIAG_ON("c11-c23-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")

if (overflow && my_isinf(dendian, buf + j * sizeof(H5__Float16), dst_size, dst_mpos,
Expand Down Expand Up @@ -4224,6 +4234,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
if (run_test == TEST_NORMAL) {
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
H5_GCC_DIAG_OFF("c11-c23-compat")
/* Suppress warning about float conversion in macro code path
* that sets H5__Float16 multiply = 100000000;, which shouldn't
* happen due to the small value of FLT16_MAX_10_EXP.
Expand All @@ -4232,6 +4243,7 @@ test_conv_int_fp(const char *name, int run_test, hid_t src, hid_t dst)
INIT_FP_NORM(H5__Float16, FLT16_MAX, FLT16_MIN, FLT16_MAX_10_EXP, FLT16_MIN_10_EXP, src_size,
dst_size, buf, saved, nelmts);
H5_GCC_CLANG_DIAG_ON("float-conversion")
H5_GCC_DIAG_ON("c11-c23-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
else if (run_test == TEST_DENORM) {
Expand Down

0 comments on commit b5c95a0

Please sign in to comment.