From: Jan Dubois Date: Thu, 14 Feb 2008 11:24:01 +0000 (-0800) Subject: Silence compiler warnings on Win32/VC6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0053d415f506c0bd87de287f5b4d68652d94b7b1;p=p5sagit%2Fp5-mst-13.2.git Silence compiler warnings on Win32/VC6 Subject: RE: Bit-fields patch causes warnings on Win32/VC6 From: "Jan Dubois" Message-ID: <002f01c86f3f$27e23ca0$77a6b5e0$@com> p4raw-id: //depot/perl@33315 --- diff --git a/ext/B/B.xs b/ext/B/B.xs index 7eff7b9..9d65a72 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -916,7 +916,7 @@ OP_type(o) #if PERL_VERSION >= 9 -U8 +U16 OP_opt(o) B::OP o @@ -938,7 +938,7 @@ OP_private(o) #if PERL_VERSION >= 9 -U8 +U16 OP_spare(o) B::OP o diff --git a/op.c b/op.c index 3ec1979..92a5c34 100644 --- a/op.c +++ b/op.c @@ -548,7 +548,7 @@ Perl_op_clear(pTHX_ OP *o) switch (o->op_type) { case OP_NULL: /* Was holding old type, if any. */ if (PL_madskills && o->op_targ != OP_NULL) { - o->op_type = o->op_targ; + o->op_type = (optype)o->op_targ; o->op_targ = 0; goto retry; } @@ -5039,7 +5039,7 @@ S_newGIVWHENOP(pTHX_ OP *cond, OP *block, PERL_ARGS_ASSERT_NEWGIVWHENOP; NewOp(1101, enterop, 1, LOGOP); - enterop->op_type = enter_opcode; + enterop->op_type = (optype)enter_opcode; enterop->op_ppaddr = PL_ppaddr[enter_opcode]; enterop->op_flags = (U8) OPf_KIDS; enterop->op_targ = ((entertarg == NOT_IN_PAD) ? 0 : entertarg); diff --git a/op.h b/op.h index b35e9da..b230988 100644 --- a/op.h +++ b/op.h @@ -45,6 +45,8 @@ # define MADPROP_IN_BASEOP #endif +typedef PERL_BITFIELD16 optype; + #ifdef BASEOP_DEFINITION #define BASEOP BASEOP_DEFINITION #else @@ -64,7 +66,10 @@ U8 op_private; #endif -/* If op_type:9 is changed to :10, also change PUSHEVAL in cop.h */ +/* If op_type:9 is changed to :10, also change PUSHEVAL in cop.h. + Also, if the type of op_type is ever changed (e.g. to PERL_BITFIELD32) + then all the other bit-fields before/after it should change their + types too to let VC pack them into the same 4 byte integer.*/ #define OP_GIMME(op,dfl) \ (((op)->op_flags & OPf_WANT) == OPf_WANT_VOID ? G_VOID : \