|NULLOK HV *ourstash
: Only used in op.c
pd |PADOFFSET|pad_add_anon |NN SV* sv|OPCODE op_type
-: Only used in op.c
-Mpd |void |pad_check_dup |NN const char *name|const STRLEN len\
- |const U32 flags|NN const HV *ourstash
+#if defined(PERL_IN_PAD_C) || defined(PERL_DECL_PROT)
+sd |void |pad_check_dup |NN const char *name|const STRLEN len\
+ |const U32 flags|NULLOK const HV *ourstash
+#endif
#ifdef DEBUGGING
: Only used PAD_SETSV() in op.c
pd |void |pad_setsv |PADOFFSET po|NN SV* sv
#define pad_undef Perl_pad_undef
#define pad_add_name Perl_pad_add_name
#define pad_add_anon Perl_pad_add_anon
-#define pad_check_dup Perl_pad_check_dup
+#endif
+#if defined(PERL_IN_PAD_C) || defined(PERL_DECL_PROT)
+#ifdef PERL_CORE
+#define pad_check_dup S_pad_check_dup
+#endif
#endif
#ifdef DEBUGGING
#ifdef PERL_CORE
#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,d) Perl_pad_check_dup(aTHX_ a,b,c,d)
+#endif
+#if defined(PERL_IN_PAD_C) || defined(PERL_DECL_PROT)
+#ifdef PERL_CORE
+#define pad_check_dup(a,b,c,d) S_pad_check_dup(aTHX_ a,b,c,d)
+#endif
#endif
#ifdef DEBUGGING
#ifdef PERL_CORE
}
}
- /* check for duplicate declaration */
- pad_check_dup(name, len, is_our ? pad_add_OUR : 0,
- (PL_curstash && !strEQ(name,"$_") ? PL_curstash : PL_defstash));
-
/* allocate a spare slot and store the name in that slot */
off = pad_add_name(name, len,
+ is_our ? pad_add_OUR :
PL_parser->in_my == KEY_state ? pad_add_STATE : 0,
PL_parser->in_my_stash,
(is_our
PERL_ARGS_ASSERT_PAD_ADD_NAME;
- if (flags & ~(pad_add_STATE))
+ if (flags & ~(pad_add_OUR|pad_add_STATE|pad_add_NO_DUP_CHECK))
Perl_croak(aTHX_ "panic: pad_add_name illegal flag bits 0x%" UVxf,
(UV)flags);
+
+ if ((flags & pad_add_NO_DUP_CHECK) == 0) {
+ /* check for duplicate declaration */
+ pad_check_dup(name, len, flags & pad_add_OUR, ourstash);
+ }
+
namesv = newSV_type((ourstash || typestash) ? SVt_PVMG : SVt_PVNV);
/* Until we're using the length for real, cross check that we're being told
=cut
*/
-/* XXX DAPM integrate this into pad_add_name ??? */
-
void
-Perl_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags,
+S_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags,
const HV *ourstash)
{
dVAR;
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);
+ assert((flags & ~pad_add_OUR) == 0);
/* Until we're using the length for real, cross check that we're being told
the truth. */
#ifdef PERL_CORE
-/* flags for pad_add_name/pad_check_dup. SVf_UTF8 will also be valid in the
- future. */
+/* flags for pad_add_name. 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_NO_DUP_CHECK 0x04 /* skip warning on dups. */
#endif
#define PERL_ARGS_ASSERT_PAD_ADD_ANON \
assert(sv)
-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_4);
+#if defined(PERL_IN_PAD_C) || defined(PERL_DECL_PROT)
+STATIC void S_pad_check_dup(pTHX_ const char *name, const STRLEN len, const U32 flags, const HV *ourstash)
+ __attribute__nonnull__(pTHX_1);
#define PERL_ARGS_ASSERT_PAD_CHECK_DUP \
- assert(name); assert(ourstash)
+ assert(name)
+#endif
#ifdef DEBUGGING
PERL_CALLCONV void Perl_pad_setsv(pTHX_ PADOFFSET po, SV* sv)
__attribute__nonnull__(pTHX_2);