mirror of git://gcc.gnu.org/git/gcc.git
re PR libfortran/31335 (Calls lstat(), stat() and fstat() in libgfortran should be protected by autoconf HAVE_{L,,F}STAT macros)
PR libfortran/31335 * intrinsics/stat.c: Only provide STAT and FSTAT library routines if stat() and fstat() library functions are available. When lstat() is not available, use stat() instead. * configure.ac: Add checks for stat, fstat and lstat. * configure: Regenerate. * config.h.in: Regenerate. From-SVN: r123388
This commit is contained in:
parent
3f5faa7cea
commit
29e86cb09c
|
@ -1,3 +1,13 @@
|
||||||
|
2007-03-31 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
|
||||||
|
|
||||||
|
PR libfortran/31335
|
||||||
|
* intrinsics/stat.c: Only provide STAT and FSTAT library routines
|
||||||
|
if stat() and fstat() library functions are available. When lstat()
|
||||||
|
is not available, use stat() instead.
|
||||||
|
* configure.ac: Add checks for stat, fstat and lstat.
|
||||||
|
* configure: Regenerate.
|
||||||
|
* config.h.in: Regenerate.
|
||||||
|
|
||||||
2007-03-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
2007-03-27 Jerry DeLisle <jvdelisle@gcc.gnu.org>
|
||||||
|
|
||||||
PR libgfortran/31052
|
PR libgfortran/31052
|
||||||
|
|
|
@ -378,6 +378,9 @@
|
||||||
/* libm includes frexpl */
|
/* libm includes frexpl */
|
||||||
#undef HAVE_FREXPL
|
#undef HAVE_FREXPL
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `fstat' function. */
|
||||||
|
#undef HAVE_FSTAT
|
||||||
|
|
||||||
/* Define to 1 if you have the `ftruncate' function. */
|
/* Define to 1 if you have the `ftruncate' function. */
|
||||||
#undef HAVE_FTRUNCATE
|
#undef HAVE_FTRUNCATE
|
||||||
|
|
||||||
|
@ -489,6 +492,9 @@
|
||||||
/* libm includes logl */
|
/* libm includes logl */
|
||||||
#undef HAVE_LOGL
|
#undef HAVE_LOGL
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `lstat' function. */
|
||||||
|
#undef HAVE_LSTAT
|
||||||
|
|
||||||
/* Define to 1 if you have the <math.h> header file. */
|
/* Define to 1 if you have the <math.h> header file. */
|
||||||
#undef HAVE_MATH_H
|
#undef HAVE_MATH_H
|
||||||
|
|
||||||
|
@ -582,6 +588,9 @@
|
||||||
/* libm includes sqrtl */
|
/* libm includes sqrtl */
|
||||||
#undef HAVE_SQRTL
|
#undef HAVE_SQRTL
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `stat' function. */
|
||||||
|
#undef HAVE_STAT
|
||||||
|
|
||||||
/* Define to 1 if you have the <stddef.h> header file. */
|
/* Define to 1 if you have the <stddef.h> header file. */
|
||||||
#undef HAVE_STDDEF_H
|
#undef HAVE_STDDEF_H
|
||||||
|
|
||||||
|
|
|
@ -10511,7 +10511,10 @@ fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
for ac_func in gettimeofday
|
|
||||||
|
|
||||||
|
|
||||||
|
for ac_func in gettimeofday stat fstat lstat
|
||||||
do
|
do
|
||||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||||
|
|
|
@ -177,7 +177,7 @@ AC_CHECK_FUNCS(getrusage times mkstemp strtof strtold snprintf ftruncate chsize)
|
||||||
AC_CHECK_FUNCS(chdir strerror getlogin gethostname kill link symlink perror)
|
AC_CHECK_FUNCS(chdir strerror getlogin gethostname kill link symlink perror)
|
||||||
AC_CHECK_FUNCS(sleep time ttyname signal alarm ctime clock access fork execl)
|
AC_CHECK_FUNCS(sleep time ttyname signal alarm ctime clock access fork execl)
|
||||||
AC_CHECK_FUNCS(wait setmode execvp pipe dup2 close fdopen strcasestr getrlimit)
|
AC_CHECK_FUNCS(wait setmode execvp pipe dup2 close fdopen strcasestr getrlimit)
|
||||||
AC_CHECK_FUNCS(gettimeofday)
|
AC_CHECK_FUNCS(gettimeofday stat fstat lstat)
|
||||||
|
|
||||||
# Check for glibc backtrace functions
|
# Check for glibc backtrace functions
|
||||||
AC_CHECK_FUNCS(backtrace backtrace_symbols)
|
AC_CHECK_FUNCS(backtrace backtrace_symbols)
|
||||||
|
|
|
@ -49,6 +49,9 @@ Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_STAT
|
||||||
|
|
||||||
/* SUBROUTINE STAT(FILE, SARRAY, STATUS)
|
/* SUBROUTINE STAT(FILE, SARRAY, STATUS)
|
||||||
CHARACTER(len=*), INTENT(IN) :: FILE
|
CHARACTER(len=*), INTENT(IN) :: FILE
|
||||||
INTEGER, INTENT(OUT), :: SARRAY(13)
|
INTEGER, INTENT(OUT), :: SARRAY(13)
|
||||||
|
@ -88,9 +91,12 @@ stat_i4_sub_0 (char *name, gfc_array_i4 *sarray, GFC_INTEGER_4 *status,
|
||||||
memcpy (str, name, name_len);
|
memcpy (str, name, name_len);
|
||||||
str[name_len] = '\0';
|
str[name_len] = '\0';
|
||||||
|
|
||||||
|
/* On platforms that don't provide lstat(), we use stat() instead. */
|
||||||
|
#ifdef HAVE_LSTAT
|
||||||
if (is_lstat)
|
if (is_lstat)
|
||||||
val = lstat(str, &sb);
|
val = lstat(str, &sb);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
val = stat(str, &sb);
|
val = stat(str, &sb);
|
||||||
|
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
|
@ -204,9 +210,12 @@ stat_i8_sub_0 (char *name, gfc_array_i8 *sarray, GFC_INTEGER_8 *status,
|
||||||
memcpy (str, name, name_len);
|
memcpy (str, name, name_len);
|
||||||
str[name_len] = '\0';
|
str[name_len] = '\0';
|
||||||
|
|
||||||
|
/* On platforms that don't provide lstat(), we use stat() instead. */
|
||||||
|
#ifdef HAVE_LSTAT
|
||||||
if (is_lstat)
|
if (is_lstat)
|
||||||
val = lstat(str, &sb);
|
val = lstat(str, &sb);
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
val = stat(str, &sb);
|
val = stat(str, &sb);
|
||||||
|
|
||||||
if (val == 0)
|
if (val == 0)
|
||||||
|
@ -319,13 +328,13 @@ stat_i8 (char *name, gfc_array_i8 *sarray, gfc_charlen_type name_len)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* SUBROUTINE STAT(FILE, SARRAY, STATUS)
|
/* SUBROUTINE LSTAT(FILE, SARRAY, STATUS)
|
||||||
CHARACTER(len=*), INTENT(IN) :: FILE
|
CHARACTER(len=*), INTENT(IN) :: FILE
|
||||||
INTEGER, INTENT(OUT), :: SARRAY(13)
|
INTEGER, INTENT(OUT), :: SARRAY(13)
|
||||||
INTEGER, INTENT(OUT), OPTIONAL :: STATUS
|
INTEGER, INTENT(OUT), OPTIONAL :: STATUS
|
||||||
|
|
||||||
FUNCTION STAT(FILE, SARRAY)
|
FUNCTION LSTAT(FILE, SARRAY)
|
||||||
INTEGER STAT
|
INTEGER LSTAT
|
||||||
CHARACTER(len=*), INTENT(IN) :: FILE
|
CHARACTER(len=*), INTENT(IN) :: FILE
|
||||||
INTEGER, INTENT(OUT), :: SARRAY(13) */
|
INTEGER, INTENT(OUT), :: SARRAY(13) */
|
||||||
|
|
||||||
|
@ -351,8 +360,11 @@ lstat_i8 (char *name, gfc_array_i8 *sarray, gfc_charlen_type name_len)
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_FSTAT
|
||||||
|
|
||||||
/* SUBROUTINE FSTAT(UNIT, SARRAY, STATUS)
|
/* SUBROUTINE FSTAT(UNIT, SARRAY, STATUS)
|
||||||
INTEGER, INTENT(IN) :: UNIT
|
INTEGER, INTENT(IN) :: UNIT
|
||||||
INTEGER, INTENT(OUT) :: SARRAY(13)
|
INTEGER, INTENT(OUT) :: SARRAY(13)
|
||||||
|
@ -546,3 +558,5 @@ fstat_i8 (GFC_INTEGER_8 *unit, gfc_array_i8 *sarray)
|
||||||
fstat_i8_sub (unit, sarray, &val);
|
fstat_i8_sub (unit, sarray, &val);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue