develooper Front page | perl.perl5.porters | Postings from January 2008

Re: compile warnings w/ PM_SETRE and ReREFCNT_inc

Thread Previous
From:
Nicholas Clark
Date:
January 7, 2008 05:58
Subject:
Re: compile warnings w/ PM_SETRE and ReREFCNT_inc
Message ID:
20080107135801.GR23703@plum.flirble.org
On Sun, Jan 06, 2008 at 06:14:30PM -0600, Craig A. Berry wrote:

> After change #32804, the definition of ReREFCNT_inc for the non-gcc
> case is merely the following:
> 
> #  define ReREFCNT_inc(re)	SvREFCNT_inc(re)
> 
> My first thought was something like
> 
> #  define ReREFCNT_inc(re)	(REGEXP*)SvREFCNT_inc(re)
> 
> was needed, but that causes trouble when the increment is used in
> void context.  On the other hand, the following does shut up the
> compiler but seems too big a hammer, basically wiping out all type
> checking for PM_SETRE:

Yes, I'd spotted the warning (but only) yesterday, and was testing with a
cast on the return of Re_REFCNT_inc() as above. I've committed it with
change 32890. I don't really want to wipe out the type checking (because I
like it and it found something we were doing twice. Now "optimised" to once
with change 32867)

I don't see warnings about void context, but if they do appear, I think that
then the correct silence is to add a void cast to the statement - ie

    ReREFCNT_inc(re);

becomes

    (void)ReREFCNT_inc(re);

Nicholas Clark

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About