This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Cleaned up warning messages in pad.c, plus related tests.
[perl5.git] / pad.h
diff --git a/pad.h b/pad.h
index 8602eda..184b067 100644 (file)
--- a/pad.h
+++ b/pad.h
@@ -10,7 +10,9 @@
  * variables, op targets and constants.
  */
 
-
+/*
+=head1 Pad Data Structures
+*/
 
 
 /* a padlist is currently just an AV; but that might change,
@@ -31,6 +33,12 @@ typedef U64TYPE PADOFFSET;
 #endif
 #define NOT_IN_PAD ((PADOFFSET) -1)
 
+/* a value that PL_cop_seqmax is guaranteed never to be,
+ * flagging that a lexical is being introduced, or has not yet left scope
+ */
+#define PERL_PADSEQ_INTRO  U32_MAX
+
+
 /* B.xs needs these for the benefit of B::Deparse */
 /* Low range end is exclusive (valid from the cop seq after this one) */
 /* High range end is inclusive (valid up to this cop seq) */
@@ -112,15 +120,12 @@ typedef enum {
        padtidy_FORMAT          /* or a format */
 } padtidy_type;
 
-#ifdef PERL_CORE
+/* flags for pad_add_name_pvn. */
 
-/* flags for pad_add_name. SVf_UTF8 will also be valid in the future.  */
-
-#  define padadd_OUR           0x01    /* our declaration. */
-#  define padadd_STATE         0x02    /* state declaration. */
-#  define padadd_NO_DUP_CHECK  0x04    /* skip warning on dups. */
-
-#endif
+#define padadd_OUR             0x01       /* our declaration. */
+#define padadd_STATE           0x02       /* state declaration. */
+#define padadd_NO_DUP_CHECK    0x04       /* skip warning on dups. */
+#define padadd_UTF8_NAME       SVf_UTF8   /* name is UTF-8 encoded. */
 
 /* ASSERT_CURPAD_LEGAL and ASSERT_CURPAD_ACTIVE respectively determine
  * whether PL_comppad and PL_curpad are consistent and whether they have
@@ -303,8 +308,7 @@ ling pad (lvalue) to C<gen>.  Note that C<SvUV_set> is hijacked for this purpose
 
 #define PAD_COMPNAME_SV(po) (*av_fetch(PL_comppad_name, (po), FALSE))
 #define PAD_COMPNAME_FLAGS(po) SvFLAGS(PAD_COMPNAME_SV(po))
-#define PAD_COMPNAME_FLAGS_isOUR(po) \
-  ((PAD_COMPNAME_FLAGS(po) & (SVpad_NAME|SVpad_OUR)) == (SVpad_NAME|SVpad_OUR))
+#define PAD_COMPNAME_FLAGS_isOUR(po) SvPAD_OUR(PAD_COMPNAME_SV(po))
 #define PAD_COMPNAME_PV(po) SvPV_nolen(PAD_COMPNAME_SV(po))
 
 #define PAD_COMPNAME_TYPE(po) pad_compname_type(po)
@@ -361,6 +365,30 @@ Clone the state variables associated with running and compiling pads.
     PL_cop_seqmax              = proto_perl->Icop_seqmax;
 
 /*
+=for apidoc Am|PADOFFSET|pad_add_name_pvs|const char *name|U32 flags|HV *typestash|HV *ourstash
+
+Exactly like L</pad_add_name_pvn>, but takes a literal string instead
+of a string/length pair.
+
+=cut
+*/
+
+#define pad_add_name_pvs(name,flags,typestash,ourstash) \
+    Perl_pad_add_name_pvn(aTHX_ STR_WITH_LEN(name), flags, typestash, ourstash)
+
+/*
+=for apidoc Am|PADOFFSET|pad_findmy_pvs|const char *name|U32 flags
+
+Exactly like L</pad_findmy_pvn>, but takes a literal string instead
+of a string/length pair.
+
+=cut
+*/
+
+#define pad_findmy_pvs(name,flags) \
+    Perl_pad_findmy_pvn(aTHX_ STR_WITH_LEN(name), flags)
+
+/*
  * Local variables:
  * c-indentation-style: bsd
  * c-basic-offset: 4