]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libfortran/26540 ([4.1 only] intrinsics/signal.c warnings)
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>
Sun, 8 Oct 2006 14:27:22 +0000 (16:27 +0200)
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>
Sun, 8 Oct 2006 14:27:22 +0000 (14:27 +0000)
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

libgfortran/ChangeLog
libgfortran/config.h.in
libgfortran/configure
libgfortran/configure.ac
libgfortran/intrinsics/signal.c

index bb7b7baff4dcd7cd8d9b6de490caa273b1133247..effc06e48790dca278e4fb7e6b6fafc729a5f196 100644 (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
index 444cd2bbb0b2591fd8808f46f8c265c2d8918dbe..0be4cf94feff4e98e8b2babab4ac2856d5e2646f 100644 (file)
 /* 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
 
index 6544f66bed12292c0405dceed45f8610d08fb461..8265f5b3683476e1ed096e51ebff0aea6b2ed7e5 100755 (executable)
@@ -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`
 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
index 4784fa575099959d00ca8d8f44431ad7a4d3d9db..abdf37a65b138f59e78d2806c28ef3df19066ed3 100644 (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])])
index 9e403585027c1fc6812310f4a48d6868ce7c2c49..e912c90780eb7729297ad468f7f9df360b69aefa 100644 (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)