Rearrange some private op flag constants
authorFather Chrysostomos <sprout@cpan.org>
Fri, 3 Jun 2011 13:26:18 +0000 (06:26 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Fri, 3 Jun 2011 16:17:14 +0000 (09:17 -0700)
Some constants in op.h were a bit muddled up and were not grouped
according to which ops used them. And one of the comments was wrong.
The history is a bit involved:

Commit 7a52d87 added this comment, which was correct:

+  /* OP_RV2CV only */
 #define OPpENTERSUB_AMPER 8 /* Used & form to call. */

Commit 9675f7a added this constant:

   /* OP_RV2CV only */
 #define OPpENTERSUB_AMPER 8 /* Used & form to call. */
+#define OPpENTERSUB_NOPAREN 128 /* bare sub call (without parens) */

Commit cd06dff added this one, which is confusing, as it is only used
on entersub:

   /* OP_RV2CV only */
 #define OPpENTERSUB_AMPER 8 /* Used & form to call. */
 #define OPpENTERSUB_NOPAREN 128 /* bare sub call (without parens) */
+#define OPpENTERSUB_INARGS 4 /* Lval used as arg to a sub. */

Commit e26df76 added this, resulting in there being two
OP_RV2CV sections:

+  /* OP_RV2CV only */
+#define OPpMAY_RETURN_CONSTANT 1 /* If a constant sub, return the constant */
+

To top it all, commit b900987 unfortunately ‘fixed’ a mislead-
ing comment:

-  /* OP_RV2CV only */
+  /* OP_ENTERSUB and OP_RV2CV only */
 #define OPpENTERSUB_AMPER 8 /* Used & form to call. */
 #define OPpENTERSUB_NOPAREN 128 /* bare sub call (without parens) */
 #define OPpENTERSUB_INARGS 4 /* Lval used as arg to a sub. */

op.h

diff --git a/op.h b/op.h
index ae6989a..5466e57 100644 (file)
--- a/op.h
+++ b/op.h
@@ -203,10 +203,12 @@ Deprecated.  Use C<GIMME_V> instead.
 #define OPpENTERSUB_DB         16      /* Debug subroutine. */
 #define OPpENTERSUB_HASTARG    32      /* Called from OP tree. */
 #define OPpENTERSUB_NOMOD      64      /* Immune to op_lvalue() for :attrlist. */
-  /* OP_ENTERSUB and OP_RV2CV only */
+#define OPpENTERSUB_INARGS     4       /* Lval used as arg to a sub. */
+  /* OP_RV2CV only */
 #define OPpENTERSUB_AMPER      8       /* Used & form to call. */
 #define OPpENTERSUB_NOPAREN    128     /* bare sub call (without parens) */
-#define OPpENTERSUB_INARGS     4       /* Lval used as arg to a sub. */
+#define OPpMAY_RETURN_CONSTANT 1       /* If a constant sub, return the constant */
+
   /* OP_GV only */
 #define OPpEARLY_CV            32      /* foo() called before sub foo was parsed */
   /* OP_?ELEM only */
@@ -224,9 +226,6 @@ Deprecated.  Use C<GIMME_V> instead.
 /* (Therefore will return whatever is currently in the symbol table, not
    guaranteed to be a PVGV)  */
 
-  /* OP_RV2CV only */
-#define OPpMAY_RETURN_CONSTANT 1       /* If a constant sub, return the constant */
-
 /* Private for OPs with TARGLEX */
   /* (lower bits may carry MAXARG) */
 #define OPpTARGET_MY           16      /* Target is PADMY. */