test745.pl (2353B)
1 #!/usr/bin/env perl 2 #*************************************************************************** 3 # _ _ ____ _ 4 # Project ___| | | | _ \| | 5 # / __| | | | |_) | | 6 # | (__| |_| | _ <| |___ 7 # \___|\___/|_| \_\_____| 8 # 9 # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 10 # 11 # This software is licensed as described in the file COPYING, which 12 # you should have received as part of this distribution. The terms 13 # are also available at https://curl.se/docs/copyright.html. 14 # 15 # You may opt to use, copy, modify, merge, publish, distribute and/or sell 16 # copies of the Software, and permit persons to whom the Software is 17 # furnished to do so, under the terms of the COPYING file. 18 # 19 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 20 # KIND, either express or implied. 21 # 22 # SPDX-License-Identifier: curl 23 # 24 ########################################################################### 25 26 use strict; 27 use warnings; 28 29 # we may get the dir root pointed out 30 my $root=$ARGV[0] || "."; 31 32 my %typecheck; # from the include file 33 my %enum; # from libcurl-errors.3 34 35 sub gettypecheck { 36 open(my $f, "<", "$root/include/curl/typecheck-gcc.h") 37 || die "no typecheck file"; 38 while(<$f>) { 39 chomp; 40 if($_ =~ /\(option\) == (CURL[^ \)]*)/) { 41 $typecheck{$1}++; 42 } 43 } 44 close($f); 45 } 46 47 sub getinclude { 48 open(my $f, "<", "$root/include/curl/curl.h") 49 || die "no curl.h"; 50 while(<$f>) { 51 if($_ =~ /\((CURLOPT[^,]*), (CURLOPTTYPE_[^,]*)/) { 52 my ($opt, $type) = ($1, $2); 53 if($type !~ /LONG|VALUES|BLOB|OFF_T/) { 54 $enum{$opt}++; 55 } 56 } 57 } 58 $enum{"CURLOPT_SOCKS5_GSSAPI_SERVICE"}++; 59 $enum{"CURLOPT_CONV_FROM_NETWORK_FUNCTION"}++; 60 $enum{"CURLOPT_CONV_FROM_UTF8_FUNCTION"}++; 61 $enum{"CURLOPT_CONV_TO_NETWORK_FUNCTION"}++; 62 close($f); 63 } 64 65 gettypecheck(); 66 getinclude(); 67 68 my $error; 69 for(sort keys %typecheck) { 70 if($typecheck{$_} && !$enum{$_}) { 71 print "$_ is not in curl.h\n"; 72 $error++; 73 } 74 } 75 76 for(sort keys %enum) { 77 if($enum{$_} && !$typecheck{$_}) { 78 print "$_ is not checked in typecheck-gcc-h\n"; 79 $error++; 80 } 81 } 82 print "OK\n" if(!$error);