diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-12-08 22:11:56 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-12-08 22:11:56 +0000 |
commit | 60c8298a73edc9f7e89dcf60682f3477045fa898 (patch) | |
tree | 52874e501b8154072ff9a57ed58078d5fd215151 /sv.h | |
parent | d07077ccb1603dbe7825b6fa721a5e5e922b807e (diff) | |
download | perl-60c8298a73edc9f7e89dcf60682f3477045fa898.tar.gz |
Assert that BmRARE, BmUSEFUL and BmPREVIOUS are only called on SVtPVBM
p4raw-id: //depot/perl@29487
Diffstat (limited to 'sv.h')
-rw-r--r-- | sv.h | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -1300,9 +1300,27 @@ the scalar's value cannot change unless written to. } \ } STMT_END -#define BmRARE(sv) ((XPVBM*) SvANY(sv))->xbm_rare -#define BmUSEFUL(sv) ((XPVBM*) SvANY(sv))->xbm_useful -#define BmPREVIOUS(sv) ((XPVBM*) SvANY(sv))->xbm_previous +#if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) +# define BmRARE(sv) \ + (*({ SV *const _svi = (SV *) (sv); \ + assert(SvTYPE(_svi) == SVt_PVBM); \ + &(((XPVBM*) SvANY(_svi))->xbm_rare); \ + })) +# define BmUSEFUL(sv) \ + (*({ SV *const _svi = (SV *) (sv); \ + assert(SvTYPE(_svi) == SVt_PVBM); \ + &(((XPVBM*) SvANY(_svi))->xbm_useful); \ + })) +# define BmPREVIOUS(sv) \ + (*({ SV *const _svi = (SV *) (sv); \ + assert(SvTYPE(_svi) == SVt_PVBM); \ + &(((XPVBM*) SvANY(_svi))->xbm_previous); \ + })) +#else +# define BmRARE(sv) ((XPVBM*) SvANY(sv))->xbm_rare +# define BmUSEFUL(sv) ((XPVBM*) SvANY(sv))->xbm_useful +# define BmPREVIOUS(sv) ((XPVBM*) SvANY(sv))->xbm_previous +#endif #define FmLINES(sv) ((XPVFM*) SvANY(sv))->xfm_lines |