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
This commit is contained in:
Daniel Stenberg 2019-11-11 17:16:04 +01:00
parent 13182b33f7
commit cbaaae44fe
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
4 changed files with 150 additions and 14 deletions

View file

@ -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(<F>) {
$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;