aboutsummaryrefslogtreecommitdiff
path: root/libgfortran/intrinsics/signal.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>2006-10-08 16:27:22 +0200
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2006-10-08 14:27:22 +0000
commit28f8c9e97bf154ca2ae2be7da91bb8ca109527b1 (patch)
treeffb84f961e1bffef9af13aa03299b35be358889b /libgfortran/intrinsics/signal.c
parentbec93d793735ff33a75a0e77ba96e78dd4b01262 (diff)
downloadgcc-28f8c9e97bf154ca2ae2be7da91bb8ca109527b1.zip
gcc-28f8c9e97bf154ca2ae2be7da91bb8ca109527b1.tar.gz
gcc-28f8c9e97bf154ca2ae2be7da91bb8ca109527b1.tar.bz2
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
Diffstat (limited to 'libgfortran/intrinsics/signal.c')
-rw-r--r--libgfortran/intrinsics/signal.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/libgfortran/intrinsics/signal.c b/libgfortran/intrinsics/signal.c
index 9e40358..e912c90 100644
--- a/libgfortran/intrinsics/signal.c
+++ b/libgfortran/intrinsics/signal.c
@@ -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)