summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2015-01-04 11:44:03 -0800
committerFather Chrysostomos <sprout@cpan.org>2015-01-31 22:03:51 -0800
commita6eb74ec7f79f7c519927e9496acfe0a09cd1726 (patch)
tree785280276ae99b5aac7dc57d3740e7db84af2f85
parent27f31adf88291fb0c1238c9bb558f95a54a8555b (diff)
downloadperl-a6eb74ec7f79f7c519927e9496acfe0a09cd1726.tar.gz
Warning about experimental bitops
-rw-r--r--op.c7
-rw-r--r--opcode.h2
-rw-r--r--pod/perldiag.pod12
-rw-r--r--regen/opcodes4
4 files changed, 23 insertions, 2 deletions
diff --git a/op.c b/op.c
index b5de89ac77..db53f97a34 100644
--- a/op.c
+++ b/op.c
@@ -9481,6 +9481,13 @@ Perl_ck_bitop(pTHX_ OP *o)
PERL_ARGS_ASSERT_CK_BITOP;
o->op_private = (U8)(PL_hints & HINT_INTEGER);
+
+ if (o->op_type == OP_NBIT_OR || o->op_type == OP_SBIT_OR
+ || o->op_type == OP_NBIT_XOR || o->op_type == OP_SBIT_XOR
+ || o->op_type == OP_NBIT_AND || o->op_type == OP_SBIT_AND
+ || o->op_type == OP_NCOMPLEMENT || o->op_type == OP_SCOMPLEMENT)
+ Perl_ck_warner_d(aTHX_ packWARN(WARN_EXPERIMENTAL__BITWISE),
+ "The bitwise feature is experimental");
if (!(o->op_flags & OPf_STACKED) /* Not an assignment */
&& OP_IS_INFIX_BIT(o->op_type))
{
diff --git a/opcode.h b/opcode.h
index edb2702b48..cf39a4b57a 100644
--- a/opcode.h
+++ b/opcode.h
@@ -1492,7 +1492,7 @@ EXT Perl_check_t PL_check[] /* or perlvars.h */
Perl_ck_null, /* not */
Perl_ck_bitop, /* complement */
Perl_ck_bitop, /* ncomplement */
- Perl_ck_null, /* scomplement */
+ Perl_ck_bitop, /* scomplement */
Perl_ck_smartmatch, /* smartmatch */
Perl_ck_fun, /* atan2 */
Perl_ck_fun, /* sin */
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index e6b056238d..877b992270 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -5750,6 +5750,18 @@ as a compiler directive. You may say only one of
This is to prevent the problem of one module changing the array base out
from under another module inadvertently. See L<perlvar/$[> and L<arybase>.
+=item The bitwise feature is experimental
+
+(S experimental::bitwise) This warning is emitted if you use bitwise
+operators (C<& | ^ ~ &. |. ^. ~.>) with the "bitwise" feature enabled.
+Simply suppress the warning if you want to use the feature, but know
+that in doing so you are taking the risk of using an experimental
+feature which may change or be removed in a future Perl version:
+
+ no warnings "experimental::bitwise";
+ use feature "bitwise";
+ $x |.= $y;
+
=item The crypt() function is unimplemented due to excessive paranoia.
(F) Configure couldn't find the crypt() function on your machine,
diff --git a/regen/opcodes b/regen/opcodes
index cbf38dce50..8bbd557036 100644
--- a/regen/opcodes
+++ b/regen/opcodes
@@ -177,7 +177,9 @@ i_negate integer negation (-) ck_null ifst1 S
not not ck_null ifs1 S
complement 1's complement (~) ck_bitop fsT1 S
ncomplement numeric 1's complement (~) ck_bitop fsT1 S
-scomplement string 1's complement (~) ck_null fsT1 S
+# scomplement uses ck_bitop only for the experimental warning. Once the
+# warning is gone, this can change to ck_null.
+scomplement string 1's complement (~) ck_bitop fsT1 S
smartmatch smart match ck_smartmatch s2