develooper Front page | perl.perl5.porters | Postings from July 2016

[perl #33156] perlapi.pod and the Perl_ prefix

Thread Next
From:
Dan Collins via RT
Date:
July 7, 2016 18:02
Subject:
[perl #33156] perlapi.pod and the Perl_ prefix
Message ID:
rt-4.0.18-15989-1467914552-1146.33156-15-0@perl.org
If we do want perlapi.pod to use the Perl_ prefix...

embed.fnc:

    Afpda   |SV*    |newSVpvf       |NN const char *const pat|...

:   f  Function takes a format string. If the function name /strftime/
:      then its assumed to take a strftime-style format string as 1st arg;
:      otherwise it's assumed to be a printf style format string, varargs
:      (hence any entry that would otherwise go in embed.h is suppressed):
:
:         proto.h: add __attribute__format__ (or ...null_ok__)
:
:   p  Function in source code has a Perl_ prefix:
:
:         proto.h: function is declared as Perl_foo rather than foo
:         embed.h: "#define foo Perl_foo" entries added
:
:   o  Has no Perl_foo or S_foo compatibility macro:
:
:         embed.h: suppress "#define foo Perl_foo"
:

Currently autodoc only looks for flags =~ /o/ to add the Perl_ prefix to the function name. If the quote above is to be believed, it should also look for flags =~ /f/ && name !~ /strftime/

But for some reason the f flag never makes it into docout() in autodoc.pl. I'm not sure why we don't just pass in all the flags from embed.fnc, but I modified autodoc.pl to at least pass in and check 'f', and prepend Perl_ if it is present and name !~ /strftime/.

pod/perlapi.pod is not under version control, but comparing before and after gives these changes:

5844c5844
<       char*   form(const char* pat, ...)
---
>       char*   Perl_form(const char* pat, ...)
5965c5965
<       SV *    mess(const char *pat, ...)
---
>       SV *    Perl_mess(const char *pat, ...)
6006,6007c6006,6007
<       int     my_snprintf(char *buffer, const Size_t len,
<                           const char *format, ...)
---
>       int     Perl_my_snprintf(char *buffer, const Size_t len,
>                                const char *format, ...)
9679c9679
<       SV*     newSVpvf(const char *const pat, ...)
---
>       SV*     Perl_newSVpvf(const char *const pat, ...)
10027,10028c10027,10028
<       void    sv_catpvf(SV *const sv, const char *const pat,
<                         ...)
---
>       void    Perl_sv_catpvf(SV *const sv,
>                              const char *const pat, ...)
10038,10039c10038,10039
<       void    sv_catpvf_mg(SV *const sv,
<                            const char *const pat, ...)
---
>       void    Perl_sv_catpvf_mg(SV *const sv,
>                                 const char *const pat, ...)
10887,10888c10887,10888
<       void    sv_setpvf(SV *const sv, const char *const pat,
<                         ...)
---
>       void    Perl_sv_setpvf(SV *const sv,
>                              const char *const pat, ...)
10898,10899c10898,10899
<       void    sv_setpvf_mg(SV *const sv,
<                            const char *const pat, ...)
---
>       void    Perl_sv_setpvf_mg(SV *const sv,
>                                 const char *const pat, ...)
13998c13998
<       void    croak(const char *pat, ...)
---
>       void    Perl_croak(const char *pat, ...)
14045c14045
<       OP *    die(const char *pat, ...)
---
>       OP *    Perl_die(const char *pat, ...)
14125c14125
<       void    warn(const char *pat, ...)
---
>       void    Perl_warn(const char *pat, ...)

Patch to autodoc.pl is attached, if those changes are correct.

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

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