From 24e088424d00bddc47a2aa3c7233e7d9b6f372b8 Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Fri, 14 Dec 2012 21:28:02 +0000 Subject: [PATCH] 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. --- sv.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 */ -- 2.7.4