Skip to contentSkip to conversation

kernel-doc: extend $type_param to match members referenced by pointer

PATCH In review Mike Rapoport 3 participants 5 messages Nov 7, 2018 Documentation

lore
Share & tools
lore
#0 lore raw

v2 cover kernel-doc: extend $type_param to match members referenced by pointer

Hi,

v2: separate whitespace and functional changes

Mike Rapoport (2):
kernel-doc: kill trailing whitespace
kernel-doc: extend $type_param to match members referenced by pointer

 scripts/kernel-doc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 1/2 kernel-doc: kill trailing whitespace

---
 scripts/kernel-doc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kernel-doc +2 -2
index ffbe901..24d3550 100755
@@ -361,7 +361,7 @@ my $doc_com = '\s*\*\s*';
 my $doc_com_body = '\s*\* ?';
 my $doc_decl = $doc_com . '(\w+)';
 # @params and a strictly limited set of supported section names
-my $doc_sect = $doc_com . 
+my $doc_sect = $doc_com .
     '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:(.*)';
 my $doc_content = $doc_com_body . '(.*)';
 my $doc_block = $doc_com . 'DOC:\s*(.*)?';
@@ -751,7 +751,7 @@ sub output_blockhead_rst(%) {
 
 #
 # Apply the RST highlights to a sub-block of text.
-#   
+#
 sub highlight_block($) {
     # The dohighlight kludge requires the text be called $contents
     my $contents = shift;
Signature · 1 line
2.7.4
#2 lore raw

PATCH v2 2/2 kernel-doc: extend $type_param to match members referenced by pointer

In reply to Mike Rapoport

Currently, function parameter description can match '@type.member' expressions but fails to match '@type->member'.
Extend the $type_param regex to allow matching both

---
 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +1 -1
index 24d3550..f9f1431 100755
@@ -212,7 +212,7 @@ my $anon_struct_union = 0;
 my $type_constant = '\b``([^\`]+)``\b';
 my $type_constant2 = '\%([-_\w]+)';
 my $type_func = '(\w+)\(\)';
-my $type_param = '\@(\w*(\.\w+)*(\.\.\.)?)';
+my $type_param = '\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
 my $type_fp_param = '\@(\w+)\(\)';  # Special RST handling for func ptr params
 my $type_env = '(\$\w+)';
 my $type_enum = '\&(enum\s*([_\w]+))';
Signature · 1 line
2.7.4
#3 lore raw

Am 07.11.18 um 17:47 schrieb Mike Rapoport:

Quoted 14 lines

Currently, function parameter description can match '@type.member' expressions but fails to match '@type->member'.
Extend the $type_param regex to allow matching both

---
  scripts/kernel-doc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
scripts/kernel-doc +0 -0
index 24d3550..f9f1431 100755

scripts/kernel-doc my $anon_struct_union = 0; · line 215

Quoted 5 lines
scripts/kernel-doc +1 -1
@@ -212,7 +212,7 @@ my $anon_struct_union = 0;
  my $type_constant = '\b``([^\`]+)``\b';
  my $type_constant2 = '\%([-_\w]+)';
  my $type_func = '(\w+)\(\)';
-my $type_param = '\@(\w*(\.\w+)*(\.\.\.)?)';
+my $type_param = '\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';

Thanks, works! FWIW: added [1] this to the linuxdoc project (a kernel-doc spinoff). There we have a small frmaework for testing kernel-doc patches [2]. Which found a few hundert usages of '->' pointers in the whole kernel sources.

[1] https://github.com/return42/linuxdoc/commit/cce336ce0
[2] https://github.com/return42/linuxdoc/blob/master/Makefile#L95

-- Markus --

maintainer
#4 lore raw
In reply to Mike Rapoport
Quoted 5 lines · On Wed, 7 Nov 2018 18:47:13 +0200 Mike Rapoport <[email protected]> wrote:

Currently, function parameter description can match '@type.member' expressions but fails to match '@type->member'.
Extend the $type_param regex to allow matching both

That makes a lot of changes to the generated output but, as far as I can tell, they're all correct. A definite improvement. Applied, thanks.

jon