diff options
author | schwarze <> | 2021-12-07 16:43:24 +0000 |
---|---|---|
committer | schwarze <> | 2021-12-07 16:43:24 +0000 |
commit | 12bd85dc5366a7b11a496529fcd2963a4d0ef55b (patch) | |
tree | b9e9e4b32bceb2aae02c6b1768054ef79854f2b5 /src | |
parent | 0dac27b8f62da9acb2557baf3463eaa689bc0332 (diff) | |
download | openbsd-12bd85dc5366a7b11a496529fcd2963a4d0ef55b.tar.gz openbsd-12bd85dc5366a7b11a496529fcd2963a4d0ef55b.tar.bz2 openbsd-12bd85dc5366a7b11a496529fcd2963a4d0ef55b.zip |
Some improvements allowing to handle asn1.h and x509v3.h:
* handle multiple qualifiers on the function return type
* handle function pointer type declarations
* handle unions inside structs
* handle forward struct declarations
* handle "typedef const"
* handle ASN1_F_, ASN1_R_, and X509V3_R_ error constants
* handle "#if defined" in the same way as "#ifdef"
* skip whitespace between "#" and "define"
* skip whitespace before C comments
* ignore TYPEDEF_D2I2D_OF
Diffstat (limited to 'src')
-rwxr-xr-x | src/regress/lib/libcrypto/man/check_complete.pl | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/src/regress/lib/libcrypto/man/check_complete.pl b/src/regress/lib/libcrypto/man/check_complete.pl index 6d72f44441..142413867c 100755 --- a/src/regress/lib/libcrypto/man/check_complete.pl +++ b/src/regress/lib/libcrypto/man/check_complete.pl | |||
@@ -66,8 +66,8 @@ try_again: | |||
66 | $in_comment = 0; | 66 | $in_comment = 0; |
67 | } | 67 | } |
68 | while (/\/\*/) { | 68 | while (/\/\*/) { |
69 | s/\/\*.*?\*\/// and next; | 69 | s/\s*\/\*.*?\*\/// and next; |
70 | s/\/\*.*// and $in_comment = 1; | 70 | s/\s*\/\*.*// and $in_comment = 1; |
71 | } | 71 | } |
72 | 72 | ||
73 | # End C++ stuff. | 73 | # End C++ stuff. |
@@ -81,11 +81,19 @@ try_again: | |||
81 | # End declarations of structs. | 81 | # End declarations of structs. |
82 | 82 | ||
83 | if ($in_struct) { | 83 | if ($in_struct) { |
84 | if (/^\s*union\s+{$/) { | ||
85 | print "-s $line\n" if $verbose; | ||
86 | $in_struct++; | ||
87 | next; | ||
88 | } | ||
84 | unless (s/^\s*\}//) { | 89 | unless (s/^\s*\}//) { |
85 | print "-s $line\n" if $verbose; | 90 | print "-s $line\n" if $verbose; |
86 | next; | 91 | next; |
87 | } | 92 | } |
88 | $in_struct = 0; | 93 | if (--$in_struct && /^\s+\w+;$/) { |
94 | print "-s $line\n" if $verbose; | ||
95 | next; | ||
96 | } | ||
89 | unless ($in_typedef_struct) { | 97 | unless ($in_typedef_struct) { |
90 | /^\s*;$/ or die "at end of struct: $_"; | 98 | /^\s*;$/ or die "at end of struct: $_"; |
91 | print "-s $line\n" if $verbose; | 99 | print "-s $line\n" if $verbose; |
@@ -143,11 +151,13 @@ try_again: | |||
143 | 151 | ||
144 | if (/^\s*$/ || | 152 | if (/^\s*$/ || |
145 | /^DECLARE_STACK_OF\(\w+\)$/ || | 153 | /^DECLARE_STACK_OF\(\w+\)$/ || |
154 | /^TYPEDEF_D2I2D_OF\(\w+\);$/ || | ||
146 | /^#define HEADER_\w+_H$/ || | 155 | /^#define HEADER_\w+_H$/ || |
147 | /^#endif$/ || | 156 | /^#endif$/ || |
148 | /^extern\s+const\s+ASN1_ITEM\s+\w+_it;$/ || | 157 | /^extern\s+const\s+ASN1_ITEM\s+\w+_it;$/ || |
149 | /^#include\s/ || | 158 | /^#include\s/ || |
150 | /^#ifn?def\s/) { | 159 | /^#ifn?def\s/ || |
160 | /^#if defined/) { | ||
151 | print "-- $line\n" if $verbose; | 161 | print "-- $line\n" if $verbose; |
152 | next; | 162 | next; |
153 | } | 163 | } |
@@ -163,7 +173,7 @@ try_again: | |||
163 | 173 | ||
164 | # Handle macros. | 174 | # Handle macros. |
165 | 175 | ||
166 | if (my ($id) = /^#define\s+(\w+)\s+\S/) { | 176 | if (my ($id) = /^#\s*define\s+(\w+)\s+\S/) { |
167 | /\\$/ and $in_define = 1; | 177 | /\\$/ and $in_define = 1; |
168 | unless (system "$MANW -k Dv=$id > /dev/null 2>&1") { | 178 | unless (system "$MANW -k Dv=$id > /dev/null 2>&1") { |
169 | print "Dv $line\n" if $verbose; | 179 | print "Dv $line\n" if $verbose; |
@@ -182,7 +192,7 @@ try_again: | |||
182 | print "D- $line\n" if $verbose; | 192 | print "D- $line\n" if $verbose; |
183 | next; | 193 | next; |
184 | } | 194 | } |
185 | if ($id =~ /^X509_[FR]_\w+$/) { | 195 | if ($id =~ /^(?:ASN1|X509(?:V3)?)_[FR]_\w+$/) { |
186 | print "D- $line\n" if $verbose; | 196 | print "D- $line\n" if $verbose; |
187 | next; | 197 | next; |
188 | } | 198 | } |
@@ -201,7 +211,7 @@ try_again: | |||
201 | } | 211 | } |
202 | next; | 212 | next; |
203 | } | 213 | } |
204 | if (my ($id) = /^#define\s+(\w+)\(/) { | 214 | if (my ($id) = /^#\s*define\s+(\w+)\(/) { |
205 | /\\$/ and $in_define = 1; | 215 | /\\$/ and $in_define = 1; |
206 | unless (system "$MANW $id > /dev/null 2>&1") { | 216 | unless (system "$MANW $id > /dev/null 2>&1") { |
207 | print "Fn $line\n" if $verbose; | 217 | print "Fn $line\n" if $verbose; |
@@ -220,9 +230,22 @@ try_again: | |||
220 | next; | 230 | next; |
221 | } | 231 | } |
222 | 232 | ||
223 | # Handle variable type definitions. | 233 | # Handle variable type declarations. |
224 | 234 | ||
225 | if (my ($id) = /^typedef\s+(?:struct\s+)?\S+\s+(\w+);$/) { | 235 | if (my ($id) = /^struct\s+(\w+);$/) { |
236 | unless (system "$MANW -k Vt=$id > /dev/null 2>&1") { | ||
237 | print "Vt $line\n" if $verbose; | ||
238 | next; | ||
239 | } | ||
240 | if ($verbose) { | ||
241 | print "XX $line\n"; | ||
242 | } else { | ||
243 | warn "not found: struct $id"; | ||
244 | } | ||
245 | next; | ||
246 | } | ||
247 | |||
248 | if (my ($id) = /^typedef\s+(?:const\s+)?(?:struct\s+)?\S+\s+(\w+);$/) { | ||
226 | unless (system "$MANW -k Vt=$id > /dev/null 2>&1") { | 249 | unless (system "$MANW -k Vt=$id > /dev/null 2>&1") { |
227 | print "Vt $line\n" if $verbose; | 250 | print "Vt $line\n" if $verbose; |
228 | next; | 251 | next; |
@@ -239,9 +262,23 @@ try_again: | |||
239 | next; | 262 | next; |
240 | } | 263 | } |
241 | 264 | ||
265 | if (my ($id) =/^typedef\s+\w+(?:\s+\*)?\s+\(\*(\w+)\)\(/) { | ||
266 | /\);$/ or $in_function = 1; | ||
267 | unless (system "$MANW $id > /dev/null 2>&1") { | ||
268 | print "Fn $line\n" if $verbose; | ||
269 | next; | ||
270 | } | ||
271 | if ($verbose) { | ||
272 | print "XX $line\n"; | ||
273 | } else { | ||
274 | warn "not found: function type (*$id)()"; | ||
275 | } | ||
276 | next; | ||
277 | } | ||
278 | |||
242 | # Handle function declarations. | 279 | # Handle function declarations. |
243 | 280 | ||
244 | if (/^\w+(?:\(\w+\))?(?:\s+\w+)?\s+(?:\(?\*\s*)?(\w+)\(/) { | 281 | if (/^\w+(?:\(\w+\))?(?:\s+\w+)*\s+(?:\(?\*\s*)?(\w+)\(/) { |
245 | my $id = $1; | 282 | my $id = $1; |
246 | /\);$/ or $in_function = 1; | 283 | /\);$/ or $in_function = 1; |
247 | unless (system "$MANW $id > /dev/null 2>&1") { | 284 | unless (system "$MANW $id > /dev/null 2>&1") { |