develooper Front page | perl.perl5.porters | Postings from September 2013

[perl #119251] [PATCH] Enhancement request - a prototype attribute

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
September 30, 2013 16:00
Subject:
[perl #119251] [PATCH] Enhancement request - a prototype attribute
Message ID:
rt-3.6.HEAD-31239-1380556814-1422.119251-15-0@perl.org
On Sun Sep 29 23:31:58 2013, pcm wrote:
> The last issues I'd noted were removing the '*' from a GV if it hits
> the attributes module, which the last version of the attributes patch
> did (https://rt.perl.org/rt3/Ticket/Attachment/1244083/649157/0001-
> perl-119251-Added-a-prototype-attribute-to-attributes.xs.patch),
> and not crashing on a syntax error.  The attached patch fixes the
> crashing on syntax error part by not calling move_proto_attr if there
> were any errors compiling the sub, as that's the only case (right?)
> where there would not be a name.
> 
> (And I did look into a cv_name function, but I'm not sure where the
> best place to put it would be).

Neither am I.  The cv_ functions are scattered between pad.c and op.c. 
Maybe op.c, as op.c will use it the most?

> 
> It's late, so I may be overlooking things.  If I forgot something
> obvious, sorry, just wanted to get the ball rolling again!

> +            (void)validate_proto(svname, cSVOPx_sv(new_proto), true);

We usually use TRUE.  Does true work everywhere?

> +        if (*proto && ckWARN(WARN_PROTOTYPE)) {
...
> +            op_free(*proto);
> +        }
> +        *proto = new_proto;

*proto needs to be freed even when warnings are off:

(You can’t depend on the slab to clean it up, as it only does so when
compilation aborts.  That also means that op_free after Perl_warner is
safe when fatal warnings are on, because the slab *will* clean it up in
that case.)

> +=item Attribute prototype(%s) discards earlier prototype attribute in
same sub
> +
> +(W misc) A sub was declared as sub foo : prototype(A) : prototype(B)
{}, for
...
> +=item Prototype '%s' overridden by attribute 'prototype(%s)' in %s
> +
> +(W prototype) A prototype was declared in both the parentheses after

I would have put these in the same category (prototype), but it’s not
critical.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=119251

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