From: Yacine Belkadi <yacine.belkadi.1@gmail.com>
To: Randy Dunlap <rdunlap@xenotime.net>, Rob Landley <rob@landley.net>
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Yacine Belkadi <yacine.belkadi.1@gmail.com>
Subject: [PATCH RFC 1/2] Kernel-doc: Convention: Use a "Return" section to describe return values
Date: Fri, 21 Sep 2012 21:48:59 +0200 [thread overview]
Message-ID: <1348256940-3212-1-git-send-email-yacine.belkadi.1@gmail.com> (raw)
Non-void functions should describe their return values in their kernel-doc
comments. Currently, some don't, others do in various forms. For example:
* Return the result.
* Return: The result.
* Returns the result.
* Returns: the result.
* Return Value: The result.
* @return: the result.
* This function returns the result.
* It will return the result.
Defining a convention would improve consistency of kernel-doc comments. It
would also help scripts/kernel-doc identify the text describing the return
value of a function. Thus allowing additional checks on the comments, and
suitable highlighting in the generated docs (man pages, html, etc).
So, as a convention, use a section named "Return" to describe the return
value of a function.
Signed-off-by: Yacine Belkadi <yacine.belkadi.1@gmail.com>
---
Documentation/kernel-doc-nano-HOWTO.txt | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/Documentation/kernel-doc-nano-HOWTO.txt b/Documentation/kernel-doc-nano-HOWTO.txt
index 3d8a977..99b57ab 100644
--- a/Documentation/kernel-doc-nano-HOWTO.txt
+++ b/Documentation/kernel-doc-nano-HOWTO.txt
@@ -64,6 +64,8 @@ Example kernel-doc function comment:
* comment lines.
*
* The longer description can have multiple paragraphs.
+ *
+ * Return: Describe the return value of foobar.
*/
The short description following the subject can span multiple lines
@@ -78,6 +80,8 @@ If a function parameter is "..." (varargs), it should be listed in
kernel-doc notation as:
* @...: description
+The return value, if any, should be described in a dedicated section
+named "Return".
Example kernel-doc data structure comment.
@@ -222,6 +226,9 @@ only a "*").
"section header:" names must be unique per function (or struct,
union, typedef, enum).
+Use the section header "Return" for sections describing the return value
+of a function.
+
Avoid putting a spurious blank line after the function name, or else the
description will be repeated!
@@ -237,21 +244,21 @@ patterns, which are highlighted appropriately.
NOTE 1: The multi-line descriptive text you provide does *not* recognize
line breaks, so if you try to format some text nicely, as in:
- Return codes
+ Return:
0 - cool
1 - invalid arg
2 - out of memory
this will all run together and produce:
- Return codes 0 - cool 1 - invalid arg 2 - out of memory
+ Return: 0 - cool 1 - invalid arg 2 - out of memory
NOTE 2: If the descriptive text you provide has lines that begin with
some phrase followed by a colon, each of those phrases will be taken as
a new section heading, which means you should similarly try to avoid text
like:
- Return codes:
+ Return:
0: cool
1: invalid arg
2: out of memory
--
1.7.9.5
next reply other threads:[~2012-09-21 19:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-21 19:48 Yacine Belkadi [this message]
2012-09-21 19:49 ` [PATCH RFC 2/2] scripts/kernel-doc: check that non-void fcts describe their return value Yacine Belkadi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1348256940-3212-1-git-send-email-yacine.belkadi.1@gmail.com \
--to=yacine.belkadi.1@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@xenotime.net \
--cc=rob@landley.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).