]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
made more clever to ignore inline function body.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 17 Nov 2013 16:44:22 +0000 (17:44 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Sun, 17 Nov 2013 16:45:08 +0000 (17:45 +0100)
doc/scripts/getfuncs.pl

index e7a0387a1bed2a67f898345f578dc0653e1625b0..69137405f01b60dc01113ec6868426a6646183ba 100755 (executable)
@@ -31,8 +31,9 @@ $state = 0;
 
 # 0: scanning
 # 1: comment
-# 2: struct||enum
+# 2: struct||enum||typedef func
 # 3: function
+# 4: inline function { }
 
 sub function_print {
   my $prototype = shift @_;
@@ -71,11 +72,18 @@ while ($line=<STDIN>) {
       $state = 1;
       next;
     } elsif ($line =~ m/^\s*typedef\s+enum/ || $line =~ m/^\s*enum/ || 
-             $line =~ m/^\s*struct/ || $line =~ m/^\s*typedef\s+struct/) {
+             $line =~ m/^\s*struct/ || $line =~ m/^\s*typedef\s+struct/ ||
+             $line =~ m/^\s*typedef/) {
 
       next if ($line =~ m/;/);
       $state = 2;
       next;
+    } elsif ($line =~ m/^\s*extern\s+"C"/) {
+      next;
+    } elsif ($line =~ m/^\s*\{/) {
+      next if ($line =~ m/\}/);
+      $state = 4;
+      next;
     } elsif ($line !~ m/^\s*extern/ && $line !~ m/^\s*typedef/ && $line !~ m/doc-skip/ && $line =~ m/^\s*\w/) {
       $state = 3;
 
@@ -93,12 +101,12 @@ while ($line=<STDIN>) {
       $state = 0;
       next;
     }
-  } elsif ($state == 2) { #struct||enum
+  } elsif ($state == 2) { #struct||enum||typedef
     if ($line =~ m/;/) {
       $state = 0;
       next;
     }
-  } elsif ($state == 3) {
+  } elsif ($state == 3) { #possible function
     $prototype .= $line;
     
     if ($line =~ m/;/) {
@@ -106,6 +114,11 @@ while ($line=<STDIN>) {
 
       function_print($prototype);
     }
+  } elsif ($state == 4) { #inline function to be skipped
+    if ($line =~ m/\}/) {
+      $state = 0;
+      next;
+    }
   }
 
 }