* [PATCH] kernel-doc: trivial improvement for warning message
@ 2019-10-20 13:23 Changbin Du
2019-10-21 18:54 ` Matthew Wilcox
0 siblings, 1 reply; 3+ messages in thread
From: Changbin Du @ 2019-10-20 13:23 UTC (permalink / raw)
To: Jonathan Corbet; +Cc: Jiri Kosina, linux-doc, linux-kernel, Changbin Du
The message "Function parameter or member ..." looks weird.
Signed-off-by: Changbin Du <changbin.du@gmail.com>
---
scripts/kernel-doc | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 81dc91760b23..cd3d2ca52c34 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1475,8 +1475,13 @@ sub push_parameter($$$$) {
$parameterdescs{$param} = $undescribed;
if (show_warnings($type, $declaration_name) && $param !~ /\./) {
- print STDERR
- "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n";
+ if ($decl_type eq "struct" or $decl_type eq 'union') {
+ print STDERR
+ "${file}:$.: warning: $decl_type member '$param' not described in '$declaration_name'\n";
+ } else {
+ print STDERR
+ "${file}:$.: warning: $decl_type parameter '$param' not described in '$declaration_name'\n";
+ }
++$warnings;
}
}
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kernel-doc: trivial improvement for warning message
2019-10-20 13:23 [PATCH] kernel-doc: trivial improvement for warning message Changbin Du
@ 2019-10-21 18:54 ` Matthew Wilcox
2019-10-23 11:27 ` Changbin Du
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2019-10-21 18:54 UTC (permalink / raw)
To: Changbin Du; +Cc: Jonathan Corbet, Jiri Kosina, linux-doc, linux-kernel
On Sun, Oct 20, 2019 at 09:23:23PM +0800, Changbin Du wrote:
> The message "Function parameter or member ..." looks weird.
>
> Signed-off-by: Changbin Du <changbin.du@gmail.com>
> ---
> scripts/kernel-doc | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index 81dc91760b23..cd3d2ca52c34 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -1475,8 +1475,13 @@ sub push_parameter($$$$) {
> $parameterdescs{$param} = $undescribed;
>
> if (show_warnings($type, $declaration_name) && $param !~ /\./) {
> - print STDERR
> - "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n";
> + if ($decl_type eq "struct" or $decl_type eq 'union') {
> + print STDERR
> + "${file}:$.: warning: $decl_type member '$param' not described in '$declaration_name'\n";
> + } else {
> + print STDERR
> + "${file}:$.: warning: $decl_type parameter '$param' not described in '$declaration_name'\n";
> + }
> ++$warnings;
How about instead ...
if (show_warnings($type, $declaration_name) && $param !~ /\./) { if ($decl_type eq "struct")
$msg = "struct member";
elif ($decl_type eq "union")
$msg = "union member";
else
$msg = "function parameter";
print STDERR "${file}:$.: warning: $msg '$param' not described in '$declaration_name'\n";
(please excuse my perl, i am not a native speaker)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kernel-doc: trivial improvement for warning message
2019-10-21 18:54 ` Matthew Wilcox
@ 2019-10-23 11:27 ` Changbin Du
0 siblings, 0 replies; 3+ messages in thread
From: Changbin Du @ 2019-10-23 11:27 UTC (permalink / raw)
To: Matthew Wilcox
Cc: Changbin Du, Jonathan Corbet, Jiri Kosina, linux-doc, linux-kernel
On Mon, Oct 21, 2019 at 11:54:06AM -0700, Matthew Wilcox wrote:
> On Sun, Oct 20, 2019 at 09:23:23PM +0800, Changbin Du wrote:
> > The message "Function parameter or member ..." looks weird.
> >
> > Signed-off-by: Changbin Du <changbin.du@gmail.com>
> > ---
> > scripts/kernel-doc | 9 +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> > index 81dc91760b23..cd3d2ca52c34 100755
> > --- a/scripts/kernel-doc
> > +++ b/scripts/kernel-doc
> > @@ -1475,8 +1475,13 @@ sub push_parameter($$$$) {
> > $parameterdescs{$param} = $undescribed;
> >
> > if (show_warnings($type, $declaration_name) && $param !~ /\./) {
> > - print STDERR
> > - "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n";
> > + if ($decl_type eq "struct" or $decl_type eq 'union') {
> > + print STDERR
> > + "${file}:$.: warning: $decl_type member '$param' not described in '$declaration_name'\n";
> > + } else {
> > + print STDERR
> > + "${file}:$.: warning: $decl_type parameter '$param' not described in '$declaration_name'\n";
> > + }
> > ++$warnings;
>
> How about instead ...
>
> if (show_warnings($type, $declaration_name) && $param !~ /\./) { if ($decl_type eq "struct")
> $msg = "struct member";
> elif ($decl_type eq "union")
> $msg = "union member";
> else
> $msg = "function parameter";
> print STDERR "${file}:$.: warning: $msg '$param' not described in '$declaration_name'\n";
>
> (please excuse my perl, i am not a native speaker)
This removes some duplicated characters, but need to decalare a extra variable.
I am okay for both approaches. :)
--
Cheers,
Changbin Du
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-23 11:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-20 13:23 [PATCH] kernel-doc: trivial improvement for warning message Changbin Du
2019-10-21 18:54 ` Matthew Wilcox
2019-10-23 11:27 ` Changbin Du
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).