test1175.pl 2.2 KB

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