summaryrefslogtreecommitdiff
path: root/Documentation/sphinx
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2025-08-22 16:19:13 +0200
committerJonathan Corbet <corbet@lwn.net>2025-08-29 15:54:42 -0600
commitb5698da669401ed3f51add92f80457703f0937e3 (patch)
tree8de86425d1b02466b3084e17c915495510a93c81 /Documentation/sphinx
parent61578493ca7f9d4acd804544f3f5651f5124b12f (diff)
downloadlinux-b5698da669401ed3f51add92f80457703f0937e3.tar.gz
linux-b5698da669401ed3f51add92f80457703f0937e3.tar.bz2
linux-b5698da669401ed3f51add92f80457703f0937e3.zip
docs: parse-headers.pl: improve its debug output format
Change the --debug logic to help comparing its results with a new python script. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Jonathan Corbet <corbet@lwn.net> Link: https://lore.kernel.org/r/1064011717951eac257889a3032303c9d4440711.1755872208.git.mchehab+huawei@kernel.org
Diffstat (limited to 'Documentation/sphinx')
-rwxr-xr-xDocumentation/sphinx/parse-headers.pl31
1 files changed, 23 insertions, 8 deletions
diff --git a/Documentation/sphinx/parse-headers.pl b/Documentation/sphinx/parse-headers.pl
index 7b1458544e2e..560685926cdb 100755
--- a/Documentation/sphinx/parse-headers.pl
+++ b/Documentation/sphinx/parse-headers.pl
@@ -31,8 +31,6 @@ my %enums;
my %enum_symbols;
my %structs;
-require Data::Dumper if ($debug);
-
#
# read the file and get identifiers
#
@@ -197,6 +195,9 @@ if ($file_exceptions) {
} else {
$reftype = $def_reftype{$type};
}
+ if (!$reftype) {
+ print STDERR "Warning: can't find ref type for $type";
+ }
$new = "$reftype:`$old <$new>`";
if ($type eq "ioctl") {
@@ -229,12 +230,26 @@ if ($file_exceptions) {
}
if ($debug) {
- print Data::Dumper->Dump([\%ioctls], [qw(*ioctls)]) if (%ioctls);
- print Data::Dumper->Dump([\%typedefs], [qw(*typedefs)]) if (%typedefs);
- print Data::Dumper->Dump([\%enums], [qw(*enums)]) if (%enums);
- print Data::Dumper->Dump([\%structs], [qw(*structs)]) if (%structs);
- print Data::Dumper->Dump([\%defines], [qw(*defines)]) if (%defines);
- print Data::Dumper->Dump([\%enum_symbols], [qw(*enum_symbols)]) if (%enum_symbols);
+ my @all_hashes = (
+ {ioctl => \%ioctls},
+ {typedef => \%typedefs},
+ {enum => \%enums},
+ {struct => \%structs},
+ {define => \%defines},
+ {symbol => \%enum_symbols}
+ );
+
+ foreach my $hash (@all_hashes) {
+ while (my ($name, $hash_ref) = each %$hash) {
+ next unless %$hash_ref; # Skip empty hashes
+
+ print "$name:\n";
+ for my $key (sort keys %$hash_ref) {
+ print " $key -> $hash_ref->{$key}\n";
+ }
+ print "\n";
+ }
+ }
}
#