test1175.pl (2241B)
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 %error; # from the include file 33 my %docs; # from libcurl-errors.3 34 35 sub getdocserrors { 36 open(my $f, "<", "$root/docs/libcurl/libcurl-errors.md"); 37 while(<$f>) { 38 if($_ =~ /^## (CURL[EM]_[^ ]*)/) { 39 my ($symbol) = ($1); 40 if($symbol =~ /OBSOLETE/) { 41 ; 42 } 43 else { 44 $docs{$symbol}=1; 45 } 46 } 47 } 48 close($f); 49 } 50 51 sub getincludeerrors { 52 open(my $f, "<", "$root/docs/libcurl/symbols-in-versions"); 53 while(<$f>) { 54 if($_ =~ /^(CURL[EM]_[^ \t]*)[ \t]*([0-9.]+)[ \t]*(.*)/) { 55 my ($symbol, $added, $rest) = ($1,$2,$3); 56 if($rest =~ /^([0-9.]+)/) { 57 # removed! 58 } 59 else { 60 $error{$symbol}=$added; 61 } 62 } 63 } 64 close($f); 65 } 66 67 getincludeerrors(); 68 getdocserrors(); 69 70 for(sort keys %error) { 71 if($error{$_} && !$docs{$_}) { 72 print "$_ is not in libcurl-errors.md\n"; 73 } 74 } 75 76 for(sort keys %docs) { 77 if($docs{$_} && !$error{$_}) { 78 print "$_ is not in symbols-in-versions\n"; 79 } 80 }