perf probe: Fix memory leak when synthesizing SDT probes
[linux-2.6-microblaze.git] / scripts / get_abi.pl
index 2cb592f..92d9aa6 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!/usr/bin/env perl
 # SPDX-License-Identifier: GPL-2.0
 
 use strict;
@@ -287,6 +287,8 @@ my $bondary = qr { (?<![\w\/\`\{])(?=[\w\/\`\{])|(?<=[\w\/\`\{])(?![\w\/\`\{]) }
 sub output_rest {
        create_labels();
 
+       my $part = "";
+
        foreach my $what (sort {
                                ($data{$a}->{type} eq "File") cmp ($data{$b}->{type} eq "File") ||
                                $a cmp $b
@@ -306,6 +308,21 @@ sub output_rest {
                $w =~ s/([\(\)\_\-\*\=\^\~\\])/\\$1/g;
 
                if ($type ne "File") {
+                       my $cur_part = $what;
+                       if ($what =~ '/') {
+                               if ($what =~ m#^(\/?(?:[\w\-]+\/?){1,2})#) {
+                                       $cur_part = "Symbols under $1";
+                                       $cur_part =~ s,/$,,;
+                               }
+                       }
+
+                       if ($cur_part ne "" && $part ne $cur_part) {
+                           $part = $cur_part;
+                           my $bar = $part;
+                           $bar =~ s/./-/g;
+                           print "$part\n$bar\n\n";
+                       }
+
                        printf ".. _%s:\n\n", $data{$what}->{label};
 
                        my @names = split /, /,$w;
@@ -352,6 +369,12 @@ sub output_rest {
 
                if (!($desc =~ /^\s*$/)) {
                        if ($description_is_rst) {
+                               # Remove title markups from the description
+                               # Having titles inside ABI files will only work if extra
+                               # care would be taken in order to strictly follow the same
+                               # level order for each markup.
+                               $desc =~ s/\n[\-\*\=\^\~]+\n/\n\n/g;
+
                                # Enrich text by creating cross-references
 
                                $desc =~ s,Documentation/(?!devicetree)(\S+)\.rst,:doc:`/$1`,g;