develooper Front page | perl.perl5.porters | Postings from March 2015

Re: testing non-nullness of non-null args

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
March 11, 2015 14:32
Subject:
Re: testing non-nullness of non-null args
Message ID:
20150311143225.GL28599@iabyn.com
On Wed, Mar 04, 2015 at 04:06:05PM +0000, Dave Mitchell wrote:
> On Wed, Feb 25, 2015 at 01:39:36PM +1100, Tony Cook wrote:
> > On Tue, Feb 24, 2015 at 11:28:29AM +0000, Dave Mitchell wrote:
> > > 
> > > Clang has started throwing a lot of warnings like these:
> > > 
> > >     op.c:3240:10: warning: nonnull parameter 'o' will evaluate to 'true' on first encounter [-Wpointer-bool-conversion]
> > >         if (!o || (PL_parser && PL_parser->error_count))
> > > 
> > > for code like this:
> > > 
> > >     Perl_doref(pTHX_ OP *o, I32 type, bool set_op_ref)
> > >     {
> > >         dVAR;
> > >         OP *kid;
> > > 
> > >         PERL_ARGS_ASSERT_DOREF;
> > > 
> > >         if (!o || (PL_parser && PL_parser->error_count))
> > >             return o;
> > > 
> > > where the o arg is declared NN in embed.fnc.
> > > 
> > > So the question is whether for such functions we stop testing vars for
> > > nullness within the main body of the function?
> > 
> > There are existing commits that remove such checks:
> > 
> > 6c4650b32e1142e017440b6cef647077dfed2d1a
> > 492254706dd070a67dab2799fba515e6e4c3a3bb
> > 5805b5855c54176df1831b2fbbb0fae5dc2d52ad
> > 1061065f7a09399eefb50e9a035502621722bcc0
> 
> 
> I have pushes the branch davem/nonnull. Unless anyone objects, I'll
> merge it in a few days.

Now merged.

-- 
I before E. Except when it isn't.

Thread Previous | Thread Next


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