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

Re: testing non-nullness of non-null args

Thread Previous
From:
hv
Date:
February 24, 2015 11:56
Subject:
Re: testing non-nullness of non-null args
Message ID:
201502241153.t1OBriP26575@crypt.org
Dave Mitchell <davem@iabyn.com> 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?

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

Hugo

Thread Previous


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