scripts: kernel-doc: transform documentation into POD
PATCH 1/1 scripts: kernel-doc: transform documentation into POD
The only change in the script execution flow is the replacement of the 'usage' function with the native core Perl 'pod2usage'.
This entails:
- an overall documentation restructuring
- addition of a synopsis
Otherwise my intervention is minimal:
- a few tiny language, formatting and spacing corrections
- a few missing bits added in the command syntax description
- adding subsections in the "FORMAT OF COMMENTS" section
- alphabetical sorting within OPTIONS subections
Finally, the TODO stub evolves into a section:
- perldoc request removed
- undocumented options added
Run kernel-doc -h to see the full doc.
The TODO suggestion is ancient, thus I can't address its author with a "Suggested-by" tag.
--- scripts/kernel-doc | 613 ++++++++++++++++++++++++++++++--------------- 1 file changed, 413 insertions(+), 200 deletions(-)
scripts/kernel-doc +413 -200
@@ -4,46 +4,33 @@ use warnings; use strict; -## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## -## Copyright (C) 2000, 1 Tim Waugh <[email protected]> ## -## Copyright (C) 2001 Simon Huggins ## -## Copyright (C) 2005-2012 Randy Dunlap ## -## Copyright (C) 2012 Dan Luedtke ## -## ## -## #define enhancements by Armin Kuster <[email protected]> ## -## Copyright (c) 2000 MontaVista Software, Inc. ## -## ## -## This software falls under the GNU General Public License. ## -## Please read the COPYING file for more information ## - -# 18/01/2001 - Cleanups -# Functions prototyped as foo(void) same as foo() -# Stop eval'ing where we don't need to. -# -- [email protected] - -# 27/06/2001 - Allowed whitespace after initial "/**" and -# allowed comments before function declarations. -# -- Christian Kreibich <[email protected]> - -# Still to do: -# - add perldoc documentation -# - Look more closely at some of the scarier bits :) - -# 26/05/2001 - Support for separate source and object trees. -# Return error code. -# Keith Owens <[email protected]> - -# 23/09/2001 - Added support for typedefs, structs, enums and unions -# Support for Context section; can be terminated using empty line -# Small fixes (like spaces vs. \s in regex) -# -- Tim Jansen <[email protected]> - -# 25/07/2012 - Added support for HTML5 -# -- Dan Luedtke <[email protected]> - -sub usage { - my $message = <<"EOF"; -Usage: $0 [OPTION ...] FILE ... +use Pod::Usage qw/pod2usage/; + +=head1 NAME + +kernel-doc - Print formatted kernel documentation to stdout. + +=head1 SYNOPSIS + + kernel-doc [-h] [-v] [-Werror] + [-man|-none|-rst] + [-sphinx-version VERSION] + [ + -export | + [-function NAME] ... | + -internal | + [-nosymbol NAME] ... + ] + [-enable-lineno] + [-export-file FILE] ... + [-no-doc-sections] + FILE ... + +Run `kernel-doc -h` for details. + +=cut + +=head1 DESCRIPTION Read C language source or header FILEs, extract embedded documentation comments, and print formatted documentation to standard output.
@@ -51,163 +38,9 @@ and print formatted documentation to standard output. The documentation comments are identified by "/**" opening comment mark. See Documentation/doc-guide/kernel-doc.rst for the documentation comment syntax. -Output format selection (mutually exclusive): - -man Output troff manual page format. This is the default. - -rst Output reStructuredText format. - -none Do not output documentation, only warnings. - -Output format selection modifier (affects only ReST output): - - -sphinx-version Use the ReST C domain dialect compatible with an - specific Sphinx Version. - If not specified, kernel-doc will auto-detect using - the sphinx-build version found on PATH. - -Output selection (mutually exclusive): - -export Only output documentation for symbols that have been - exported using EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL() - in any input FILE or -export-file FILE. - -internal Only output documentation for symbols that have NOT been - exported using EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL() - in any input FILE or -export-file FILE. - -function NAME Only output documentation for the given function(s) - or DOC: section title(s). All other functions and DOC: - sections are ignored. May be specified multiple times. - -nosymbol NAME Exclude the specified symbols from the output - documentation. May be specified multiple times. - -Output selection modifiers: - -no-doc-sections Do not output DOC: sections. - -enable-lineno Enable output of #define LINENO lines. Only works with - reStructuredText format. - -export-file FILE Specify an additional FILE in which to look for - EXPORT_SYMBOL() and EXPORT_SYMBOL_GPL(). To be used with - -export or -internal. May be specified multiple times. - -Other parameters: - -v Verbose output, more warnings and other information. - -h Print this help. - -Werror Treat warnings as errors. - -EOF - print $message; - exit 1; -} +=cut -# -# format of comments. -# In the following table, (...)? signifies optional structure. -# (...)* signifies 0 or more structure elements -# /** -# * function_name(:)? (- short description)? -# (* @parameterx: (description of parameter x)?)* -# (* a blank line)? -# * (Description:)? (Description of function)? -# * (section header: (section description)? )* -# (*)?*/ -# -# So .. the trivial example would be: -# -# /** -# * my_function -# */ -# -# If the Description: header tag is omitted, then there must be a blank line -# after the last parameter specification. -# e.g. -# /** -# * my_function - does my stuff -# * @my_arg: its mine damnit -# * -# * Does my stuff explained. -# */ -# -# or, could also use: -# /** -# * my_function - does my stuff -# * @my_arg: its mine damnit -# * Description: Does my stuff explained. -# */ -# etc. -# -# Besides functions you can also write documentation for structs, unions, -# enums and typedefs. Instead of the function name you must write the name -# of the declaration; the struct/union/enum/typedef must always precede -# the name. Nesting of declarations is not supported. -# Use the argument mechanism to document members or constants. -# e.g. -# /** -# * struct my_struct - short description -# * @a: first member -# * @b: second member -# * -# * Longer description -# */ -# struct my_struct { -# int a; -# int b; -# /* private: */ -# int c; -# }; -# -# All descriptions can be multiline, except the short function description. -# -# For really longs structs, you can also describe arguments inside the -# body of the struct. -# eg. -# /** -# * struct my_struct - short description -# * @a: first member -# * @b: second member -# * -# * Longer description -# */ -# struct my_struct { -# int a; -# int b; -# /** -# * @c: This is longer description of C -# * -# * You can use paragraphs to describe arguments -# * using this method. -# */ -# int c; -# }; -# -# This should be use only for struct/enum members. -# -# You can also add additional sections. When documenting kernel functions you -# should document the "Context:" of the function, e.g. whether the functions -# can be called form interrupts. Unlike other sections you can end it with an -# empty line. -# A non-void function should have a "Return:" section describing the return -# value(s). -# Example-sections should contain the string EXAMPLE so that they are marked -# appropriately in DocBook. -# -# Example: -# /** -# * user_function - function that can only be called in user context -# * @a: some argument -# * Context: !in_interrupt() -# * -# * Some description -# * Example: -# * user_function(22); -# */ -# ... -# -# -# All descriptive text is further processed, scanning for the following special -# patterns, which are highlighted appropriately. -# -# 'funcname()' - function -# '$ENVVAR' - environmental variable -# '&struct_name' - name of a structure (up to two words including 'struct') -# '&struct_name.member' - name of a structure member -# '@parameter' - name of a parameter -# '%CONST' - name of a constant. -# '``LITERAL``' - literal string without any spaces on it. +# more perldoc at the end of the file ## init lots of data
@@ -273,7 +106,12 @@ my $blankline_rst = "\n"; # read arguments if ($#ARGV == -1) { - usage(); + pod2usage( + -message => "No arguments!\n", + -exitval => 1, + -verbose => 99, + -sections => 'SYNOPSIS' + ); } my $kernelversion;
@@ -468,7 +306,7 @@ while ($ARGV[0] =~ m/^--?(.*)/) { } elsif ($cmd eq "Werror") { $Werror = 1; } elsif (($cmd eq "h") || ($cmd eq "help")) { - usage(); + pod2usage(-exitval => 0, -verbose => 2); } elsif ($cmd eq 'no-doc-sections') { $no_doc_sections = 1; } elsif ($cmd eq 'enable-lineno') {
@@ -493,8 +331,13 @@ while ($ARGV[0] =~ m/^--?(.*)/) { die "Sphinx version should either major.minor or major.minor.patch format\n"; } } else { - # Unknown argument - usage(); + # Unknown argument + pod2usage( + -message => "Argument unknown!\n", + -exitval => 1, + -verbose => 99, + -sections => 'SYNOPSIS' + ); } }
@@ -2521,3 +2364,373 @@ if ($Werror && $warnings) { } else { exit($output_mode eq "none" ? 0 : $errors) } + +__END__ + +=head1 OPTIONS + +=head2 Output format selection (mutually exclusive): + +=over 8 + +=item -man + +Output troff manual page format. This is the default. + +=item -none + +Do not output documentation, only warnings. + +=item -rst + +Output reStructuredText format. + +=back + +=head2 Output format selection modifier (affects only ReST output): + +=over 8 + +=item -sphinx-version VERSION + +Use the ReST C domain dialect compatible with a specific Sphinx Version. + +If not specified, kernel-doc will auto-detect using the sphinx-build version +found on PATH. + +=back + +=head2 Output selection (mutually exclusive): + +=over 8 + +=item -export + +Only output documentation for symbols that have been exported using +EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL() in any input FILE or -export-file FILE. + +=item -function NAME + +Only output documentation for the given function(s) or DOC: section title(s). +All other functions and DOC: sections are ignored. + +May be specified multiple times. + +=item -internal + +Only output documentation for symbols that have NOT been exported using +EXPORT_SYMBOL() or EXPORT_SYMBOL_GPL() in any input FILE or -export-file FILE. + +=item -nosymbol NAME + +Exclude the specified symbols from the output documentation. + +May be specified multiple times. + +=back + +=head2 Output selection modifiers: + +=over 8 + +=item -enable-lineno + +Enable output of #define LINENO lines. Only works with reStructuredText format. + +=item -export-file FILE + +Specify an additional FILE in which to look for EXPORT_SYMBOL() and +EXPORT_SYMBOL_GPL(). To be used with -export or -internal. + +May be specified multiple times. + +=item -no-doc-sections + +Do not output DOC: sections. + +=back + +=head2 Other parameters: + +=over 8 + +=item -h, -help + +Print this help. + +=item -v + +Verbose output, more warnings and other information. + +=item -Werror + +Treat warnings as errors. + +=back + +=cut + +=head1 FORMAT OF COMMENTS + +=head2 Functions + +=over 8 + +=item In the following table, + +=over 8 + +=item (...)? + +signifies optional structure, + +=item (...)* + +signifies 0 or more structure elements. + +=back + +=back + + /** + * function_name(:)? (- short description)? + (* @parameterx: (description of parameter x)?)* + (* a blank line)? + * (Description:)? (Description of function)? + * (section header: (section description)? )* + (*)?*/ + +So the trivial example would be: + + /** + * my_function + */ + +If the "Description:" header tag is omitted, then there must be a blank line +after the last parameter specification. + +e.g. + + /** + * my_function - does my stuff + * @my_arg: its mine damnit + * + * Does my stuff explained. + */ + +or, could also use: + + /** + * my_function - does my stuff + * @my_arg: its mine damnit + * Description: Does my stuff explained. + */ + +etc. + +=head2 Structs, unions, enums and typedefs + +Besides functions you can also write documentation for structs, unions, +enums and typedefs. + +Instead of the function name you must write the name of the declaration; +the struct/union/enum/typedef must always precede the name. + +Nesting of declarations is not supported. + +Use the argument mechanism to document members or constants. + +e.g. + + /** + * struct my_struct - short description + * @a: first member + * @b: second member + * + * Longer description + */ + struct my_struct { + int a; + int b; + /* private: */ + int c; + }; + +All descriptions can be multiline, except the short function description. + +For really longs structs, you can also describe arguments inside the +body of the struct. + +e.g. + + /** + * struct my_struct - short description + * @a: first member + * @b: second member + * + * Longer description + */ + struct my_struct { + int a; + int b; + /** + * @c: This is longer description of C + * + * You can use paragraphs to describe arguments + * using this method. + */ + int c; + }; + +This should be used only for struct/enum members. + +=head2 Additional sections + +You can also add additional sections. + +When documenting kernel functions, you should document the "Context:" of +the function, e.g. whether the functions can be called from interrupts. +Unlike other sections you can end it with an empty line. + +A non-void function should have a "Return:" section describing the return +value(s). + +Example-sections should contain the string EXAMPLE, so that they are marked +appropriately in DocBook. + +Example: + + /** + * user_function - function that can only be called in user context + * @a: some argument + * Context: !in_interrupt() + * + * Some description + * Example: + * user_function(22); + */ + ... + +All descriptive text is further processed, scanning for the following special +patterns, which are highlighted appropriately. + +=over 8 + +=item 'funcname()' + +function + +=item '$ENVVAR' + +environmental variable + +=item '&struct_name' + +name of a structure (up to two words including 'struct') + +=item '&struct_name.member' + +name of a structure member + +=item '@parameter' + +name of a parameter + +=item '%CONST' + +name of a constant + +=item '``LITERAL``' + +literal string without any spaces on it + +=back + +=cut + +=head1 TODO + +=head2 General + +=over 2 + +=item - + +Look more closely at some of the scarier bits :) + +=back + +=head2 Options + +=over 2 + +=item - + +Document: -module NAME, -show-not-found + +=back + +=head1 LICENSE + +This software falls under the GNU General Public License. + +Please read the COPYING file for more information. + +=head1 COPYRIGHT + +=over 2 + +=item * + +Copyright (C) 1998 Michael Zucchi, All Rights Reserved + +=item * + +Copyright (C) 2000, 1 Tim Waugh <[email protected]> + +=item * + +Copyright (C) 2001 Simon Huggins + +=item * + +Copyright (C) 2005-2012 Randy Dunlap + +=item * + +Copyright (C) 2012 Dan Luedtke + +=item * + +Copyright (C) 2000 MontaVista Software, Inc. + +#define enhancements by Armin Kuster <[email protected]> + +=back + +=head1 SOME PRE-GIT CONTRIBUTIONS + +Original formatting preserved for its historical value. + + # 18/01/2001 - Cleanups + # Functions prototyped as foo(void) same as foo() + # Stop eval'ing where we don't need to. + # -- [email protected] + + # 27/06/2001 - Allowed whitespace after initial "/**" and + # allowed comments before function declarations. + # -- Christian Kreibich <[email protected]> + + # 26/05/2001 - Support for separate source and object trees. + # Return error code. + # Keith Owens <[email protected]> + + # 23/09/2001 - Added support for typedefs, structs, enums and unions + # Support for Context section; can be terminated using empty line + # Small fixes (like spaces vs. \s in regex) + # -- Tim Jansen <[email protected]> + + # 25/07/2012 - Added support for HTML5 + # -- Dan Luedtke <[email protected]> + +=cut
Signature · 1 line
2.30.2
Jonathan Corbet
maintainerQuoted 7 lines · Tomasz Warniełło
The only change in the script execution flow is the replacement of the 'usage' function with the native core Perl 'pod2usage'.
This entails:
- an overall documentation restructuring
- addition of a synopsis
Quoted 5 lines
Otherwise my intervention is minimal:
- a few tiny language, formatting and spacing corrections
- a few missing bits added in the command syntax description
- adding subsections in the "FORMAT OF COMMENTS" section
- alphabetical sorting within OPTIONS subections
So I think that this is generally a good thing, but I do have some quibbles. Starting with the above, which is a pretty clear violation of the "each patch does one thing" rule. Please separate out your changes into separate patches so that they are more easily reviewed.
A few other things below...
Quoted 20 lines
Finally, the TODO stub evolves into a section:
- perldoc request removed
- undocumented options addedRun
kernel-doc -hto see the full doc.The TODO suggestion is ancient, thus I can't address its author with a "Suggested-by" tag.
Signed-off-by Tomasz Warniełło <[email protected]>--- scripts/kernel-doc | 613 ++++++++++++++++++++++++++++++--------------- 1 file changed, 413 insertions(+), 200 deletions(-)scripts/kernel-doc +0
-0@@ -4,46 +4,33 @@ use warnings;
scripts/kernel-doc line 14
Quoted 10 lines
scripts/kernel-doc +0
-8use strict; -## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## -## Copyright (C) 2000, 1 Tim Waugh <[email protected]> ## -## Copyright (C) 2001 Simon Huggins ## -## Copyright (C) 2005-2012 Randy Dunlap ## -## Copyright (C) 2012 Dan Luedtke ## -## ## -## #define enhancements by Armin Kuster <[email protected]> ## -## Copyright (c) 2000 MontaVista Software, Inc. ##
My immediate reaction is that you shouldn't be removing copyright lines, though I did see that you put them back later. I think, though, that the copyright assertions should remain at the top of the file; they don't need to be part of the help text that the program emits. So leave them here, please.
(I guess I should add one of my own, assuming I want any part of this file actually associated with my name...:)
scripts/kernel-doc line 17
Quoted 2 lines
scripts/kernel-doc +0
-2-## This software falls under the GNU General Public License. ## -## Please read the COPYING file for more information ##
This could come out, though; that's what the SPDX line is for.
Quoted 14 lines
scripts/kernel-doc +0
-14-# 18/01/2001 - Cleanups -# Functions prototyped as foo(void) same as foo() -# Stop eval'ing where we don't need to. -# -- [email protected] - -# 27/06/2001 - Allowed whitespace after initial "/**" and -# allowed comments before function declarations. -# -- Christian Kreibich <[email protected]> - -# Still to do: -# - add perldoc documentation -# - Look more closely at some of the scarier bits :) - -# 26/05/2001 - Support for separate source and object trees.
scripts/kernel-doc line 42
Quoted 10 lines
scripts/kernel-doc +0
-10-# Return error code. -# Keith Owens <[email protected]> - -# 23/09/2001 - Added support for typedefs, structs, enums and unions -# Support for Context section; can be terminated using empty line -# Small fixes (like spaces vs. \s in regex) -# -- Tim Jansen <[email protected]> - -# 25/07/2012 - Added support for HTML5 -# -- Dan Luedtke <[email protected]>
These, too, should come out; that's what the git log is for.
[...]
scripts/kernel-doc while ($ARGV[0] =~ m/^--?(.*)/) { · line 309
Quoted 7 lines
scripts/kernel-doc +1
-1my $kernelversion;@@ -468,7 +306,7 @@ while ($ARGV[0] =~ m/^--?(.*)/) { } elsif ($cmd eq "Werror") { $Werror = 1; } elsif (($cmd eq "h") || ($cmd eq "help")) { - usage(); + pod2usage(-exitval => 0, -verbose => 2);
Why the strange indentation here? This file is far from pretty, but that makes it worse. (Other places too).
[...]
Thanks,
jon
Quoted 15 lines · Jonathan Corbet
Quoted 7 lines · Tomasz Warniełło
The only change in the script execution flow is the replacement of the 'usage' function with the native core Perl 'pod2usage'.
This entails:
- an overall documentation restructuring
- addition of a synopsisQuoted 5 lines
Otherwise my intervention is minimal:
- a few tiny language, formatting and spacing corrections
- a few missing bits added in the command syntax description
- adding subsections in the "FORMAT OF COMMENTS" section
- alphabetical sorting within OPTIONS subections
Quoted 6 lines
So I think that this is generally a good thing, but I do have some quibbles. Starting with the above, which is a pretty clear violation of the "each patch does one thing" rule. Please separate out your changes into separate patches so that they are more easily reviewed.
A few other things below...
I'd throw all code comment formatting documentation out of here, and restrict the script to describing the command-line parameters only, and focus on Documentation/doc-guide/kernel-doc.rst being the single point of truth for comment formatting.
BR,
Jani.
Quoted 91 lines
Quoted 21 lines
Finally, the TODO stub evolves into a section:
- perldoc request removed
- undocumented options addedRun
kernel-doc -hto see the full doc.The TODO suggestion is ancient, thus I can't address its author with a "Suggested-by" tag.
Signed-off-by Tomasz Warniełło <[email protected]>--- scripts/kernel-doc | 613 ++++++++++++++++++++++++++++++--------------- 1 file changed, 413 insertions(+), 200 deletions(-)scripts/kernel-doc +0
-0@@ -4,46 +4,33 @@ use warnings;scripts/kernel-doc line 14
Quoted 10 lines
scripts/kernel-doc +0
-8use strict; -## Copyright (c) 1998 Michael Zucchi, All Rights Reserved ## -## Copyright (C) 2000, 1 Tim Waugh <[email protected]> ## -## Copyright (C) 2001 Simon Huggins ## -## Copyright (C) 2005-2012 Randy Dunlap ## -## Copyright (C) 2012 Dan Luedtke ## -## ## -## #define enhancements by Armin Kuster <[email protected]> ## -## Copyright (c) 2000 MontaVista Software, Inc. ##My immediate reaction is that you shouldn't be removing copyright lines, though I did see that you put them back later. I think, though, that the copyright assertions should remain at the top of the file; they don't need to be part of the help text that the program emits. So leave them here, please.
(I guess I should add one of my own, assuming I want any part of this file actually associated with my name...:)
scripts/kernel-doc line 17
Quoted 2 lines
scripts/kernel-doc +0
-2-## This software falls under the GNU General Public License. ## -## Please read the COPYING file for more information ##This could come out, though; that's what the SPDX line is for.
Quoted 14 lines
scripts/kernel-doc +0
-14-# 18/01/2001 - Cleanups -# Functions prototyped as foo(void) same as foo() -# Stop eval'ing where we don't need to. -# -- [email protected] - -# 27/06/2001 - Allowed whitespace after initial "/**" and -# allowed comments before function declarations. -# -- Christian Kreibich <[email protected]> - -# Still to do: -# - add perldoc documentation -# - Look more closely at some of the scarier bits :) - -# 26/05/2001 - Support for separate source and object trees.scripts/kernel-doc line 42
Quoted 10 lines
scripts/kernel-doc +0
-10-# Return error code. -# Keith Owens <[email protected]> - -# 23/09/2001 - Added support for typedefs, structs, enums and unions -# Support for Context section; can be terminated using empty line -# Small fixes (like spaces vs. \s in regex) -# -- Tim Jansen <[email protected]> - -# 25/07/2012 - Added support for HTML5 -# -- Dan Luedtke <[email protected]>These, too, should come out; that's what the git log is for.
[...]
scripts/kernel-doc while ($ARGV[0] =~ m/^--?(.*)/) { · line 309
Quoted 7 lines
scripts/kernel-doc +1
-1my $kernelversion;@@ -468,7 +306,7 @@ while ($ARGV[0] =~ m/^--?(.*)/) { } elsif ($cmd eq "Werror") { $Werror = 1; } elsif (($cmd eq "h") || ($cmd eq "help")) { - usage(); + pod2usage(-exitval => 0, -verbose => 2);Why the strange indentation here? This file is far from pretty, but that makes it worse. (Other places too).
[...]
Thanks,
jon
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Quoted 10 lines · Jonathan Corbet
scripts/kernel-doc while ($ARGV[0] =~ m/^--?(.*)/) { · line 309
Quoted 7 lines
my $kernelversion;
scripts/kernel-doc +1
-1@@ -468,7 +306,7 @@ while ($ARGV[0] =~ m/^--?(.*)/) { } elsif ($cmd eq "Werror") { $Werror = 1; } elsif (($cmd eq "h") || ($cmd eq "help")) { - usage(); + pod2usage(-exitval => 0, -verbose => 2);Why the strange indentation here? This file is far from pretty, but that makes it worse. (Other places too).
Sometimes beauty requires cooperation. You can help it in your pager. If it's less, then try -x 2, -x 4, etc.
I will address the other topics in a new version. To be sent shortly.
Tx, TW
Quoted 12 lines · Tomasz Warniełło
Quoted 10 lines · Jonathan Corbet
scripts/kernel-doc while ($ARGV[0] =~ m/^--?(.*)/) { · line 309
Quoted 7 lines
my $kernelversion;
scripts/kernel-doc +1
-1@@ -468,7 +306,7 @@ while ($ARGV[0] =~ m/^--?(.*)/) { } elsif ($cmd eq "Werror") { $Werror = 1; } elsif (($cmd eq "h") || ($cmd eq "help")) { - usage(); + pod2usage(-exitval => 0, -verbose => 2);Why the strange indentation here? This file is far from pretty, but that makes it worse. (Other places too).
Quoted 2 lines
Sometimes beauty requires cooperation. You can help it in your pager. If it's less, then try
-x 2,-x 4, etc.
In kernel, tabs are 8 characters.
See Documentation/process/coding-style.rst
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Quoted 16 lines · On Mon, 03 Jan 2022 11:04:53 +0200 Jani Nikula <[email protected]>…
Quoted 12 lines · Tomasz Warniełło
Quoted 10 lines · Jonathan Corbet
scripts/kernel-doc while ($ARGV[0] =~ m/^--?(.*)/) { · line 309
Quoted 7 lines
my $kernelversion;
scripts/kernel-doc +1
-1@@ -468,7 +306,7 @@ while ($ARGV[0] =~ m/^--?(.*)/) { } elsif ($cmd eq "Werror") { $Werror = 1; } elsif (($cmd eq "h") || ($cmd eq "help")) { - usage(); + pod2usage(-exitval => 0, -verbose => 2);Why the strange indentation here? This file is far from pretty, but that makes it worse. (Other places too).
Quoted 2 lines
Sometimes beauty requires cooperation. You can help it in your pager. If it's less, then try
-x 2,-x 4, etc.
Quoted 9 lines
In kernel, tabs are 8 characters.
See
Documentation/process/coding-style.rstBR,
Jani.
I am a heretic then.
Except for the initial dogma, I understand and agree with the rationale in coding-style.rst.
Only what if I have stared at the screen not for 20 hours, but for 40 hours? Now I want to have indentation even deeper, of 16 spaces. And how do I get this having 8 spaces here and there instead of tabs? The system begins to fall apart.
The misleading statement is that tabs are 8 characters long. No. They are exactly 1 character long. And that's ASCII 9.
Cheers,
TW
Jonathan Corbet
maintainerQuoted 12 lines · Tomasz Warniełło
Quoted 4 lines · On Mon, 03 Jan 2022 11:04:53 +0200 Jani Nikula <[email protected]>…
In kernel, tabs are 8 characters.
See
Documentation/process/coding-style.rstI am a heretic then.
Except for the initial dogma, I understand and agree with the rationale in
coding-style.rst.
Quoted 7 lines
Only what if I have stared at the screen not for 20 hours, but for 40 hours? Now I want to have indentation even deeper, of 16 spaces. And how do I get this having 8 spaces here and there instead of tabs? The system begins to fall apart.
The misleading statement is that tabs are 8 characters long. No. They are exactly 1 character long. And that's ASCII 9.
This is not particularly helpful.
I would like to get your work in, but need some cooperation to get there.
Please:
- Post your patch series as a single thread with a coherent cover letter.
- Stick with current coding conventions
- Avoid snide comments to reviewers.
Thanks,
jon
Em Thu, 16 Dec 2021 16:12:15 -0700
Jonathan Corbet <[email protected]> escreveu:
Quoted 15 lines
Quoted 7 lines · Tomasz Warniełło
The only change in the script execution flow is the replacement of the 'usage' function with the native core Perl 'pod2usage'.
This entails:
- an overall documentation restructuring
- addition of a synopsisQuoted 5 lines
Otherwise my intervention is minimal:
- a few tiny language, formatting and spacing corrections
- a few missing bits added in the command syntax description
- adding subsections in the "FORMAT OF COMMENTS" section
- alphabetical sorting within OPTIONS subections
Quoted 4 lines
So I think that this is generally a good thing, but I do have some quibbles. Starting with the above, which is a pretty clear violation of the "each patch does one thing" rule. Please separate out your changes into separate patches so that they are more easily reviewed.
I almost did that in the past, but due to a different rationale ;-)
Besides the points that Jonathan already mentioned, I'd like to add one additional request...
Pod is very useful when associated with Getopt, e. g.:
use Getopt::Long; use Pod::Usage;
In a similar way to scripts/get_abi.pl (and scripts/get_feat.pl).
This simplifies a lot the parameter handling, as it would be like:
GetOptions( "debug=i" => \$debug, "enable-lineno" => \$enable_lineno, "rst-source!" => \$description_is_rst, "dir=s" => \$prefix, 'help|?' => \$help, "show-hints" => \$hint, "search-string=s" => \$search_string, man => \$man ) or pod2usage(2);
This would make easier to maintain the parameters and the associated summary help and man-like help. An additional advantage of using Getopt is that the parameters can be added before or after the file name.
IMO, the best would be to add a patch at the version 2 of this series in order to use GetOpt too.
Quoted 16 lines
A few other things below...
Quoted 14 lines
Finally, the TODO stub evolves into a section:
- perldoc request removed
- undocumented options addedRun
kernel-doc -hto see the full doc.The TODO suggestion is ancient, thus I can't address its author with a "Suggested-by" tag.
Signed-off-by Tomasz Warniełło <[email protected]>--- scripts/kernel-doc | 613 ++++++++++++++++++++++++++++++--------------- 1 file changed, 413 insertions(+), 200 deletions(-)
Quoted 7 lines
scripts/kernel-doc line 5
Quoted 7 lines
scripts/kernel-doc +0
-0@@ -4,46 +4,33 @@ use warnings; use strict;
I would also add:
BEGIN { $Pod::Usage::Formatter = 'Pod::Text::Termcap'; }at the final version, in order to produce a better output.
Regards,
Mauro
Thanks,
Mauro
Quoted 19 lines · On Mon, 03 Jan 2022 13:04:09 -0700 Jonathan Corbet <[email protected]> wrote:
Quoted 17 lines · Tomasz Warniełło
Quoted 4 lines · On Mon, 03 Jan 2022 11:04:53 +0200 Jani Nikula <[email protected]>…
In kernel, tabs are 8 characters.
See
Documentation/process/coding-style.rstI am a heretic then.
Except for the initial dogma, I understand and agree with the rationale in
coding-style.rst.Only what if I have stared at the screen not for 20 hours, but for 40 hours? Now I want to have indentation even deeper, of 16 spaces. And how do I get this having 8 spaces here and there instead of tabs? The system begins to fall apart.
Quoted 4 lines
Quoted 2 lines
The misleading statement is that tabs are 8 characters long. No. They are exactly 1 character long. And that's ASCII 9.
This is not particularly helpful.
Not helpful? In what matter? It is a matter of fact opinion on coding-style.rst, which Jani Nikula referred to, so I think it is both in topic and may be helpful to some. While troublesome to some others, that's true.
Quoted 7 lines
I would like to get your work in, but need some cooperation to get there.
Please:
- Post your patch series as a single thread with a coherent cover letter.
Sorry, I'm a newbie in this business. I need to figure out how emails work. Is this just one thread per version or one thread per all versions? Can you please direct me to some documentation about this?
Quoted 1 line
- Stick with current coding conventions
To be honest, I need to think this over.
Quoted 1 line
- Avoid snide comments to reviewers.
My reply is no more snide than coding-style.rst. Compare them. It strictly relates to it. I don't point my answer at the reviewer in any way, if that's what you mean.
Ch, TW
Jonathan Corbet
maintainerQuoted 6 lines · Tomasz Warniełło
Quoted 2 lines
- Post your patch series as a single thread with a coherent cover letter.
Sorry, I'm a newbie in this business. I need to figure out how emails work. Is this just one thread per version or one thread per all versions? Can you please direct me to some documentation about this?
One thread per version is good; please do not post new versions to old threads. A tool like "git send-email" can be your friend here. See Documentation/process/submitting-patches.rst for lots of details on how to submit patches.
Along these lines, I appreciate that you broke up the series as I requested, but you overdid it a bit. Think in terms of logical changes and making things easy to review, and you should be able to coalesce things a bit.
Quoted 3 lines
Quoted 1 line
- Stick with current coding conventions
To be honest, I need to think this over.
Think hard; if you're unable to work with the kernel project's conventions, there's not a lot of point in resubmitting the patches.
Thanks,
jon
Quoted 4 lines · On Mon, 03 Jan 2022 14:57:48 -0700 Jonathan Corbet <[email protected]> wrote:
One thread per version is good; please do not post new versions to old threads. A tool like "git send-email" can be your friend here. See
Documentation/process/submitting-patches.rstfor lots of details on how to submit patches.
Ok, thanks. I'll try to do it correctly this time...
Quoted 4 lines
Along these lines, I appreciate that you broke up the series as I requested, but you overdid it a bit. Think in terms of logical changes and making things easy to review, and you should be able to coalesce things a bit.
I'm not good at guessing what seems logical to others, especially those I don't know much. No sarcasm here. Luckily it's not that many of them, so hopefully they'll pass the exam overdone as they are.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
- Stick with current coding conventions
To be honest, I need to think this over.
Think hard; if you're unable to work with the kernel project's conventions, there's not a lot of point in resubmitting the patches.
Let's finish this one together.
As for the actual code corrections, I see I put 1 tab too many in two places in the last version. So I guess I just need to reduce them by 1? No sarcasm again... So let me know before I've sent the next version, if you please.
Ch, TW