Change (l)stat’s prototype from * to ;*
authorFather Chrysostomos <sprout@cpan.org>
Fri, 12 Aug 2011 05:19:50 +0000 (22:19 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 12 Aug 2011 13:28:10 +0000 (06:28 -0700)
Since the argument is optional, we need a semicolon.

This commit accomplishes that by setting the OA_OPTIONAL flag for the
appropriate  entries in PL_opargs.  This should not affect anything
else, as ck_ftst (the check routine for [l]stat) doesn’t even look at
PL_opargs.

It also has to tweak the prototype-generation logic slightly, because
PL_opargs also has OA_DEFGV set.

I think this is insignificant enough not to warrant a delta entry.

op.c
opcode.h
regen/opcodes
t/op/cproto.t

diff --git a/op.c b/op.c
index b42069a..0ab2d1e 100644 (file)
--- a/op.c
+++ b/op.c
@@ -10314,7 +10314,9 @@ Perl_core_prototype(pTHX_ SV *sv, const char *name, const STRLEN len,
     defgv = PL_opargs[i] & OA_DEFGV;
     oa = PL_opargs[i] >> OASHIFT;
     while (oa) {
-       if (oa & OA_OPTIONAL && !seen_question && (!defgv || n)) {
+       if (oa & OA_OPTIONAL && !seen_question && (
+             !defgv || n || (oa & (OA_OPTIONAL - 1)) == OA_FILEREF
+       )) {
            seen_question = 1;
            str[n++] = ';';
        }
index fb64ae2..73c81dd 100644 (file)
--- a/opcode.h
+++ b/opcode.h
@@ -1939,8 +1939,8 @@ EXTCONST U32 PL_opargs[] = {
        0x01116404,     /* ssockopt */
        0x00006b04,     /* getsockname */
        0x00006b04,     /* getpeername */
-       0x00006c80,     /* lstat */
-       0x00006c80,     /* stat */
+       0x0000ec80,     /* lstat */
+       0x0000ec80,     /* stat */
        0x00006c84,     /* ftrread */
        0x00006c84,     /* ftrwrite */
        0x00006c84,     /* ftrexec */
index 2611111..ec9c5a7 100644 (file)
@@ -379,8 +379,8 @@ getpeername getpeername             ck_fun          is%     Fs
 
 # Stat calls.  OP_IS_FILETEST wants them consecutive.
 
-lstat          lstat                   ck_ftst         u-      F
-stat           stat                    ck_ftst         u-      F
+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-+
index 7d63c68..9711f82 100644 (file)
@@ -140,7 +140,7 @@ local undef
 localtime (;$)
 lock (\[$@%*])
 log (_)
-lstat (*)
+lstat (;*)
 lt undef
 m undef
 map undef
@@ -227,7 +227,7 @@ split undef
 sprintf ($@)
 sqrt (_)
 srand (;$)
-stat (*)
+stat (;*)
 state undef
 study undef
 sub undef