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

testing non-nullness of non-null args

Thread Next
From:
Dave Mitchell
Date:
February 24, 2015 11:28
Subject:
testing non-nullness of non-null args
Message ID:
20150224112829.GG28599@iabyn.com

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?


-- 
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


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