kernel-doc (2ac5e38ea4203852d6e99edd3cf11f044b0a409f) kernel-doc (3d9bfb19bd705f503ac7afc2776d5d56dab88858)
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> ##

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

207my $errors = 0;
208my $warnings = 0;
209my $anon_struct_union = 0;
210
211# match expressions used to find embedded type information
212my $type_constant = '\b``([^\`]+)``\b';
213my $type_constant2 = '\%([-_\w]+)';
214my $type_func = '(\w+)\(\)';
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> ##

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

207my $errors = 0;
208my $warnings = 0;
209my $anon_struct_union = 0;
210
211# match expressions used to find embedded type information
212my $type_constant = '\b``([^\`]+)``\b';
213my $type_constant2 = '\%([-_\w]+)';
214my $type_func = '(\w+)\(\)';
215my $type_param = '\@(\w*(\.\w+)*(\.\.\.)?)';
215my $type_param = '\@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)';
216my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params
217my $type_env = '(\$\w+)';
218my $type_enum = '\&(enum\s*([_\w]+))';
219my $type_struct = '\&(struct\s*([_\w]+))';
220my $type_typedef = '\&(typedef\s*([_\w]+))';
221my $type_union = '\&(union\s*([_\w]+))';
222my $type_member = '\&([_\w]+)(\.|->)([_\w]+)';
223my $type_fallback = '\&([_\w]+)';

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

356my $decl_type;
357
358my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
359my $doc_end = '\*/';
360my $doc_com = '\s*\*\s*';
361my $doc_com_body = '\s*\* ?';
362my $doc_decl = $doc_com . '(\w+)';
363# @params and a strictly limited set of supported section names
216my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params
217my $type_env = '(\$\w+)';
218my $type_enum = '\&(enum\s*([_\w]+))';
219my $type_struct = '\&(struct\s*([_\w]+))';
220my $type_typedef = '\&(typedef\s*([_\w]+))';
221my $type_union = '\&(union\s*([_\w]+))';
222my $type_member = '\&([_\w]+)(\.|->)([_\w]+)';
223my $type_fallback = '\&([_\w]+)';

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

356my $decl_type;
357
358my $doc_start = '^/\*\*\s*$'; # Allow whitespace at end of comment start.
359my $doc_end = '\*/';
360my $doc_com = '\s*\*\s*';
361my $doc_com_body = '\s*\* ?';
362my $doc_decl = $doc_com . '(\w+)';
363# @params and a strictly limited set of supported section names
364my $doc_sect = $doc_com .
364my $doc_sect = $doc_com .
365 '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:(.*)';
366my $doc_content = $doc_com_body . '(.*)';
367my $doc_block = $doc_com . 'DOC:\s*(.*)?';
368my $doc_inline_start = '^\s*/\*\*\s*$';
369my $doc_inline_sect = '\s*\*\s*(@\s*[\w][\w\.]*\s*):(.*)';
370my $doc_inline_end = '^\s*\*/\s*$';
371my $doc_inline_oneline = '^\s*/\*\*\s*(@[\w\s]+):\s*(.*)\s*\*/\s*$';
372my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;';

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

746 print_lineno($section_start_lines{$section});
747 output_highlight_rst($args{'sections'}{$section});
748 print "\n";
749 }
750}
751
752#
753# Apply the RST highlights to a sub-block of text.
365 '\s*(\@[.\w]+|\@\.\.\.|description|context|returns?|notes?|examples?)\s*:(.*)';
366my $doc_content = $doc_com_body . '(.*)';
367my $doc_block = $doc_com . 'DOC:\s*(.*)?';
368my $doc_inline_start = '^\s*/\*\*\s*$';
369my $doc_inline_sect = '\s*\*\s*(@\s*[\w][\w\.]*\s*):(.*)';
370my $doc_inline_end = '^\s*\*/\s*$';
371my $doc_inline_oneline = '^\s*/\*\*\s*(@[\w\s]+):\s*(.*)\s*\*/\s*$';
372my $export_symbol = '^\s*EXPORT_SYMBOL(_GPL)?\s*\(\s*(\w+)\s*\)\s*;';

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

746 print_lineno($section_start_lines{$section});
747 output_highlight_rst($args{'sections'}{$section});
748 print "\n";
749 }
750}
751
752#
753# Apply the RST highlights to a sub-block of text.
754#
754#
755sub highlight_block($) {
756 # The dohighlight kludge requires the text be called $contents
757 my $contents = shift;
758 eval $dohighlight;
759 die $@ if $@;
760 return $contents;
761}
762

--- 294 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
755sub highlight_block($) {
756 # The dohighlight kludge requires the text be called $contents
757 my $contents = shift;
758 eval $dohighlight;
759 die $@ if $@;
760 return $contents;
761}
762

--- 294 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*\{(.*)\}/) {
1065 if ($x =~ /(struct|union)\s+(\w+)\s*\{(.*)\}(\s*(__packed|__aligned|__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/__attribute__\s*\(\([a-z,_\*\s\(\)]*\)\)//i;
1077 $members =~ s/__aligned\s*\([^;]*\)//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;
1078 $members =~ s/\s*CRYPTO_MINALIGN_ATTR//gos;
1079 # replace DECLARE_BITMAP
1080 $members =~ s/DECLARE_BITMAP\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[BITS_TO_LONGS($2)\]/gos;
1081 # replace DECLARE_HASHTABLE
1082 $members =~ s/DECLARE_HASHTABLE\s*\(([^,)]+),\s*([^,)]+)\)/unsigned long $1\[1 << (($2) - 1)\]/gos;
1083 # replace DECLARE_KFIFO
1084 $members =~ s/DECLARE_KFIFO\s*\(([^,)]+),\s*([^,)]+),\s*([^,)]+)\)/$2 \*$1/gos;
1085 # replace DECLARE_KFIFO_PTR

--- 1137 unchanged lines hidden ---
1079 $members =~ s/\s*CRYPTO_MINALIGN_ATTR//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

--- 1137 unchanged lines hidden ---