summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2015-06-04 20:26:02 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2015-06-04 20:26:02 (GMT)
commit043173a689015960758c0276486eca9e7a223366 (patch)
treea46d5a93e1bad794cf8bac37f1e4b41a5e200b98 /fortran
parent4d500d49023156f1f8ef60375e63ac22e79e1749 (diff)
downloadhdf5-043173a689015960758c0276486eca9e7a223366.zip
hdf5-043173a689015960758c0276486eca9e7a223366.tar.gz
hdf5-043173a689015960758c0276486eca9e7a223366.tar.bz2
[svn-r27151] fixed __float128 errors
Diffstat (limited to 'fortran')
-rw-r--r--fortran/Makefile.in1
-rw-r--r--fortran/examples/Makefile.in1
-rw-r--r--fortran/src/CMakeLists.txt6
-rw-r--r--fortran/src/H5_ff.F902
-rw-r--r--fortran/src/H5config_f.inc.cmake2
-rw-r--r--fortran/src/H5config_f.inc.in4
-rw-r--r--fortran/src/H5fort_type_defines.h.in1
-rw-r--r--fortran/src/H5match_types.c34
-rw-r--r--fortran/src/Makefile.in1
-rw-r--r--fortran/test/Makefile.in1
-rw-r--r--fortran/testpar/Makefile.in1
11 files changed, 33 insertions, 21 deletions
diff --git a/fortran/Makefile.in b/fortran/Makefile.in
index 8359314..5fd05e7 100644
--- a/fortran/Makefile.in
+++ b/fortran/Makefile.in
@@ -520,6 +520,7 @@ PAC_FC_ALL_INTEGER_KINDS = @PAC_FC_ALL_INTEGER_KINDS@
PAC_FC_ALL_INTEGER_KINDS_SIZEOF = @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@
PAC_FC_ALL_REAL_KINDS = @PAC_FC_ALL_REAL_KINDS@
PAC_FC_ALL_REAL_KINDS_SIZEOF = @PAC_FC_ALL_REAL_KINDS_SIZEOF@
+PAC_FC_MAX_REAL_PRECISION = @PAC_FC_MAX_REAL_PRECISION@
PAC_FORTRAN_NATIVE_DOUBLE_KIND = @PAC_FORTRAN_NATIVE_DOUBLE_KIND@
PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF = @PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF@
PAC_FORTRAN_NATIVE_INTEGER_KIND = @PAC_FORTRAN_NATIVE_INTEGER_KIND@
diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in
index bc82f9f..5db1685 100644
--- a/fortran/examples/Makefile.in
+++ b/fortran/examples/Makefile.in
@@ -464,6 +464,7 @@ PAC_FC_ALL_INTEGER_KINDS = @PAC_FC_ALL_INTEGER_KINDS@
PAC_FC_ALL_INTEGER_KINDS_SIZEOF = @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@
PAC_FC_ALL_REAL_KINDS = @PAC_FC_ALL_REAL_KINDS@
PAC_FC_ALL_REAL_KINDS_SIZEOF = @PAC_FC_ALL_REAL_KINDS_SIZEOF@
+PAC_FC_MAX_REAL_PRECISION = @PAC_FC_MAX_REAL_PRECISION@
PAC_FORTRAN_NATIVE_DOUBLE_KIND = @PAC_FORTRAN_NATIVE_DOUBLE_KIND@
PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF = @PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF@
PAC_FORTRAN_NATIVE_INTEGER_KIND = @PAC_FORTRAN_NATIVE_INTEGER_KIND@
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 03db548..5317346 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -27,7 +27,13 @@ if (H5_HAVE_PARALLEL)
set (CMAKE_H5_HAVE_PARALLEL 1)
endif (H5_HAVE_PARALLEL)
+set (CMAKE_H5_HAVE_FLOAT128 0)
+if (HAVE_FLOAT128)
+ set (CMAKE_H5_HAVE_FLOAT128 1)
+endif(HAVE_FLOAT128)
+
configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5config_f.inc.cmake ${CMAKE_BINARY_DIR}/H5config_f.inc @ONLY)
+configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5fort_type_defines.h.in ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h @ONLY)
#-----------------------------------------------------------------------------
# Setup the Fortran auto-detection utilities
diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90
index f4090cc..aba9d1b 100644
--- a/fortran/src/H5_ff.F90
+++ b/fortran/src/H5_ff.F90
@@ -391,7 +391,7 @@ CONTAINS
h5_type = H5T_NATIVE_REAL_C_DOUBLE
ELSE IF(kind.EQ.Fortran_REAL_C_LONG_DOUBLE)THEN
h5_type = H5T_NATIVE_REAL_C_LONG_DOUBLE
-#if H5_HAVE_FLOAT128!=0
+#if H5_PAC_FC_MAX_REAL_PRECISION > 28
ELSE IF(kind.EQ.Fortran_REAL_C_FLOAT128)THEN
h5_type = H5T_NATIVE_FLOAT_128
#endif
diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake
index cb1d9e8..9fbc987 100644
--- a/fortran/src/H5config_f.inc.cmake
+++ b/fortran/src/H5config_f.inc.cmake
@@ -28,7 +28,7 @@
#undef H5_FORTRAN_HAVE_C_SIZEOF
#endif
-! Define if the intrinsic function FORTRAN_HAVE_C_LONG_DOUBLE exists
+! Define if the intrinsic C_LONG_DOUBLE exists
#define H5_FORTRAN_HAVE_C_LONG_DOUBLE @FORTRAN_HAVE_C_LONG_DOUBLE@
#if H5_FORTRAN_HAVE_C_LONG_DOUBLE==0
diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in
index b227c13..a28480c 100644
--- a/fortran/src/H5config_f.inc.in
+++ b/fortran/src/H5config_f.inc.in
@@ -24,8 +24,8 @@
! Define the size of C's long double
#undef SIZEOF_LONG_DOUBLE
-! Define if the C intrinsic __FLOAT128 exists
-#undef HAVE_FLOAT128
+! Define the maximum decimal precision for reals
+#undef PAC_FC_MAX_REAL_PRECISION
! Define if INTEGER*16 is available
#undef HAVE_Fortran_INTEGER_SIZEOF_16
diff --git a/fortran/src/H5fort_type_defines.h.in b/fortran/src/H5fort_type_defines.h.in
index 9e8015c..dc2fc94 100644
--- a/fortran/src/H5fort_type_defines.h.in
+++ b/fortran/src/H5fort_type_defines.h.in
@@ -11,6 +11,7 @@
#define H5_FORTRAN_INTEGER_KINDS_SIZEOF @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@
#define H5_FORTRAN_REAL_KINDS @PAC_FC_ALL_REAL_KINDS@
#define H5_FORTRAN_REAL_KINDS_SIZEOF @PAC_FC_ALL_REAL_KINDS_SIZEOF@
+#define H5_PAC_FC_MAX_REAL_PRECISION @PAC_FC_MAX_REAL_PRECISION@
#define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @HAVE_Fortran_INTEGER_SIZEOF_16@
#define C_LONG_DOUBLE_KIND 10
#define C_LONG_DOUBLE_SIZEOF 12
diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c
index 2067f60..5ac5c80 100644
--- a/fortran/src/H5match_types.c
+++ b/fortran/src/H5match_types.c
@@ -206,28 +206,28 @@ int main(void)
/* (b) Define c_float_x */
- /* make sure we find long double first before checking for __float128
- * ideally we need to match precision instead of matching sizeof */
-
- int found_longdb = 0;
+ int found_long_double = 0;
for(i=0;i< H5_FORTRAN_NUM_REAL_KINDS;i++) {
+
+ if (sizeof(float) == RealKinds_SizeOf[i]) {
+ writeTypedef("float", "float", RealKinds[i]);
+ strcpy(Real_C_TYPES[i], "C_FLOAT");
+ } else if(sizeof(double) == RealKinds_SizeOf[i]) {
+ writeTypedef("float", "double", RealKinds[i]);
+ strcpy(Real_C_TYPES[i], "C_DOUBLE");
+ } else if(sizeof(long double) == RealKinds_SizeOf[i] && found_long_double == 0) {
+ writeTypedef("float", "long double", RealKinds[i]);
+ strcpy(Real_C_TYPES[i], "C_LONG_DOUBLE");
+ found_long_double = 1;
+ }
#ifdef H5_HAVE_FLOAT128
- if(sizeof(__float128) == RealKinds_SizeOf[i] && found_longdb == 1) {
+ /* Don't select a higher precision than Fortran can support */
+ else if(sizeof(__float128) == RealKinds_SizeOf[i] && found_long_double == 1 && H5_PAC_FC_MAX_REAL_PRECISION > 28) {
writeTypedef("float", "__float128", RealKinds[i]);
strcpy(Real_C_TYPES[i], "C_FLOAT128");
- } else
+ }
#endif
- if(sizeof(long double) == RealKinds_SizeOf[i]) {
- found_longdb = 1;
- writeTypedef("float", "long double", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_LONG_DOUBLE");
- } else if(sizeof(double) == RealKinds_SizeOf[i]) {
- writeTypedef("float", "double", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_DOUBLE");
- } else if(sizeof(float) == RealKinds_SizeOf[i]) {
- writeTypedef("float", "float", RealKinds[i]);
- strcpy(Real_C_TYPES[i], "C_FLOAT");
- } else {
+ else {
printf(" **** HDF5 WARNING ****/n");
printf("Fortran REAL is %d bytes, but no corresponding C floating type exists\n",RealKinds_SizeOf[i]);
printf("Fortran Interfaces for Fortran REALs of %d bytes will not exist\n",RealKinds_SizeOf[i]);
diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in
index 8aea063..eaf0244 100644
--- a/fortran/src/Makefile.in
+++ b/fortran/src/Makefile.in
@@ -565,6 +565,7 @@ PAC_FC_ALL_INTEGER_KINDS = @PAC_FC_ALL_INTEGER_KINDS@
PAC_FC_ALL_INTEGER_KINDS_SIZEOF = @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@
PAC_FC_ALL_REAL_KINDS = @PAC_FC_ALL_REAL_KINDS@
PAC_FC_ALL_REAL_KINDS_SIZEOF = @PAC_FC_ALL_REAL_KINDS_SIZEOF@
+PAC_FC_MAX_REAL_PRECISION = @PAC_FC_MAX_REAL_PRECISION@
PAC_FORTRAN_NATIVE_DOUBLE_KIND = @PAC_FORTRAN_NATIVE_DOUBLE_KIND@
PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF = @PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF@
PAC_FORTRAN_NATIVE_INTEGER_KIND = @PAC_FORTRAN_NATIVE_INTEGER_KIND@
diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in
index a8a207e..eb132fb 100644
--- a/fortran/test/Makefile.in
+++ b/fortran/test/Makefile.in
@@ -576,6 +576,7 @@ PAC_FC_ALL_INTEGER_KINDS = @PAC_FC_ALL_INTEGER_KINDS@
PAC_FC_ALL_INTEGER_KINDS_SIZEOF = @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@
PAC_FC_ALL_REAL_KINDS = @PAC_FC_ALL_REAL_KINDS@
PAC_FC_ALL_REAL_KINDS_SIZEOF = @PAC_FC_ALL_REAL_KINDS_SIZEOF@
+PAC_FC_MAX_REAL_PRECISION = @PAC_FC_MAX_REAL_PRECISION@
PAC_FORTRAN_NATIVE_DOUBLE_KIND = @PAC_FORTRAN_NATIVE_DOUBLE_KIND@
PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF = @PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF@
PAC_FORTRAN_NATIVE_INTEGER_KIND = @PAC_FORTRAN_NATIVE_INTEGER_KIND@
diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in
index 000d2f0..3b924f2 100644
--- a/fortran/testpar/Makefile.in
+++ b/fortran/testpar/Makefile.in
@@ -516,6 +516,7 @@ PAC_FC_ALL_INTEGER_KINDS = @PAC_FC_ALL_INTEGER_KINDS@
PAC_FC_ALL_INTEGER_KINDS_SIZEOF = @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@
PAC_FC_ALL_REAL_KINDS = @PAC_FC_ALL_REAL_KINDS@
PAC_FC_ALL_REAL_KINDS_SIZEOF = @PAC_FC_ALL_REAL_KINDS_SIZEOF@
+PAC_FC_MAX_REAL_PRECISION = @PAC_FC_MAX_REAL_PRECISION@
PAC_FORTRAN_NATIVE_DOUBLE_KIND = @PAC_FORTRAN_NATIVE_DOUBLE_KIND@
PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF = @PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF@
PAC_FORTRAN_NATIVE_INTEGER_KIND = @PAC_FORTRAN_NATIVE_INTEGER_KIND@