mirror of
https://github.com/curl/curl.git
synced 2026-08-24 21:43:32 +03:00
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:
parent
13182b33f7
commit
cbaaae44fe
4 changed files with 150 additions and 14 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue