: Only used in op.c
pd |PADOFFSET|pad_add_anon |NN SV* sv|OPCODE op_type
: Only used in op.c
-pd |void |pad_check_dup |NN const char* name|bool is_our|NN const HV* ourstash
+Mpd |void |pad_check_dup |NN const char *name|const STRLEN len\
+ |const U32 flags|NN const HV *ourstash
#ifdef DEBUGGING
: Only used PAD_SETSV() in op.c
pd |void |pad_setsv |PADOFFSET po|NN SV* sv
#define pad_undef(a) Perl_pad_undef(aTHX_ a)
#define pad_add_name(a,b,c,d,e) Perl_pad_add_name(aTHX_ a,b,c,d,e)
#define pad_add_anon(a,b) Perl_pad_add_anon(aTHX_ a,b)
-#define pad_check_dup(a,b,c) Perl_pad_check_dup(aTHX_ a,b,c)
+#define pad_check_dup(a,b,c,d) Perl_pad_check_dup(aTHX_ a,b,c,d)
#endif
#ifdef DEBUGGING
#ifdef PERL_CORE
}
/* check for duplicate declaration */
- pad_check_dup(name, is_our, (PL_curstash ? PL_curstash : PL_defstash));
+ pad_check_dup(name, len, is_our ? pad_add_OUR : 0,
+ (PL_curstash ? PL_curstash : PL_defstash));
/* allocate a spare slot and store the name in that slot */
/* XXX DAPM integrate this into pad_add_name ??? */
void
-Perl_pad_check_dup(pTHX_ const char *name, bool is_our, const HV *ourstash)
+Perl_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags,
+ const HV *ourstash)
{
dVAR;
SV **svp;
PADOFFSET top, off;
+ const U32 is_our = flags & pad_add_OUR;
PERL_ARGS_ASSERT_PAD_CHECK_DUP;
ASSERT_CURPAD_ACTIVE("pad_check_dup");
+
+ if (flags & ~pad_add_OUR)
+ Perl_croak(aTHX_ "panic: pad_check_dup illegal flag bits 0x%" UVxf,
+ (UV)flags);
+
+ /* Until we're using the length for real, cross check that we're being told
+ the truth. */
+ PERL_UNUSED_ARG(len);
+ assert(strlen(name) == len);
+
if (AvFILLp(PL_comppad_name) < 0 || !ckWARN(WARN_MISC))
return; /* nothing to check */
padtidy_FORMAT /* or a format */
} padtidy_type;
+#ifdef PERL_CORE
+
+/* flags for pad_add_name/pad_check_dup. SVf_UTF8 will also be valid in the
+ future. */
+
+# define pad_add_OUR 0x01 /* our declaration. */
+# define pad_add_STATE 0x02 /* state declaration. */
+# define pad_add_FAKE 0x04
+
+#endif
+
/* ASSERT_CURPAD_LEGAL and ASSERT_CURPAD_ACTIVE respectively determine
* whether PL_comppad and PL_curpad are consistent and whether they have
* active values */
#define PERL_ARGS_ASSERT_PAD_ADD_ANON \
assert(sv)
-PERL_CALLCONV void Perl_pad_check_dup(pTHX_ const char* name, bool is_our, const HV* ourstash)
+PERL_CALLCONV void Perl_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags, const HV *ourstash)
__attribute__nonnull__(pTHX_1)
- __attribute__nonnull__(pTHX_3);
+ __attribute__nonnull__(pTHX_4);
#define PERL_ARGS_ASSERT_PAD_CHECK_DUP \
assert(name); assert(ourstash)