summaryrefslogtreecommitdiff
path: root/gv.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-02-24 11:52:53 +0000
committerNicholas Clark <nick@ccl4.org>2006-02-24 11:52:53 +0000
commitc72c5e99f3b78a3b5da264328bcba75e0ae7e88b (patch)
tree8ef5698b6ecb94b4a422c3b5001545519ee03238 /gv.h
parent035dab7448e2a9119f77775183b21181a53213a3 (diff)
downloadperl-c72c5e99f3b78a3b5da264328bcba75e0ae7e88b.tar.gz
Assert that GvSTASH is only called on PVGVs and PVLVs.
p4raw-id: //depot/perl@27307
Diffstat (limited to 'gv.h')
-rw-r--r--gv.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/gv.h b/gv.h
index 250c7b92d5..da9da4a4fc 100644
--- a/gv.h
+++ b/gv.h
@@ -38,9 +38,17 @@ struct gp {
#define GvNAME(gv) (GvXPVGV(gv)->xgv_name)
#define GvNAMELEN(gv) (GvXPVGV(gv)->xgv_namelen)
-#define GvSTASH(gv) (GvXPVGV(gv)->xgv_stash)
#define GvFLAGS(gv) (GvXPVGV(gv)->xgv_flags)
+#if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
+# define GvSTASH(gv) \
+ (*({ GV *_gv = (GV *) gv; \
+ assert(SvTYPE(_gv) == SVt_PVGV || SvTYPE(_gv) >= SVt_PVLV); \
+ &(GvXPVGV(_gv)->xgv_stash); \
+ }))
+#else
+#define GvSTASH(gv) (GvXPVGV(gv)->xgv_stash)
+#endif
/*
=head1 GV Functions