kernel-doc (728d90bdc9e480dc93913e59a0aa3c896c7aa697) kernel-doc (43756e347f213b68f884c3b4082e95e7f98204f1)
1#!/usr/bin/env perl
2# SPDX-License-Identifier: GPL-2.0
3
4use warnings;
5use strict;
6
7## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
8## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##

--- 1048 unchanged lines hidden (view full) ---

1057sub dump_union($$) {
1058 dump_struct(@_);
1059}
1060
1061sub dump_struct($$) {
1062 my $x = shift;
1063 my $file = shift;
1064
1#!/usr/bin/env perl
2# SPDX-License-Identifier: GPL-2.0
3
4use warnings;
5use strict;
6
7## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ##
8## Copyright (C) 2000, 1 Tim Waugh <twaugh@redhat.com> ##

--- 1048 unchanged lines hidden (view full) ---

1057sub dump_union($$) {
1058 dump_struct(@_);
1059}
1060
1061sub dump_struct($$) {
1062 my $x = shift;
1063 my $file = shift;
1064
1065 if ($x =~ /(struct|union)\s+(\w+)\s*\{(.*)\}(\s*(__packed|__aligned|__attribute__\s*\(\([a-z0-9,_\s\(\)]*\)\)))*/) {
1065 if ($x =~ /(struct|union)\s+(\w+)\s*\{(.*)\}(\s*(__packed|__aligned|____cacheline_aligned_in_smp|__attribute__\s*\(\([a-z0-9,_\s\(\)]*\)\)))*/) {
1066 my $decl_type = $1;
1067 $declaration_name = $2;
1068 my $members = $3;
1069
1070 # ignore members marked private:
1071 $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi;
1072 $members =~ s/\/\*\s*private:.*//gosi;
1073 # strip comments:
1074 $members =~ s/\/\*.*?\*\///gos;
1075 # strip attributes
1066 my $decl_type = $1;
1067 $declaration_name = $2;
1068 my $members = $3;
1069
1070 # ignore members marked private:
1071 $members =~ s/\/\*\s*private:.*?\/\*\s*public:.*?\*\///gosi;
1072 $members =~ s/\/\*\s*private:.*//gosi;
1073 # strip comments:
1074 $members =~ s/\/\*.*?\*\///gos;
1075 # strip attributes
1076 $members =~ s/\s*__attribute__\s*\(\([a-z0-9,_\*\s\(\)]*\)\)//gi;
1077 $members =~ s/\s*__aligned\s*\([^;]*\)//gos;
1078 $members =~ s/\s*__packed\s*//gos;
1079 $members =~ s/\s*CRYPTO_MINALIGN_ATTR//gos;
1076 $members =~ s/\s*__attribute__\s*\(\([a-z0-9,_\*\s\(\)]*\)\)/ /gi;
1077 $members =~ s/\s*__aligned\s*\([^;]*\)/ /gos;
1078 $members =~ s/\s*__packed\s*/ /gos;
1079 $members =~ s/\s*CRYPTO_MINALIGN_ATTR/ /gos;
1080 $members =~ s/\s*____cacheline_aligned_in_smp/ /gos;
1080 # replace DECLARE_BITMAP
1081 $members =~ s/DECLARE_BITMAP\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[BITS_TO_LONGS($2)\]/gos;
1082 # replace DECLARE_HASHTABLE
1083 $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos;
1084 # replace DECLARE_KFIFO
1085 $members =~ s/DECLARE_KFIFO\s*\(([^,)]+),\s*([^,)]+),\s*([^,)]+)\)/$2 \*$1/gos;
1086 # replace DECLARE_KFIFO_PTR
1087 $members =~ s/DECLARE_KFIFO_PTR\s*\(([^,)]+),\s*([^,)]+)\)/$2 \*$1/gos;

--- 356 unchanged lines hidden (view full) ---

1444 $param =~ s/[\[\)].*//;
1445
1446 if ($type eq "" && $param =~ /\.\.\.$/)
1447 {
1448 if (!$param =~ /\w\.\.\.$/) {
1449 # handles unnamed variable parameters
1450 $param = "...";
1451 }
1081 # replace DECLARE_BITMAP
1082 $members =~ s/DECLARE_BITMAP\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[BITS_TO_LONGS($2)\]/gos;
1083 # replace DECLARE_HASHTABLE
1084 $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos;
1085 # replace DECLARE_KFIFO
1086 $members =~ s/DECLARE_KFIFO\s*\(([^,)]+),\s*([^,)]+),\s*([^,)]+)\)/$2 \*$1/gos;
1087 # replace DECLARE_KFIFO_PTR
1088 $members =~ s/DECLARE_KFIFO_PTR\s*\(([^,)]+),\s*([^,)]+)\)/$2 \*$1/gos;

--- 356 unchanged lines hidden (view full) ---

1445 $param =~ s/[\[\)].*//;
1446
1447 if ($type eq "" && $param =~ /\.\.\.$/)
1448 {
1449 if (!$param =~ /\w\.\.\.$/) {
1450 # handles unnamed variable parameters
1451 $param = "...";
1452 }
1453 elsif ($param =~ /\w\.\.\.$/) {
1454 # for named variable parameters of the form `x...`, remove the dots
1455 $param =~ s/\.\.\.$//;
1456 }
1452 if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq "") {
1453 $parameterdescs{$param} = "variable arguments";
1454 }
1455 }
1456 elsif ($type eq "" && ($param eq "" or $param eq "void"))
1457 {
1458 $param="void";
1459 $parameterdescs{void} = "no arguments";

--- 471 unchanged lines hidden (view full) ---

1931
1932
1933#
1934# STATE_BODY and STATE_BODY_MAYBE: the bulk of a kerneldoc comment.
1935#
1936sub process_body($$) {
1937 my $file = shift;
1938
1457 if (!defined $parameterdescs{$param} || $parameterdescs{$param} eq "") {
1458 $parameterdescs{$param} = "variable arguments";
1459 }
1460 }
1461 elsif ($type eq "" && ($param eq "" or $param eq "void"))
1462 {
1463 $param="void";
1464 $parameterdescs{void} = "no arguments";

--- 471 unchanged lines hidden (view full) ---

1936
1937
1938#
1939# STATE_BODY and STATE_BODY_MAYBE: the bulk of a kerneldoc comment.
1940#
1941sub process_body($$) {
1942 my $file = shift;
1943
1944 # Until all named variable macro parameters are
1945 # documented using the bare name (`x`) rather than with
1946 # dots (`x...`), strip the dots:
1947 if ($section =~ /\w\.\.\.$/) {
1948 $section =~ s/\.\.\.$//;
1949
1950 if ($verbose) {
1951 print STDERR "${file}:$.: warning: Variable macro arguments should be documented without dots\n";
1952 ++$warnings;
1953 }
1954 }
1955
1939 if (/$doc_sect/i) { # case insensitive for supported section names
1940 $newsection = $1;
1941 $newcontents = $2;
1942
1943 # map the supported section names to the canonical names
1944 if ($newsection =~ m/^description$/i) {
1945 $newsection = $section_default;
1946 } elsif ($newsection =~ m/^context$/i) {

--- 280 unchanged lines hidden ---
1956 if (/$doc_sect/i) { # case insensitive for supported section names
1957 $newsection = $1;
1958 $newcontents = $2;
1959
1960 # map the supported section names to the canonical names
1961 if ($newsection =~ m/^description$/i) {
1962 $newsection = $section_default;
1963 } elsif ($newsection =~ m/^context$/i) {

--- 280 unchanged lines hidden ---