From: Nicholas Clark Date: Tue, 12 Dec 2006 21:00:37 +0000 (+0000) Subject: Assert that PVGVs are never SvVALID() in the PVBM sense. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=85ffbbb0b9ce8124eef68c3c6234c26ffa9aba18;p=p5sagit%2Fp5-mst-13.2.git Assert that PVGVs are never SvVALID() in the PVBM sense. p4raw-id: //depot/perl@29536 --- diff --git a/gv.h b/gv.h index 6ef8ee6..2463335 100644 --- a/gv.h +++ b/gv.h @@ -46,6 +46,7 @@ struct gp { (*({ GV * const zzzz = (GV *) (gv); \ assert(isGV_with_GP(zzzz)); \ assert(SvTYPE(zzzz) == SVt_PVGV || SvTYPE(zzzz) >= SVt_PVLV); \ + assert(!SvVALID(zzzz)); \ &(GvXPVGV(zzzz)->xiv_u.xivu_namehek); \ })) # define GvNAME_get(gv) ({ assert(GvNAME_HEK(gv)); HEK_KEY(GvNAME_HEK(gv)); }) diff --git a/sv.h b/sv.h index 5417759..9d8ef39 100644 --- a/sv.h +++ b/sv.h @@ -1056,6 +1056,20 @@ the scalar's value cannot change unless written to. #define SvEVALED_off(sv) (SvFLAGS(sv) &= ~SVrepl_EVAL) #if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) +# define SvVALID(sv) ({ SV *const thwacke = (SV *) (sv); \ + if (SvFLAGS(thwacke) & SVpbm_VALID) \ + assert(!isGV_with_GP(thwacke)); \ + (SvFLAGS(thwacke) & SVpbm_VALID); \ + }) +# define SvVALID_on(sv) ({ SV *const thwacke = (SV *) (sv); \ + assert(!isGV_with_GP(thwacke)); \ + (SvFLAGS(thwacke) |= SVpbm_VALID); \ + }) +# define SvVALID_off(sv) ({ SV *const thwacke = (SV *) (sv); \ + assert(!isGV_with_GP(thwacke)); \ + (SvFLAGS(thwacke) &= ~SVpbm_VALID); \ + }) + # define SvTAIL(sv) ({ SV *const _svi = (SV *) (sv); \ assert(SvTYPE(_svi) != SVt_PVAV); \ assert(SvTYPE(_svi) != SVt_PVHV); \ @@ -1063,6 +1077,9 @@ the scalar's value cannot change unless written to. == (SVpbm_TAIL|SVpbm_VALID); \ }) #else +# define SvVALID(sv) (SvFLAGS(sv) & SVpbm_VALID) +# define SvVALID_on(sv) (SvFLAGS(sv) |= SVpbm_VALID) +# define SvVALID_off(sv) (SvFLAGS(sv) &= ~SVpbm_VALID) # define SvTAIL(sv) ((SvFLAGS(sv) & (SVpbm_TAIL|SVpbm_VALID)) \ == (SVpbm_TAIL|SVpbm_VALID)) @@ -1070,9 +1087,6 @@ the scalar's value cannot change unless written to. #define SvTAIL_on(sv) (SvFLAGS(sv) |= SVpbm_TAIL) #define SvTAIL_off(sv) (SvFLAGS(sv) &= ~SVpbm_TAIL) -#define SvVALID(sv) (SvFLAGS(sv) & SVpbm_VALID) -#define SvVALID_on(sv) (SvFLAGS(sv) |= SVpbm_VALID) -#define SvVALID_off(sv) (SvFLAGS(sv) &= ~SVpbm_VALID) #ifdef USE_ITHREADS /* The following uses the FAKE flag to show that a regex pointer is infact