Skip to content

Commit

Permalink
Removed code trying to avoid intrinsic warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
hfp committed Dec 4, 2024
2 parents f83483c + 49696be commit de4e87d
Showing 1 changed file with 21 additions and 30 deletions.
51 changes: 21 additions & 30 deletions src/base/machine.F
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ SUBROUTINE m_cpuinfo(model_name)
INTEGER, PARAMETER :: bufferlen = 2048

CHARACTER(LEN=bufferlen) :: buffer
INTEGER :: cpuid, i, icol, iline, stat
INTEGER :: i, icol, iline, stat

model_name = "UNKNOWN"
buffer = ""
Expand Down Expand Up @@ -384,12 +384,11 @@ END SUBROUTINE m_datum
!> \brief Can be used to get a nice core
! **************************************************************************************************
SUBROUTINE m_abort()
#if !defined(__GFORTRAN__) && !defined(__INTEL_COMPILER) && !defined(__INTEL_LLVM_COMPILER)
INTERFACE
SUBROUTINE abort() BIND(C, name="abort")
END SUBROUTINE
END INTERFACE
#endif

CALL abort()
END SUBROUTINE m_abort

Expand All @@ -406,20 +405,20 @@ FUNCTION m_procrun(pid) RESULT(run_on)
run_on = 0
#else
INTEGER :: istat
#if !defined(__GFORTRAN__)

INTERFACE
FUNCTION kill(pid, sig) BIND(C, name="kill") RESULT(errno)
IMPORT
INTEGER(KIND=C_INT), VALUE :: pid, sig
INTEGER(KIND=C_INT) :: errno
END FUNCTION
END INTERFACE
#endif

! If sig is 0, then no signal is sent, but error checking is still
! performed; this can be used to check for the existence of a process
! ID or process group ID.

istat = kill(pid, 0)
istat = kill(pid=pid, sig=0)
IF (istat == 0) THEN
run_on = 1 ! no error, process exists
ELSE
Expand Down Expand Up @@ -606,35 +605,27 @@ END SUBROUTINE m_hostnm
!> \param curdir ...
! **************************************************************************************************
SUBROUTINE m_getcwd(curdir)
CHARACTER(len=*), INTENT(OUT) :: curdir
CHARACTER(len=*), INTENT(OUT) :: curdir
TYPE(C_PTR) :: stat
INTEGER :: i
CHARACTER(len=default_path_length), TARGET :: tmp
#if !defined(__GFORTRAN__)
TYPE(C_PTR) :: stat
INTEGER :: i
INTERFACE
FUNCTION getcwd(buf, buflen) BIND(C, name="getcwd") RESULT(stat)
IMPORT
CHARACTER(KIND=C_CHAR), DIMENSION(*) :: buf
INTEGER(KIND=C_INT), VALUE :: buflen
TYPE(C_PTR) :: stat
CHARACTER(KIND=C_CHAR), DIMENSION(*) :: buf
INTEGER(KIND=C_INT), VALUE :: buflen
TYPE(C_PTR) :: stat
END FUNCTION
END INTERFACE
stat = getcwd(tmp, LEN(tmp))
IF (.NOT. C_ASSOCIATED(stat)) THEN
WRITE (*, *) "m_getcwd failed"
CALL m_abort()
END IF
i = INDEX(tmp, c_null_char) - 1
curdir = tmp(1:i)
#else
INTEGER :: stat
stat = getcwd(tmp)
IF (stat /= 0) THEN
WRITE (*, *) "m_getcwd failed"
CALL m_abort()
END IF
curdir = tmp
#endif
END SUBROUTINE m_getcwd
! **************************************************************************************************
Expand All @@ -645,15 +636,15 @@ END SUBROUTINE m_getcwd
SUBROUTINE m_chdir(dir, ierror)
CHARACTER(len=*), INTENT(IN) :: dir
INTEGER, INTENT(OUT) :: ierror
#if !defined(__GFORTRAN__)
INTERFACE
FUNCTION chdir(path) BIND(C, name="chdir") RESULT(errno)
IMPORT
CHARACTER(KIND=C_CHAR), DIMENSION(*) :: path
INTEGER(KIND=C_INT) :: errno
END FUNCTION
END INTERFACE
#endif
ierror = chdir(TRIM(dir)//c_null_char)
END SUBROUTINE m_chdir
Expand All @@ -663,14 +654,14 @@ END SUBROUTINE m_chdir
! **************************************************************************************************
SUBROUTINE m_getpid(pid)
INTEGER, INTENT(OUT) :: pid
#if !defined(__GFORTRAN__)
INTERFACE
FUNCTION getpid() BIND(C, name="getpid") RESULT(pid)
IMPORT
INTEGER(KIND=C_INT) :: pid
END FUNCTION
END INTERFACE
#endif
pid = getpid()
END SUBROUTINE m_getpid
Expand All @@ -684,15 +675,15 @@ FUNCTION m_unlink(path) RESULT(istat)
CHARACTER(LEN=*), INTENT(IN) :: path
INTEGER :: istat
#if !defined(__GFORTRAN__)
INTERFACE
FUNCTION unlink(path) BIND(C, name="unlink") RESULT(errno)
IMPORT
CHARACTER(KIND=C_CHAR), DIMENSION(*) :: path
INTEGER(KIND=C_INT) :: errno
END FUNCTION
END INTERFACE
#endif
istat = unlink(TRIM(path)//c_null_char)
END FUNCTION m_unlink
Expand All @@ -706,15 +697,15 @@ SUBROUTINE m_mov(source, TARGET)
CHARACTER(LEN=*), INTENT(IN) :: source, TARGET
INTEGER :: istat
#if !defined(__GFORTRAN__)
INTERFACE
FUNCTION rename(src, dest) BIND(C, name="rename") RESULT(errno)
IMPORT
CHARACTER(KIND=C_CHAR), DIMENSION(*) :: src, dest
INTEGER(KIND=C_INT) :: errno
END FUNCTION
END INTERFACE
#endif
IF (TARGET == source) THEN
WRITE (*, *) "Warning: m_mov ", TRIM(TARGET), " equals ", TRIM(source)
RETURN
Expand Down

0 comments on commit de4e87d

Please sign in to comment.