tizen 2.3.1 release
[external/curl.git] / tests / symbol-scan.pl
index cda9b73..89f5eef 100644 (file)
@@ -6,7 +6,7 @@
 #                            | (__| |_| |  _ <| |___
 #                             \___|\___/|_| \_\_____|
 #
-# Copyright (C) 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
+# Copyright (C) 2010-2011, Daniel Stenberg, <daniel@haxx.se>, et al.
 #
 # This software is licensed as described in the file COPYING, which
 # you should have received as part of this distribution. The terms
 
 use strict;
 use warnings;
+use vars qw($Cpreprocessor);
 
 #
 # configurehelp perl module is generated by configure script
 #
-use configurehelp qw(
-    $Cpreprocessor
-    );
+my $rc = eval {
+    require configurehelp;
+    configurehelp->import(qw(
+        $Cpreprocessor
+    ));
+    1;
+};
+# Set default values if configure has not generated a configurehelp.pm file.
+# This is the case with cmake.
+if (!$rc) {
+    $Cpreprocessor = 'cpp';
+}
 
 # we may get the dir root pointed out
 my $root=$ARGV[0] || ".";
@@ -82,6 +92,11 @@ open S, "<$root/docs/libcurl/symbols-in-versions";
 while(<S>) {
     if(/(^CURL[^ \n]*) *(.*)/) {
         my ($sym, $rest)=($1, $2);
+        if($doc{$sym}) {
+            print "Detected duplicate symbol: $sym\n";
+            $misses++;
+            next;
+        }
         $doc{$sym}=$sym;
         my @a=split(/ +/, $rest);
         if($a[2]) {
@@ -105,7 +120,7 @@ for my $e (sort @syms) {
     # *_LAST and *_LASTENTRY are just prefix for the placeholders used for the
     # last entry in many enum series.
     #
-    
+
     if($e =~ /(OBSOLETE|^CURL_EXTERN|_LAST\z|_LASTENTRY\z)/) {
         $ignored++;
         next;
@@ -154,7 +169,6 @@ if($summary) {
     scalar(@syms)- $ignored;
     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);
     printf "%d symbols in symbols-in-versions should match the ones in headers\n", scalar(keys %doc) - scalar(keys %rem);
-    
 }
 
 if($misses) {