diff options
author | Richard Levitte <levitte@openssl.org> | 2020-09-15 17:10:44 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2020-09-16 18:07:24 +0200 |
commit | fc661b50dfedfed1b067782665e0452ed964c22c (patch) | |
tree | ec64b8bc493853c80cd1da4ad6ba1764197a9b5c /util | |
parent | 4343a4187d28d719006642a610afea6e186832bf (diff) | |
download | openssl-fc661b50dfedfed1b067782665e0452ed964c22c.tar.gz |
OpenSSL::ParseC: recognise inline function bodies
Function bodies in headers weren't a thing when OpenSSL::ParseC was
created, at least not as clearly as they are nowadays. This module
must evolve to recognise them (and promptly ignore them).
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/12882)
Diffstat (limited to 'util')
-rw-r--r-- | util/perl/OpenSSL/ParseC.pm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/util/perl/OpenSSL/ParseC.pm b/util/perl/OpenSSL/ParseC.pm index c5be9b8c2a..b2ac909dc1 100644 --- a/util/perl/OpenSSL/ParseC.pm +++ b/util/perl/OpenSSL/ParseC.pm @@ -601,6 +601,7 @@ my @chandlers = ( massager => sub { return (); } }, # Function returning function pointer declaration + # This sort of declaration may have a body (inline functions, for example) { regexp => qr/(?:(typedef)\s?)? # Possible typedef ($1) ((?:\w|\*|\s)*?) # Return type ($2) \s? # Possible space @@ -609,14 +610,15 @@ my @chandlers = ( (\(.*\)) # Parameters ($4) \)>>> <<<(\(.*\))>>> # F.p. parameters ($5) - ; + (?:<<<\{.*\}>>>|;) # Body or semicolon /x, massager => sub { - return ("", $3, 'F', "", "$2(*$4)$5", all_conds()) + return ("", $3, 'T', "", "$2(*$4)$5", all_conds()) if defined $1; return ("", $3, 'F', "$2(*)$5", "$2(*$4)$5", all_conds()); } }, # Function pointer declaration, or typedef thereof + # This sort of declaration never has a function body { regexp => qr/(?:(typedef)\s?)? # Possible typedef ($1) ((?:\w|\*|\s)*?) # Return type ($2) <<<\(\*([[:alpha:]_]\w*)\)>>> # T.d. or var name ($3) @@ -630,12 +632,13 @@ my @chandlers = ( }, }, # Function declaration, or typedef thereof + # This sort of declaration may have a body (inline functions, for example) { regexp => qr/(?:(typedef)\s?)? # Possible typedef ($1) ((?:\w|\*|\s)*?) # Return type ($2) \s? # Possible space ([[:alpha:]_]\w*) # Function name ($3) <<<(\(.*\))>>> # Parameters ($4) - ; + (?:<<<\{.*\}>>>|;) # Body or semicolon /x, massager => sub { return ("", $3, 'T', "", "$2$4", all_conds()) |