From: Robin Barker Date: Thu, 28 Jul 2005 13:57:31 +0000 (+0100) Subject: silence compiler warning in mg.c POSIX.xs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e91e3b10e63de8f75d881ff2701d550f199a5a25;p=p5sagit%2Fp5-mst-13.2.git silence compiler warning in mg.c POSIX.xs Message-ID: <533D273D4014D411AB1D00062938C4D90849C75B@hotel.npl.co.uk> p4raw-id: //depot/perl@25236 --- diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 26d5e20..79aa58d 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -1347,7 +1347,9 @@ sigaction(sig, optaction, oldaction = 0) /* 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, + /* compare incompatible pointers by casting to integer */ + PTR2nat(oact.sa_handler) == PTR2nat(PL_csighandlerp)); } if (action) { @@ -1355,8 +1357,12 @@ sigaction(sig, optaction, oldaction = 0) PL_sighandlerp pointer when it's safe to do so. (BTW, "csighandler" is very different from "sighandler".) */ svp = hv_fetch(action, "SAFE", 4, FALSE); - act.sa_handler = (*svp && SvTRUE(*svp)) - ? PL_csighandlerp : PL_sighandlerp; + act.sa_handler = + DPTR2FPTR( + void (*)(), + (*svp && SvTRUE(*svp)) + ? PL_csighandlerp : PL_sighandlerp + ); /* Vector new Perl handler through %SIG. (The core signal handlers read %SIG to dispatch.) */ diff --git a/mg.c b/mg.c index fe78c20..3c691ea 100644 --- a/mg.c +++ b/mg.c @@ -2069,7 +2069,7 @@ Perl_magic_killbackrefs(pTHX_ SV *sv, MAGIC *mg) } else { Perl_croak(aTHX_ "panic: magic_killbackrefs (flags=%"UVxf")", - SvFLAGS(referrer)); + (UV)SvFLAGS(referrer)); } *svp = Nullsv; diff --git a/perl.h b/perl.h index 63eba70..73979b6 100644 --- a/perl.h +++ b/perl.h @@ -1497,20 +1497,25 @@ typedef UVTYPE UV; #else # if PTRSIZE == LONGSIZE # define PTRV unsigned long +# define PTR2ul(p) (unsigned long)(p) # else # define PTRV unsigned # endif +#endif + +#ifndef INT2PTR # define INT2PTR(any,d) (any)(PTRV)(d) #endif + +#ifndef PTR2ul +# define PTR2ul(p) INT2PTR(unsigned long,p) +#endif + #define NUM2PTR(any,d) (any)(PTRV)(d) #define PTR2IV(p) INT2PTR(IV,p) #define PTR2UV(p) INT2PTR(UV,p) #define PTR2NV(p) NUM2PTR(NV,p) -#if PTRSIZE == LONGSIZE -# define PTR2ul(p) (unsigned long)(p) -#else -# define PTR2ul(p) INT2PTR(unsigned long,p) -#endif +#define PTR2nat(p) (PTRV)(p) /* pointer to integer of PTRSIZE */ /* According to strict ANSI C89 one cannot freely cast between * data pointers and function (code) pointers. There are at least @@ -1522,8 +1527,8 @@ typedef UVTYPE UV; * The only feasible use is probably temporarily storing * function pointers in a data pointer (such as a void pointer). */ -#define DPTR2FPTR(t,p) ((t)(PTRV)(p)) /* data pointer to function pointer */ -#define FPTR2DPTR(t,p) ((t)(PTRV)(p)) /* function pointer to data pointer */ +#define DPTR2FPTR(t,p) ((t)PTR2nat(p)) /* data pointer to function pointer */ +#define FPTR2DPTR(t,p) ((t)PTR2nat(p)) /* function pointer to data pointer */ #ifdef USE_LONG_DOUBLE # if defined(HAS_LONG_DOUBLE) && LONG_DOUBLESIZE == DOUBLESIZE