#define dUNDERBAR I32 padoff_du = find_rundefsvoffset()
#define UNDERBAR ((padoff_du == NOT_IN_PAD \
- || PAD_COMPNAME_FLAGS(padoff_du) & SVpad_OUR) \
+ || PAD_COMPNAME_FLAGS_isOUR(padoff_du)) \
? DEFSV : PAD_SVl(padoff_du))
/* Simple macros to put new mortal values onto the stack. */
if (GvUNIQUE(sv)) sv_catpv(d, "UNIQUE,");
if (GvASSUMECV(sv)) sv_catpv(d, "ASSUMECV,");
if (GvIN_PAD(sv)) sv_catpv(d, "IN_PAD,");
- if (flags & SVpad_OUR) sv_catpv(d, "OUR,");
+ if (SvPAD_OUR(sv)) sv_catpv(d, "OUR,");
+ if (SvPAD_TYPED(sv)) sv_catpv(d, "TYPED,");
if (GvIMPORTED(sv)) {
sv_catpv(d, "IMPORT");
if (GvIMPORTED(sv) == GVf_IMPORTED)
if (SvVALID(sv)) sv_catpv(d, "VALID,");
break;
case SVt_PVMG:
- if (flags & SVpad_TYPED)
- sv_catpv(d, "TYPED,");
+ if (SvPAD_TYPED(sv)) sv_catpv(d, "TYPED,");
break;
case SVt_PVAV:
break;
{
dVAR;
const I32 offset = pad_findmy("$_");
- if (offset == NOT_IN_PAD || PAD_COMPNAME_FLAGS(offset) & SVpad_OUR) {
+ if (offset == NOT_IN_PAD || PAD_COMPNAME_FLAGS_isOUR(offset)) {
return newSVREF(newGVOP(OP_GV, 0, PL_defgv));
}
else {
}
else {
const I32 offset = pad_findmy("$_");
- if (offset == NOT_IN_PAD || PAD_COMPNAME_FLAGS(offset) & SVpad_OUR) {
+ if (offset == NOT_IN_PAD || PAD_COMPNAME_FLAGS_isOUR(offset)) {
sv = newGVOP(OP_GV, 0, PL_defgv);
}
else {
gwop->op_other = LINKLIST(kid);
kid->op_next = (OP*)gwop;
offset = pad_findmy("$_");
- if (offset == NOT_IN_PAD || PAD_COMPNAME_FLAGS(offset) & SVpad_OUR) {
+ if (offset == NOT_IN_PAD || PAD_COMPNAME_FLAGS_isOUR(offset)) {
o->op_private = gwop->op_private = 0;
gwop->op_targ = pad_alloc(type, SVs_PADTMP);
}
dVAR;
if (o->op_type != OP_QR && PL_compcv) {
const I32 offset = pad_findmy("$_");
- if (offset != NOT_IN_PAD && !(PAD_COMPNAME_FLAGS(offset) & SVpad_OUR)) {
+ if (offset != NOT_IN_PAD && !(PAD_COMPNAME_FLAGS_isOUR(offset))) {
o->op_targ = offset;
o->op_private |= OPpTARGET_MY;
}
if (rop->op_type != OP_RV2HV || rop->op_first->op_type != OP_PADSV)
break;
lexname = *av_fetch(PL_comppad_name, rop->op_first->op_targ, TRUE);
- if (!(SvFLAGS(lexname) & SVpad_TYPED))
+ if (!SvPAD_TYPED(lexname))
break;
fields = (GV**)hv_fetchs(SvSTASH(lexname), "FIELDS", FALSE);
if (!fields || !GvHV(*fields))
}
lexname = *av_fetch(PL_comppad_name, rop->op_targ, TRUE);
- if (!(SvFLAGS(lexname) & SVpad_TYPED))
+ if (!SvPAD_TYPED(lexname))
break;
fields = (GV**)hv_fetchs(SvSTASH(lexname), "FIELDS", FALSE);
if (!fields || !GvHV(*fields))
sv_setpv(namesv, name);
if (typestash) {
- SvFLAGS(namesv) |= SVpad_TYPED;
+ SvPAD_TYPED_on(namesv);
SvSTASH_set(namesv, (HV*)SvREFCNT_inc((SV*) typestash));
}
if (ourstash) {
- SvFLAGS(namesv) |= SVpad_OUR;
+ SvPAD_OUR_on(namesv);
GvSTASH(namesv) = ourstash;
Perl_sv_add_backref(aTHX_ (SV*)ourstash, namesv);
}
&& (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0)
&& strEQ(name, SvPVX_const(sv)))
{
- if (is_our && (SvFLAGS(sv) & SVpad_OUR))
+ if (is_our && (SvPAD_OUR(sv)))
break; /* "our" masking "our" */
Perl_warner(aTHX_ packWARN(WARN_MISC),
"\"%s\" variable %s masks earlier declaration in same %s",
&& sv != &PL_sv_undef
&& !SvFAKE(sv)
&& (SvIVX(sv) == PAD_MAX || SvIVX(sv) == 0)
- && ((SvFLAGS(sv) & SVpad_OUR) && GvSTASH(sv) == ourstash)
+ && ((SvPAD_OUR(sv)) && GvSTASH(sv) == ourstash)
&& strEQ(name, SvPVX_const(sv)))
{
Perl_warner(aTHX_ packWARN(WARN_MISC),
const SV * const namesv = name_svp[offset];
if (namesv && namesv != &PL_sv_undef
&& !SvFAKE(namesv)
- && (SvFLAGS(namesv) & SVpad_OUR)
+ && (SvPAD_OUR(namesv))
&& strEQ(SvPVX_const(namesv), name)
&& U_32(SvNVX(namesv)) == PAD_MAX /* min */
)
if (out_capture) {
/* our ? */
- if ((SvFLAGS(*out_name_sv) & SVpad_OUR)) {
+ if (SvPAD_OUR(*out_name_sv)) {
*out_capture = NULL;
return offset;
}
new_offset = pad_add_name(
SvPVX_const(*out_name_sv),
- (SvFLAGS(*out_name_sv) & SVpad_TYPED)
+ SvPAD_TYPED(*out_name_sv)
? SvSTASH(*out_name_sv) : NULL,
- (SvFLAGS(*out_name_sv) & SVpad_OUR)
+ SvPAD_OUR(*out_name_sv)
? GvSTASH(*out_name_sv) : NULL,
1 /* fake */
);
SvIV_set(new_namesv, *out_flags);
SvNV_set(new_namesv, (NV)0);
- if (SvFLAGS(new_namesv) & SVpad_OUR) {
+ if (SvPAD_OUR(new_namesv)) {
/*EMPTY*/; /* do nothing */
}
else if (CvLATE(cv)) {
{
dVAR;
SV* const * const av = av_fetch(PL_comppad_name, po, FALSE);
- if ( SvFLAGS(*av) & SVpad_TYPED ) {
+ if ( SvPAD_TYPED(*av) ) {
return SvSTASH(*av);
}
return NULL;
*/
#define PAD_COMPNAME_FLAGS(po) SvFLAGS(*av_fetch(PL_comppad_name, (po), FALSE))
+#define PAD_COMPNAME_FLAGS_isOUR(po) (PAD_COMPNAME_FLAGS(po) & SVpad_OUR)
#define PAD_COMPNAME_PV(po) SvPV_nolen(*av_fetch(PL_comppad_name, (po), FALSE))
#define PAD_COMPNAME_TYPE(po) pad_compname_type(po)
sv_setsv(TARG, (SP > MARK)
? *SP
: (padoff_du = find_rundefsvoffset(),
- (padoff_du == NOT_IN_PAD || PAD_COMPNAME_FLAGS(padoff_du) & SVpad_OUR)
+ (padoff_du == NOT_IN_PAD
+ || PAD_COMPNAME_FLAGS_isOUR(padoff_du))
? DEFSV : PAD_SVl(padoff_du)));
up = SvPV_force(TARG, len);
if (len > 1) {
/* This flag bit is used to mean other things in other scalar types.
Given that it only has meaning inside the pad, it shouldn't be set
on anything that can get upgraded. */
- assert((SvFLAGS(sv) & SVpad_TYPED) == 0);
+ assert(!SvPAD_TYPED(sv));
break;
default:
if (old_type_details->cant_upgrade)
if (type >= SVt_PVMG) {
if (SvMAGIC(sv))
mg_free(sv);
- if (type == SVt_PVMG && SvFLAGS(sv) & SVpad_TYPED)
+ if (type == SVt_PVMG && SvPAD_TYPED(sv))
SvREFCNT_dec(SvSTASH(sv));
}
switch (type) {
#define SvREPADTMP_off(sv) (SvFLAGS(sv) &= ~SVf_FAKE)
#endif
+#define SvPAD_TYPED(sv) (SvFLAGS(sv) & SVpad_TYPED)
+#define SvPAD_TYPED_on(sv) (SvFLAGS(sv) |= SVpad_TYPED)
+#define SvPAD_TYPED_off(sv) (SvFLAGS(sv) &= ~SVpad_TYPED)
+
+#define SvPAD_OUR(sv) (SvFLAGS(sv) & SVpad_OUR)
+#define SvPAD_OUR_on(sv) (SvFLAGS(sv) |= SVpad_OUR)
+#define SvPAD_OUR_off(sv) (SvFLAGS(sv) &= ~SVpad_OUR)
+
#ifdef PERL_DEBUG_COW
#define SvRV(sv) (0 + (sv)->sv_u.svu_rv)
#else
tmp = pad_findmy(PL_tokenbuf);
if (tmp != NOT_IN_PAD) {
/* might be an "our" variable" */
- if (PAD_COMPNAME_FLAGS(tmp) & SVpad_OUR) {
+ if (PAD_COMPNAME_FLAGS_isOUR(tmp)) {
/* build ops for a bareword */
HV * const stash = PAD_COMPNAME_OURSTASH(tmp);
HEK * const stashname = HvNAME_HEK(stash);
add symbol table ops
*/
if ((tmp = pad_findmy(d)) != NOT_IN_PAD) {
- if (PAD_COMPNAME_FLAGS(tmp) & SVpad_OUR) {
+ if (PAD_COMPNAME_FLAGS_isOUR(tmp)) {
HV * const stash = PAD_COMPNAME_OURSTASH(tmp);
HEK * const stashname = HvNAME_HEK(stash);
SV * const sym = sv_2mortal(newSVhek(stashname));