From 31d3a7590274b48b194ed070ae531238764647f9 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 19 Nov 2019 10:50:14 +0100 Subject: [PATCH] util/find-doc-nits: limit the prototype check The prototype checks shouldn't be performed on SYNOPSIS lines that aren't function prototypes. Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/10394) --- util/find-doc-nits | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/util/find-doc-nits b/util/find-doc-nits index da6e49f781..acd9aa4e93 100755 --- a/util/find-doc-nits +++ b/util/find-doc-nits @@ -140,6 +140,7 @@ sub name_synopsis { foreach my $line ( split /\n+/, $syn ) { next unless $line =~ /^\s/; my $sym; + my $is_prototype = 1; $line =~ s/STACK_OF\([^)]+\)/int/g; $line =~ s/SPARSE_ARRAY_OF\([^)]+\)/int/g; $line =~ s/__declspec\([^)]+\)//; @@ -154,11 +155,13 @@ sub name_synopsis { $sym = $1; } elsif ( $line =~ /typedef.* (\S+);/ ) { # a simple typedef: typedef ... NAME; + $is_prototype = 0; $sym = $1; } elsif ( $line =~ /enum (\S*) \{/ ) { # an enumeration: enum ... { $sym = $1; } elsif ( $line =~ /#(?:define|undef) ([A-Za-z0-9_]+)/ ) { + $is_prototype = 0; $sym = $1; } elsif ( $line =~ /([A-Za-z0-9_]+)\(/ ) { $sym = $1; @@ -172,7 +175,7 @@ sub name_synopsis { # Do some sanity checks on the prototype. err($id, "prototype missing spaces around commas: $line") - if ( $line =~ /[a-z0-9],[^ ]/ ); + if $is_prototype && $line =~ /[a-z0-9],[^ ]/; } foreach my $n ( keys %names ) { -- 2.25.1