develooper Front page | perl.perl5.porters | Postings from July 2005

[PATCH] Squish warnings in POSIX.xs

Thread Next
From:
Steve Peters
Date:
July 27, 2005 09:01
Subject:
[PATCH] Squish warnings in POSIX.xs
Message ID:
20050727160100.GA27892@mccoy.peters.homeunix.org
POSIX.xs has recently been giving the following warnings:

POSIX.xs: In function `XS_POSIX_sigaction':
POSIX.xs:1348: warning: comparison of distinct pointer types lacks a cast
POSIX.xs:1357: warning: assignment from incompatible pointer type

The problem comes with assigning Perl's Sigaction_t to sigaction.sa_handler.  It
seems to like C<void *>, so that's what we can give it.  It's paassing its
tests from what I can see, but we'll see how the smokes do on platforms other 
than Linux and OpenBSD.

Steve Peters
steve@fisharerojo.org

--- ext/POSIX/POSIX.xs.old      Tue Jul 19 16:46:37 2005
+++ ext/POSIX/POSIX.xs  Wed Jul 27 10:50:17 2005
@@ -1347,7 +1347,7 @@

                /* Get back whether the old handler used safe signals. */
                svp = hv_fetch(oldaction, "SAFE", 4, TRUE);
-               sv_setiv(*svp, oact.sa_handler == PL_csighandlerp);
+               sv_setiv(*svp, oact.sa_handler == (void*)PL_csighandlerp);
            }

            if (action) {
@@ -1356,7 +1356,8 @@
                   (BTW, "csighandler" is very different from "sighandler".) */
                svp = hv_fetch(action, "SAFE", 4, FALSE);
                act.sa_handler = (*svp && SvTRUE(*svp))
-                                ? PL_csighandlerp : PL_sighandlerp;
+                                ? (void*)PL_csighandlerp :
+                                   (void*)PL_sighandlerp;

                /* Vector new Perl handler through %SIG.
                   (The core signal handlers read %SIG to dispatch.) */


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About