From 9c7e9b3ac9a8f20e62867b24d1b618d5bdd2eefe Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Tue, 11 Jun 2024 16:34:50 -0500 Subject: [PATCH] Implement more conversions --- src/H5T.c | 43 ++++++-- src/H5Tconv_complex.c | 224 +++++++++++++++++++++++++++------------ src/H5Tconv_float.c | 18 ++-- src/H5Tconv_macros.h | 238 +++++++++++++++++++++++++++++++++++++----- src/H5Tpkg.h | 12 ++- 5 files changed, 425 insertions(+), 110 deletions(-) diff --git a/src/H5T.c b/src/H5T.c index 25d0aaf5c3e..60eb9808d3f 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -43,6 +43,10 @@ #include "H5VLprivate.h" /* Virtual Object Layer */ #include "H5VMprivate.h" /* Vectors and arrays */ +#ifdef H5_HAVE_COMPLEX_NUMBERS +#include +#endif + /* Datatype conversion functions */ #include "H5Tconv_integer.h" #include "H5Tconv_float.h" @@ -604,6 +608,14 @@ float H5T_NATIVE_FLOAT_POS_INF_g = 0.0F; float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0F; double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0; double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0; +#ifdef H5_HAVE_COMPLEX_NUMBERS +float _Complex H5T_NATIVE_FLOAT_COMPLEX_POS_INF_g = 0.0F + 0.0F * (float _Complex)_Complex_I; +float _Complex H5T_NATIVE_FLOAT_COMPLEX_NEG_INF_g = 0.0F + 0.0F * (float _Complex)_Complex_I; +double _Complex H5T_NATIVE_DOUBLE_COMPLEX_POS_INF_g = 0.0 + 0.0 * (double _Complex)_Complex_I; +double _Complex H5T_NATIVE_DOUBLE_COMPLEX_NEG_INF_g = 0.0 + 0.0 * (double _Complex)_Complex_I; +long double _Complex H5T_NATIVE_LDOUBLE_COMPLEX_POS_INF_g = 0.0L + 0.0L * (long double _Complex)_Complex_I; +long double _Complex H5T_NATIVE_LDOUBLE_COMPLEX_NEG_INF_g = 0.0L + 0.0L * (long double _Complex)_Complex_I; +#endif /* Declare the free list for H5T_t's and H5T_shared_t's */ H5FL_DEFINE(H5T_t); @@ -752,6 +764,8 @@ H5T__init_inf(void) } /* end for */ } /* end if */ + /* TODO: add ldouble pos and neg inf. */ + #ifdef H5_HAVE__FLOAT16 /* Get the _Float16 datatype */ if (NULL == (dst_p = (H5T_t *)H5I_object(H5T_NATIVE_FLOAT16_g))) @@ -795,6 +809,21 @@ H5T__init_inf(void) } /* end if */ #endif +#ifdef H5_HAVE_COMPLEX_NUMBERS + /* + * A complex number is considered to be infinite if any of its parts + * (real or imaginary) is infinite, so simply set the real part of + * the complex number positive/negative infinity values to the + * positive/negative infinity value for the base floating-point type. + */ + memcpy(&H5T_NATIVE_FLOAT_COMPLEX_POS_INF_g, &H5T_NATIVE_FLOAT_POS_INF_g, sizeof(float)); + memcpy(&H5T_NATIVE_FLOAT_COMPLEX_NEG_INF_g, &H5T_NATIVE_FLOAT_NEG_INF_g, sizeof(float)); + memcpy(&H5T_NATIVE_DOUBLE_COMPLEX_POS_INF_g, &H5T_NATIVE_DOUBLE_POS_INF_g, sizeof(double)); + memcpy(&H5T_NATIVE_DOUBLE_COMPLEX_NEG_INF_g, &H5T_NATIVE_DOUBLE_NEG_INF_g, sizeof(double)); + memcpy(&H5T_NATIVE_LDOUBLE_COMPLEX_POS_INF_g, &H5T_NATIVE_LDOUBLE_POS_INF_g, sizeof(long double)); + memcpy(&H5T_NATIVE_LDOUBLE_COMPLEX_NEG_INF_g, &H5T_NATIVE_LDOUBLE_NEG_INF_g, sizeof(long double)); +#endif + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__init_inf() */ @@ -841,7 +870,7 @@ H5T_init(void) H5T_t *enum_type = NULL; /* Datatype structure for enum objects */ H5T_t *vlen = NULL; /* Datatype structure for vlen objects */ H5T_t *array = NULL; /* Datatype structure for array objects */ - H5T_t *complex = NULL; /* Datatype structure for complex number objects */ + H5T_t *cplx = NULL; /* Datatype structure for complex number objects */ H5T_t *objref = NULL; /* Datatype structure for deprecated reference objects */ H5T_t *regref = NULL; /* Datatype structure for deprecated region references */ H5T_t *ref = NULL; /* Datatype structure for opaque references */ @@ -1159,7 +1188,7 @@ H5T_init(void) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); if (NULL == (array = H5T__array_create(native_int, 1, dim))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); - if (NULL == (complex = H5T__complex_create(native_float))) + if (NULL == (cplx = H5T__complex_create(native_float))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype"); status = 0; @@ -1173,8 +1202,8 @@ H5T_init(void) status |= H5T__register_int(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T__conv_order_opt); status |= H5T__register_int(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T__conv_order); status |= H5T__register_int(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T__conv_order_opt); - status |= H5T__register_int(H5T_PERS_SOFT, "cpxbo", complex, complex, H5T__conv_order); - status |= H5T__register_int(H5T_PERS_SOFT, "cpxbo(opt)", complex, complex, H5T__conv_order_opt); + status |= H5T__register_int(H5T_PERS_SOFT, "cplxbo", cplx, cplx, H5T__conv_order); + status |= H5T__register_int(H5T_PERS_SOFT, "cplxbo(opt)", cplx, cplx, H5T__conv_order_opt); status |= H5T__register_int(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct); status |= H5T__register_int(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt); /* TODO: complex number struct conversions */ @@ -1188,7 +1217,7 @@ H5T_init(void) status |= H5T__register_int(H5T_PERS_SOFT, "ref", ref, ref, H5T__conv_ref); status |= H5T__register_int(H5T_PERS_SOFT, "objref_ref", objref, ref, H5T__conv_ref); status |= H5T__register_int(H5T_PERS_SOFT, "regref_ref", regref, ref, H5T__conv_ref); - /* TODO: complex number between conversions */ + /* TODO: rename conversion routines below */ /* * Native conversions should be listed last since we can use hardware to @@ -1889,8 +1918,8 @@ H5T_init(void) (void)H5T_close_real(vlen); if (array != NULL) (void)H5T_close_real(array); - if (complex != NULL) - (void)H5T_close_real(complex); + if (cplx != NULL) + (void)H5T_close_real(cplx); /* Error cleanup */ if (ret_value < 0) { diff --git a/src/H5Tconv_complex.c b/src/H5Tconv_complex.c index 27b15b1e21f..4dac4a2d8ec 100644 --- a/src/H5Tconv_complex.c +++ b/src/H5Tconv_complex.c @@ -105,9 +105,12 @@ H5T__conv_complex_struct(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, */ herr_t H5T__conv_fcomplex_schar(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(FLOAT_COMPLEX, SCHAR, float _Complex, signed char, SCHAR_MIN, SCHAR_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -121,9 +124,12 @@ H5T__conv_fcomplex_schar(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_fcomplex_uchar(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(FLOAT_COMPLEX, UCHAR, float _Complex, unsigned char, 0, UCHAR_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -137,9 +143,12 @@ H5T__conv_fcomplex_uchar(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_fcomplex_short(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(FLOAT_COMPLEX, SHORT, float _Complex, short, SHRT_MIN, SHRT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -152,11 +161,13 @@ H5T__conv_fcomplex_short(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c *------------------------------------------------------------------------- */ herr_t -H5T__conv_fcomplex_ushort(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 bkg_stride, - void *buf, void *bkg) +H5T__conv_fcomplex_ushort(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) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(FLOAT_COMPLEX, USHORT, float _Complex, unsigned short, 0, USHRT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -170,9 +181,12 @@ H5T__conv_fcomplex_ushort(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, */ herr_t H5T__conv_fcomplex_int(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(FLOAT_COMPLEX, INT, float _Complex, int, INT_MIN, INT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -186,9 +200,12 @@ H5T__conv_fcomplex_int(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, con */ herr_t H5T__conv_fcomplex_uint(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(FLOAT_COMPLEX, UINT, float _Complex, unsigned int, 0, UINT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -202,9 +219,12 @@ H5T__conv_fcomplex_uint(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, co */ herr_t H5T__conv_fcomplex_long(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(FLOAT_COMPLEX, LONG, float _Complex, long, LONG_MIN, LONG_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -218,9 +238,12 @@ H5T__conv_fcomplex_long(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, co */ herr_t H5T__conv_fcomplex_ulong(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(FLOAT_COMPLEX, ULONG, float _Complex, unsigned long, 0, ULONG_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -234,9 +257,12 @@ H5T__conv_fcomplex_ulong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_fcomplex_llong(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(FLOAT_COMPLEX, LLONG, float _Complex, long long, LLONG_MIN, LLONG_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -249,11 +275,13 @@ H5T__conv_fcomplex_llong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c *------------------------------------------------------------------------- */ herr_t -H5T__conv_fcomplex_ullong(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 bkg_stride, - void *buf, void *bkg) +H5T__conv_fcomplex_ullong(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) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(FLOAT_COMPLEX, ULLONG, float _Complex, unsigned long long, 0, ULLONG_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } #ifdef H5_HAVE__FLOAT16 @@ -269,9 +297,12 @@ H5T__conv_fcomplex_ullong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, herr_t 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 bkg_stride, void *buf, void *bkg) + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") H5T_CONV_Zf(FLOAT_COMPLEX, FLOAT16, float _Complex, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") } #endif @@ -286,7 +317,8 @@ H5T__conv_fcomplex__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata */ herr_t H5T__conv_fcomplex_float(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { H5T_CONV_zf(FLOAT_COMPLEX, FLOAT, float _Complex, float, -, -); } @@ -301,9 +333,9 @@ H5T__conv_fcomplex_float(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c *------------------------------------------------------------------------- */ herr_t -H5T__conv_fcomplex_double(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 bkg_stride, - void *buf, void *bkg) +H5T__conv_fcomplex_double(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) { H5T_CONV_zF(FLOAT_COMPLEX, DOUBLE, float _Complex, double, -, -); } @@ -318,9 +350,9 @@ H5T__conv_fcomplex_double(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, *------------------------------------------------------------------------- */ herr_t -H5T__conv_fcomplex_ldouble(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 bkg_stride, void *buf, void *bkg) +H5T__conv_fcomplex_ldouble(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) { H5T_CONV_zF(FLOAT_COMPLEX, LDOUBLE, float _Complex, long double, -, -); } @@ -335,9 +367,9 @@ H5T__conv_fcomplex_ldouble(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, *------------------------------------------------------------------------- */ herr_t -H5T__conv_fcomplex_dcomplex(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 bkg_stride, void *buf, void *bkg) +H5T__conv_fcomplex_dcomplex(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) { H5T_CONV_zZ(FLOAT_COMPLEX, DOUBLE_COMPLEX, float _Complex, double _Complex, -, -); } @@ -354,7 +386,7 @@ H5T__conv_fcomplex_dcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata herr_t H5T__conv_fcomplex_lcomplex(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 bkg_stride, void *buf, void *bkg) + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { H5T_CONV_zZ(FLOAT_COMPLEX, LDOUBLE_COMPLEX, float _Complex, long double _Complex, -, -); } @@ -370,9 +402,12 @@ H5T__conv_fcomplex_lcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata */ herr_t H5T__conv_dcomplex_schar(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(DOUBLE_COMPLEX, SCHAR, double _Complex, signed char, SCHAR_MIN, SCHAR_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -386,9 +421,12 @@ H5T__conv_dcomplex_schar(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_dcomplex_uchar(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(DOUBLE_COMPLEX, UCHAR, double _Complex, unsigned char, 0, UCHAR_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -402,9 +440,12 @@ H5T__conv_dcomplex_uchar(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_dcomplex_short(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(DOUBLE_COMPLEX, SHORT, double _Complex, short, SHRT_MIN, SHRT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -418,10 +459,12 @@ H5T__conv_dcomplex_short(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_dcomplex_ushort(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 bkg_stride, - void *buf, void *bkg) + 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) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(DOUBLE_COMPLEX, USHORT, double _Complex, unsigned short, 0, USHRT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -435,9 +478,12 @@ H5T__conv_dcomplex_ushort(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, */ herr_t H5T__conv_dcomplex_int(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(DOUBLE_COMPLEX, INT, double _Complex, int, INT_MIN, INT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -451,9 +497,12 @@ H5T__conv_dcomplex_int(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, con */ herr_t H5T__conv_dcomplex_uint(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(DOUBLE_COMPLEX, UINT, double _Complex, unsigned int, 0, UINT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -467,9 +516,12 @@ H5T__conv_dcomplex_uint(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, co */ herr_t H5T__conv_dcomplex_long(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(DOUBLE_COMPLEX, LONG, double _Complex, long, LONG_MIN, LONG_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -483,9 +535,12 @@ H5T__conv_dcomplex_long(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, co */ herr_t H5T__conv_dcomplex_ulong(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(DOUBLE_COMPLEX, ULONG, double _Complex, unsigned long, 0, ULONG_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -499,9 +554,12 @@ H5T__conv_dcomplex_ulong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_dcomplex_llong(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(DOUBLE_COMPLEX, LLONG, double _Complex, long long, LLONG_MIN, LLONG_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -515,10 +573,12 @@ H5T__conv_dcomplex_llong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_dcomplex_ullong(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 bkg_stride, - void *buf, void *bkg) + 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) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(DOUBLE_COMPLEX, ULLONG, double _Complex, unsigned long long, 0, ULLONG_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } #ifdef H5_HAVE__FLOAT16 @@ -534,9 +594,12 @@ H5T__conv_dcomplex_ullong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, herr_t H5T__conv_dcomplex__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 bkg_stride, void *buf, void *bkg) + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") H5T_CONV_Zf(DOUBLE_COMPLEX, FLOAT16, double _Complex, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") } #endif @@ -551,7 +614,8 @@ H5T__conv_dcomplex__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata */ herr_t H5T__conv_dcomplex_float(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { H5T_CONV_Zf(DOUBLE_COMPLEX, FLOAT, double _Complex, float, -FLT_MAX, FLT_MAX); } @@ -567,8 +631,8 @@ H5T__conv_dcomplex_float(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_dcomplex_double(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 bkg_stride, - void *buf, void *bkg) + 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) { H5T_CONV_zf(DOUBLE_COMPLEX, DOUBLE, double _Complex, double, -, -); } @@ -585,7 +649,7 @@ H5T__conv_dcomplex_double(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, herr_t H5T__conv_dcomplex_ldouble(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 bkg_stride, void *buf, void *bkg) + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { H5T_CONV_zF(DOUBLE_COMPLEX, LDOUBLE, double _Complex, long double, -, -); } @@ -602,7 +666,7 @@ H5T__conv_dcomplex_ldouble(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, herr_t H5T__conv_dcomplex_fcomplex(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 bkg_stride, void *buf, void *bkg) + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { H5T_CONV_Zz(DOUBLE_COMPLEX, FLOAT_COMPLEX, double _Complex, float _Complex, -FLT_MAX, FLT_MAX); } @@ -619,7 +683,7 @@ H5T__conv_dcomplex_fcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata herr_t H5T__conv_dcomplex_lcomplex(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 bkg_stride, void *buf, void *bkg) + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { H5T_CONV_zZ(DOUBLE_COMPLEX, LDOUBLE_COMPLEX, double _Complex, long double _Complex, -, -); } @@ -635,9 +699,12 @@ H5T__conv_dcomplex_lcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata */ herr_t H5T__conv_lcomplex_schar(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(LDOUBLE_COMPLEX, SCHAR, long double _Complex, signed char, SCHAR_MIN, SCHAR_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -651,9 +718,12 @@ H5T__conv_lcomplex_schar(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_lcomplex_uchar(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(LDOUBLE_COMPLEX, UCHAR, long double _Complex, unsigned char, 0, UCHAR_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -667,9 +737,12 @@ H5T__conv_lcomplex_uchar(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_lcomplex_short(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(LDOUBLE_COMPLEX, SHORT, long double _Complex, short, SHRT_MIN, SHRT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -683,10 +756,12 @@ H5T__conv_lcomplex_short(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_lcomplex_ushort(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 bkg_stride, - void *buf, void *bkg) + 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) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(LDOUBLE_COMPLEX, USHORT, long double _Complex, unsigned short, 0, USHRT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -700,9 +775,12 @@ H5T__conv_lcomplex_ushort(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, */ herr_t H5T__conv_lcomplex_int(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(LDOUBLE_COMPLEX, INT, long double _Complex, int, INT_MIN, INT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -716,9 +794,12 @@ H5T__conv_lcomplex_int(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, con */ herr_t H5T__conv_lcomplex_uint(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(LDOUBLE_COMPLEX, UINT, long double _Complex, unsigned int, 0, UINT_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -732,9 +813,12 @@ H5T__conv_lcomplex_uint(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, co */ herr_t H5T__conv_lcomplex_long(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(LDOUBLE_COMPLEX, LONG, long double _Complex, long, LONG_MIN, LONG_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -748,9 +832,12 @@ H5T__conv_lcomplex_long(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, co */ herr_t H5T__conv_lcomplex_ulong(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(LDOUBLE_COMPLEX, ULONG, long double _Complex, unsigned long, 0, ULONG_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } /*------------------------------------------------------------------------- @@ -765,9 +852,12 @@ H5T__conv_lcomplex_ulong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c #ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG herr_t H5T__conv_lcomplex_llong(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(LDOUBLE_COMPLEX, LLONG, long double _Complex, long long, LLONG_MIN, LLONG_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } #endif /* H5T_CONV_INTERNAL_LDOUBLE_LLONG */ @@ -783,10 +873,12 @@ H5T__conv_lcomplex_llong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c #ifdef H5T_CONV_INTERNAL_LDOUBLE_ULLONG herr_t H5T__conv_lcomplex_ullong(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 bkg_stride, - void *buf, void *bkg) + 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) { + H5_GCC_CLANG_DIAG_OFF("float-equal") H5T_CONV_Zx(LDOUBLE_COMPLEX, ULLONG, long double _Complex, unsigned long long, 0, ULLONG_MAX); + H5_GCC_CLANG_DIAG_ON("float-equal") } #endif /* H5T_CONV_INTERNAL_LDOUBLE_ULLONG */ @@ -804,9 +896,12 @@ H5T__conv_lcomplex_ullong(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, herr_t H5T__conv_lcomplex__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 bkg_stride, void *buf, void *bkg) + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { + /* Suppress warning about non-standard floating-point literal suffix */ + H5_GCC_CLANG_DIAG_OFF("pedantic") H5T_CONV_Zf(LDOUBLE_COMPLEX, FLOAT16, long double _Complex, H5__Float16, -FLT16_MAX, FLT16_MAX); + H5_GCC_CLANG_DIAG_ON("pedantic") } #endif #endif @@ -822,7 +917,8 @@ H5T__conv_lcomplex__Float16(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata */ herr_t H5T__conv_lcomplex_float(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 bkg_stride, void *buf, void *bkg) + size_t nelmts, size_t buf_stride, size_t H5_ATTR_UNUSED bkg_stride, void *buf, + void H5_ATTR_UNUSED *bkg) { H5T_CONV_Zf(LDOUBLE_COMPLEX, FLOAT, long double _Complex, float, -FLT_MAX, FLT_MAX); } @@ -838,8 +934,8 @@ H5T__conv_lcomplex_float(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c */ herr_t H5T__conv_lcomplex_double(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 bkg_stride, - void *buf, void *bkg) + 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) { H5T_CONV_Zf(LDOUBLE_COMPLEX, DOUBLE, long double _Complex, double, -DBL_MAX, DBL_MAX); } @@ -856,7 +952,7 @@ H5T__conv_lcomplex_double(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, herr_t H5T__conv_lcomplex_ldouble(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 bkg_stride, void *buf, void *bkg) + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { H5T_CONV_zf(LDOUBLE_COMPLEX, LDOUBLE, long double _Complex, long double, -, -); } @@ -873,7 +969,7 @@ H5T__conv_lcomplex_ldouble(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, herr_t H5T__conv_lcomplex_fcomplex(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 bkg_stride, void *buf, void *bkg) + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { H5T_CONV_Zz(LDOUBLE_COMPLEX, FLOAT_COMPLEX, long double _Complex, float _Complex, -FLT_MAX, FLT_MAX); } @@ -890,7 +986,7 @@ H5T__conv_lcomplex_fcomplex(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata herr_t H5T__conv_lcomplex_dcomplex(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 bkg_stride, void *buf, void *bkg) + size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg) { H5T_CONV_Zz(LDOUBLE_COMPLEX, DOUBLE_COMPLEX, long double _Complex, double _Complex, -DBL_MAX, DBL_MAX); } diff --git a/src/H5Tconv_float.c b/src/H5Tconv_float.c index 56ae06c2c8a..cd01aa15032 100644 --- a/src/H5Tconv_float.c +++ b/src/H5Tconv_float.c @@ -1838,7 +1838,7 @@ H5T__conv_float_ldouble(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, co *------------------------------------------------------------------------- */ herr_t -H5T__conv_float_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, +H5T__conv_float_fcomplex(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 bkg_stride, void *buf, void *bkg) { @@ -1856,7 +1856,7 @@ H5T__conv_float_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, *------------------------------------------------------------------------- */ herr_t -H5T__conv_float_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, +H5T__conv_float_dcomplex(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 bkg_stride, void *buf, void *bkg) { @@ -1874,7 +1874,7 @@ H5T__conv_float_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, *------------------------------------------------------------------------- */ herr_t -H5T__conv_float_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, +H5T__conv_float_lcomplex(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 bkg_stride, void *buf, void *bkg) { @@ -2153,7 +2153,7 @@ H5T__conv_double_ldouble(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c *------------------------------------------------------------------------- */ herr_t -H5T__conv_double_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, +H5T__conv_double_fcomplex(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 bkg_stride, void *buf, void *bkg) { @@ -2171,7 +2171,7 @@ H5T__conv_double_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata *------------------------------------------------------------------------- */ herr_t -H5T__conv_double_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, +H5T__conv_double_dcomplex(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 bkg_stride, void *buf, void *bkg) { @@ -2189,7 +2189,7 @@ H5T__conv_double_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata *------------------------------------------------------------------------- */ herr_t -H5T__conv_double_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, +H5T__conv_double_lcomplex(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 bkg_stride, void *buf, void *bkg) { @@ -2474,7 +2474,7 @@ H5T__conv_ldouble_double(const H5T_t *st, const H5T_t *dt, H5T_cdata_t *cdata, c *------------------------------------------------------------------------- */ herr_t -H5T__conv_ldouble_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, +H5T__conv_ldouble_fcomplex(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 bkg_stride, void *buf, void *bkg) { @@ -2492,7 +2492,7 @@ H5T__conv_ldouble_fcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdat *------------------------------------------------------------------------- */ herr_t -H5T__conv_ldouble_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, +H5T__conv_ldouble_dcomplex(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 bkg_stride, void *buf, void *bkg) { @@ -2510,7 +2510,7 @@ H5T__conv_ldouble_dcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdat *------------------------------------------------------------------------- */ herr_t -H5T__conv_ldouble_lcomplex(const H5T_t *src, const H5T_t *dst, H5T_cdata_t *cdata, +H5T__conv_ldouble_lcomplex(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 bkg_stride, void *buf, void *bkg) { diff --git a/src/H5Tconv_macros.h b/src/H5Tconv_macros.h index 16ae0a6b6b7..e273d630bd3 100644 --- a/src/H5Tconv_macros.h +++ b/src/H5Tconv_macros.h @@ -863,12 +863,17 @@ typedef struct H5T_conv_hw_t { * the complex number functions used below to reduce macro duplication between * the float, double and long double _Complex cases, support for the tgmath.h * header appears to be problematic and not particularly portable pre-C11. This - * should be revisited if the minimum required C standard version is upped to + * should be revisited if the minimum required C standard version is moved to * C11 or later. */ -#define H5T_CONV_FLOAT_COMPLEX_REALVAL(S) float s_val = crealf(*(S)); -#define H5T_CONV_DOUBLE_COMPLEX_REALVAL(S) double s_val = creal(*(S)); -#define H5T_CONV_LDOUBLE_COMPLEX_REALVAL(S) long double s_val = creall(*(S)); +#define H5T_CONV_FLOAT_COMPLEX_REALVAL(S) float sr_val = crealf(*(S)); +#define H5T_CONV_DOUBLE_COMPLEX_REALVAL(S) double sr_val = creal(*(S)); +#define H5T_CONV_LDOUBLE_COMPLEX_REALVAL(S) long double sr_val = creall(*(S)); +#define H5T_CONV_FLOAT_COMPLEX_IMAGVAL(S) float si_val = cimagf(*(S)); +#define H5T_CONV_DOUBLE_COMPLEX_IMAGVAL(S) double si_val = cimag(*(S)); +#define H5T_CONV_LDOUBLE_COMPLEX_IMAGVAL(S) long double si_val = cimagl(*(S)); + +/* TODO: cleanup, compact and comment below */ #define H5T_CONV_zZ(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ do { \ @@ -877,7 +882,65 @@ typedef struct H5T_conv_hw_t { } while (0) /* TODO */ -#define H5T_CONV_Zz(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) +#define H5T_CONV_Zz_NOEX_CORE_IMP(STYPE, DTYPE, S, S_REAL, S_IMAG, D, ST, DT, D_MIN, D_MAX) \ + { \ + bool sr_over = (S_REAL) > (ST)(D_MAX); \ + bool sr_under = (S_REAL) < (ST)(D_MIN); \ + bool si_over = (S_IMAG) > (ST)(D_MAX); \ + bool si_under = (S_IMAG) < (ST)(D_MIN); \ + if (!sr_over && !sr_under && !si_over && !si_under) \ + *(D) = (DT)(*(S)); \ + else { \ + uint8_t *tmp_buf_ptr = (uint8_t *)(D); \ + DT tmp_real; \ + DT tmp_imag; \ + \ + /* Process real and imaginary parts separately as individual complex numbers, \ + * then combine them together. While a little hacky, this avoids needing to \ + * know the base destination datatype and reduces some of the macro explosion. \ + */ \ + if (sr_over) \ + tmp_real = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \ + else if (sr_under) \ + tmp_real = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \ + else \ + tmp_real = (DT)(S_REAL); \ + if (si_over) \ + tmp_imag = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \ + else if (si_under) \ + tmp_imag = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \ + else \ + tmp_imag = (DT)(S_IMAG); \ + \ + memcpy(tmp_buf_ptr, &tmp_real, sizeof(DT) / 2); \ + tmp_buf_ptr += sizeof(DT) / 2; \ + memcpy(tmp_buf_ptr, &tmp_imag, sizeof(DT) / 2); \ + } \ + } +#define H5T_CONV_Zz_FLOAT_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + H5T_CONV_##STYPE##_REALVAL(S); \ + H5T_CONV_##STYPE##_IMAGVAL(S); \ + H5T_CONV_Zz_NOEX_CORE_IMP(STYPE, DTYPE, S, sr_val, si_val, D, float, DT, D_MIN, D_MAX) \ + } +#define H5T_CONV_Zz_DOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + H5T_CONV_##STYPE##_REALVAL(S); \ + H5T_CONV_##STYPE##_IMAGVAL(S); \ + H5T_CONV_Zz_NOEX_CORE_IMP(STYPE, DTYPE, S, sr_val, si_val, D, double, DT, D_MIN, D_MAX) \ + } +#define H5T_CONV_Zz_LDOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + H5T_CONV_##STYPE##_REALVAL(S); \ + H5T_CONV_##STYPE##_IMAGVAL(S); \ + H5T_CONV_Zz_NOEX_CORE_IMP(STYPE, DTYPE, S, sr_val, si_val, D, long double, DT, D_MIN, D_MAX) \ + } + +#define H5T_CONV_Zz(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + do { \ + HDcompile_assert(sizeof(ST) >= sizeof(DT)); \ + H5T_CONV(H5T_CONV_Zz_##STYPE, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \ + } while (0) #define H5T_CONV_zF(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ do { \ @@ -885,14 +948,130 @@ typedef struct H5T_conv_hw_t { H5T_CONV(H5T_CONV_xX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \ } while (0) -/* TODO */ -#define H5T_CONV_Zf(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) +#define H5T_CONV_Zf_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX, S_VAL) \ + { \ + if ((S_VAL) > (ST)(D_MAX)) { \ + H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \ + H5T_CONV_EXCEPT_RANGE_HI, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \ + conv_ctx->u.conv.cb_struct.user_data); \ + if (except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \ + else if (except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ + } \ + else if ((S_VAL) < (ST)(D_MIN)) { \ + H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \ + H5T_CONV_EXCEPT_RANGE_LOW, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \ + conv_ctx->u.conv.cb_struct.user_data); \ + if (except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \ + else if (except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ + } \ + else \ + *(D) = (DT)((S_VAL)); \ + } +#define H5T_CONV_Zf_FLOAT_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + H5T_CONV_##STYPE##_REALVAL(S); \ + /* Pass sr_val as an extra parameter so "S" can be preserved for exception handling */ \ + H5T_CONV_Zf_CORE_IMP(STYPE, DTYPE, S, D, float, DT, D_MIN, D_MAX, sr_val) \ + } +#define H5T_CONV_Zf_DOUBLE_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + H5T_CONV_##STYPE##_REALVAL(S); \ + /* Pass sr_val as an extra parameter so "S" can be preserved for exception handling */ \ + H5T_CONV_Zf_CORE_IMP(STYPE, DTYPE, S, D, double, DT, D_MIN, D_MAX, sr_val) \ + } +#define H5T_CONV_Zf_LDOUBLE_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + H5T_CONV_##STYPE##_REALVAL(S); \ + /* Pass sr_val as an extra parameter so "S" can be preserved for exception handling */ \ + H5T_CONV_Zf_CORE_IMP(STYPE, DTYPE, S, D, long double, DT, D_MIN, D_MAX, sr_val) \ + } +#define H5T_CONV_Zf_NOEX_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + if ((S) > (ST)(D_MAX)) \ + *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \ + else if ((S) < (ST)(D_MIN)) \ + *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \ + else \ + *(D) = (DT)((S)); \ + } +#define H5T_CONV_Zf_FLOAT_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + H5T_CONV_##STYPE##_REALVAL(S); \ + H5T_CONV_Zf_NOEX_CORE_IMP(STYPE, DTYPE, sr_val, D, float, DT, D_MIN, D_MAX) \ + } +#define H5T_CONV_Zf_DOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + H5T_CONV_##STYPE##_REALVAL(S); \ + H5T_CONV_Zf_NOEX_CORE_IMP(STYPE, DTYPE, sr_val, D, double, DT, D_MIN, D_MAX) \ + } +#define H5T_CONV_Zf_LDOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + H5T_CONV_##STYPE##_REALVAL(S); \ + H5T_CONV_Zf_NOEX_CORE_IMP(STYPE, DTYPE, sr_val, D, long double, DT, D_MIN, D_MAX) \ + } -/* TODO */ -#define H5T_CONV_fZ(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) +#define H5T_CONV_Zf(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + do { \ + HDcompile_assert(sizeof(ST) >= sizeof(DT)); \ + H5T_CONV(H5T_CONV_Zf_##STYPE, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \ + } while (0) -/* TODO */ -#define H5T_CONV_Fz(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) +#define H5T_CONV_fZ(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + do { \ + HDcompile_assert(sizeof(ST) <= sizeof(DT)); \ + H5T_CONV(H5T_CONV_xX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \ + } while (0) + +#define H5T_CONV_Fz_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + if (*(S) > (ST)(D_MAX)) { \ + H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \ + H5T_CONV_EXCEPT_RANGE_HI, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \ + conv_ctx->u.conv.cb_struct.user_data); \ + if (except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \ + else if (except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ + } \ + else if (*(S) < (ST)(D_MIN)) { \ + H5T_conv_ret_t except_ret = (conv_ctx->u.conv.cb_struct.func)( \ + H5T_CONV_EXCEPT_RANGE_LOW, conv_ctx->u.conv.src_type_id, conv_ctx->u.conv.dst_type_id, S, D, \ + conv_ctx->u.conv.cb_struct.user_data); \ + if (except_ret == H5T_CONV_UNHANDLED) \ + /* Let compiler convert if case is ignored by user handler*/ \ + *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \ + else if (except_ret == H5T_CONV_ABORT) \ + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception"); \ + /* if(except_ret==H5T_CONV_HANDLED): Fall through, user handled it */ \ + } \ + else \ + *(D) = (DT)(*(S)); \ + } +#define H5T_CONV_Fz_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ + { \ + if (*(S) > (ST)(D_MAX)) \ + *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _POS_INF_g); \ + else if (*(S) < (ST)(D_MIN)) \ + *(D) = H5_GLUE3(H5T_NATIVE_, DTYPE, _NEG_INF_g); \ + else \ + *(D) = (DT)(*(S)); \ + } + +#define H5T_CONV_Fz(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + do { \ + HDcompile_assert(sizeof(ST) >= sizeof(DT)); \ + H5T_CONV(H5T_CONV_Fz, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \ + } while (0) #define H5T_CONV_zf(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ do { \ @@ -900,8 +1079,11 @@ typedef struct H5T_conv_hw_t { H5T_CONV(H5T_CONV_xX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \ } while (0) -/* TODO */ -#define H5T_CONV_fz(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) +#define H5T_CONV_fz(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ + do { \ + HDcompile_assert((2 * sizeof(ST)) == sizeof(DT)); \ + H5T_CONV(H5T_CONV_xX, STYPE, DTYPE, ST, DT, D_MIN, D_MAX, N) \ + } while (0) #define H5T_CONV_xZ_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ { \ @@ -979,21 +1161,21 @@ typedef struct H5T_conv_hw_t { } #define H5T_CONV_Zx_FLOAT_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ { \ - H5T_CONV_##STYPE##_REALVAL( \ - S) /* Pass s_val as an extra parameter so "S" can be preserved for exception handling */ \ - H5T_CONV_Zx_CORE_IMP(STYPE, DTYPE, S, D, float, DT, D_MIN, D_MAX, s_val) \ + H5T_CONV_##STYPE##_REALVAL(S); \ + /* Pass sr_val as an extra parameter so "S" can be preserved for exception handling */ \ + H5T_CONV_Zx_CORE_IMP(STYPE, DTYPE, S, D, float, DT, D_MIN, D_MAX, sr_val) \ } #define H5T_CONV_Zx_DOUBLE_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ { \ - H5T_CONV_##STYPE##_REALVAL( \ - S) /* Pass s_val as an extra parameter so "S" can be preserved for exception handling */ \ - H5T_CONV_Zx_CORE_IMP(STYPE, DTYPE, S, D, double, DT, D_MIN, D_MAX, s_val) \ + H5T_CONV_##STYPE##_REALVAL(S); \ + /* Pass sr_val as an extra parameter so "S" can be preserved for exception handling */ \ + H5T_CONV_Zx_CORE_IMP(STYPE, DTYPE, S, D, double, DT, D_MIN, D_MAX, sr_val) \ } #define H5T_CONV_Zx_LDOUBLE_COMPLEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ { \ - H5T_CONV_##STYPE##_REALVAL( \ - S) /* Pass s_val as an extra parameter so "S" can be preserved for exception handling */ \ - H5T_CONV_Zx_CORE_IMP(STYPE, DTYPE, S, D, long double, DT, D_MIN, D_MAX, s_val) \ + H5T_CONV_##STYPE##_REALVAL(S); \ + /* Pass sr_val as an extra parameter so "S" can be preserved for exception handling */ \ + H5T_CONV_Zx_CORE_IMP(STYPE, DTYPE, S, D, long double, DT, D_MIN, D_MAX, sr_val) \ } #define H5T_CONV_Zx_NOEX_CORE_IMP(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ { \ @@ -1006,18 +1188,18 @@ typedef struct H5T_conv_hw_t { } #define H5T_CONV_Zx_FLOAT_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ { \ - H5T_CONV_##STYPE##_REALVAL(S) \ - H5T_CONV_Zx_NOEX_CORE_IMP(STYPE, DTYPE, s_val, D, float, DT, D_MIN, D_MAX) \ + H5T_CONV_##STYPE##_REALVAL(S); \ + H5T_CONV_Zx_NOEX_CORE_IMP(STYPE, DTYPE, sr_val, D, float, DT, D_MIN, D_MAX) \ } #define H5T_CONV_Zx_DOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ { \ - H5T_CONV_##STYPE##_REALVAL(S) \ - H5T_CONV_Zx_NOEX_CORE_IMP(STYPE, DTYPE, s_val, D, double, DT, D_MIN, D_MAX) \ + H5T_CONV_##STYPE##_REALVAL(S); \ + H5T_CONV_Zx_NOEX_CORE_IMP(STYPE, DTYPE, sr_val, D, double, DT, D_MIN, D_MAX) \ } #define H5T_CONV_Zx_LDOUBLE_COMPLEX_NOEX_CORE(STYPE, DTYPE, S, D, ST, DT, D_MIN, D_MAX) \ { \ - H5T_CONV_##STYPE##_REALVAL(S) \ - H5T_CONV_Zx_NOEX_CORE_IMP(STYPE, DTYPE, s_val, D, long double, DT, D_MIN, D_MAX) \ + H5T_CONV_##STYPE##_REALVAL(S); \ + H5T_CONV_Zx_NOEX_CORE_IMP(STYPE, DTYPE, sr_val, D, long double, DT, D_MIN, D_MAX) \ } #define H5T_CONV_Zx(STYPE, DTYPE, ST, DT, D_MIN, D_MAX) \ diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 08c51106a43..b085052a04a 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -444,8 +444,16 @@ H5_DLLVAR float H5T_NATIVE_FLOAT_POS_INF_g; H5_DLLVAR float H5T_NATIVE_FLOAT_NEG_INF_g; H5_DLLVAR double H5T_NATIVE_DOUBLE_POS_INF_g; H5_DLLVAR double H5T_NATIVE_DOUBLE_NEG_INF_g; -H5_DLLVAR double H5T_NATIVE_LDOUBLE_POS_INF_g; -H5_DLLVAR double H5T_NATIVE_LDOUBLE_NEG_INF_g; +H5_DLLVAR long double H5T_NATIVE_LDOUBLE_POS_INF_g; +H5_DLLVAR long double H5T_NATIVE_LDOUBLE_NEG_INF_g; +#ifdef H5_HAVE_COMPLEX_NUMBERS +H5_DLLVAR float _Complex H5T_NATIVE_FLOAT_COMPLEX_POS_INF_g; +H5_DLLVAR float _Complex H5T_NATIVE_FLOAT_COMPLEX_NEG_INF_g; +H5_DLLVAR double _Complex H5T_NATIVE_DOUBLE_COMPLEX_POS_INF_g; +H5_DLLVAR double _Complex H5T_NATIVE_DOUBLE_COMPLEX_NEG_INF_g; +H5_DLLVAR long double _Complex H5T_NATIVE_LDOUBLE_COMPLEX_POS_INF_g; +H5_DLLVAR long double _Complex H5T_NATIVE_LDOUBLE_COMPLEX_NEG_INF_g; +#endif /* Declare extern the free lists for H5T_t's and H5T_shared_t's */ H5FL_EXTERN(H5T_t);