error-codes.pl 2.2 KB

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