Skip to content

Commit

Permalink
rid of c_sizeof
Browse files Browse the repository at this point in the history
  • Loading branch information
brtnfld committed Nov 13, 2023
1 parent b5bfea2 commit c7cbc87
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 62 deletions.
3 changes: 0 additions & 3 deletions config/cmake/H5pubconf.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@
/* Define if we have Fortran C_LONG_DOUBLE */
#define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@

/* Define if we have Fortran intrinsic C_SIZEOF */
#cmakedefine H5_FORTRAN_HAVE_C_SIZEOF @H5_FORTRAN_HAVE_C_SIZEOF@

/* Define if we have Fortran intrinsic SIZEOF */
#cmakedefine H5_FORTRAN_HAVE_SIZEOF @H5_FORTRAN_HAVE_SIZEOF@

Expand Down
2 changes: 1 addition & 1 deletion config/cmake/HDF5UseFortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ if (${HDF_PREFIX}_FORTRAN_HAVE_STORAGE_SIZE)
set (FC_SIZEOF_A "STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)")
set (FC_SIZEOF_B "STORAGE_SIZE(b, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)")
set (FC_SIZEOF_C "STORAGE_SIZE(c, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)")
elseif (${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF)
elseif (${HDF_PREFIX}_FORTRAN_HAVE_SIZEOF)
set (FC_SIZEOF_A "SIZEOF(a)")
set (FC_SIZEOF_B "SIZEOF(b)")
set (FC_SIZEOF_C "SIZEOF(c)")
Expand Down
11 changes: 0 additions & 11 deletions config/cmake/HDFUseFortran.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,6 @@ set (SIZEOF_CODE
END PROGRAM
"
)
set (C_SIZEOF_CODE
"
PROGRAM main
USE ISO_C_BINDING
INTEGER(C_INT) :: a
INTEGER(C_SIZE_T) :: result
result = c_sizeof(a)
END PROGRAM
"
)
set (STORAGE_SIZE_CODE
"
PROGRAM main
Expand Down Expand Up @@ -121,7 +111,6 @@ if (HDF5_REQUIRED_LIBRARIES)
set (CMAKE_REQUIRED_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}")
endif ()
check_fortran_source_compiles (${SIZEOF_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_SIZEOF SRC_EXT f90)
check_fortran_source_compiles (${C_SIZEOF_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_C_SIZEOF SRC_EXT f90)
check_fortran_source_compiles (${STORAGE_SIZE_CODE} ${HDF_PREFIX}_FORTRAN_HAVE_STORAGE_SIZE SRC_EXT f90)
check_fortran_source_compiles (${ISO_FORTRAN_ENV_CODE} ${HDF_PREFIX}_HAVE_ISO_FORTRAN_ENV SRC_EXT f90)
check_fortran_source_compiles (${REALISNOTDOUBLE_CODE} ${HDF_PREFIX}_FORTRAN_DEFAULT_REAL_NOT_DOUBLE SRC_EXT f90)
Expand Down
7 changes: 0 additions & 7 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,6 @@ if test "X$HDF_FORTRAN" = "Xyes"; then
## See if the fortran compiler supports the intrinsic function "SIZEOF"
PAC_PROG_FC_SIZEOF

## See if the fortran compiler supports the intrinsic function "C_SIZEOF"
PAC_PROG_FC_C_SIZEOF

## See if the fortran compiler supports the intrinsic function "STORAGE_SIZE"
PAC_PROG_FC_STORAGE_SIZE

Expand Down Expand Up @@ -725,10 +722,6 @@ if test "X$HDF_FORTRAN" = "Xyes"; then
AC_DEFINE([FORTRAN_HAVE_STORAGE_SIZE], [1], [Define if we have Fortran intrinsic STORAGE_SIZE])
fi

if test "X$HAVE_C_SIZEOF_FORTRAN" = "Xyes"; then
AC_DEFINE([FORTRAN_HAVE_C_SIZEOF], [1], [Define if we have Fortran intrinsic C_SIZEOF])
fi

if test "X$HAVE_SIZEOF_FORTRAN" = "Xyes"; then
AC_DEFINE([FORTRAN_HAVE_SIZEOF], [1], [Define if we have Fortran intrinsic SIZEOF])
fi
Expand Down
5 changes: 0 additions & 5 deletions fortran/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ 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)

Expand Down
8 changes: 0 additions & 8 deletions fortran/src/H5config_f.inc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,6 @@
#define H5_FORTRAN_HAVE_SIZEOF
#endif

! Define if the intrinsic function C_SIZEOF exists
#cmakedefine01 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@

Expand Down
4 changes: 0 additions & 4 deletions fortran/src/H5config_f.inc.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
! Define if the intrinsic function SIZEOF exists
#undef FORTRAN_HAVE_SIZEOF

! Define if the intrinsic function C_SIZEOF exists
#undef FORTRAN_HAVE_C_SIZEOF

! Define if the intrinsic function C_LONG_DOUBLE exists
#undef FORTRAN_HAVE_C_LONG_DOUBLE

Expand Down Expand Up @@ -79,4 +76,3 @@

! Define if deprecated public API symbols are disabled
#undef NO_DEPRECATED_SYMBOLS

6 changes: 2 additions & 4 deletions fortran/test/tf.F90
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ SUBROUTINE write_test_header(title_header)
WRITE(*,'("| |")')

WRITE(*,'(A)') TRIM(title_centered)

WRITE(*,'("| |")', ADVANCE="NO")
DO i = 1, width-5
WRITE(*,'(1X)', ADVANCE="NO")
Expand Down Expand Up @@ -382,9 +382,7 @@ END SUBROUTINE h5_env_nocleanup_f
! Thus, we can not overload the H5_SIZEOF function to handle arrays (as used in tH5P_F03.f90), or
! characters that do not have a set length (as used in tH5P_F03.f90), sigh...
!
! (2) F08+TS29113 requires C interoperable variable as argument for C_SIZEOF.
!
! (3) Unfortunately we need to wrap the C_SIZEOF/STORAGE_SIZE functions to handle different
! (2) Unfortunately we need to wrap the H5_SIZEOF functions to handle different
! data types from the various tests.
!
! ---------------------------------------------------------------------------------------------------
Expand Down
7 changes: 0 additions & 7 deletions m4/aclocal_fc.f90
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ PROGRAM PROG_FC_SIZEOF
i = sizeof(x)
END PROGRAM PROG_FC_SIZEOF

PROGRAM PROG_FC_C_SIZEOF
USE ISO_C_BINDING
INTEGER(C_INT) :: a
INTEGER(C_SIZE_T) :: RESULT
RESULT = C_SIZEOF(a)
END PROGRAM PROG_FC_C_SIZEOF

PROGRAM PROG_FC_STORAGE_SIZE
INTEGER :: a
INTEGER :: RESULT
Expand Down
12 changes: 0 additions & 12 deletions m4/aclocal_fc.m4
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,6 @@ AC_DEFUN([PAC_PROG_FC_SIZEOF],[
[AC_MSG_RESULT([no])])
])

dnl See if the fortran compiler supports the intrinsic function "C_SIZEOF"

AC_DEFUN([PAC_PROG_FC_C_SIZEOF],[
HAVE_C_SIZEOF_FORTRAN="no"
AC_MSG_CHECKING([if Fortran compiler supports intrinsic C_SIZEOF])
TEST_SRC="`sed -n '/PROGRAM PROG_FC_C_SIZEOF/,/END PROGRAM PROG_FC_C_SIZEOF/p' $srcdir/m4/aclocal_fc.f90`"
AC_LINK_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes])
HAVE_C_SIZEOF_FORTRAN="yes"],
[AC_MSG_RESULT([no])])
])

dnl See if the fortran compiler supports the intrinsic function "STORAGE_SIZE"

AC_DEFUN([PAC_PROG_FC_STORAGE_SIZE],[
Expand Down Expand Up @@ -439,4 +428,3 @@ AC_MSG_CHECKING([maximum decimal precision for C])
AC_MSG_ERROR([C program fails to build or run!])
],[])
])

0 comments on commit c7cbc87

Please sign in to comment.