summaryrefslogtreecommitdiffstats
path: root/fortran/src/H5match_types.c
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2012-09-27 19:13:13 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2012-09-27 19:13:13 (GMT)
commita81cc2ac7ef875999f01a91a9a492e19da94ce56 (patch)
treee55aba0e61a9b044c3782b7438fc3bf68f1ee2d5 /fortran/src/H5match_types.c
parent0710ab3955c9d5cf7e5ba4be3b48c6e8380553ae (diff)
downloadhdf5-a81cc2ac7ef875999f01a91a9a492e19da94ce56.zip
hdf5-a81cc2ac7ef875999f01a91a9a492e19da94ce56.tar.gz
hdf5-a81cc2ac7ef875999f01a91a9a492e19da94ce56.tar.bz2
[svn-r22824] FIX: HDFFV-8118: Support Fortran compiler flags that change the default size of integer and real
Tested: jam(gnu,intel), machine with gcc 4.7 and C long double = 16 bytes.
Diffstat (limited to 'fortran/src/H5match_types.c')
-rw-r--r--fortran/src/H5match_types.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c
index 61504ec..4c83d21 100644
--- a/fortran/src/H5match_types.c
+++ b/fortran/src/H5match_types.c
@@ -533,7 +533,21 @@ int main(void)
/* double_f */
#if defined H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND
- writeFloatToFiles("Fortran_DOUBLE", "double_f", 16, H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND);
+ if(H5_C_HAS_REAL_NATIVE_16 != 0) { /* Check if C has 16 byte floats */
+ writeFloatToFiles("Fortran_DOUBLE", "double_f", 16, H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND);
+ } else {
+#if defined H5_FORTRAN_HAS_REAL_NATIVE_8_KIND /* Fall back to 8 byte floats */
+ writeFloatToFiles("Fortran_DOUBLE", "double_f", 8, H5_FORTRAN_HAS_REAL_NATIVE_8_KIND);
+ }
+#elif defined H5_FORTRAN_HAS_REAL_NATIVE_4_KIND /* Fall back to 4 byte floats */
+ writeFloatToFiles("Fortran_DOUBLE", "double_f", 4, H5_FORTRAN_HAS_REAL_NATIVE_4_KIND);
+ }
+#else
+ /* Error: couldn't find a size for double_f when fortran has 16 byte reals */
+ return -1;
+ }
+#endif
+
#elif defined H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND
writeFloatToFiles("Fortran_DOUBLE", "double_f", 8, H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND);
#else
@@ -541,6 +555,14 @@ int main(void)
return -1;
#endif
+ /* Need the buffer size for the fortran derive type 'hdset_reg_ref_t_f03'
+ * in order to be interoperable with C's structure, the C buffer size
+ * H5R_DSET_REG_REF_BUF_SIZE is (sizeof(haddr_t)+4)
+ */
+
+ fprintf(fort_header, " INTEGER, PARAMETER :: H5R_DSET_REG_REF_BUF_SIZE_F = %u\n", H5_SIZEOF_HADDR_T + 4 );
+
+
/* Close files */
endCfile();
endFfile();