This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add '#' flag for autodoc entries
authorKarl Williamson <khw@cpan.org>
Thu, 22 Oct 2020 15:14:15 +0000 (09:14 -0600)
committerKarl Williamson <khw@cpan.org>
Fri, 17 Jun 2022 13:32:40 +0000 (07:32 -0600)
This indicates the symbol is accessed via #ifdef and is not a function
or a macro with a returned value

autodoc.pl
embed.fnc

index 0a8d745..65e6f9d 100644 (file)
@@ -529,13 +529,19 @@ sub autodoc ($$) { # parse a file and extract documentation info
             }
 
             die "flag '$1' is not legal (for function $element_name (from $file))"
-                        if $flags =~ / ( [^AabCDdEeFfGhiIMmNnTOoPpRrSUuWXxy;] ) /x;
+                        if $flags =~ / ( [^AabCDdEeFfGhiIMmNnTOoPpRrSsUuWXxy;#] ) /x;
 
             die "'u' flag must also have 'm' or 'y' flags' for $element_name"
                                             if $flags =~ /u/ && $flags !~ /[my]/;
             warn ("'$element_name' not \\w+ in '$proto_in_file' in $file")
                         if $flags !~ /N/ && $element_name !~ / ^ [_[:alpha:]] \w* $ /x;
 
+            if ($flags =~ /#/) {
+                die "Return type must be empty for '$element_name'"
+                                                                   if $ret_type;
+                $ret_type = '#ifdef';
+            }
+
             if (exists $seen{$element_name} && $flags !~ /h/) {
                 die ("'$element_name' in $file was already documented in $seen{$element_name}");
             }
index e741953..66f2b96 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
 :   ;  autodoc.pl adds a terminating semi-colon to the usage example in the
 :      documentation.
 :
+:   #  The number sign flag indicates that this is a pre-processor symbol that
+:      is just #define'd or #undef'd.  (Mnemonic: The ';' indicates the end of
+:      statement, with no definition to follow the symbol name.
+:
+:   ?  The question mark flag is used internally by Devel::PPPort to indicate
+:      that it does not have enough information to generate a proper test case.
+:
 : In this file, pointer parameters that must not be passed NULLs should be
 : prefixed with NN.
 :