summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-12-08 23:22:31 +0000
committerNicholas Clark <nick@ccl4.org>2006-12-08 23:22:31 +0000
commit85efc3a51ca0ee5724a80b554624140f51d5305c (patch)
tree7cd98e5a29f72db0d1c2ccbbfd1dcab4c12c1d41 /sv.h
parent55c1d76f9af684ffb624841d197d3ddfdb081f8e (diff)
downloadperl-85efc3a51ca0ee5724a80b554624140f51d5305c.tar.gz
assert that SvTAIL() isn't being called on PVAVs or PVHVs
p4raw-id: //depot/perl@29491
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/sv.h b/sv.h
index 4ec96e8efc..054ec6b3d3 100644
--- a/sv.h
+++ b/sv.h
@@ -349,7 +349,7 @@ perform the upgrade if necessary. See C<svtype>.
#define SVpav_REAL 0x40000000 /* free old entries */
/* PVHV */
#define SVphv_LAZYDEL 0x40000000 /* entry in xhv_eiter must be deleted */
-/* PVBM */
+/* Not just PVBM - basically anything that can be a regular scalar */
#define SVpbm_TAIL 0x40000000
/* ??? */
#define SVrepl_EVAL 0x40000000 /* Replacement part of s///e */
@@ -1059,7 +1059,15 @@ the scalar's value cannot change unless written to.
#define SvEVALED_on(sv) (SvFLAGS(sv) |= SVrepl_EVAL)
#define SvEVALED_off(sv) (SvFLAGS(sv) &= ~SVrepl_EVAL)
-#define SvTAIL(sv) (SvFLAGS(sv) & SVpbm_TAIL)
+#if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
+# define SvTAIL(sv) ({ SV *const _svi = (SV *) (sv); \
+ assert(SvTYPE(_svi) != SVt_PVAV); \
+ assert(SvTYPE(_svi) != SVt_PVHV); \
+ SvFLAGS(sv) & SVpbm_TAIL; \
+ })
+#else
+# define SvTAIL(sv) (SvFLAGS(sv) & SVpbm_TAIL)
+#endif
#define SvTAIL_on(sv) (SvFLAGS(sv) |= SVpbm_TAIL)
#define SvTAIL_off(sv) (SvFLAGS(sv) &= ~SVpbm_TAIL)