From 1fbd88dca62ac1229f868175c997834e730e5134 Mon Sep 17 00:00:00 2001 From: Chip Salzenberg Date: Tue, 7 Jan 1997 10:00:11 +1200 Subject: [PATCH] Finish OP= warnings: none on ^= --- doop.c | 4 ++-- pp.c | 4 ++-- t/op/assignwarn.t | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doop.c b/doop.c index 2dccbb9..cb5560c 100644 --- a/doop.c +++ b/doop.c @@ -535,8 +535,8 @@ SV *right; char *lsave; char *rsave; - if (optype == OP_BIT_OR && sv == left && !SvOK(sv) && !SvGMAGICAL(sv)) - sv_setpvn(sv, "", 0); /* avoid undef warning on |= */ + if (sv != left || (optype != OP_BIT_AND && !SvOK(sv) && !SvGMAGICAL(sv))) + sv_setpvn(sv, "", 0); /* avoid undef warning on |= and ^= */ lsave = lc = SvPV(left, leftlen); rsave = rc = SvPV(right, rightlen); len = leftlen < rightlen ? leftlen : rightlen; diff --git a/pp.c b/pp.c index 089d523..7a24843 100644 --- a/pp.c +++ b/pp.c @@ -977,11 +977,11 @@ PP(pp_bit_xor) dPOPTOPssrl; if (SvNIOKp(left) || SvNIOKp(right)) { if (op->op_private & HINT_INTEGER) { - IBW value = SvIV(left) ^ SvIV(right); + IBW value = (USE_LEFT(left) ? SvIV(left) : 0) ^ SvIV(right); SETi( value ); } else { - UBW value = SvUV(left) ^ SvUV(right); + UBW value = (USE_LEFT(left) ? SvUV(left) : 0) ^ SvUV(right); SETu( value ); } } diff --git a/t/op/assignwarn.t b/t/op/assignwarn.t index 32ee5bb..57e89c4 100755 --- a/t/op/assignwarn.t +++ b/t/op/assignwarn.t @@ -43,7 +43,7 @@ print "1..23\n"; { my $x; $x &= 1; ok 13, uninitialized; } { my $x; $x |= 1; ok 14, ! uninitialized; } -{ my $x; $x ^= 1; ok 15, uninitialized; } +{ my $x; $x ^= 1; ok 15, ! uninitialized; } { my $x; $x &&= 1; ok 16, ! uninitialized; } { my $x; $x ||= 1; ok 17, ! uninitialized; } @@ -53,7 +53,7 @@ print "1..23\n"; { my $x; $x &= "x"; ok 20, uninitialized; } { my $x; $x |= "x"; ok 21, ! uninitialized; } -{ my $x; $x ^= "x"; ok 22, uninitialized; } +{ my $x; $x ^= "x"; ok 22, ! uninitialized; } ok 23, $warn eq ''; -- 2.7.4