From: Paul Yang Date: Tue, 26 Feb 2019 05:51:02 +0000 (+0800) Subject: Add section order check in util/find-doc-nits X-Git-Tag: OpenSSL_1_1_1c~51 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a345fa370e6acd1293e7370a85266e87dc7ebc38;p=oweals%2Fopenssl.git Add section order check in util/find-doc-nits This patch checks if the EXAMPLES section in a pod file is placed before the RETURN VALUES section. Reviewed-by: Richard Levitte (cherry picked from commit cc838ee2d66f7295bf7a7e6695aab1080d6791e9) Reviewed-by: Matt Caswell Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/8736) --- diff --git a/util/find-doc-nits b/util/find-doc-nits index 860bb9958b..deae76ce0f 100755 --- a/util/find-doc-nits +++ b/util/find-doc-nits @@ -137,6 +137,18 @@ sub name_synopsis() } } +# Check if EXAMPLES is located after RETURN VALUES section. +sub check_example_location() +{ + my $filename = shift; + my $contents = shift; + + return unless $contents =~ /=head1 RETURN VALUES/ + and $contents =~ /=head1 EXAMPLES/; + print "$filename: RETURN VAULES should be placed before EXAMPLES section\n" + if $contents =~ /=head1 EXAMPLES.*=head1 RETURN VALUES/ms; +} + sub check() { my $filename = shift; @@ -150,6 +162,8 @@ sub check() close POD; } + &check_example_location($filename, $contents) if $filename =~ m|man3/|; + my $id = "${filename}:1:"; &name_synopsis($id, $filename, $contents)