diff options
author | schwarze <> | 2022-11-23 17:20:23 +0000 |
---|---|---|
committer | schwarze <> | 2022-11-23 17:20:23 +0000 |
commit | 8fe2402158d1795d8f8a84b4f2dc59e1790a1a09 (patch) | |
tree | a6fecf2e8c67d1b10c67f19535aae413989729eb /src/regress/lib | |
parent | 0609289d1e34d584c8949e71ae6a3c0adebe5a46 (diff) | |
download | openbsd-8fe2402158d1795d8f8a84b4f2dc59e1790a1a09.tar.gz openbsd-8fe2402158d1795d8f8a84b4f2dc59e1790a1a09.tar.bz2 openbsd-8fe2402158d1795d8f8a84b4f2dc59e1790a1a09.zip |
Several improvements required for <openssl/bn.h>:
* List internal constants and types that are intentionally undocumented.
* List unused constants and types that are intentionally undocumented.
* Cope with intentionally undocumented identifiers being declared
more than once (in this case, because of #if and #else).
* Require exact matches for man -k searches (in this case,
such that BN_BITS does not match BN_BITS2).
* Handle the weird BN_ULONG, which is #define'd instead of using typedef.
Diffstat (limited to 'src/regress/lib')
-rwxr-xr-x | src/regress/lib/libcrypto/man/check_complete.pl | 65 |
1 files changed, 39 insertions, 26 deletions
diff --git a/src/regress/lib/libcrypto/man/check_complete.pl b/src/regress/lib/libcrypto/man/check_complete.pl index 6a55bdcb8f..964191f705 100755 --- a/src/regress/lib/libcrypto/man/check_complete.pl +++ b/src/regress/lib/libcrypto/man/check_complete.pl | |||
@@ -25,7 +25,10 @@ my %internal = ( | |||
25 | CHARTYPE_FIRST_ESC_2253 CHARTYPE_LAST_ESC_2253 CHARTYPE_PRINTABLESTRING | 25 | CHARTYPE_FIRST_ESC_2253 CHARTYPE_LAST_ESC_2253 CHARTYPE_PRINTABLESTRING |
26 | )], | 26 | )], |
27 | bn => [qw( | 27 | bn => [qw( |
28 | BN_MUL_COMBA BN_RECURSION BN_SQR_COMBA | 28 | BN_BITS BN_BITS4 BN_BYTES |
29 | BN_DEC_CONV BN_DEC_FMT1 BN_DEC_FMT2 BN_DEC_NUM BN_LLONG BN_LONG | ||
30 | BN_MASK2 BN_MASK2h BN_MASK2h1 BN_MASK2l BN_MUL_COMBA | ||
31 | BN_RECURSION BN_SQR_COMBA BN_TBIT BN_ULLONG | ||
29 | )], | 32 | )], |
30 | objects => [qw( | 33 | objects => [qw( |
31 | OBJ_bsearch OBJ_bsearch_ OBJ_bsearch_ex OBJ_bsearch_ex_ | 34 | OBJ_bsearch OBJ_bsearch_ OBJ_bsearch_ex OBJ_bsearch_ex_ |
@@ -47,7 +50,8 @@ my %obsolete = ( | |||
47 | X509_algor_st | 50 | X509_algor_st |
48 | )], | 51 | )], |
49 | bn => [qw( | 52 | bn => [qw( |
50 | BN_set_params BN_get_params | 53 | BN_FLG_EXP_CONSTTIME BN_FLG_FREE BN_get_params |
54 | BN_HEX_FMT1 BN_HEX_FMT2 BN_MASK BN_set_params | ||
51 | )], | 55 | )], |
52 | objects => [qw( | 56 | objects => [qw( |
53 | _DECLARE_OBJ_BSEARCH_CMP_FN | 57 | _DECLARE_OBJ_BSEARCH_CMP_FN |
@@ -98,7 +102,8 @@ my $in_define = 0; | |||
98 | my $in_function = 0; | 102 | my $in_function = 0; |
99 | my $in_struct = 0; | 103 | my $in_struct = 0; |
100 | my $in_typedef_struct = 0; | 104 | my $in_typedef_struct = 0; |
101 | my %undoc = (); | 105 | my %expect_undoc = (); |
106 | my %found_undoc = (); | ||
102 | my $verbose = 0; | 107 | my $verbose = 0; |
103 | 108 | ||
104 | if (defined $ARGV[0] && $ARGV[0] eq '-v') { | 109 | if (defined $ARGV[0] && $ARGV[0] eq '-v') { |
@@ -109,9 +114,9 @@ $#ARGV == 0 or die "usage: $0 [-v] headername"; | |||
109 | $hfile .= "/$ARGV[0].h"; | 114 | $hfile .= "/$ARGV[0].h"; |
110 | open my $in_fh, '<', $hfile or die "$hfile: $!"; | 115 | open my $in_fh, '<', $hfile or die "$hfile: $!"; |
111 | 116 | ||
112 | $undoc{$_} = 1 foreach @{$internal{$ARGV[0]}}; | 117 | $expect_undoc{$_} = 1 foreach @{$internal{$ARGV[0]}}; |
113 | $undoc{$_} = 1 foreach @{$obsolete{$ARGV[0]}}; | 118 | $expect_undoc{$_} = 1 foreach @{$obsolete{$ARGV[0]}}; |
114 | $undoc{$_} = 1 foreach @{$postponed{$ARGV[0]}}; | 119 | $expect_undoc{$_} = 1 foreach @{$postponed{$ARGV[0]}}; |
115 | 120 | ||
116 | while (<$in_fh>) { | 121 | while (<$in_fh>) { |
117 | try_again: | 122 | try_again: |
@@ -164,13 +169,13 @@ try_again: | |||
164 | $in_typedef_struct = 0; | 169 | $in_typedef_struct = 0; |
165 | my ($id) = /^\s*(\w+);$/ | 170 | my ($id) = /^\s*(\w+);$/ |
166 | or die "at end of typedef struct: $_"; | 171 | or die "at end of typedef struct: $_"; |
167 | unless (system "$MANW -k Vt=$id > /dev/null 2>&1") { | 172 | unless (system "$MANW -k 'Vt~^$id\$' > /dev/null 2>&1") { |
168 | print "Vt $line\n" if $verbose; | 173 | print "Vt $line\n" if $verbose; |
169 | next; | 174 | next; |
170 | } | 175 | } |
171 | if ($undoc{$id}) { | 176 | if ($expect_undoc{$id}) { |
172 | print "V- $line\n" if $verbose; | 177 | print "V- $line\n" if $verbose; |
173 | delete $undoc{$id}; | 178 | $found_undoc{$id} = 1; |
174 | next; | 179 | next; |
175 | } | 180 | } |
176 | if ($verbose) { | 181 | if ($verbose) { |
@@ -236,7 +241,12 @@ try_again: | |||
236 | 241 | ||
237 | if (my ($id) = /^#\s*define\s+(\w+)\s+\S/) { | 242 | if (my ($id) = /^#\s*define\s+(\w+)\s+\S/) { |
238 | /\\$/ and $in_define = 1; | 243 | /\\$/ and $in_define = 1; |
239 | unless (system "$MANW -k Dv=$id > /dev/null 2>&1") { | 244 | if ($id eq 'BN_ULONG' && |
245 | not system "$MANW -k 'Vt~^$id\$' > /dev/null 2>&1") { | ||
246 | print "Vt $line\n" if $verbose; | ||
247 | next; | ||
248 | } | ||
249 | unless (system "$MANW -k 'Dv~^$id\$' > /dev/null 2>&1") { | ||
240 | print "Dv $line\n" if $verbose; | 250 | print "Dv $line\n" if $verbose; |
241 | next; | 251 | next; |
242 | } | 252 | } |
@@ -265,9 +275,9 @@ try_again: | |||
265 | print "D- $line\n" if $verbose; | 275 | print "D- $line\n" if $verbose; |
266 | next; | 276 | next; |
267 | } | 277 | } |
268 | if ($undoc{$id}) { | 278 | if ($expect_undoc{$id}) { |
269 | print "D- $line\n" if $verbose; | 279 | print "D- $line\n" if $verbose; |
270 | delete $undoc{$id}; | 280 | $found_undoc{$id} = 1; |
271 | next; | 281 | next; |
272 | } | 282 | } |
273 | if ($verbose) { | 283 | if ($verbose) { |
@@ -288,9 +298,9 @@ try_again: | |||
288 | print "F- $line\n" if $verbose; | 298 | print "F- $line\n" if $verbose; |
289 | next; | 299 | next; |
290 | } | 300 | } |
291 | if ($undoc{$id}) { | 301 | if ($expect_undoc{$id}) { |
292 | print "F- $line\n" if $verbose; | 302 | print "F- $line\n" if $verbose; |
293 | delete $undoc{$id}; | 303 | $found_undoc{$id} = 1; |
294 | next; | 304 | next; |
295 | } | 305 | } |
296 | if ($verbose) { | 306 | if ($verbose) { |
@@ -301,9 +311,9 @@ try_again: | |||
301 | next; | 311 | next; |
302 | } | 312 | } |
303 | if (my ($id) = /^#\s*define\s+(\w+)$/) { | 313 | if (my ($id) = /^#\s*define\s+(\w+)$/) { |
304 | if ($undoc{$id}) { | 314 | if ($expect_undoc{$id}) { |
305 | print "-- $line\n" if $verbose; | 315 | print "-- $line\n" if $verbose; |
306 | delete $undoc{$id}; | 316 | $found_undoc{$id} = 1; |
307 | next; | 317 | next; |
308 | } | 318 | } |
309 | if ($verbose) { | 319 | if ($verbose) { |
@@ -317,7 +327,7 @@ try_again: | |||
317 | # Handle global variables. | 327 | # Handle global variables. |
318 | 328 | ||
319 | if (my ($id) = /^extern\s+int\s+(\w+);$/) { | 329 | if (my ($id) = /^extern\s+int\s+(\w+);$/) { |
320 | unless (system "$MANW -k Va=$id > /dev/null 2>&1") { | 330 | unless (system "$MANW -k 'Va~^$id\$' > /dev/null 2>&1") { |
321 | print "Va $line\n" if $verbose; | 331 | print "Va $line\n" if $verbose; |
322 | next; | 332 | next; |
323 | } | 333 | } |
@@ -332,13 +342,13 @@ try_again: | |||
332 | # Handle variable type declarations. | 342 | # Handle variable type declarations. |
333 | 343 | ||
334 | if (my ($id) = /^struct\s+(\w+);$/) { | 344 | if (my ($id) = /^struct\s+(\w+);$/) { |
335 | unless (system "$MANW -k Vt=$id > /dev/null 2>&1") { | 345 | unless (system "$MANW -k 'Vt~^$id\$' > /dev/null 2>&1") { |
336 | print "Vt $line\n" if $verbose; | 346 | print "Vt $line\n" if $verbose; |
337 | next; | 347 | next; |
338 | } | 348 | } |
339 | if ($undoc{$id}) { | 349 | if ($expect_undoc{$id}) { |
340 | print "V- $line\n" if $verbose; | 350 | print "V- $line\n" if $verbose; |
341 | delete $undoc{$id}; | 351 | $found_undoc{$id} = 1; |
342 | next; | 352 | next; |
343 | } | 353 | } |
344 | if ($verbose) { | 354 | if ($verbose) { |
@@ -350,13 +360,13 @@ try_again: | |||
350 | } | 360 | } |
351 | 361 | ||
352 | if (my ($id) = /^typedef\s+(?:const\s+)?(?:struct\s+)?\S+\s+(\w+);$/) { | 362 | if (my ($id) = /^typedef\s+(?:const\s+)?(?:struct\s+)?\S+\s+(\w+);$/) { |
353 | unless (system "$MANW -k Vt=$id > /dev/null 2>&1") { | 363 | unless (system "$MANW -k 'Vt~^$id\$' > /dev/null 2>&1") { |
354 | print "Vt $line\n" if $verbose; | 364 | print "Vt $line\n" if $verbose; |
355 | next; | 365 | next; |
356 | } | 366 | } |
357 | if ($undoc{$id}) { | 367 | if ($expect_undoc{$id}) { |
358 | print "V- $line\n" if $verbose; | 368 | print "V- $line\n" if $verbose; |
359 | delete $undoc{$id}; | 369 | $found_undoc{$id} = 1; |
360 | next; | 370 | next; |
361 | } | 371 | } |
362 | if ($verbose) { | 372 | if ($verbose) { |
@@ -403,9 +413,9 @@ try_again: | |||
403 | print "F- $line\n" if $verbose; | 413 | print "F- $line\n" if $verbose; |
404 | next; | 414 | next; |
405 | } | 415 | } |
406 | if ($undoc{$id}) { | 416 | if ($expect_undoc{$id}) { |
407 | print "F- $line\n" if $verbose; | 417 | print "F- $line\n" if $verbose; |
408 | delete $undoc{$id}; | 418 | $found_undoc{$id} = 1; |
409 | next; | 419 | next; |
410 | } | 420 | } |
411 | if ($id =~ /^ASN1_PCTX_\w+$/) { | 421 | if ($id =~ /^ASN1_PCTX_\w+$/) { |
@@ -430,5 +440,8 @@ try_again: | |||
430 | die "parse error: $_"; | 440 | die "parse error: $_"; |
431 | } | 441 | } |
432 | close $in_fh; | 442 | close $in_fh; |
433 | warn "expected as undocumented but not found: $_" foreach keys %undoc; | 443 | foreach (keys %expect_undoc) { |
444 | warn "expected as undocumented but not found: $_" | ||
445 | unless $found_undoc{$_}; | ||
446 | } | ||
434 | exit 0; | 447 | exit 0; |