re PR libfortran/26540 ([4.1 only] intrinsics/signal.c warnings)

PR libfortran/26540
	* intrinsics/signal.c (signal_sub, signal_sub_int): Use intptr_t
	if available to cast function pointers to int and back.
	* configure.ac: Check for intptr_t.
	* config.h.in: Regenerate.
	* configure: Regenerate.

From-SVN: r117556
This commit is contained in:
Francois-Xavier Coudert 2006-10-08 16:27:22 +02:00 committed by François-Xavier Coudert
parent bec93d7937
commit 28f8c9e97b
5 changed files with 165 additions and 12 deletions

View File

@ -1,3 +1,12 @@
2006-10-08 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/26540
* intrinsics/signal.c (signal_sub, signal_sub_int): Use intptr_t
if available to cast function pointers to int and back.
* configure.ac: Check for intptr_t.
* config.h.in: Regenerate.
* configure: Regenerate.
2006-10-01 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR fortran/16580

View File

@ -390,6 +390,9 @@
/* Define to 1 if you have the <ieeefp.h> header file. */
#undef HAVE_IEEEFP_H
/* Define to 1 if the system has the type `intptr_t'. */
#undef HAVE_INTPTR_T
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

136
libgfortran/configure vendored
View File

@ -6898,8 +6898,9 @@ fi
break
done
if test "$acx_cv_header_stdint" = stddef.h; then
acx_cv_header_stdint_kind="(lacks uintptr_t)"
acx_cv_header_stdint_kind="(lacks uintmax_t)"
for i in stdint.h $inttype_headers; do
unset ac_cv_type_uintptr_t
unset ac_cv_type_uint32_t
unset ac_cv_type_uint64_t
echo $ECHO_N "looking for an incomplete stdint.h in $i, $ECHO_C" >&6
@ -7025,11 +7026,65 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5
echo "${ECHO_T}$ac_cv_type_uint64_t" >&6
if test $ac_cv_type_uint64_t = yes; then
:
echo "$as_me:$LINENO: checking for uintptr_t" >&5
echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6
if test "${ac_cv_type_uintptr_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
acx_cv_header_stdint_kind="(lacks uintptr_t and uint64_t)"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#include <$i>
int
main ()
{
if ((uintptr_t *) 0)
return 0;
if (sizeof (uintptr_t))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type_uintptr_t=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_uintptr_t=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6
break
done
@ -7162,11 +7217,6 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_u_int64_t" >&5
echo "${ECHO_T}$ac_cv_type_u_int64_t" >&6
if test $ac_cv_type_u_int64_t = yes; then
:
else
acx_cv_header_stdint_kind="(u_intXX_t style, lacks u_int64_t)"
fi
break
done
@ -10037,6 +10087,7 @@ fi
done
for ac_func in wait setmode
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
@ -10144,6 +10195,73 @@ fi
done
# Check for types
echo "$as_me:$LINENO: checking for intptr_t" >&5
echo $ECHO_N "checking for intptr_t... $ECHO_C" >&6
if test "${ac_cv_type_intptr_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
if ((intptr_t *) 0)
return 0;
if (sizeof (intptr_t))
return 0;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
ac_cv_type_intptr_t=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_type_intptr_t=no
fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_intptr_t" >&5
echo "${ECHO_T}$ac_cv_type_intptr_t" >&6
if test $ac_cv_type_intptr_t = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_INTPTR_T 1
_ACEOF
fi
# Check libc for getgid, getpid, getuid
echo "$as_me:$LINENO: checking for getgid in -lc" >&5
echo $ECHO_N "checking for getgid in -lc... $ECHO_C" >&6

View File

@ -174,6 +174,9 @@ 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(wait setmode)
# Check for types
AC_CHECK_TYPES([intptr_t])
# Check libc for getgid, getpid, getuid
AC_CHECK_LIB([c],[getgid],[AC_DEFINE([HAVE_GETGID],[1],[libc includes getgid])])
AC_CHECK_LIB([c],[getpid],[AC_DEFINE([HAVE_GETPID],[1],[libc includes getpid])])

View File

@ -38,8 +38,18 @@ Boston, MA 02110-1301, USA. */
#include <signal.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <errno.h>
#ifdef HAVE_INTPTR_T
# define INTPTR_T intptr_t
#else
# define INTPTR_T int
#endif
/* SIGNAL subroutine with PROCEDURE as handler */
extern void signal_sub (int *, void (*)(int), int *);
iexport_proto(signal_sub);
@ -48,8 +58,13 @@ void
signal_sub (int *number, void (*handler)(int), int *status)
{
#ifdef HAVE_SIGNAL
INTPTR_T ret;
if (status != NULL)
*status = (int) signal (*number, handler);
{
ret = (INTPTR_T) signal (*number, handler);
*status = (int) ret;
}
else
signal (*number, handler);
#else
@ -69,10 +84,15 @@ void
signal_sub_int (int *number, int *handler, int *status)
{
#ifdef HAVE_SIGNAL
INTPTR_T ptr = *handler, ret;
if (status != NULL)
*status = (int) signal (*number, (void (*)(int)) *handler);
{
ret = (INTPTR_T) signal (*number, (void (*)(int)) ptr);
*status = (int) ret;
}
else
signal (*number, (void (*)(int)) *handler);
signal (*number, (void (*)(int)) ptr);
#else
errno = ENOSYS;
if (status != NULL)