Change 29859 by [EMAIL PROTECTED] on 2007/01/17 22:07:40

        Integrate:
        [ 27126]
        Merging pp_bit_or and pp_bit_xor shrinks the object code by about .7K.
        The overloading tests are not free.
        
        [ 27127]
        Borland's C compiler warns that the & is unnecessary.
        
        [ 27129]
        Subject: [PATCH] Handle unused args
        From: [EMAIL PROTECTED] (Andy Lester)
        Date: Tue, 7 Feb 2006 16:36:56 -0600
        Message-ID: <[EMAIL PROTECTED]>
        
        [ 27134]
        Avoid calling all the scanning code in gv_fetchpvn_flags when saving
        $1 etc, as we can perfom a hash lookup on %:: directly.
        
        [ 27161]
        Remove SOFT_CAST() as it no longer does anything useful.
        
        [ 27194]
        Get perl_fini() running on HP-UX again.
        It was effectively disabled by change 24667 since
        __ux_version is only available under DCE threads
        which isn't used when perl is built on HP-UX 11
        and later.
        
        [ 27203]
        Subject: Problem compiling swigged c++ code with 5.8.8
        From: Merijn Broeren <[EMAIL PROTECTED]>
        Date: Wed, 15 Feb 2006 13:51:49 +0100
        Message-ID: <[EMAIL PROTECTED]>
        
        [ 27227]
        SvROK(sv) will never be true when SvIOKp() or SvNOKp() is true, so the
        code inside the if() test in sv_2pv_flags is dead and can be removed.
        
        [ 27235]
        Remove the last (U16) cast for CV depths, missed by change 17835.
        
        [ 27279]
        Remove un-needed case in Perl_sv_setsv_flags (sv_upgrade will cover
        this one for us).
        
        [ 27282]
        Recalculate dstr in Perl_sv_setsv_flags, as dstr may have been upgraded.
        
        [ 27288]
        In XS_attributes__guess_stash, attempting to call Gv* on a PVMG is
        bad and wrong.

Affected files ...

... //depot/maint-5.8/perl/XSUB.h#32 integrate
... //depot/maint-5.8/perl/doio.c#89 integrate
... //depot/maint-5.8/perl/mathoms.c#18 integrate
... //depot/maint-5.8/perl/opcode.h#22 integrate
... //depot/maint-5.8/perl/opcode.pl#30 integrate
... //depot/maint-5.8/perl/pad.c#56 integrate
... //depot/maint-5.8/perl/perl.c#183 integrate
... //depot/maint-5.8/perl/perl.h#127 integrate
... //depot/maint-5.8/perl/pp.c#110 integrate
... //depot/maint-5.8/perl/pp.h#20 integrate
... //depot/maint-5.8/perl/pp_ctl.c#140 integrate
... //depot/maint-5.8/perl/pp_sys.c#123 integrate
... //depot/maint-5.8/perl/regcomp.c#77 integrate
... //depot/maint-5.8/perl/scope.h#20 integrate
... //depot/maint-5.8/perl/sv.c#286 integrate
... //depot/maint-5.8/perl/xsutils.c#23 integrate

Differences ...

==== //depot/maint-5.8/perl/XSUB.h#32 (text) ====
Index: perl/XSUB.h
--- perl/XSUB.h#31~29137~       2006-10-29 12:23:57.000000000 -0800
+++ perl/XSUB.h 2007-01-17 14:07:40.000000000 -0800
@@ -99,7 +99,7 @@
 #if defined(__CYGWIN__) && defined(USE_DYNAMIC_LOADING)
 #  define XS(name) __declspec(dllexport) void name(pTHX_ CV* cv)
 #else
-#  ifdef HASATTRIBUTE_UNUSED
+#  if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
 #    define XS(name) void name(pTHX_ CV* cv __attribute__unused__)
 #  else
 #    define XS(name) void name(pTHX_ CV* cv)

==== //depot/maint-5.8/perl/doio.c#89 (text) ====
Index: perl/doio.c
--- perl/doio.c#88~29858~       2007-01-17 13:17:52.000000000 -0800
+++ perl/doio.c 2007-01-17 14:07:40.000000000 -0800
@@ -1978,7 +1978,8 @@
     const key_t key = (key_t)SvNVx(*++mark);
     const I32 n = (optype == OP_MSGGET) ? 0 : SvIVx(*++mark);
     const I32 flags = SvIVx(*++mark);
-    (void)sp;
+
+    PERL_UNUSED_ARG(sp);
 
     SETERRNO(0,0);
     switch (optype)

==== //depot/maint-5.8/perl/mathoms.c#18 (text) ====
Index: perl/mathoms.c
--- perl/mathoms.c#17~29807~    2007-01-14 05:09:22.000000000 -0800
+++ perl/mathoms.c      2007-01-17 14:07:40.000000000 -0800
@@ -1068,6 +1068,11 @@
     return pp_sin();
 }
 
+PP(pp_bit_xor)
+{
+    return pp_bit_or();
+}
+
 U8 *
 Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv)
 {

==== //depot/maint-5.8/perl/opcode.h#22 (text+w) ====
Index: perl/opcode.h
--- perl/opcode.h#21~29759~     2007-01-11 08:45:05.000000000 -0800
+++ perl/opcode.h       2007-01-17 14:07:40.000000000 -0800
@@ -848,7 +848,7 @@
        MEMBER_TO_FPTR(Perl_pp_sne),
        MEMBER_TO_FPTR(Perl_pp_scmp),
        MEMBER_TO_FPTR(Perl_pp_bit_and),
-       MEMBER_TO_FPTR(Perl_pp_bit_xor),
+       MEMBER_TO_FPTR(Perl_pp_bit_or), /* Perl_pp_bit_xor */
        MEMBER_TO_FPTR(Perl_pp_bit_or),
        MEMBER_TO_FPTR(Perl_pp_negate),
        MEMBER_TO_FPTR(Perl_pp_i_negate),

==== //depot/maint-5.8/perl/opcode.pl#30 (xtext) ====
Index: perl/opcode.pl
--- perl/opcode.pl#29~29759~    2007-01-11 08:45:05.000000000 -0800
+++ perl/opcode.pl      2007-01-17 14:07:40.000000000 -0800
@@ -81,6 +81,7 @@
                 Perl_pp_oct => ['hex'],
                 Perl_pp_shift => ['pop'],
                 Perl_pp_sin => [qw(cos exp log sqrt)],
+                Perl_pp_bit_or => ['bit_xor'],
                );
 
 while (my ($func, $names) = splice @raw_alias, 0, 2) {

==== //depot/maint-5.8/perl/pad.c#56 (text) ====
Index: perl/pad.c
--- perl/pad.c#55~29807~        2007-01-14 05:09:22.000000000 -0800
+++ perl/pad.c  2007-01-17 14:07:40.000000000 -0800
@@ -1483,6 +1483,8 @@
     AV * const comppad = (AV*)AvARRAY(padlist)[1];
     SV ** const namepad = AvARRAY(comppad_name);
     SV ** const curpad = AvARRAY(comppad);
+    PERL_UNUSED_ARG(old_cv);
+
     for (ix = AvFILLp(comppad_name); ix > 0; ix--) {
         const SV * const namesv = namepad[ix];
        if (namesv && namesv != &PL_sv_undef

==== //depot/maint-5.8/perl/perl.c#183 (text) ====
Index: perl/perl.c
--- perl/perl.c#182~29858~      2007-01-17 13:17:52.000000000 -0800
+++ perl/perl.c 2007-01-17 14:07:40.000000000 -0800
@@ -1432,7 +1432,7 @@
 /* provide destructors to clean up the thread key when libperl is unloaded */
 #ifndef WIN32 /* handled during DLL_PROCESS_DETACH in win32/perllib.c */
 
-#if defined(__hpux) && __ux_version > 1020 && !defined(__GNUC__)
+#if defined(__hpux) && !(defined(__ux_version) && __ux_version <= 1020) && 
!defined(__GNUC__)
 #pragma fini "perl_fini"
 #endif
 
@@ -4347,6 +4347,8 @@
     Perl_croak(aTHX_ "Can't do setuid (suidperl cannot exec perl)\n");
 #endif /* IAMSUID */
 #else /* !DOSUID */
+    PERL_UNUSED_ARG(fdscript);
+    PERL_UNUSED_ARG(suidscript);
     if (PL_euid != PL_uid || PL_egid != PL_gid) {      /* (suidperl doesn't 
exist, in fact) */
 #ifndef SETUID_SCRIPTS_ARE_SECURE_NOW
        PerlLIO_fstat(PerlIO_fileno(PL_rsfp),&PL_statbuf);      /* may be 
either wrapped or real suid */
@@ -4361,8 +4363,8 @@
        /* not set-id, must be wrapped */
     }
 #endif /* DOSUID */
-    (void)validarg;
-    (void)scriptname;
+    PERL_UNUSED_ARG(validarg);
+    PERL_UNUSED_ARG(scriptname);
 }
 
 STATIC void

==== //depot/maint-5.8/perl/perl.h#127 (text) ====
Index: perl/perl.h
--- perl/perl.h#126~29847~      2007-01-17 04:30:43.000000000 -0800
+++ perl/perl.h 2007-01-17 14:07:40.000000000 -0800
@@ -170,7 +170,7 @@
 #endif
 
 #ifndef PERL_UNUSED_DECL
-#  ifdef HASATTRIBUTE_UNUSED
+#  if defined(HASATTRIBUTE_UNUSED) && !defined(__cplusplus)
 #    define PERL_UNUSED_DECL __attribute__unused__
 #  else
 #    define PERL_UNUSED_DECL
@@ -309,16 +309,6 @@
 #define WITH_THX(s) STMT_START { dTHX; s; } STMT_END
 #define WITH_THR(s) WITH_THX(s)
 
-/*
- * SOFT_CAST can be used for args to prototyped functions to retain some
- * type checking; it only casts if the compiler does not know prototypes.
- */
-#if defined(CAN_PROTOTYPE) && defined(DEBUGGING_COMPILE)
-#define SOFT_CAST(type)        
-#else
-#define SOFT_CAST(type)        (type)
-#endif
-
 #ifndef BYTEORDER  /* Should never happen -- byteorder is in config.h */
 #   define BYTEORDER 0x1234
 #endif

==== //depot/maint-5.8/perl/pp.c#110 (text) ====
Index: perl/pp.c
--- perl/pp.c#109~29807~        2007-01-14 05:09:22.000000000 -0800
+++ perl/pp.c   2007-01-17 14:07:40.000000000 -0800
@@ -2229,50 +2229,32 @@
     }
 }
 
-PP(pp_bit_xor)
-{
-    dSP; dATARGET; tryAMAGICbin(bxor,opASSIGN);
-    {
-      dPOPTOPssrl;
-      SvGETMAGIC(left);
-      SvGETMAGIC(right);
-      if (SvNIOKp(left) || SvNIOKp(right)) {
-       if (PL_op->op_private & HINT_INTEGER) {
-         const IV i = (USE_LEFT(left) ? SvIV_nomg(left) : 0) ^ 
SvIV_nomg(right);
-         SETi(i);
-       }
-       else {
-         const UV u = (USE_LEFT(left) ? SvUV_nomg(left) : 0) ^ 
SvUV_nomg(right);
-         SETu(u);
-       }
-      }
-      else {
-       do_vop(PL_op->op_type, TARG, left, right);
-       SETTARG;
-      }
-      RETURN;
-    }
-}
-
 PP(pp_bit_or)
 {
-    dSP; dATARGET; tryAMAGICbin(bor,opASSIGN);
+    dSP; dATARGET;
+    const int op_type = PL_op->op_type;
+
+    tryAMAGICbin_var((op_type == OP_BIT_OR ? bor_amg : bxor_amg), opASSIGN);
     {
       dPOPTOPssrl;
       SvGETMAGIC(left);
       SvGETMAGIC(right);
       if (SvNIOKp(left) || SvNIOKp(right)) {
        if (PL_op->op_private & HINT_INTEGER) {
-         const IV i = (USE_LEFT(left) ? SvIV_nomg(left) : 0) | 
SvIV_nomg(right);
-         SETi(i);
+         const IV l = (USE_LEFT(left) ? SvIV_nomg(left) : 0);
+         const IV r = SvIV_nomg(right);
+         const IV result = op_type == OP_BIT_OR ? (l | r) : (l ^ r);
+         SETi(result);
        }
        else {
-         const UV u = (USE_LEFT(left) ? SvUV_nomg(left) : 0) | 
SvUV_nomg(right);
-         SETu(u);
+         const UV l = (USE_LEFT(left) ? SvUV_nomg(left) : 0);
+         const UV r = SvUV_nomg(right);
+         const UV result = op_type == OP_BIT_OR ? (l | r) : (l ^ r);
+         SETu(result);
        }
       }
       else {
-       do_vop(PL_op->op_type, TARG, left, right);
+       do_vop(op_type, TARG, left, right);
        SETTARG;
       }
       RETURN;
@@ -2670,26 +2652,26 @@
     dSP; dTARGET;
     int amg_type = sin_amg;
     const char *neg_report = NULL;
-    NV (*func)(NV) = &Perl_sin;
+    NV (*func)(NV) = Perl_sin;
     const int op_type = PL_op->op_type;
 
     switch (op_type) {
     case OP_COS:
        amg_type = cos_amg;
-       func = &Perl_cos;
+       func = Perl_cos;
        break;
     case OP_EXP:
        amg_type = exp_amg;
-       func = &Perl_exp;
+       func = Perl_exp;
        break;
     case OP_LOG:
        amg_type = log_amg;
-       func = &Perl_log;
+       func = Perl_log;
        neg_report = "log";
        break;
     case OP_SQRT:
        amg_type = sqrt_amg;
-       func = &Perl_sqrt;
+       func = Perl_sqrt;
        neg_report = "sqrt";
        break;
     }

==== //depot/maint-5.8/perl/pp.h#20 (text) ====
Index: perl/pp.h
--- perl/pp.h#19~29791~ 2007-01-13 10:27:36.000000000 -0800
+++ perl/pp.h   2007-01-17 14:07:40.000000000 -0800
@@ -427,7 +427,11 @@
 #define tryAMAGICbinW(meth,assign,set) \
     tryAMAGICbinW_var(CAT2(meth,_amg),assign,set)
 
-#define tryAMAGICbin(meth,assign) tryAMAGICbinW(meth,assign,SETsv)
+#define tryAMAGICbin_var(meth_enum,assign) \
+               tryAMAGICbinW_var(meth_enum,assign,SETsv)
+#define tryAMAGICbin(meth,assign) \
+               tryAMAGICbin_var(CAT2(meth,_amg),assign)
+
 #define tryAMAGICbinSET(meth,assign) tryAMAGICbinW(meth,assign,SETs)
 
 #define tryAMAGICbinSET_var(meth_enum,assign) \

==== //depot/maint-5.8/perl/pp_ctl.c#140 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#139~29858~    2007-01-17 13:17:52.000000000 -0800
+++ perl/pp_ctl.c       2007-01-17 14:07:40.000000000 -0800
@@ -2280,7 +2280,7 @@
                    cx->blk_sub.hasargs = 0;
                }
                cx->blk_sub.cv = cv;
-               cx->blk_sub.olddepth = (U16)CvDEPTH(cv);
+               cx->blk_sub.olddepth = CvDEPTH(cv);
 
                CvDEPTH(cv)++;
                if (CvDEPTH(cv) < 2)

==== //depot/maint-5.8/perl/pp_sys.c#123 (text) ====
Index: perl/pp_sys.c
--- perl/pp_sys.c#122~29809~    2007-01-14 05:47:07.000000000 -0800
+++ perl/pp_sys.c       2007-01-17 14:07:40.000000000 -0800
@@ -307,8 +307,8 @@
 STATIC int
 S_emulate_eaccess(pTHX_ const char* path, Mode_t mode)
 {
-    (void)path;
-    (void)mode;
+    PERL_UNUSED_ARG(path);
+    PERL_UNUSED_ARG(mode);
     Perl_croak(aTHX_ "switching effective uid is not implemented");
     /*NOTREACHED*/
     return -1;

==== //depot/maint-5.8/perl/regcomp.c#77 (text) ====
Index: perl/regcomp.c
--- perl/regcomp.c#76~29804~    2007-01-14 04:22:41.000000000 -0800
+++ perl/regcomp.c      2007-01-17 14:07:40.000000000 -0800
@@ -5099,15 +5099,19 @@
        if (rx) {
            U32 i;
            for (i = 1; i <= rx->nparens; i++) {
+               GV *gv;
                char digits[TYPE_CHARS(long)];
 #ifdef USE_SNPRINTF
                const STRLEN len = snprintf(digits, sizeof(digits), "%lu", 
(long)i);
 #else
                const STRLEN len = my_sprintf(digits, "%lu", (long)i);
 #endif /* #ifdef USE_SNPRINTF */
-               GV * const mgv = gv_fetchpvn_flags(digits, len, 0, SVt_PV);
-               if (mgv)
-                   save_scalar(mgv);
+               GV *const *const gvp
+                   = (GV**)hv_fetch(PL_defstash, digits, len, 0);
+
+               if (gvp && SvTYPE(gv = *gvp) == SVt_PVGV && GvSV(gv)) {
+                   save_scalar(gv);
+               }
            }
        }
     }

==== //depot/maint-5.8/perl/scope.h#20 (text) ====
Index: perl/scope.h
--- perl/scope.h#19~29081~      2006-10-22 14:00:37.000000000 -0700
+++ perl/scope.h        2007-01-17 14:07:40.000000000 -0800
@@ -117,36 +117,32 @@
 #endif
 #define LEAVE_SCOPE(old) if (PL_savestack_ix > old) leave_scope(old)
 
-/*
- * Not using SOFT_CAST on SAVESPTR, SAVEGENERICSV and SAVEFREESV
- * because these are used for several kinds of pointer values
- */
-#define SAVEI8(i)      save_I8(SOFT_CAST(I8*)&(i))
-#define SAVEI16(i)     save_I16(SOFT_CAST(I16*)&(i))
-#define SAVEI32(i)     save_I32(SOFT_CAST(I32*)&(i))
-#define SAVEINT(i)     save_int(SOFT_CAST(int*)&(i))
-#define SAVEIV(i)      save_iv(SOFT_CAST(IV*)&(i))
-#define SAVELONG(l)    save_long(SOFT_CAST(long*)&(l))
-#define SAVEBOOL(b)    save_bool(SOFT_CAST(bool*)&(b))
+#define SAVEI8(i)      save_I8((I8*)&(i))
+#define SAVEI16(i)     save_I16((I16*)&(i))
+#define SAVEI32(i)     save_I32((I32*)&(i))
+#define SAVEINT(i)     save_int((int*)&(i))
+#define SAVEIV(i)      save_iv((IV*)&(i))
+#define SAVELONG(l)    save_long((long*)&(l))
+#define SAVEBOOL(b)    save_bool((bool*)&(b))
 #define SAVESPTR(s)    save_sptr((SV**)&(s))
-#define SAVEPPTR(s)    save_pptr(SOFT_CAST(char**)&(s))
+#define SAVEPPTR(s)    save_pptr((char**)&(s))
 #define SAVEVPTR(s)    save_vptr((void*)&(s))
 #define SAVEPADSV(s)   save_padsv(s)
 #define SAVEFREESV(s)  save_freesv((SV*)(s))
 #define SAVEMORTALIZESV(s)     save_mortalizesv((SV*)(s))
-#define SAVEFREEOP(o)  save_freeop(SOFT_CAST(OP*)(o))
-#define SAVEFREEPV(p)  save_freepv(SOFT_CAST(char*)(p))
-#define SAVECLEARSV(sv)        save_clearsv(SOFT_CAST(SV**)&(sv))
+#define SAVEFREEOP(o)  save_freeop((OP*)(o))
+#define SAVEFREEPV(p)  save_freepv((char*)(p))
+#define SAVECLEARSV(sv)        save_clearsv((SV**)&(sv))
 #define SAVEGENERICSV(s)       save_generic_svref((SV**)&(s))
 #define SAVEGENERICPV(s)       save_generic_pvref((char**)&(s))
 #define SAVESHAREDPV(s)                save_shared_pvref((char**)&(s))
 #define SAVEDELETE(h,k,l) \
-         save_delete(SOFT_CAST(HV*)(h), SOFT_CAST(char*)(k), (I32)(l))
+         save_delete((HV*)(h), (char*)(k), (I32)(l))
 #define SAVEDESTRUCTOR(f,p) \
-         save_destructor((DESTRUCTORFUNC_NOCONTEXT_t)(f), SOFT_CAST(void*)(p))
+         save_destructor((DESTRUCTORFUNC_NOCONTEXT_t)(f), (void*)(p))
 
 #define SAVEDESTRUCTOR_X(f,p) \
-         save_destructor_x((DESTRUCTORFUNC_t)(f), SOFT_CAST(void*)(p))
+         save_destructor_x((DESTRUCTORFUNC_t)(f), (void*)(p))
 
 #define SAVESTACK_POS() \
     STMT_START {                               \

==== //depot/maint-5.8/perl/sv.c#286 (text) ====
Index: perl/sv.c
--- perl/sv.c#285~29858~        2007-01-17 13:17:52.000000000 -0800
+++ perl/sv.c   2007-01-17 14:07:40.000000000 -0800
@@ -2382,16 +2382,8 @@
                Gconvert(SvNVX(sv), NV_DIG, 0, tbuf);
                len = strlen(tbuf);
            }
-           if (SvROK(sv)) {    /* XXX Skip this when sv_pvn_force calls */
-               /* Sneaky stuff here */
-               SV * const tsv = newSVpvn(tbuf, len);
-
-               sv_2mortal(tsv);
-               if (lp)
-                   *lp = SvCUR(tsv);
-               return SvPVX(tsv);
-           }
-           else {
+           assert(!SvROK(sv));
+           {
 
 #ifdef FIXNEGATIVEZERO
                if (len == 2 && tbuf[0] == '-' && tbuf[1] == '0') {
@@ -3079,8 +3071,6 @@
                sv_upgrade(dstr, SVt_IV);
                break;
            case SVt_NV:
-               sv_upgrade(dstr, SVt_PVNV);
-               break;
            case SVt_RV:
            case SVt_PV:
                sv_upgrade(dstr, SVt_PVIV);
@@ -3175,6 +3165,8 @@
            (void)SvUPGRADE(dstr, (U32)stype);
     }
 
+    /* dstr may have been upgraded.  */
+    dtype = SvTYPE(dstr);
     sflags = SvFLAGS(sstr);
 
     if (sflags & SVf_ROK) {

==== //depot/maint-5.8/perl/xsutils.c#23 (text) ====
Index: perl/xsutils.c
--- perl/xsutils.c#22~29802~    2007-01-13 16:36:51.000000000 -0800
+++ perl/xsutils.c      2007-01-17 14:07:40.000000000 -0800
@@ -271,10 +271,6 @@
            else if (/* !CvANON(sv) && */ CvSTASH(sv))
                stash = CvSTASH(sv);
            break;
-       case SVt_PVMG:
-           if (!(SvFAKE(sv) && SvTIED_mg(sv, PERL_MAGIC_glob)))
-               break;
-           /*FALLTHROUGH*/
        case SVt_PVGV:
            if (GvGP(sv) && GvESTASH((GV*)sv))
                stash = GvESTASH((GV*)sv);
End of Patch.

Reply via email to