diff options
author | Richard Levitte <levitte@openssl.org> | 2020-09-15 10:02:34 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-09-20 17:32:36 +0200 |
commit | b1415dc1820def1e9e344f9b83ad05c2a352ec56 (patch) | |
tree | acfe24ec0a994b99588a1f65fee9024aff08eb09 /util | |
parent | 48b62fb33aa0c5bce52b939fcd94780736491a5d (diff) |
util/find-doc-nits: Add a regexp for C symbols and use it
Our matching of C symbols here was inconsistent and could therefore
give false negatives when the SYNOPSIS was parsed. Now we have
$C_symbol, which is a simple regexp that matches the common C symbol.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12873)
Diffstat (limited to 'util')
-rwxr-xr-x | util/find-doc-nits | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/util/find-doc-nits b/util/find-doc-nits index ac661827dd..d614844952 100755 --- a/util/find-doc-nits +++ b/util/find-doc-nits @@ -104,6 +104,9 @@ my $ignored = qr/(?| ^i2d_ | ^DEFINE_LHASH_OF_INTERNAL )/x; +# A common regexp for C symbol names +my $C_symbol = qr/\b[[:alpha:]][_[:alnum:]]*\b/; + # Collect all POD files, both internal and public, and regardless of location # We collect them in a hash table with each file being a key, so we can attach # tags to them. For example, internal docs will have the word "internal" @@ -367,27 +370,27 @@ sub name_synopsis { if ( $line =~ /env (\S*)=/ ) { # environment variable env NAME=... $sym = $1; - } elsif ( $line =~ /typedef.*\(\*?(\S+)\)\s*\(/ ) { + } elsif ( $line =~ /typedef.*\(\*?($C_symbol)\)\s*\(/ ) { # a callback function pointer: typedef ... (*NAME)(... # a callback function signature: typedef ... (NAME)(... $sym = $1; - } elsif ( $line =~ /typedef.* (\S+)\s*\(/ ) { + } elsif ( $line =~ /typedef.*($C_symbol)\s*\(/ ) { # a callback function signature: typedef ... NAME(... $sym = $1; - } elsif ( $line =~ /typedef.* (\S+);/ ) { + } elsif ( $line =~ /typedef.*($C_symbol);/ ) { # a simple typedef: typedef ... NAME; $is_prototype = 0; $sym = $1; - } elsif ( $line =~ /enum (\S*) \{/ ) { + } elsif ( $line =~ /enum ($C_symbol) \{/ ) { # an enumeration: enum ... { $sym = $1; - } elsif ( $line =~ /#\s*(?:define|undef) ([A-Za-z0-9_]+)/ ) { + } elsif ( $line =~ /#\s*(?:define|undef) ($C_symbol)/ ) { $is_prototype = 0; $sym = $1; - } elsif ( $line =~ /^[^\(]*?\(\*([A-Za-z0-9_]+)\s*\(/ ) { + } elsif ( $line =~ /^[^\(]*?\(\*($C_symbol)\s*\(/ ) { # a function returning a function pointer: TYPE (*NAME(args))(args) $sym = $1; - } elsif ( $line =~ /^[^\(]*?([A-Za-z0-9_]+)\s*\(/ ) { + } elsif ( $line =~ /^[^\(]*?($C_symbol)\s*\(/ ) { # a simple function declaration $sym = $1; } |