From cbaaae44fee13767a2436cc358348236342fbb9c Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 11 Nov 2019 17:16:04 +0100 Subject: CURL-DISABLE: initial docs for the CURL_DISABLE_* defines The disable-scan script used in test 1165 is extended to also verify that the docs cover all used defines and all defines offered by configure. Reported-by: SLDiggie on github Fixes #4545 Closes #4587 --- tests/disable-scan.pl | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'tests/disable-scan.pl') diff --git a/tests/disable-scan.pl b/tests/disable-scan.pl index e57fdc697..45373ca40 100755 --- a/tests/disable-scan.pl +++ b/tests/disable-scan.pl @@ -29,9 +29,12 @@ use warnings; my %disable; # the DISABLE options that are used in C files my %file; +# the DISABLE options that are documented +my %docs; # we may get the dir root pointed out my $root=$ARGV[0] || "."; +my $DOCS="CURL-DISABLE.md"; sub scan_configure { open S, "<$root/configure.ac"; @@ -73,8 +76,22 @@ sub scan_sources { scan_dir("$root/lib/vauth"); } +sub scan_docs { + open F, "<$root/docs/$DOCS"; + my $line = 0; + while() { + $line++; + if(/^## (CURL_DISABLE_[A-Z_]+)/g) { + my ($sym)=($1); + $docs{$sym} = $line; + } + } + close F; +} + scan_configure(); scan_sources(); +scan_docs(); my $error = 0; @@ -84,6 +101,10 @@ for my $s (sort keys %disable) { printf "Present in configure.ac, not used by code: %s\n", $s; $error++; } + if(!$docs{$s}) { + printf "Present in configure.ac, not documented in $DOCS: %s\n", $s; + $error++; + } } # Check the code symbols for use in configure @@ -92,6 +113,22 @@ for my $s (sort keys %file) { printf "Not set by configure: %s (%s)\n", $s, $file{$s}; $error++; } + if(!$docs{$s}) { + printf "Used in code, not documented in $DOCS: %s\n", $s; + $error++; + } +} + +# Check the documented symbols +for my $s (sort keys %docs) { + if(!$disable{$s}) { + printf "Documented but not in configure: %s\n", $s; + $error++; + } + if(!$file{$s}) { + printf "Documented, but not used by code: %s\n", $s; + $error++; + } } exit $error; -- cgit v1.2.3