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.
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 */