diff options
author | Robin Barker <RMBarker@cpan.org> | 1999-09-13 15:15:11 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 1999-09-13 13:23:04 +0000 |
commit | 564319723c2c18fa4801cd77e0d203a582b4d5a3 (patch) | |
tree | 94b6775a09b4e1758847fd3b22587eeae744317b | |
parent | 23614c1f233bf6c8f35366cee6be53ae80af0e28 (diff) | |
download | perl-564319723c2c18fa4801cd77e0d203a582b4d5a3.tar.gz |
Replace change #4100 with
To: gsar@activestate.com
Cc: perl5-porters@perl.org
Subject: Re: [ID 19990907.004] [PATCH perl5.005_61] compiler warnings with -Duse64bits
Message-Id: <199909131315.OAA24012@tempest.npl.co.uk>
p4raw-link: @4100 on //depot/cfgperl: 427181846486e3aa5034a647dc1922377185f4c0
p4raw-id: //depot/cfgperl@4136
-rw-r--r-- | doio.c | 2 | ||||
-rw-r--r-- | dump.c | 46 | ||||
-rw-r--r-- | ext/B/B.xs | 16 | ||||
-rw-r--r-- | ext/B/typemap | 10 | ||||
-rw-r--r-- | ext/Devel/DProf/DProf.xs | 4 | ||||
-rw-r--r-- | ext/DynaLoader/dl_dlopen.xs | 4 | ||||
-rw-r--r-- | ext/ODBM_File/ODBM_File.xs | 2 | ||||
-rw-r--r-- | ext/POSIX/POSIX.xs | 4 | ||||
-rw-r--r-- | lib/ExtUtils/typemap | 12 | ||||
-rw-r--r-- | malloc.c | 34 | ||||
-rw-r--r-- | perl.h | 32 | ||||
-rw-r--r-- | pp.c | 4 | ||||
-rw-r--r-- | pp_ctl.c | 10 | ||||
-rw-r--r-- | pp_hot.c | 2 | ||||
-rw-r--r-- | pp_sys.c | 2 | ||||
-rw-r--r-- | sv.c | 24 |
16 files changed, 110 insertions, 98 deletions
@@ -1696,7 +1696,7 @@ Perl_do_ipcctl(pTHX_ I32 optype, SV **mark, SV **sp) else { IV i = SvIV(astr); - a = (char *)PTR_CAST i; /* ouch */ + a = INT2PTR(char *,i); /* ouch */ } SETERRNO(0,0); switch (optype) @@ -768,7 +768,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo #ifdef IV_IS_QUAD Perl_sv_setpvf(aTHX_ d, "(0x%" PERL_PRIx64") at 0x%" PERL_PRIx64 "\n%*s REFCNT = %" PERL_PRId64 "\n%*s FLAGS = (", - (UV)PTR_CAST SvANY(sv), (UV)PTR_CAST sv, + PTR2UV(SvANY(sv)), PTR2UV(sv), PL_dumpindent*level, "", (IV)SvREFCNT(sv), PL_dumpindent*level, ""); #else @@ -933,7 +933,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo } if (SvROK(sv)) { #ifdef IV_IS_QUAD - Perl_dump_indent(aTHX_ level, file, " RV = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST SvRV(sv)); + Perl_dump_indent(aTHX_ level, file, " RV = 0x%" PERL_PRIx64 "\n", PTR2IV(SvRV(sv))); #else Perl_dump_indent(aTHX_ level, file, " RV = 0x%lx\n", (long)SvRV(sv)); #endif @@ -946,7 +946,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo if (type <= SVt_PVLV) { if (SvPVX(sv)) { #ifdef IV_IS_QUAD - Perl_dump_indent(aTHX_ level, file," PV = 0x%" PERL_PRIx64 " ", (IV)PTR_CAST SvPVX(sv)); + Perl_dump_indent(aTHX_ level, file," PV = 0x%" PERL_PRIx64 " ", PTR2IV(SvPVX(sv))); #else Perl_dump_indent(aTHX_ level, file," PV = 0x%lx ", (long)SvPVX(sv)); #endif @@ -976,7 +976,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo #ifdef IV_IS_QUAD Perl_dump_indent(aTHX_ level, file, " TARGOFF = %" PERL_PRId64 "\n", (IV)LvTARGOFF(sv)); Perl_dump_indent(aTHX_ level, file, " TARGLEN = %" PERL_PRId64 "\n", (IV)LvTARGLEN(sv)); - Perl_dump_indent(aTHX_ level, file, " TARG = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST LvTARG(sv)); + Perl_dump_indent(aTHX_ level, file, " TARG = 0x%" PERL_PRIx64 "\n", PTR2IV(LvTARG(sv))); #else Perl_dump_indent(aTHX_ level, file, " TARGOFF = %ld\n", (long)LvTARGOFF(sv)); Perl_dump_indent(aTHX_ level, file, " TARGLEN = %ld\n", (long)LvTARGLEN(sv)); @@ -987,14 +987,14 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo break; case SVt_PVAV: #ifdef IV_IS_QUAD - Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%" PERL_PRIx64 , (IV)PTR_CAST AvARRAY(sv)); + Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%" PERL_PRIx64 , PTR2IV(AvARRAY(sv))); #else Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%lx", (long)AvARRAY(sv)); #endif if (AvARRAY(sv) != AvALLOC(sv)) { PerlIO_printf(file, " (offset=%d)\n", (AvARRAY(sv) - AvALLOC(sv))); #ifdef IV_IS_QUAD - Perl_dump_indent(aTHX_ level, file, " ALLOC = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST AvALLOC(sv)); + Perl_dump_indent(aTHX_ level, file, " ALLOC = 0x%" PERL_PRIx64 "\n", PTR2IV(AvALLOC(sv))); #else Perl_dump_indent(aTHX_ level, file, " ALLOC = 0x%lx\n", (long)AvALLOC(sv)); #endif @@ -1004,7 +1004,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo #ifdef IV_IS_QUAD Perl_dump_indent(aTHX_ level, file, " FILL = %" PERL_PRId64 "\n", (IV)AvFILLp(sv)); Perl_dump_indent(aTHX_ level, file, " MAX = %" PERL_PRId64 "\n", (IV)AvMAX(sv)); - Perl_dump_indent(aTHX_ level, file, " ARYLEN = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST AvARYLEN(sv)); + Perl_dump_indent(aTHX_ level, file, " ARYLEN = 0x%" PERL_PRIx64 "\n", PTR2IV(AvARYLEN(sv))); #else Perl_dump_indent(aTHX_ level, file, " FILL = %ld\n", (long)AvFILLp(sv)); Perl_dump_indent(aTHX_ level, file, " MAX = %ld\n", (long)AvMAX(sv)); @@ -1033,7 +1033,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo break; case SVt_PVHV: #ifdef IV_IS_QUAD - Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%" PERL_PRIx64,(IV)PTR_CAST HvARRAY(sv)); + Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%" PERL_PRIx64,PTR2IV(HvARRAY(sv))); #else Perl_dump_indent(aTHX_ level, file, " ARRAY = 0x%lx",(long)HvARRAY(sv)); #endif @@ -1086,7 +1086,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo Perl_dump_indent(aTHX_ level, file, " FILL = %" PERL_PRId64 "\n", (IV)HvFILL(sv)); Perl_dump_indent(aTHX_ level, file, " MAX = %" PERL_PRId64 "\n", (IV)HvMAX(sv)); Perl_dump_indent(aTHX_ level, file, " RITER = %" PERL_PRId64 "\n", (IV)HvRITER(sv)); - Perl_dump_indent(aTHX_ level, file, " EITER = 0x%" PERL_PRIx64 "\n",(IV)PTR_CAST HvEITER(sv)); + Perl_dump_indent(aTHX_ level, file, " EITER = 0x%" PERL_PRIx64 "\n",PTR2IV(HvEITER(sv))); #else Perl_dump_indent(aTHX_ level, file, " KEYS = %ld\n", (long)HvKEYS(sv)); Perl_dump_indent(aTHX_ level, file, " FILL = %ld\n", (long)HvFILL(sv)); @@ -1096,7 +1096,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo #endif if (HvPMROOT(sv)) #ifdef IV_IS_QUAD - Perl_dump_indent(aTHX_ level, file, " PMROOT = 0x%" PERL_PRIx64 "\n",(IV)PTR_CAST HvPMROOT(sv)); + Perl_dump_indent(aTHX_ level, file, " PMROOT = 0x%" PERL_PRIx64 "\n",PTR2IV(HvPMROOT(sv))); #else Perl_dump_indent(aTHX_ level, file, " PMROOT = 0x%lx\n",(long)HvPMROOT(sv)); #endif @@ -1143,7 +1143,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo if (CvROOT(sv) && dumpops) do_op_dump(level+1, file, CvROOT(sv)); #ifdef IV_IS_QUAD - Perl_dump_indent(aTHX_ level, file, " XSUB = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST CvXSUB(sv)); + Perl_dump_indent(aTHX_ level, file, " XSUB = 0x%" PERL_PRIx64 "\n", PTR2IV(CvXSUB(sv))); Perl_dump_indent(aTHX_ level, file, " XSUBANY = %" PERL_PRId64 "\n", (IV)CvXSUBANY(sv).any_i32); #else Perl_dump_indent(aTHX_ level, file, " XSUB = 0x%lx\n", (long)CvXSUB(sv)); @@ -1177,7 +1177,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo Perl_dump_indent(aTHX_ level, file, " LINES = %ld\n", (long)FmLINES(sv)); #endif #ifdef IV_IS_QUAD - Perl_dump_indent(aTHX_ level, file, " PADLIST = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST CvPADLIST(sv)); + Perl_dump_indent(aTHX_ level, file, " PADLIST = 0x%" PERL_PRIx64 "\n", PTR2IV(CvPADLIST(sv))); #else Perl_dump_indent(aTHX_ level, file, " PADLIST = 0x%lx\n", (long)CvPADLIST(sv)); #endif @@ -1217,7 +1217,7 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo CV *outside = CvOUTSIDE(sv); #ifdef IV_IS_QUAD Perl_dump_indent(aTHX_ level, file, " OUTSIDE = 0x%" PERL_PRIx64 " (%s)\n", - (IV)PTR_CAST outside, + PTR2IV(outside), (!outside ? "null" : CvANON(outside) ? "ANON" : (outside == PL_main_cv) ? "MAIN" @@ -1245,14 +1245,14 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo #endif do_hv_dump (level, file, " GvSTASH", GvSTASH(sv)); #ifdef IV_IS_QUAD - Perl_dump_indent(aTHX_ level, file, " GP = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST GvGP(sv)); - Perl_dump_indent(aTHX_ level, file, " SV = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST GvSV(sv)); + Perl_dump_indent(aTHX_ level, file, " GP = 0x%" PERL_PRIx64 "\n", PTR2IV(GvGP(sv))); + Perl_dump_indent(aTHX_ level, file, " SV = 0x%" PERL_PRIx64 "\n", PTR2IV(GvSV(sv))); Perl_dump_indent(aTHX_ level, file, " REFCNT = %" PERL_PRId64 "\n", (IV)GvREFCNT(sv)); - Perl_dump_indent(aTHX_ level, file, " IO = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST GvIOp(sv)); - Perl_dump_indent(aTHX_ level, file, " FORM = 0x%" PERL_PRIx64 " \n", (IV)PTR_CAST GvFORM(sv)); - Perl_dump_indent(aTHX_ level, file, " AV = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST GvAV(sv)); - Perl_dump_indent(aTHX_ level, file, " HV = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST GvHV(sv)); - Perl_dump_indent(aTHX_ level, file, " CV = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST GvCV(sv)); + Perl_dump_indent(aTHX_ level, file, " IO = 0x%" PERL_PRIx64 "\n", PTR2IV(GvIOp(sv))); + Perl_dump_indent(aTHX_ level, file, " FORM = 0x%" PERL_PRIx64 " \n", PTR2IV(GvFORM(sv))); + Perl_dump_indent(aTHX_ level, file, " AV = 0x%" PERL_PRIx64 "\n", PTR2IV(GvAV(sv))); + Perl_dump_indent(aTHX_ level, file, " HV = 0x%" PERL_PRIx64 "\n", PTR2IV(GvHV(sv))); + Perl_dump_indent(aTHX_ level, file, " CV = 0x%" PERL_PRIx64 "\n", PTR2IV(GvCV(sv))); Perl_dump_indent(aTHX_ level, file, " CVGEN = 0x%" PERL_PRIx64 "\n", (IV)GvCVGEN(sv)); Perl_dump_indent(aTHX_ level, file, " LASTEXPR = %" PERL_PRId64 "\n", (IV)GvLASTEXPR(sv)); Perl_dump_indent(aTHX_ level, file, " LINE = %" PERL_PRId64 "\n", (IV)GvLINE(sv)); @@ -1275,9 +1275,9 @@ Perl_do_sv_dump(pTHX_ I32 level, PerlIO *file, SV *sv, I32 nest, I32 maxnest, bo break; case SVt_PVIO: #ifdef IV_IS_QUAD - Perl_dump_indent(aTHX_ level, file, " IFP = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST IoIFP(sv)); - Perl_dump_indent(aTHX_ level, file, " OFP = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST IoOFP(sv)); - Perl_dump_indent(aTHX_ level, file, " DIRP = 0x%" PERL_PRIx64 "\n", (IV)PTR_CAST IoDIRP(sv)); + Perl_dump_indent(aTHX_ level, file, " IFP = 0x%" PERL_PRIx64 "\n", PTR2IV(IoIFP(sv))); + Perl_dump_indent(aTHX_ level, file, " OFP = 0x%" PERL_PRIx64 "\n", PTR2IV(IoOFP(sv))); + Perl_dump_indent(aTHX_ level, file, " DIRP = 0x%" PERL_PRIx64 "\n", PTR2IV(IoDIRP(sv))); Perl_dump_indent(aTHX_ level, file, " LINES = %" PERL_PRId64 "\n", (IV)IoLINES(sv)); Perl_dump_indent(aTHX_ level, file, " PAGE = %" PERL_PRId64 "\n", (IV)IoPAGE(sv)); Perl_dump_indent(aTHX_ level, file, " PAGE_LEN = %" PERL_PRId64 "\n", (IV)IoPAGE_LEN(sv)); diff --git a/ext/B/B.xs b/ext/B/B.xs index ad3d00842d..2d6145da66 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -202,7 +202,7 @@ make_sv_object(pTHX_ SV *arg, SV *sv) } if (!type) { type = svclassnames[SvTYPE(sv)]; - iv = (IV)PTR_CAST sv; + iv = PTR2IV(sv); } sv_setiv(newSVrv(arg, type), iv); return arg; @@ -211,7 +211,7 @@ make_sv_object(pTHX_ SV *arg, SV *sv) static SV * make_mg_object(pTHX_ SV *arg, MAGIC *mg) { - sv_setiv(newSVrv(arg, "B::MAGIC"), (IV)PTR_CAST mg); + sv_setiv(newSVrv(arg, "B::MAGIC"), PTR2IV(mg)); return arg; } @@ -317,7 +317,7 @@ walkoptree(pTHX_ SV *opsv, char *method) if (!SvROK(opsv)) croak("opsv is not a reference"); opsv = sv_mortalcopy(opsv); - o = (OP*)PTR_CAST SvIV((SV*)SvRV(opsv)); + o = INT2PTR(OP*,SvIV((SV*)SvRV(opsv))); if (walkoptree_debug) { PUSHMARK(sp); XPUSHs(opsv); @@ -332,7 +332,7 @@ walkoptree(pTHX_ SV *opsv, char *method) OP *kid; for (kid = ((UNOP*)o)->op_first; kid; kid = kid->op_sibling) { /* Use the same opsv. Rely on methods not to mess it up. */ - sv_setiv(newSVrv(opsv, cc_opclassname(aTHX_ kid)), (IV)PTR_CAST kid); + sv_setiv(newSVrv(opsv, cc_opclassname(aTHX_ kid)), PTR2IV(kid)); walkoptree(aTHX_ opsv, method); } } @@ -437,7 +437,7 @@ walkoptree_debug(...) OUTPUT: RETVAL -#define address(sv) (IV)PTR_CAST sv +#define address(sv) PTR2IV(sv) IV address(sv) @@ -647,10 +647,10 @@ PMOP_pmreplroot(o) if (o->op_type == OP_PUSHRE) { sv_setiv(newSVrv(ST(0), root ? svclassnames[SvTYPE((SV*)root)] : "B::SV"), - (IV)PTR_CAST root); + PTR2IV(root)); } else { - sv_setiv(newSVrv(ST(0), cc_opclassname(aTHX_ root)), (IV)PTR_CAST root); + sv_setiv(newSVrv(ST(0), cc_opclassname(aTHX_ root)), PTR2IV(root)); } B::OP @@ -1153,7 +1153,7 @@ void CvXSUB(cv) B::CV cv CODE: - ST(0) = sv_2mortal(newSViv((IV)PTR_CAST CvXSUB(cv))); + ST(0) = sv_2mortal(newSViv(PTR2IV(CvXSUB(cv)))); void diff --git a/ext/B/typemap b/ext/B/typemap index 5f6af0f2dc..febadf8d62 100644 --- a/ext/B/typemap +++ b/ext/B/typemap @@ -35,7 +35,7 @@ INPUT T_OP_OBJ if (SvROK($arg)) { IV tmp = SvIV((SV*)SvRV($arg)); - $var = ($type)PTR_CAST tmp; + $var = INT2PTR($type,tmp); } else croak(\"$var is not a reference\") @@ -43,7 +43,7 @@ T_OP_OBJ T_SV_OBJ if (SvROK($arg)) { IV tmp = SvIV((SV*)SvRV($arg)); - $var = ($type)PTR_CAST tmp; + $var = INT2PTR($type,tmp); } else croak(\"$var is not a reference\") @@ -51,18 +51,18 @@ T_SV_OBJ T_MG_OBJ if (SvROK($arg)) { IV tmp = SvIV((SV*)SvRV($arg)); - $var = ($type)PTR_CAST tmp; + $var = INT2PTR($type,tmp); } else croak(\"$var is not a reference\") OUTPUT T_OP_OBJ - sv_setiv(newSVrv($arg, cc_opclassname(aTHX_ (OP*)$var)), (IV)PTR_CAST $var); + sv_setiv(newSVrv($arg, cc_opclassname(aTHX_ (OP*)$var)), PTR2IV($var)); T_SV_OBJ make_sv_object(aTHX_ ($arg), (SV*)($var)); T_MG_OBJ - sv_setiv(newSVrv($arg, "B::MAGIC"), (IV)PTR_CAST $var); + sv_setiv(newSVrv($arg, "B::MAGIC"), PTR2IV($var)); diff --git a/ext/Devel/DProf/DProf.xs b/ext/Devel/DProf/DProf.xs index 62a0c9ec1c..69f0b899a3 100644 --- a/ext/Devel/DProf/DProf.xs +++ b/ext/Devel/DProf/DProf.xs @@ -292,7 +292,7 @@ prof_mark( opcode ptype ) static U32 lastid; CV *cv; - cv = (CV*)PTR_CAST SvIVX(Sub); + cv = INT2PTR(CV*,SvIVX(Sub)); svp = hv_fetch(cv_hash, (char*)&cv, sizeof(CV*), TRUE); if (!SvOK(*svp)) { GV *gv = CvGV(cv); @@ -568,7 +568,7 @@ XS(XS_DB_sub) PUSHMARK( ORIGMARK ); #ifdef G_NODEBUG - perl_call_sv( (SV*)PTR_CAST SvIV(Sub), GIMME | G_NODEBUG); + perl_call_sv( INT2PTR(SV*,SvIV(Sub)), GIMME | G_NODEBUG); #else curstash = debstash; /* To disable debugging of perl_call_sv */ #ifdef PERLDBf_NONAME diff --git a/ext/DynaLoader/dl_dlopen.xs b/ext/DynaLoader/dl_dlopen.xs index a4dcfb4fbe..641db33514 100644 --- a/ext/DynaLoader/dl_dlopen.xs +++ b/ext/DynaLoader/dl_dlopen.xs @@ -166,7 +166,7 @@ dl_load_file(filename, flags=0) if (RETVAL == NULL) SaveError(aTHX_ "%s",dlerror()) ; else - sv_setiv( ST(0), (IV)PTR_CAST RETVAL); + sv_setiv( ST(0), PTR2IV(RETVAL)); void * @@ -187,7 +187,7 @@ dl_find_symbol(libhandle, symbolname) if (RETVAL == NULL) SaveError(aTHX_ "%s",dlerror()) ; else - sv_setiv( ST(0), (IV)PTR_CAST RETVAL); + sv_setiv( ST(0), PTR2IV(RETVAL)); void diff --git a/ext/ODBM_File/ODBM_File.xs b/ext/ODBM_File/ODBM_File.xs index bb2eb4714a..7601c3433b 100644 --- a/ext/ODBM_File/ODBM_File.xs +++ b/ext/ODBM_File/ODBM_File.xs @@ -111,7 +111,7 @@ odbm_TIEHASH(dbtype, filename, flags, mode) Zero(RETVAL, 1, ODBM_File_type) ; RETVAL->dbp = dbp ; ST(0) = sv_mortalcopy(&PL_sv_undef); - sv_setptrobj(ST(0), PTR_CAST RETVAL, dbtype); + sv_setptrobj(ST(0), RETVAL, dbtype); } void diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs index 0f09aace1a..16217f0936 100644 --- a/ext/POSIX/POSIX.xs +++ b/ext/POSIX/POSIX.xs @@ -3246,7 +3246,7 @@ sigaction(sig, action, oldaction = 0) } else { New(0, sigset, 1, sigset_t); - sv_setptrobj(*svp, PTR_CAST sigset, "POSIX::SigSet"); + sv_setptrobj(*svp, sigset, "POSIX::SigSet"); } *sigset = oact.sa_mask; @@ -3274,7 +3274,7 @@ INIT: } else if (sv_derived_from(ST(2), "POSIX::SigSet")) { IV tmp = SvIV((SV*)SvRV(ST(2))); - oldsigset = (POSIX__SigSet)PTR_CAST tmp; + oldsigset = INT2PTR(POSIX__SigSet,tmp); } else { New(0, oldsigset, 1, sigset_t); diff --git a/lib/ExtUtils/typemap b/lib/ExtUtils/typemap index a332024011..d84435e50f 100644 --- a/lib/ExtUtils/typemap +++ b/lib/ExtUtils/typemap @@ -1,4 +1,4 @@ -# $Header: /home/rmb1/misc/perl/build/perl5.005_60/lib/ExtUtils/../../../RCS/perl5.005_61/lib/ExtUtils/typemap,v 1.2 1999/09/07 10:05:21 rmb1 Exp $ +# $Header: /home/rmb1/misc/CVS/perl5.005_61/lib/ExtUtils/typemap,v 1.3 1999/09/13 09:46:43 rmb1 Exp $ # basic C types int T_IV unsigned T_UV @@ -107,11 +107,11 @@ T_DOUBLE T_PV $var = ($type)SvPV($arg,PL_na) T_PTR - $var = ($type)PTR_CAST SvIV($arg) + $var = INT2PTR($type,SvIV($arg)) T_PTRREF if (SvROK($arg)) { IV tmp = SvIV((SV*)SvRV($arg)); - $var = ($type)PTR_CAST tmp; + $var = INT2PTR($type,tmp); } else croak(\"$var is not a reference\") @@ -132,7 +132,7 @@ T_REF_IV_PTR T_PTROBJ if (sv_derived_from($arg, \"${ntype}\")) { IV tmp = SvIV((SV*)SvRV($arg)); - $var = ($type)PTR_CAST tmp; + $var = INT2PTR($type,tmp); } else croak(\"$var is not of type ${ntype}\") @@ -147,14 +147,14 @@ T_PTRDESC T_REFREF if (SvROK($arg)) { IV tmp = SvIV((SV*)SvRV($arg)); - $var = *($type)PTR_CAST tmp; + $var = *INT2PTR($type,tmp); } else croak(\"$var is not a reference\") T_REFOBJ if (sv_isa($arg, \"${ntype}\")) { IV tmp = SvIV((SV*)SvRV($arg)); - $var = *($type)PTR_CAST tmp; + $var = *INT2PTR($type,tmp); } else croak(\"$var is not of type ${ntype}\") @@ -384,13 +384,11 @@ #define u_char unsigned char #define u_int unsigned int - -#ifdef HAS_QUAD -# define u_bigint UV /* Needs to eat *void. */ -#else /* needed? */ -# define u_bigint unsigned long /* Needs to eat *void. */ -#endif - +/* + * I removed the definition of u_bigint which appeared to be u_bigint = UV + * u_bigint was only used in TWOK_MASKED and TWOK_SHIFT + * where I have used PTR2UV. RMB + */ #define u_short unsigned short /* 286 and atarist like big chunks, which gives too much overhead. */ @@ -516,9 +514,9 @@ static u_short buck_size[MAX_BUCKET_BY_TABLE + 1] = # define MAX_PACKED (MAX_PACKED_POW2 * BUCKETS_PER_POW2 + BUCKET_POW2_SHIFT) # define MAX_POW2_ALGO ((1<<(MAX_PACKED_POW2 + 1)) - M_OVERHEAD) # define TWOK_MASK ((1<<LOG_OF_MIN_ARENA) - 1) -# define TWOK_MASKED(x) ((u_bigint)PTR_CAST(x) & ~TWOK_MASK) -# define TWOK_SHIFT(x) ((u_bigint)PTR_CAST(x) & TWOK_MASK) -# define OV_INDEXp(block) ((u_char*)PTR_CAST(TWOK_MASKED(block))) +# define TWOK_MASKED(x) (PTR2UV(x) & ~TWOK_MASK) +# define TWOK_SHIFT(x) (PTR2UV(x) & TWOK_MASK) +# define OV_INDEXp(block) (INT2PTR(u_char*,TWOK_MASKED(block))) # define OV_INDEX(block) (*OV_INDEXp(block)) # define OV_MAGIC(block,bucket) (*(OV_INDEXp(block) + \ (TWOK_SHIFT(block)>> \ @@ -781,7 +779,7 @@ emergency_sbrk(MEM_SIZE size) /* Got it, now detach SvPV: */ pv = SvPV(sv, n_a); /* Check alignment: */ - if (((UV)PTR_CAST (pv - sizeof(union overhead))) & (NEEDED_ALIGNMENT - 1)) { + if ((PTR2UV(pv) - sizeof(union overhead)) & (NEEDED_ALIGNMENT - 1)) { PerlIO_puts(PerlIO_stderr(),"Bad alignment of $^M!\n"); return (char *)-1; /* die die die */ } @@ -924,7 +922,7 @@ Perl_malloc(register size_t nbytes) /* remove from linked list */ #if defined(RCHECK) - if (((UV)PTR_CAST p) & (MEM_ALIGNBYTES - 1)) + if ((PTR2UV(p)) & (MEM_ALIGNBYTES - 1)) PerlIO_printf(PerlIO_stderr(), "Corrupt malloc ptr 0x%lx at 0x%lx\n", (unsigned long)*((int*)p),(unsigned long)p); #endif @@ -1121,8 +1119,8 @@ getpages(int needed, int *nblksp, int bucket) # ifndef I286 /* The sbrk(0) call on the I286 always returns the next segment */ /* WANTED_ALIGNMENT may be more than NEEDED_ALIGNMENT, but this may improve performance of memory access. */ - if ((UV)PTR_CAST cp & (WANTED_ALIGNMENT - 1)) { /* Not aligned. */ - slack = WANTED_ALIGNMENT - ((UV)PTR_CAST cp & (WANTED_ALIGNMENT - 1)); + if (PTR2UV(cp) & (WANTED_ALIGNMENT - 1)) { /* Not aligned. */ + slack = WANTED_ALIGNMENT - (PTR2UV(cp) & (WANTED_ALIGNMENT - 1)); add += slack; } # endif @@ -1183,16 +1181,16 @@ getpages(int needed, int *nblksp, int bucket) */ # if NEEDED_ALIGNMENT > MEM_ALIGNBYTES - if ((UV)PTR_CAST ovp & (NEEDED_ALIGNMENT - 1)) + if (PTR2UV(ovp) & (NEEDED_ALIGNMENT - 1)) fatalcroak("Misalignment of sbrk()\n"); else # endif #ifndef I286 /* Again, this should always be ok on an 80286 */ - if ((UV)PTR_CAST ovp & (MEM_ALIGNBYTES - 1)) { + if (PTR2UV(ovp) & (MEM_ALIGNBYTES - 1)) { DEBUG_m(PerlIO_printf(Perl_debug_log, "fixing sbrk(): %d bytes off machine alignement\n", - (int)((UV)PTR_CAST ovp & (MEM_ALIGNBYTES - 1)))); - ovp = (union overhead *)PTR_CAST (((UV)PTR_CAST ovp + MEM_ALIGNBYTES) & + (int)(PTR2UV(ovp) & (MEM_ALIGNBYTES - 1)))); + ovp = INT2PTR(union overhead *,(PTR2UV(ovp) + MEM_ALIGNBYTES) & (MEM_ALIGNBYTES - 1)); (*nblksp)--; # if defined(DEBUGGING_MSTATS) @@ -1044,19 +1044,33 @@ Free_t Perl_mfree (Malloc_t where); # define IVSIZE LONGSIZE #endif #define IV_DIG (BIT_DIGITS(IVSIZE * 8)) -#define UV_DIG (BIT_DIGITS(UVSIZE * 8)) - -#if (IVSIZE > PTRSIZE) || (UVSIZE > PTRSIZE) +#define UV_DIG (BIT_DIGITS(IVSIZE * 8)) + ++ /* ++ * The macros INT2PTR and NUM2PTR are (despite their names) ++ * bi-directional: they will convert int/float to or from pointers. ++ * However the conversion to int/float are named explicitly: ++ * PTR2IV, PTR2UV, PTR2NV. ++ * ++ * For int conversions we do not need two casts if pointers are ++ * the same size as IV and UV. Otherwise we need an explicit ++ * cast (PTRV) to avoid compiler warnings. ++ */ +#if (IVSIZE == PTRSIZE) && (UVSIZE == PTRSIZE) +# define PTRV UV +# define INT2PTR(any,d) (any)(d) +#else # if PTRSIZE == LONGSIZE -# define PTRV unsigned long +# define PTRV unsigned long # else -# define PTRV unsigned +# define PTRV unsigned # endif -# define PTR_CAST (PTRV) -#else -# define PTRV UV -# define PTR_CAST +# define INT2PTR(any,d) (any)(PTRV)(d) #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) #ifdef USE_LONG_DOUBLE # if defined(HAS_LONG_DOUBLE) && (LONG_DOUBLESIZE > DOUBLESIZE) @@ -1778,9 +1778,9 @@ S_seed(pTHX) # endif #endif u += SEED_C3 * (U32)getpid(); - u += SEED_C4 * (U32)(UV)PTR_CAST PL_stack_sp; + u += SEED_C4 * (U32)PTR2UV(PL_stack_sp); #ifndef PLAN9 /* XXX Plan9 assembler chokes on this; fix needed */ - u += SEED_C5 * (U32)(UV)PTR_CAST &when; + u += SEED_C5 * (U32)PTR2UV(&when); #endif return u; } @@ -223,12 +223,12 @@ Perl_rxres_save(pTHX_ void **rsp, REGEXP *rx) *rsp = (void*)p; } - *p++ = (UV)PTR_CAST (RX_MATCH_COPIED(rx) ? rx->subbeg : Nullch); + *p++ = PTR2UV(RX_MATCH_COPIED(rx) ? rx->subbeg : Nullch); RX_MATCH_COPIED_off(rx); *p++ = rx->nparens; - *p++ = (UV)PTR_CAST rx->subbeg; + *p++ = PTR2UV(rx->subbeg); *p++ = (UV)rx->sublen; for (i = 0; i <= rx->nparens; ++i) { *p++ = (UV)rx->startp[i]; @@ -249,7 +249,7 @@ Perl_rxres_restore(pTHX_ void **rsp, REGEXP *rx) rx->nparens = *p++; - rx->subbeg = (char*)PTR_CAST (*p++); + rx->subbeg = INT2PTR(char*,*p++); rx->sublen = (I32)(*p++); for (i = 0; i <= rx->nparens; ++i) { rx->startp[i] = (I32)(*p++); @@ -263,7 +263,7 @@ Perl_rxres_free(pTHX_ void **rsp) UV *p = (UV*)*rsp; if (p) { - Safefree((char*)PTR_CAST (*p)); + Safefree(INT2PTR(char*,*p)); Safefree(p); *rsp = Null(void*); } @@ -2199,7 +2199,7 @@ PP(pp_goto) CV *gotocv; if (PERLDB_SUB_NN) { - SvIVX(sv) = (IV)PTR_CAST cv; /* Already upgraded, saved */ + SvIVX(sv) = PTR2IV(cv); /* Already upgraded, saved */ } else { save_item(sv); gv_efullname3(sv, CvGV(cv), Nullch); @@ -2112,7 +2112,7 @@ S_get_db_sub(pTHX_ SV **svp, CV *cv) SvUPGRADE(dbsv, SVt_PVIV); SvIOK_on(dbsv); SAVEIV(SvIVX(dbsv)); - SvIVX(dbsv) = (IV)PTR_CAST cv; /* Do it the quickest way */ + SvIVX(dbsv) = PTR2IV(cv); /* Do it the quickest way */ } if (CvXSUB(cv)) @@ -1903,7 +1903,7 @@ PP(pp_ioctl) } else { retval = SvIV(argsv); - s = (char*)PTR_CAST retval; /* ouch */ + s = INT2PTR(char*,retval); /* ouch */ } TAINT_PROPER(optype == OP_IOCTL ? "ioctl" : "fcntl"); @@ -612,8 +612,8 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt) pv = (char*)SvRV(sv); cur = 0; len = 0; - iv = (IV)PTR_CAST pv; - nv = (NV)(PTRV)pv; + iv = PTR2IV(pv); + nv = PTR2NV(pv); del_XRV(SvANY(sv)); magic = 0; stash = 0; @@ -1077,7 +1077,7 @@ Perl_sv_2iv(pTHX_ register SV *sv) SV* tmpstr; if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv, numer))) return SvIV(tmpstr); - return (IV)PTR_CAST SvRV(sv); + return PTR2IV(SvRV(sv)); } if (SvREADONLY(sv) && !SvOK(sv)) { dTHR; @@ -1113,7 +1113,7 @@ Perl_sv_2iv(pTHX_ register SV *sv) #ifdef IV_IS_QUAD DEBUG_c(PerlIO_printf(Perl_debug_log, "0x%" PERL_PRIx64 " 2iv(%" PERL_PRIu64 " => %" PERL_PRId64 ") (as unsigned)\n", - (UV)PTR_CAST sv, + PTR2UV(sv), (UV)SvUVX(sv), (IV)SvUVX(sv))); #else DEBUG_c(PerlIO_printf(Perl_debug_log, @@ -1222,7 +1222,7 @@ Perl_sv_2uv(pTHX_ register SV *sv) SV* tmpstr; if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv, numer))) return SvUV(tmpstr); - return (UV)PTR_CAST SvRV(sv); + return PTR2UV(SvRV(sv)); } if (SvREADONLY(sv) && !SvOK(sv)) { dTHR; @@ -1393,7 +1393,7 @@ Perl_sv_2nv(pTHX_ register SV *sv) SV* tmpstr; if (SvAMAGIC(sv) && (tmpstr=AMG_CALLun(sv,numer))) return SvNV(tmpstr); - return (NV)(PTRV)SvRV(sv); + return PTR2NV(SvRV(sv)); } if (SvREADONLY(sv) && !SvOK(sv)) { dTHR; @@ -1777,7 +1777,7 @@ Perl_sv_2pv(pTHX_ register SV *sv, STRLEN *lp) else sv_setpv(tsv, s); #ifdef IV_IS_QUAD - Perl_sv_catpvf(aTHX_ tsv, "(0x%" PERL_PRIx64")", (UV)PTR_CAST sv); + Perl_sv_catpvf(aTHX_ tsv, "(0x%" PERL_PRIx64")", PTR2UV(sv)); #else Perl_sv_catpvf(aTHX_ tsv, "(0x%lx)", (unsigned long)sv); #endif @@ -3691,7 +3691,7 @@ Perl_sv_inc(pTHX_ register SV *sv) IV i; if (SvAMAGIC(sv) && AMG_CALLun(sv,inc)) return; - i = (IV)PTR_CAST SvRV(sv); + i = PTR2IV(SvRV(sv)); sv_unref(sv); sv_setiv(sv, i); } @@ -3791,7 +3791,7 @@ Perl_sv_dec(pTHX_ register SV *sv) IV i; if (SvAMAGIC(sv) && AMG_CALLun(sv,dec)) return; - i = (IV)PTR_CAST SvRV(sv); + i = PTR2IV(SvRV(sv)); sv_unref(sv); sv_setiv(sv, i); } @@ -4395,7 +4395,7 @@ Perl_sv_setref_pv(pTHX_ SV *rv, const char *classname, void *pv) SvSETMAGIC(rv); } else - sv_setiv(newSVrv(rv,classname), (IV)PTR_CAST pv); + sv_setiv(newSVrv(rv,classname), PTR2IV(pv)); return rv; } @@ -4898,9 +4898,9 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV case 'p': if (args) - uv = (UV)PTR_CAST va_arg(*args, void*); + uv = PTR2UV(va_arg(*args, void*)); else - uv = (svix < svmax) ? (UV)PTR_CAST svargs[svix++] : 0; + uv = (svix < svmax) ? PTR2UV(svargs[svix++]) : 0; base = 16; goto integer; |