2 #***************************************************************************
4 # Project ___| | | | _ \| |
6 # | (__| |_| | _ <| |___
7 # \___|\___/|_| \_\_____|
9 # Copyright (C) 2010-2011, Daniel Stenberg, <daniel@haxx.se>, et al.
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 http://curl.haxx.se/docs/copyright.html.
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.
19 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 # KIND, either express or implied.
22 ###########################################################################
24 # This script grew out of help from Przemyslaw Iskra and Balint Szilakszi
25 # a late evening in the #curl IRC channel on freenode.
32 # configurehelp perl module is generated by configure script
38 # we may get the dir root pointed out
39 my $root=$ARGV[0] || ".";
41 # need an include directory when building out-of-tree
42 my $i = ($ARGV[1]) ? "-I$ARGV[1] " : '';
44 my $h = "$root/include/curl/curl.h";
45 my $mh = "$root/include/curl/multi.h";
55 open H_IN, "-|", "$Cpreprocessor $i$h" || die "Cannot preprocess curl.h";
57 if ( /enum\s+(\S+\s+)?{/ .. /}/ ) {
65 close H_IN || die "Error preprocessing curl.h";
71 if (/^#define (CURL[A-Za-z0-9_]*)/) {
81 open S, "<$root/docs/libcurl/symbols-in-versions";
83 if(/(^CURL[^ \n]*) *(.*)/) {
84 my ($sym, $rest)=($1, $2);
86 print "Detected duplicate symbol: $sym\n";
91 my @a=split(/ +/, $rest);
93 # this symbol is documented to have been present the last time
102 for my $e (sort @syms) {
103 # OBSOLETE - names that are just placeholders for a position where we
104 # previously had a name, that is now removed. The OBSOLETE names should
105 # never be used for anything.
107 # CURL_EXTERN - is a define used for libcurl functions that are external,
108 # public. No app or other code should ever use it.
110 # *_LAST and *_LASTENTRY are just prefix for the placeholders used for the
111 # last entry in many enum series.
114 if($e =~ /(OBSOLETE|^CURL_EXTERN|_LAST\z|_LASTENTRY\z)/) {
132 # now scan through all symbols that were present in the symbols-in-versions
133 # but not in the headers
135 # If the symbols were marked 'removed' in symbols-in-versions we don't output
136 # anything about it since that is perfectly fine.
141 for my $e (sort keys %doc) {
142 if(($doc{$e} ne "used") && !$rem{$e}) {
145 print "Missing symbols mentioned in symbols-in-versions\n";
146 print "Add them to a header, or mark them as removed.\n";
156 printf "%d symbols in headers (out of which %d are ignored)\n", scalar(@syms),
158 printf "%d symbols in headers are interesting\n",
159 scalar(@syms)- $ignored;
160 printf "%d symbols are listed in symbols-in-versions\n (out of which %d are listed as removed)\n", scalar(keys %doc), scalar(keys %rem);
161 printf "%d symbols in symbols-in-versions should match the ones in headers\n", scalar(keys %doc) - scalar(keys %rem);
165 exit 2; # there are stuff to attend to!