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

Re: testing non-nullness of non-null args

Thread Previous | Thread Next
From:
Tony Cook
Date:
February 25, 2015 02:39
Subject:
Re: testing non-nullness of non-null args
Message ID:
20150225023936.GE31058@mars.tony.develop-help.com
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

Tony

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