summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2012-12-14 15:05:40 +0000
committerDavid Mitchell <davem@iabyn.com>2012-12-14 15:17:49 +0000
commit463ea2290a54ee65470ca4dd46dea0d41cfbc9dd (patch)
tree55b5470e252627f889b58a86b2bb2f29373a025f /sv.h
parentb7bc7afbe074add30fdf01d619e7cfef04b07403 (diff)
downloadperl-463ea2290a54ee65470ca4dd46dea0d41cfbc9dd.tar.gz
make SvUPGRADE() a statement.
To guote the perldelta entry: SvUPGRADE() is no longer an expression. Originally this macro (and its underlying function, sv_upgrade()) were documented as boolean, although in reality they always croaked on error and never returned false. In 2005 the documentation was updated to specify a void return value, but SvUPGRADE() was left always returning 1 for backwards compatibility. This has now been removed, and SvUPGRADE() is now a statement with no return value. So this is now a syntax error: if (!SvUPGRADE(sv)) { croak(...); } If you have code like that, simply replace it with SvUPGRADE(sv);
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sv.h b/sv.h
index e3c26731fe..c017454c44 100644
--- a/sv.h
+++ b/sv.h
@@ -327,7 +327,8 @@ perform the upgrade if necessary. See C<svtype>.
them all by using a consistent macro. */
#define SvIS_FREED(sv) ((sv)->sv_flags == SVTYPEMASK)
-#define SvUPGRADE(sv, mt) (SvTYPE(sv) >= (mt) || (sv_upgrade(sv, mt), 1))
+#define SvUPGRADE(sv, mt) \
+ STMT_START { if (SvTYPE(sv) < (mt)) sv_upgrade(sv, mt); } STMT_END
#define SVf_IOK 0x00000100 /* has valid public integer value */
#define SVf_NOK 0x00000200 /* has valid public numeric value */