diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-10-27 20:25:46 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-10-27 20:25:46 +0000 |
commit | b1bc3f345d4dfe19cd94c120c46649336b5cb92b (patch) | |
tree | bdfcef0c7875037af6a5fa8195d2203fe76e6b27 /cop.h | |
parent | bb5dd93d07e2d54d352e519c7b43ff2d3e5c5f36 (diff) | |
download | perl-b1bc3f345d4dfe19cd94c120c46649336b5cb92b.tar.gz |
Add a macro MUTABLE_PTR(p), which on (non-pedantic) gcc will not cast
away const, returning a void *. Add MUTABLE_SV(sv) which uses this, and
replace all (SV *) casts either with MUTABLE_SV(sv), or (const SV *).
This probably still needs some work - assigning to SvPVX() and SvRV()
is now likely to generate a casting error. The core doesn't do this.
But as-is it's finding bugs that can be fixed.
p4raw-id: //depot/perl@34605
Diffstat (limited to 'cop.h')
-rw-r--r-- | cop.h | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -360,13 +360,13 @@ struct block_format { cx->blk_sub.argarray = newAV(); \ av_extend(cx->blk_sub.argarray, fill); \ AvREIFY_only(cx->blk_sub.argarray); \ - CX_CURPAD_SV(cx->blk_sub, 0) = (SV*)cx->blk_sub.argarray; \ + CX_CURPAD_SV(cx->blk_sub, 0) = MUTABLE_SV(cx->blk_sub.argarray); \ } \ else { \ CLEAR_ARGARRAY(cx->blk_sub.argarray); \ } \ } \ - sv = (SV*)cx->blk_sub.cv; \ + sv = MUTABLE_SV(cx->blk_sub.cv); \ if (sv && (CvDEPTH((CV*)sv) = cx->blk_sub.olddepth)) \ sv = NULL; \ } STMT_END |