diff options
author | David Mitchell <davem@iabyn.com> | 2011-07-15 14:46:46 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2011-07-15 14:50:32 +0100 |
commit | 62bb6514085e5eddc42b4fdaf3713ccdb7f1da85 (patch) | |
tree | 87c66f67c8fe3b2244d0e1bd13c61c29b37ac9f3 /sv.h | |
parent | 76d60a5393cb55f0d74c183769765dc7db58d81c (diff) | |
download | perl-62bb6514085e5eddc42b4fdaf3713ccdb7f1da85.tar.gz |
ensure SVs_PADTMP and SVs_PADTMP not both on
There's no reason for these two flags to ever both be on.
Fix the one place that was doing this, and assert that this never happens.
If this doesn't break anything, it opens the door to freeing a bit in
SvFLAGS. (woo hoo!)
Diffstat (limited to 'sv.h')
-rw-r--r-- | sv.h | 25 |
1 files changed, 22 insertions, 3 deletions
@@ -905,15 +905,34 @@ the scalar's value cannot change unless written to. #define SvTHINKFIRST(sv) (SvFLAGS(sv) & SVf_THINKFIRST) #define SvPADSTALE(sv) (SvFLAGS(sv) & SVs_PADSTALE) -#define SvPADSTALE_on(sv) (SvFLAGS(sv) |= SVs_PADSTALE) #define SvPADSTALE_off(sv) (SvFLAGS(sv) &= ~SVs_PADSTALE) #define SvPADTMP(sv) (SvFLAGS(sv) & SVs_PADTMP) -#define SvPADTMP_on(sv) (SvFLAGS(sv) |= SVs_PADTMP) #define SvPADTMP_off(sv) (SvFLAGS(sv) &= ~SVs_PADTMP) #define SvPADMY(sv) (SvFLAGS(sv) & SVs_PADMY) -#define SvPADMY_on(sv) (SvFLAGS(sv) |= SVs_PADMY) + +#if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) +# define SvPADTMP_on(sv) ({ \ + SV *const _svpad = MUTABLE_SV(sv); \ + assert(!(SvFLAGS(_svpad) & (SVs_PADMY|SVs_PADSTALE))); \ + (SvFLAGS(_svpad) |= SVs_PADTMP); \ + }) +# define SvPADMY_on(sv) ({ \ + SV *const _svpad = MUTABLE_SV(sv); \ + assert(!(SvFLAGS(_svpad) & SVs_PADTMP)); \ + (SvFLAGS(_svpad) |= SVs_PADMY); \ + }) +# define SvPADSTALE_on(sv) ({ \ + SV *const _svpad = MUTABLE_SV(sv); \ + assert(!(SvFLAGS(_svpad) & SVs_PADTMP)); \ + (SvFLAGS(_svpad) |= SVs_PADSTALE); \ + }) +#else +# define SvPADTMP_on(sv) (SvFLAGS(sv) |= SVs_PADTMP) +# define SvPADMY_on(sv) (SvFLAGS(sv) |= SVs_PADMY) +# define SvPADSTALE_on(sv) (SvFLAGS(sv) |= SVs_PADSTALE) +#endif #define SvTEMP(sv) (SvFLAGS(sv) & SVs_TEMP) #define SvTEMP_on(sv) (SvFLAGS(sv) |= SVs_TEMP) |