From ba89bb6e6103c86c9d65d9485052b0ba8db5d064 Mon Sep 17 00:00:00 2001 From: Artur Bergman Date: Mon, 10 Sep 2001 11:17:25 +0000 Subject: [PATCH] Apply INT2PTR with force to silence warnings from PM_GETRE and friends. No more warnings with 64bit IVs and 32bit pointers. p4raw-id: //depot/perl@11970 --- op.c | 10 +++++----- op.h | 4 ++-- perl.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/op.c b/op.c index daf66bb..efc0657 100644 --- a/op.c +++ b/op.c @@ -813,10 +813,10 @@ Perl_op_clear(pTHX_ OP *o) goto clear_pmop; case OP_PUSHRE: #ifdef USE_ITHREADS - if ((PADOFFSET)cPMOPo->op_pmreplroot) { + if (INT2PTR(PADOFFSET, cPMOPo->op_pmreplroot)) { if (PL_curpad) { - GV *gv = (GV*)PL_curpad[(PADOFFSET)cPMOPo->op_pmreplroot]; - pad_swipe((PADOFFSET)cPMOPo->op_pmreplroot); + GV *gv = (GV*)PL_curpad[INT2PTR(PADOFFSET, cPMOPo->op_pmreplroot)]; + pad_swipe(INT2PTR(PADOFFSET, cPMOPo->op_pmreplroot)); /* No GvIN_PAD_off(gv) here, because other references may still * exist on the pad */ SvREFCNT_dec(gv); @@ -3553,7 +3553,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) else if (curop->op_type == OP_PUSHRE) { if (((PMOP*)curop)->op_pmreplroot) { #ifdef USE_ITHREADS - GV *gv = (GV*)PL_curpad[(PADOFFSET)((PMOP*)curop)->op_pmreplroot]; + GV *gv = (GV*)PL_curpad[INT2PTR(PADOFFSET,((PMOP*)curop)->op_pmreplroot)]; #else GV *gv = (GV*)((PMOP*)curop)->op_pmreplroot; #endif @@ -3583,7 +3583,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right) tmpop = ((UNOP*)left)->op_first; if (tmpop->op_type == OP_GV && !pm->op_pmreplroot) { #ifdef USE_ITHREADS - pm->op_pmreplroot = (OP*)cPADOPx(tmpop)->op_padix; + pm->op_pmreplroot = INT2PTR(OP*, cPADOPx(tmpop)->op_padix); cPADOPx(tmpop)->op_padix = 0; /* steal it */ #else pm->op_pmreplroot = (OP*)cSVOPx(tmpop)->op_sv; diff --git a/op.h b/op.h index 3158395..64ed3e5 100644 --- a/op.h +++ b/op.h @@ -250,8 +250,8 @@ struct pmop { }; #ifdef USE_ITHREADS -#define PM_GETRE(o) ((REGEXP*)SvIVX(PL_regex_pad[(o)->op_pmoffset])) -#define PM_SETRE(o,r) (sv_setiv(PL_regex_pad[(o)->op_pmoffset], (IV)r)) +#define PM_GETRE(o) (INT2PTR(REGEXP*,SvIVX(PL_regex_pad[(o)->op_pmoffset]))) +#define PM_SETRE(o,r) (sv_setiv(PL_regex_pad[(o)->op_pmoffset], PTR2IV(r))) #define PM_GETRE_SAFE(o) (PL_regex_pad ? PM_GETRE(o) : (REGEXP*)0) #define PM_SETRE_SAFE(o,r) if (PL_regex_pad) PM_SETRE(o,r) #else diff --git a/perl.c b/perl.c index e19ea45..510a5ed 100644 --- a/perl.c +++ b/perl.c @@ -470,7 +470,7 @@ perl_destruct(pTHXx) while (i) { SV *resv = ary[--i]; - REGEXP *re = (REGEXP *)SvIVX(resv); + REGEXP *re = INT2PTR(REGEXP *,SvIVX(resv)); if (SvFLAGS(resv) & SVf_BREAK) { /* this is PL_reg_curpm, already freed -- 2.7.4