diff options
author | David Mitchell <davem@iabyn.com> | 2012-12-14 21:28:02 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2012-12-14 23:01:16 +0000 |
commit | 24e088424d00bddc47a2aa3c7233e7d9b6f372b8 (patch) | |
tree | a0d9c66a098fa0519fa94feac60951655fa9433b /sv.h | |
parent | aac486f1db32b022ef113b1097cc0b38b713b121 (diff) | |
download | perl-24e088424d00bddc47a2aa3c7233e7d9b6f372b8.tar.gz |
further fix to SvUPGRADE
The change to SvUPGRADE introduced by 463ea2290a54e a few commits ago
to silence a warning with clang, broke g++ builds instead. Here's
a second attempt to keep everyone happy.
Basically it avoids warnings from all of gcc, g++ and clang for the two
constructs
SvUPGRADE(...);
(void)SvUPGRADE(...);
But still breaks
if (!SvUPGRADE(...) { croak(...); }
which I don't care about.
Diffstat (limited to 'sv.h')
-rw-r--r-- | sv.h | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -327,8 +327,10 @@ perform the upgrade if necessary. See C<svtype>. them all by using a consistent macro. */ #define SvIS_FREED(sv) ((sv)->sv_flags == SVTYPEMASK) +/* this is defined in this peculiar way to avoid compiler warnings. + * See the <20121213131428.GD1842@iabyn.com> thread in p5p */ #define SvUPGRADE(sv, mt) \ - STMT_START { if (SvTYPE(sv) < (mt)) sv_upgrade(sv, mt); } STMT_END + ((void)(SvTYPE(sv) >= (mt) || (sv_upgrade(sv, mt),1))) #define SVf_IOK 0x00000100 /* has valid public integer value */ #define SVf_NOK 0x00000200 /* has valid public numeric value */ |