From cb5aca4be26a8c349810208e96ebae7105b34301 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 13 Nov 2023 08:51:48 -0600 Subject: [PATCH 1/3] cmakedefine macro uses C comments with "#undef" --- fortran/src/CMakeLists.txt | 17 ++++++++++++++++- fortran/src/H5config_f.inc.cmake | 28 ++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index d054503f0d6..87557db82ab 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -37,10 +37,25 @@ if (H5_HAVE_PARALLEL) endif () set (CMAKE_H5_HAVE_FLOAT128 0) -if (HAVE_FLOAT128) +if (H5_HAVE_FLOAT128) set (CMAKE_H5_HAVE_FLOAT128 1) endif () +set (CMAKE_H5_FORTRAN_HAVE_STORAGE_SIZE 0) +if (H5_FORTRAN_HAVE_STORAGE_SIZE) + set (CMAKE_H5_FORTRAN_HAVE_STORAGE_SIZE 1) +endif () + +set (CMAKE_H5_FORTRAN_HAVE_SIZEOF 0) +if (H5_FORTRAN_HAVE_SIZEOF) + set (CMAKE_H5_FORTRAN_HAVE_SIZEOF 1) +endif () + +set (CMAKE_H5_FORTRAN_HAVE_C_SIZEOF 0) +if (H5_FORTRAN_HAVE_C_SIZEOF) + set (CMAKE_H5_FORTRAN_HAVE_C_SIZEOF 1) +endif () + configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5config_f.inc.cmake ${HDF5_F90_BINARY_DIR}/H5config_f.inc @ONLY) configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5fort_type_defines.h.cmake ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h @ONLY) diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index 0f274dbcbd4..0457855c566 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -36,13 +36,28 @@ #endif ! Define if the intrinsic function STORAGE_SIZE exists -#cmakedefine H5_FORTRAN_HAVE_STORAGE_SIZE @H5_FORTRAN_HAVE_STORAGE_SIZE@ +#cmakedefine CMAKE_H5_FORTRAN_HAVE_STORAGE_SIZE +#if CMAKE_H5_FORTRAN_HAVE_STORAGE_SIZE == 0 +#undef H5_FORTRAN_HAVE_STORAGE_SIZE +#else +#define H5_FORTRAN_HAVE_STORAGE_SIZE +#endif ! Define if the intrinsic function SIZEOF exists -#cmakedefine H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@ +#cmakedefine CMAKE_H5_FORTRAN_HAVE_SIZEOF +#if CMAKE_H5_FORTRAN_HAVE_SIZEOF == 0 +#undef H5_FORTRAN_HAVE_SIZEOF +#else +#define H5_FORTRAN_HAVE_SIZEOF +#endif ! Define if the intrinsic function C_SIZEOF exists -#cmakedefine H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@ +#cmakedefine CMAKE_H5_FORTRAN_HAVE_C_SIZEOF +#if CMAKE_H5_FORTRAN_HAVE_C_SIZEOF == 0 +#undef H5_FORTRAN_HAVE_C_SIZEOF +#else +#define H5_FORTRAN_HAVE_C_SIZEOF +#endif ! Define if the intrinsic function C_LONG_DOUBLE exists #define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ @@ -63,7 +78,12 @@ #define H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ ! If C has quad precision -#cmakedefine H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ +#cmakedefine01 CMAKE_H5_HAVE_FLOAT128 +#if CMAKE_H5_HAVE_FLOAT128 == 0 +#undef H5_HAVE_FLOAT128 +#else +#define H5_HAVE_FLOAT128 +#endif ! Define if INTEGER*16 is available #define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @H5_HAVE_Fortran_INTEGER_SIZEOF_16@ From 1decb3b3761022773ef7bb81831fe76130386b7e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 13 Nov 2023 10:18:07 -0600 Subject: [PATCH 2/3] Correct CMake macro name --- fortran/src/H5config_f.inc.cmake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index 0457855c566..665207641ee 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -36,7 +36,7 @@ #endif ! Define if the intrinsic function STORAGE_SIZE exists -#cmakedefine CMAKE_H5_FORTRAN_HAVE_STORAGE_SIZE +#cmakedefine01 CMAKE_H5_FORTRAN_HAVE_STORAGE_SIZE #if CMAKE_H5_FORTRAN_HAVE_STORAGE_SIZE == 0 #undef H5_FORTRAN_HAVE_STORAGE_SIZE #else @@ -44,7 +44,7 @@ #endif ! Define if the intrinsic function SIZEOF exists -#cmakedefine CMAKE_H5_FORTRAN_HAVE_SIZEOF +#cmakedefine01 CMAKE_H5_FORTRAN_HAVE_SIZEOF #if CMAKE_H5_FORTRAN_HAVE_SIZEOF == 0 #undef H5_FORTRAN_HAVE_SIZEOF #else @@ -52,7 +52,7 @@ #endif ! Define if the intrinsic function C_SIZEOF exists -#cmakedefine CMAKE_H5_FORTRAN_HAVE_C_SIZEOF +#cmakedefine01 CMAKE_H5_FORTRAN_HAVE_C_SIZEOF #if CMAKE_H5_FORTRAN_HAVE_C_SIZEOF == 0 #undef H5_FORTRAN_HAVE_C_SIZEOF #else From 7b5f3085659abc05a7d4770744dcda8708481138 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 13 Nov 2023 10:47:51 -0600 Subject: [PATCH 3/3] Use ifdef for H5_HAVE_FLOAT128 like elsewhere --- fortran/src/H5_ff.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 53156731946..05a48ace48c 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -996,7 +996,7 @@ INTEGER(HID_T) FUNCTION h5kind_to_type(ikind, flag) RESULT(h5_type) h5_type = H5T_NATIVE_REAL_C_LONG_DOUBLE #endif #if H5_PAC_FC_MAX_REAL_PRECISION > 28 -#if H5_HAVE_FLOAT128 == 1 +#ifdef H5_HAVE_FLOAT128 ELSE h5_type = H5T_NATIVE_FLOAT_128 #endif