summaryrefslogtreecommitdiffstats
path: root/Documentation/sphinx/parse-headers.pl
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-07 19:13:12 +0200
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-07 20:12:48 +0200
commit034e6c8e72afe0106e7ad3c19941053072b6a994 (patch)
tree6045ff51cd42bf4b8558f75200c0fe9ac62d76af /Documentation/sphinx/parse-headers.pl
parentdoc-rst: auto-generate video.h.rst (diff)
downloadlinux-034e6c8e72afe0106e7ad3c19941053072b6a994.tar.xz
linux-034e6c8e72afe0106e7ad3c19941053072b6a994.zip
doc-rst: parse-headers: better handle comments at the source code
We should not let comments to mangle with the symbols parsing. Unfortunately, videodev2.h has lots of those in the middle of enums and structs. So, we need to improve our parser to discard them. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'Documentation/sphinx/parse-headers.pl')
-rwxr-xr-xDocumentation/sphinx/parse-headers.pl17
1 files changed, 14 insertions, 3 deletions
diff --git a/Documentation/sphinx/parse-headers.pl b/Documentation/sphinx/parse-headers.pl
index b703f1a7f432..fc18eac1552c 100755
--- a/Documentation/sphinx/parse-headers.pl
+++ b/Documentation/sphinx/parse-headers.pl
@@ -27,13 +27,24 @@ my %structs;
#
my $is_enum = 0;
+my $is_comment = 0;
open IN, $file_in or die "Can't open $file_in";
while (<IN>) {
- my $ln = $_;
- $ln =~ s,/\*.*\*/,,;
-
$data .= $_;
+ my $ln = $_;
+ if (!$is_comment) {
+ $ln =~ s,/\*.*(\*/),,g;
+
+ $is_comment = 1 if ($ln =~ s,/\*.*,,);
+ } else {
+ if ($ln =~ s,^(.*\*/),,) {
+ $is_comment = 0;
+ } else {
+ next;
+ }
+ }
+
if ($is_enum && $ln =~ m/^\s*([_\w][\w\d_]+)\s*[\,=]?/) {
my $s = $1;
my $n = $1;