2
0
mirror of https://github.com/HDFGroup/hdf5.git synced 2025-04-24 17:51:25 +08:00

Suppress GCC warnings about invalid float16 literal suffix before C23 ()

* Revert to old form of warning flag
This commit is contained in:
jhendersonHDF 2025-04-02 11:54:12 -05:00 committed by GitHub
parent e5db200a8a
commit 407caf1259
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 111 additions and 1 deletions

@ -1626,9 +1626,14 @@ H5T__conv_fcomplex__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata
const H5T_conv_ctx_t *conv_ctx, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
/* Suppress warning about non-standard floating-point literal suffix */
/* Suppress warning about non-standard floating-point literal suffix (F16) */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Zf(FLOAT_COMPLEX, FLOAT16, H5_float_complex, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif
@ -1929,7 +1934,12 @@ H5T__conv_dcomplex__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata
{
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Zf(DOUBLE_COMPLEX, FLOAT16, H5_double_complex, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif
@ -2240,7 +2250,12 @@ H5T__conv_lcomplex__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata
{
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Zf(LDOUBLE_COMPLEX, FLOAT16, H5_ldouble_complex, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif

@ -1942,7 +1942,12 @@ H5T__conv_float__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c
{
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Ff(FLOAT, FLOAT16, float, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif
@ -2260,7 +2265,12 @@ H5T__conv_double__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
{
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Ff(DOUBLE, FLOAT16, double, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif
@ -2583,7 +2593,12 @@ H5T__conv_ldouble__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
{
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Ff(LDOUBLE, FLOAT16, long double, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif

@ -2083,7 +2083,12 @@ H5T__conv_ushort__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
{
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Xf(USHORT, FLOAT16, unsigned short, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif
@ -2371,7 +2376,12 @@ H5T__conv_int__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, con
{
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Xf(INT, FLOAT16, int, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif
@ -2659,7 +2669,12 @@ H5T__conv_uint__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, co
{
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Xf(UINT, FLOAT16, unsigned int, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif
@ -2947,7 +2962,12 @@ H5T__conv_long__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, co
{
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Xf(LONG, FLOAT16, long, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif
@ -3235,7 +3255,12 @@ H5T__conv_ulong__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c
{
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Xf(ULONG, FLOAT16, unsigned long, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif
@ -3523,7 +3548,12 @@ H5T__conv_llong__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c
{
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Xf(LLONG, FLOAT16, long long, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif
@ -3815,7 +3845,12 @@ H5T__conv_ullong__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata,
{
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
H5T_CONV_Xf(ULLONG, FLOAT16, unsigned long long, H5__Float16, -FLT16_MAX, FLT16_MAX);
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
#endif

@ -3512,6 +3512,10 @@ 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")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
*((H5__Float16 *)hw_dst) = (H5__Float16)aligned;
@ -3521,6 +3525,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 = CONV_UNDERFLOW;
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
break;
#else
@ -3627,6 +3632,10 @@ 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")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
*((H5__Float16 *)hw_dst) = (H5__Float16)aligned;
@ -3636,6 +3645,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 = CONV_UNDERFLOW;
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
break;
#else
@ -3753,6 +3763,10 @@ 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")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
*((H5__Float16 *)hw_dst) = (H5__Float16)aligned;
@ -3762,6 +3776,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 = CONV_UNDERFLOW;
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
break;
#else
@ -3888,6 +3903,10 @@ test_conv_flt_1_hw_conv_from_fcomplex(void *hw_dst, unsigned char *src_buf, size
/* Suppress warning about non-standard floating-point literal suffix */
H5_GCC_CLANG_DIAG_OFF("pedantic")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
#ifdef H5_HAVE_C99_COMPLEX_NUMBERS
*((H5__Float16 *)hw_dst) = (H5__Float16)aligned;
@ -3901,6 +3920,7 @@ test_conv_flt_1_hw_conv_from_fcomplex(void *hw_dst, unsigned char *src_buf, size
else if (fabsf(real_val) < (float)FLT16_MIN)
ret = CONV_UNDERFLOW;
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
break;
}
@ -4007,6 +4027,10 @@ test_conv_flt_1_hw_conv_from_dcomplex(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")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
#ifdef H5_HAVE_C99_COMPLEX_NUMBERS
*((H5__Float16 *)hw_dst) = (H5__Float16)aligned;
@ -4021,6 +4045,7 @@ test_conv_flt_1_hw_conv_from_dcomplex(void *hw_dst, unsigned char *src_buf, size
else if (fabs(real_val) < (double)FLT16_MIN)
ret = CONV_UNDERFLOW;
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
break;
#else
@ -4174,6 +4199,10 @@ test_conv_flt_1_hw_conv_from_lcomplex(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")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
#ifdef H5_HAVE_C99_COMPLEX_NUMBERS
*((H5__Float16 *)hw_dst) = (H5__Float16)aligned;
@ -4188,6 +4217,7 @@ test_conv_flt_1_hw_conv_from_lcomplex(void *hw_dst, unsigned char *src_buf, size
else if (fabsl(real_val) < (long double)FLT16_MIN)
ret = CONV_UNDERFLOW;
H5_GCC_DIAG_ON("c11-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
break;
#else
@ -4576,6 +4606,10 @@ 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")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-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.
@ -4584,6 +4618,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-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
#else
assert(0 && "Should not reach this point!");
@ -4980,6 +5015,10 @@ 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")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-compat")
#ifdef H5_HAVE_FABSF16
if (underflow && fabsf16(x) <= FLT16_MIN && fabsf16(hw_half) <= FLT16_MIN)
continue; /* all underflowed, no error */
@ -4988,6 +5027,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-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
if (overflow && my_isinf(dendian, buf + j * sizeof(H5__Float16), dst_size, dst_mpos,
@ -7811,6 +7851,10 @@ 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")
/* Suppress GCC warning about non-standard floating-point literal suffix (F16)
* before C23. This should be fine when _Float16 support is available.
*/
H5_GCC_DIAG_OFF("c11-c2x-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.
@ -7819,6 +7863,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-c2x-compat")
H5_GCC_CLANG_DIAG_ON("pedantic")
}
else if (run_test == TEST_DENORM) {