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

Re: testing non-nullness of non-null args

Thread Previous
February 24, 2015 11:56
Re: testing non-nullness of non-null args
Message ID:
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;
:        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?

I think we probably should (stop); but I'm mildly concerned that
we already get some risk of divergence by hiding the signature
information off in a different file.

I'm not sure it'd necessarily be desirable to do away with embed.fnc
completely (in favour of scavenging the same information from inline
annotations), but it'd be useful to have something clearly visible
inline stating what embed.fnc information we're relying on, in a way
that lets us check it is valid (via the compiler or porting tests).


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