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

testing non-nullness of non-null args

Thread Next
Dave Mitchell
February 24, 2015 11:28
testing non-nullness of non-null args
Message ID:

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)
        OP *kid;


        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?

The Enterprise is involved in a bizarre time-warp experience which is in
some way unconnected with the Late 20th Century.
    -- Things That Never Happen in "Star Trek" #14

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About