[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 21/32] scripts: kernel-doc: fix typedef identification
From: |
Paolo Bonzini |
Subject: |
[PATCH v2 21/32] scripts: kernel-doc: fix typedef identification |
Date: |
Tue, 1 Dec 2020 05:34:51 -0500 |
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Some typedef expressions are output as normal functions.
As we need to be clearer about the type with Sphinx 3.x,
detect such cases.
While here, fix a wrongly-indented block.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20201117165312.118257-21-pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
scripts/kernel-doc | 64 +++++++++++++++++++++++++++++-----------------
1 file changed, 41 insertions(+), 23 deletions(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 35d60af834..0c31e9ad66 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1748,30 +1748,48 @@ sub dump_function($$) {
return;
}
- my $prms = join " ", @parameterlist;
- check_sections($file, $declaration_name, "function", $sectcheck, $prms);
-
- # This check emits a lot of warnings at the moment, because many
- # functions don't have a 'Return' doc section. So until the number
- # of warnings goes sufficiently down, the check is only performed in
- # verbose mode.
- # TODO: always perform the check.
- if ($verbose && !$noret) {
- check_return_section($file, $declaration_name, $return_type);
- }
+ my $prms = join " ", @parameterlist;
+ check_sections($file, $declaration_name, "function", $sectcheck, $prms);
+
+ # This check emits a lot of warnings at the moment, because many
+ # functions don't have a 'Return' doc section. So until the number
+ # of warnings goes sufficiently down, the check is only performed in
+ # verbose mode.
+ # TODO: always perform the check.
+ if ($verbose && !$noret) {
+ check_return_section($file, $declaration_name, $return_type);
+ }
- output_declaration($declaration_name,
- 'function',
- {'function' => $declaration_name,
- 'module' => $modulename,
- 'functiontype' => $return_type,
- 'parameterlist' => \@parameterlist,
- 'parameterdescs' => \%parameterdescs,
- 'parametertypes' => \%parametertypes,
- 'sectionlist' => \@sectionlist,
- 'sections' => \%sections,
- 'purpose' => $declaration_purpose
- });
+ # The function parser can be called with a typedef parameter.
+ # Handle it.
+ if ($return_type =~ /typedef/) {
+ output_declaration($declaration_name,
+ 'function',
+ {'function' => $declaration_name,
+ 'typedef' => 1,
+ 'module' => $modulename,
+ 'functiontype' => $return_type,
+ 'parameterlist' => \@parameterlist,
+ 'parameterdescs' => \%parameterdescs,
+ 'parametertypes' => \%parametertypes,
+ 'sectionlist' => \@sectionlist,
+ 'sections' => \%sections,
+ 'purpose' => $declaration_purpose
+ });
+ } else {
+ output_declaration($declaration_name,
+ 'function',
+ {'function' => $declaration_name,
+ 'module' => $modulename,
+ 'functiontype' => $return_type,
+ 'parameterlist' => \@parameterlist,
+ 'parameterdescs' => \%parameterdescs,
+ 'parametertypes' => \%parametertypes,
+ 'sectionlist' => \@sectionlist,
+ 'sections' => \%sections,
+ 'purpose' => $declaration_purpose
+ });
+ }
}
sub reset_state {
--
2.26.2
- [PATCH v2 19/32] scripts: kernel-doc: fix troubles with line counts, (continued)
- [PATCH v2 19/32] scripts: kernel-doc: fix troubles with line counts, Paolo Bonzini, 2020/12/01
- [PATCH v2 20/32] scripts: kernel-doc: reimplement -nofunction argument, Paolo Bonzini, 2020/12/01
- [PATCH v2 25/32] scripts: kernel-doc: try to use c:function if possible, Paolo Bonzini, 2020/12/01
- [PATCH v2 12/32] kernel-doc: include line numbers for function prototypes, Paolo Bonzini, 2020/12/01
- [PATCH v2 29/32] scripts: kernel-doc: split typedef complex regex, Paolo Bonzini, 2020/12/01
- [PATCH v2 13/32] kernel-doc: add support for ____cacheline_aligned attribute, Paolo Bonzini, 2020/12/01
- [PATCH v2 24/32] scripts: kernel-doc: fix line number handling, Paolo Bonzini, 2020/12/01
- [PATCH v2 23/32] scripts: kernel-doc: allow passing desired Sphinx C domain dialect, Paolo Bonzini, 2020/12/01
- [PATCH v2 27/32] Revert "kernel-doc: Handle function typedefs that return pointers", Paolo Bonzini, 2020/12/01
- [PATCH v2 22/32] scripts: kernel-doc: don't mangle with parameter list, Paolo Bonzini, 2020/12/01
- [PATCH v2 21/32] scripts: kernel-doc: fix typedef identification,
Paolo Bonzini <=
- [PATCH v2 30/32] scripts: kernel-doc: use :c:union when needed, Paolo Bonzini, 2020/12/01
- [PATCH v2 32/32] scripts: kernel-doc: remove unnecesssary change wrt Linux, Paolo Bonzini, 2020/12/01
- [PATCH v2 31/32] Revert "docs: temporarily disable the kernel-doc extension", Paolo Bonzini, 2020/12/01
- [PATCH v2 17/32] scripts: kernel-doc: make it more compatible with Sphinx 3.x, Paolo Bonzini, 2020/12/01
- [PATCH v2 28/32] scripts: kernel-doc: fix typedef parsing, Paolo Bonzini, 2020/12/01
- [PATCH v2 18/32] scripts: kernel-doc: use a less pedantic markup for funcs on Sphinx 3.x, Paolo Bonzini, 2020/12/01