summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dump.c4
-rw-r--r--op.c2
-rw-r--r--op.h7
-rwxr-xr-xopcode.pl28
-rw-r--r--opnames.h3
5 files changed, 23 insertions, 21 deletions
diff --git a/dump.c b/dump.c
index bd11207239..7ad09b1e0c 100644
--- a/dump.c
+++ b/dump.c
@@ -982,7 +982,7 @@ Perl_do_op_dump(pTHX_ I32 level, PerlIO *file, const OP *o)
sv_catpv(tmpsv, ",HUSH_VMSISH");
}
else if (PL_check[optype] != MEMBER_TO_FPTR(Perl_ck_ftst)) {
- if (OP_IS_FILETEST_ACCESS(o) && o->op_private & OPpFT_ACCESS)
+ if (OP_IS_FILETEST_ACCESS(o->op_type) && o->op_private & OPpFT_ACCESS)
sv_catpv(tmpsv, ",FT_ACCESS");
if (o->op_private & OPpFT_STACKED)
sv_catpv(tmpsv, ",FT_STACKED");
@@ -2800,7 +2800,7 @@ Perl_do_op_xmldump(pTHX_ I32 level, PerlIO *file, const OP *o)
sv_catpv(tmpsv, ",HUSH_VMSISH");
}
else if (PL_check[o->op_type] != MEMBER_TO_FPTR(Perl_ck_ftst)) {
- if (OP_IS_FILETEST_ACCESS(o) && o->op_private & OPpFT_ACCESS)
+ if (OP_IS_FILETEST_ACCESS(o->op_type) && o->op_private & OPpFT_ACCESS)
sv_catpv(tmpsv, ",FT_ACCESS");
if (o->op_private & OPpFT_STACKED)
sv_catpv(tmpsv, ",FT_STACKED");
diff --git a/op.c b/op.c
index 4e0695f92b..0e78eb12ca 100644
--- a/op.c
+++ b/op.c
@@ -6683,7 +6683,7 @@ Perl_ck_ftst(pTHX_ OP *o)
#endif
return newop;
}
- if ((PL_hints & HINT_FILETEST_ACCESS) && OP_IS_FILETEST_ACCESS(o))
+ if ((PL_hints & HINT_FILETEST_ACCESS) && OP_IS_FILETEST_ACCESS(o->op_type))
o->op_private |= OPpFT_ACCESS;
if (PL_check[kidtype] == MEMBER_TO_FPTR(Perl_ck_ftst)
&& kidtype != OP_STAT && kidtype != OP_LSTAT)
diff --git a/op.h b/op.h
index e128ec969c..4ad2a2bcfc 100644
--- a/op.h
+++ b/op.h
@@ -266,13 +266,6 @@ Deprecated. Use C<GIMME_V> instead.
/* Private for OP_FTXXX */
#define OPpFT_ACCESS 2 /* use filetest 'access' */
#define OPpFT_STACKED 4 /* stacked filetest, as in "-f -x $f" */
-#define OP_IS_FILETEST_ACCESS(op) \
- (((op)->op_type) == OP_FTRREAD || \
- ((op)->op_type) == OP_FTRWRITE || \
- ((op)->op_type) == OP_FTREXEC || \
- ((op)->op_type) == OP_FTEREAD || \
- ((op)->op_type) == OP_FTEWRITE || \
- ((op)->op_type) == OP_FTEEXEC)
/* Private for OP_(MAP|GREP)(WHILE|START) */
#define OPpGREP_LEX 2 /* iterate over lexical $_ */
diff --git a/opcode.pl b/opcode.pl
index e8c43ddb55..a5dfa57787 100755
--- a/opcode.pl
+++ b/opcode.pl
@@ -344,6 +344,7 @@ my %opflags = (
my %OP_IS_SOCKET;
my %OP_IS_FILETEST;
+my %OP_IS_FT_ACCESS;
my $OCSHIFT = 9;
my $OASHIFT = 13;
@@ -366,6 +367,7 @@ for my $op (@ops) {
# record opnums of these opnames
$OP_IS_SOCKET{$op} = $opnum{$op} if $arg =~ s/s//;
$OP_IS_FILETEST{$op} = $opnum{$op} if $arg =~ s/-//;
+ $OP_IS_FT_ACCESS{$op} = $opnum{$op} if $arg =~ s/\+//;
}
my $argnum = ($arg =~ s/\?//) ? 8 : 0;
die "op = $op, arg = $arg\n"
@@ -403,6 +405,7 @@ EO_OP_IS_COMMENT
gen_op_is_macro( \%OP_IS_SOCKET, 'OP_IS_SOCKET');
gen_op_is_macro( \%OP_IS_FILETEST, 'OP_IS_FILETEST');
+gen_op_is_macro( \%OP_IS_FT_ACCESS, 'OP_IS_FILETEST_ACCESS');
sub gen_op_is_macro {
my ($op_is, $macname) = @_;
@@ -414,20 +417,21 @@ sub gen_op_is_macro {
} keys %$op_is;
my $last = pop @rest; # @rest slurped, get its last
-
+ die "invalid range of ops: $first .. $last" unless $last;
+
+ print ON "#define $macname(op) \\\n\t(";
+
# verify that op-ct matches 1st..last range (and fencepost)
# (we know there are no dups)
if ( $op_is->{$last} - $op_is->{$first} == scalar @rest + 1) {
# contiguous ops -> optimized version
- print ON "#define $macname(op) \\\n\t(";
print ON "(op) >= OP_" . uc($first) . " && (op) <= OP_" . uc($last);
print ON ")\n\n";
}
else {
- print ON "\n#define $macname(op) \\\n\t(";
print ON join(" || \\\n\t ",
- map { "(op) == OP_" . uc() } sort keys %OP_IS_SOCKET);
+ map { "(op) == OP_" . uc() } sort keys %$op_is);
print ON ")\n\n";
}
}
@@ -602,7 +606,9 @@ __END__
# Values for the operands are:
# scalar - S list - L array - A
# hash - H sub (CV) - C file - F
-# socket - Fs filetest - F- reference - R
+# socket - Fs filetest - F- filetest_access - F-+
+
+# reference - R
# "?" denotes an optional operand.
# Nothing.
@@ -948,12 +954,12 @@ getpeername getpeername ck_fun is% Fs
lstat lstat ck_ftst u- F
stat stat ck_ftst u- F
-ftrread -R ck_ftst isu- F-
-ftrwrite -W ck_ftst isu- F-
-ftrexec -X ck_ftst isu- F-
-fteread -r ck_ftst isu- F-
-ftewrite -w ck_ftst isu- F-
-fteexec -x ck_ftst isu- F-
+ftrread -R ck_ftst isu- F-+
+ftrwrite -W ck_ftst isu- F-+
+ftrexec -X ck_ftst isu- F-+
+fteread -r ck_ftst isu- F-+
+ftewrite -w ck_ftst isu- F-+
+fteexec -x ck_ftst isu- F-+
ftis -e ck_ftst isu- F-
ftsize -s ck_ftst istu- F-
ftmtime -M ck_ftst stu- F-
diff --git a/opnames.h b/opnames.h
index ac6d259ecd..e0012ed8e2 100644
--- a/opnames.h
+++ b/opnames.h
@@ -398,4 +398,7 @@ typedef enum opcode {
#define OP_IS_FILETEST(op) \
((op) >= OP_FTRREAD && (op) <= OP_FTBINARY)
+#define OP_IS_FILETEST_ACCESS(op) \
+ ((op) >= OP_FTRREAD && (op) <= OP_FTEEXEC)
+
/* ex: set ro: */