From: David Mitchell Date: Fri, 14 Dec 2012 21:28:02 +0000 (+0000) Subject: further fix to SvUPGRADE X-Git-Tag: upstream/5.20.0~4485 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=24e088424d00bddc47a2aa3c7233e7d9b6f372b8;p=platform%2Fupstream%2Fperl.git 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. --- diff --git a/sv.h b/sv.h index c017454..e248ba7 100644 --- a/sv.h +++ b/sv.h @@ -327,8 +327,10 @@ perform the upgrade if necessary. See C. 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 */