public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] scripts/kernel-doc: fix make htmldoc warning
@ 2023-10-28 18:22 Swarup Laxman Kotiaklapudi
  2023-10-29 18:06 ` Jonathan Corbet
  0 siblings, 1 reply; 5+ messages in thread
From: Swarup Laxman Kotiaklapudi @ 2023-10-28 18:22 UTC (permalink / raw)
  To: corbet, yujie.liu, linux-doc, swarupkotikalapudi,
	linux-kernel-mentees

make htmldocs has below warnings:

..
Variable length lookbehind is experimental in regex;
marked by <-- HERE in m/(?<=^|\s)-Werror(?=$|\s)
<-- HERE / at ./scripts/kernel-doc line 188.
...

"-Werror" option in make command,
needs "-Werror" to have space before
and after while running make command,
hence space checking is sepratly done,
and is not part of lookbehind regular expression.

Below command also didn't
show any error:
 make KCFLAGS="-Werror=return-type" W=1 kernel/fork.o

Fixes: 91f950e8b9d8 ("scripts/kernel-doc: match -Werror flag strictly")
Signed-off-by: Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com>
---
 scripts/kernel-doc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index d660e1f4b483..aa9e3e198d12 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -185,7 +185,7 @@ if (defined($ENV{'KBUILD_VERBOSE'}) && $ENV{'KBUILD_VERBOSE'} =~ '1') {
 if (defined($ENV{'KCFLAGS'})) {
 	my $kcflags = "$ENV{'KCFLAGS'}";
 
-	if ($kcflags =~ /(?<=^|\s)-Werror(?=$|\s)/) {
+	if ($kcflags =~ /(?<=^|)(\s)-Werror(?=$|)(\s)/) {
 		$Werror = 1;
 	}
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] scripts/kernel-doc: fix make htmldoc warning
  2023-10-28 18:22 [PATCH] scripts/kernel-doc: fix make htmldoc warning Swarup Laxman Kotiaklapudi
@ 2023-10-29 18:06 ` Jonathan Corbet
  2023-10-30  0:02   ` Akira Yokosawa
  2023-10-30  9:18   ` Yujie Liu
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Corbet @ 2023-10-29 18:06 UTC (permalink / raw)
  To: Swarup Laxman Kotiaklapudi, yujie.liu, linux-doc,
	swarupkotikalapudi, linux-kernel-mentees

Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com> writes:

> make htmldocs has below warnings:
>
> ..
> Variable length lookbehind is experimental in regex;
> marked by <-- HERE in m/(?<=^|\s)-Werror(?=$|\s)
> <-- HERE / at ./scripts/kernel-doc line 188.
> ...

So how do you get this warning?  I've not seen it.  Which version of
Perl? 

> "-Werror" option in make command,
> needs "-Werror" to have space before
> and after while running make command,
> hence space checking is sepratly done,
> and is not part of lookbehind regular expression.
>
> Below command also didn't
> show any error:
>  make KCFLAGS="-Werror=return-type" W=1 kernel/fork.o
>
> Fixes: 91f950e8b9d8 ("scripts/kernel-doc: match -Werror flag strictly")
> Signed-off-by: Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com>
> ---
>  scripts/kernel-doc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index d660e1f4b483..aa9e3e198d12 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -185,7 +185,7 @@ if (defined($ENV{'KBUILD_VERBOSE'}) && $ENV{'KBUILD_VERBOSE'} =~ '1') {
>  if (defined($ENV{'KCFLAGS'})) {
>  	my $kcflags = "$ENV{'KCFLAGS'}";
>  
> -	if ($kcflags =~ /(?<=^|\s)-Werror(?=$|\s)/) {
> +	if ($kcflags =~ /(?<=^|)(\s)-Werror(?=$|)(\s)/) {
>  		$Werror = 1;
>  	}
>  }

Thanks,

jon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scripts/kernel-doc: fix make htmldoc warning
  2023-10-29 18:06 ` Jonathan Corbet
@ 2023-10-30  0:02   ` Akira Yokosawa
  2023-10-30  5:37     ` Yujie Liu
  2023-10-30  9:18   ` Yujie Liu
  1 sibling, 1 reply; 5+ messages in thread
From: Akira Yokosawa @ 2023-10-30  0:02 UTC (permalink / raw)
  To: corbet
  Cc: linux-doc, linux-kernel-mentees, swarupkotikalapudi, yujie.liu,
	Akira Yokosawa

Hi,

On Date: Sun, 29 Oct 2023 12:06:58 -0600, Jonathan Corbet wrote:
> Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com> writes:
> 
>> make htmldocs has below warnings:
>>
>> ..
>> Variable length lookbehind is experimental in regex;
>> marked by <-- HERE in m/(?<=^|\s)-Werror(?=$|\s)
>> <-- HERE / at ./scripts/kernel-doc line 188.
>> ...
> 
> So how do you get this warning?  I've not seen it.  Which version of
> Perl? 

I get this warning on Ubuntu 22.04LTS, whose perl is v5.34.0.

Swarup's change silences the warning there.

I could provide a tested-by: tag if I was familiar with that
"variable length lookbehind" thing ...

        Thanks, Akira

> 
>> "-Werror" option in make command,
>> needs "-Werror" to have space before
>> and after while running make command,
>> hence space checking is sepratly done,
>> and is not part of lookbehind regular expression.
>>
>> Below command also didn't
>> show any error:
>>  make KCFLAGS="-Werror=return-type" W=1 kernel/fork.o
>>
>> Fixes: 91f950e8b9d8 ("scripts/kernel-doc: match -Werror flag strictly")
>> Signed-off-by: Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com>
>> ---
>>  scripts/kernel-doc | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
>> index d660e1f4b483..aa9e3e198d12 100755
>> --- a/scripts/kernel-doc
>> +++ b/scripts/kernel-doc
>> @@ -185,7 +185,7 @@ if (defined($ENV{'KBUILD_VERBOSE'}) && $ENV{'KBUILD_VERBOSE'} =~ '1') {
>>  if (defined($ENV{'KCFLAGS'})) {
>>  	my $kcflags = "$ENV{'KCFLAGS'}";
>>  
>> -	if ($kcflags =~ /(?<=^|\s)-Werror(?=$|\s)/) {
>> +	if ($kcflags =~ /(?<=^|)(\s)-Werror(?=$|)(\s)/) {
>>  		$Werror = 1;
>>  	}
>>  }
> 
> Thanks,
> 
> jon


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scripts/kernel-doc: fix make htmldoc warning
  2023-10-30  0:02   ` Akira Yokosawa
@ 2023-10-30  5:37     ` Yujie Liu
  0 siblings, 0 replies; 5+ messages in thread
From: Yujie Liu @ 2023-10-30  5:37 UTC (permalink / raw)
  To: Akira Yokosawa, Swarup Laxman Kotiaklapudi
  Cc: corbet, linux-doc, linux-kernel-mentees

Hi,

On Mon, Oct 30, 2023 at 09:02:32AM +0900, Akira Yokosawa wrote:
> Hi,
> 
> On Date: Sun, 29 Oct 2023 12:06:58 -0600, Jonathan Corbet wrote:
> > Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com> writes:
> > 
> >> make htmldocs has below warnings:
> >>
> >> ..
> >> Variable length lookbehind is experimental in regex;
> >> marked by <-- HERE in m/(?<=^|\s)-Werror(?=$|\s)
> >> <-- HERE / at ./scripts/kernel-doc line 188.
> >> ...
> > 
> > So how do you get this warning?  I've not seen it.  Which version of
> > Perl? 
> 
> I get this warning on Ubuntu 22.04LTS, whose perl is v5.34.0.
> 
> Swarup's change silences the warning there.
> 
> I could provide a tested-by: tag if I was familiar with that
> "variable length lookbehind" thing ...
> 
>         Thanks, Akira
> 
> > 
> >> "-Werror" option in make command,
> >> needs "-Werror" to have space before
> >> and after while running make command,
> >> hence space checking is sepratly done,
> >> and is not part of lookbehind regular expression.

Thanks a lot for the input, but I'm afraid that "have space before
and after -Werror" is not very general use case.

For example, the following command only has "-Werror" in KCFLAGS env
variable, no space before or after it. The purpose of this command is to
turn all warnings into errors, including kernel-doc ones, but after
applying your fix patch, the kernel-doc warnings are not considered as
errors:

$ make W=1 KCFLAGS="-Werror" kernel/fork.o
...
  CC      kernel/fork.o
kernel/fork.c:1405: warning: Function parameter or member 'mm' not described in 'set_mm_exe_file'
kernel/fork.c:1405: warning: Function parameter or member 'new_exe_file' not described in 'set_mm_exe_file'
kernel/fork.c:1442: warning: Function parameter or member 'mm' not described in 'replace_mm_exe_file'
kernel/fork.c:1442: warning: Function parameter or member 'new_exe_file' not described in 'replace_mm_exe_file'
kernel/fork.c:1494: warning: Function parameter or member 'mm' not described in 'get_mm_exe_file'
kernel/fork.c:1513: warning: Function parameter or member 'task' not described in 'get_task_exe_file'
kernel/fork.c:1537: warning: Function parameter or member 'task' not described in 'get_task_mm'
kernel/fork.c:2112: warning: bad line:
kernel/fork.c:2133: warning: Function parameter or member 'ret' not described in '__pidfd_prepare'
kernel/fork.c:2133: warning: Excess function parameter 'pidfd' description in '__pidfd_prepare'
kernel/fork.c:2182: warning: Function parameter or member 'ret' not described in 'pidfd_prepare'
kernel/fork.c:2182: warning: Excess function parameter 'pidfd' description in 'pidfd_prepare'
kernel/fork.c:3198: warning: expecting prototype for clone3(). Prototype was for sys_clone3() instead
$ echo $?
0

As I described in the message of commit 91f950e8b9d8, this regex should
match the general case that "there needs to be a space *OR* start of string
before -Werror, and a space *OR* end of string after -Werror."

Please feel free to try the followinn cases to see if all of them can
work as expected. MATCH means kernel-doc warnings are considered as
errors, while NO MATCH means not.

    KCFLAGS="-Werror" make W=1 kernel/fork.o [MATCH]
    KCFLAGS="-Werror=return-type" make W=1 kernel/fork.o [NO MATCH]
    KCFLAGS="-Wcomment -Werror" make W=1 kernel/fork.o [MATCH]
    KCFLAGS="-Wcomment -Werror=return-type" make W=1 kernel/fork.o [NO MATCH]
    KCFLAGS="-Werror -Wundef" make W=1 kernel/fork.o [MATCH]
    KCFLAGS="-Werror=return-type -Wundef" make W=1 kernel/fork.o [NO MATCH]
    KCFLAGS="-Wcomment -Werror -Wundef" make W=1 kernel/fork.o [MATCH]
    KCFLAGS="-Wcomment -Werror=return-type -Wundef" make W=1 kernel/fork.o [NO MATCH]

Best Regards,
Yujie

> >>
> >> Below command also didn't
> >> show any error:
> >>  make KCFLAGS="-Werror=return-type" W=1 kernel/fork.o
> >>
> >> Fixes: 91f950e8b9d8 ("scripts/kernel-doc: match -Werror flag strictly")
> >> Signed-off-by: Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com>
> >> ---
> >>  scripts/kernel-doc | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> >> index d660e1f4b483..aa9e3e198d12 100755
> >> --- a/scripts/kernel-doc
> >> +++ b/scripts/kernel-doc
> >> @@ -185,7 +185,7 @@ if (defined($ENV{'KBUILD_VERBOSE'}) && $ENV{'KBUILD_VERBOSE'} =~ '1') {
> >>  if (defined($ENV{'KCFLAGS'})) {
> >>  	my $kcflags = "$ENV{'KCFLAGS'}";
> >>  
> >> -	if ($kcflags =~ /(?<=^|\s)-Werror(?=$|\s)/) {
> >> +	if ($kcflags =~ /(?<=^|)(\s)-Werror(?=$|)(\s)/) {
> >>  		$Werror = 1;
> >>  	}
> >>  }
> > 
> > Thanks,
> > 
> > jon
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] scripts/kernel-doc: fix make htmldoc warning
  2023-10-29 18:06 ` Jonathan Corbet
  2023-10-30  0:02   ` Akira Yokosawa
@ 2023-10-30  9:18   ` Yujie Liu
  1 sibling, 0 replies; 5+ messages in thread
From: Yujie Liu @ 2023-10-30  9:18 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Swarup Laxman Kotiaklapudi, linux-doc, linux-kernel-mentees

On Sun, Oct 29, 2023 at 12:06:58PM -0600, Jonathan Corbet wrote:
> Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com> writes:
> 
> > make htmldocs has below warnings:
> >
> > ..
> > Variable length lookbehind is experimental in regex;
> > marked by <-- HERE in m/(?<=^|\s)-Werror(?=$|\s)
> > <-- HERE / at ./scripts/kernel-doc line 188.
> > ...
> 
> So how do you get this warning?  I've not seen it.  Which version of
> Perl? 

Hi Jon, I can get this warning with perl v5.34.0, but not with perl
v5.36.0.

I checked the git history of perl, variable length lookbehind is mostly
no longer considered experimental by the commit below that was included
in v5.36.0.

commit c15a34bfb4f54341de8e463d45b5bcbaad235350
Author: Yves Orton <demerphq@gmail.com>
Date:   Wed Feb 23 07:06:22 2022 +0100

    regcomp.c: Reduce scope of experimental warnings with lookbehind


Sorry for accidentally introducing this issue on old version of perl.
The fix patch has been sent at [1]

[1] https://lore.kernel.org/all/20231030085404.3343403-1-yujie.liu@intel.com/

Best Regards,
Yujie

> > "-Werror" option in make command,
> > needs "-Werror" to have space before
> > and after while running make command,
> > hence space checking is sepratly done,
> > and is not part of lookbehind regular expression.
> >
> > Below command also didn't
> > show any error:
> >  make KCFLAGS="-Werror=return-type" W=1 kernel/fork.o
> >
> > Fixes: 91f950e8b9d8 ("scripts/kernel-doc: match -Werror flag strictly")
> > Signed-off-by: Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com>
> > ---
> >  scripts/kernel-doc | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> > index d660e1f4b483..aa9e3e198d12 100755
> > --- a/scripts/kernel-doc
> > +++ b/scripts/kernel-doc
> > @@ -185,7 +185,7 @@ if (defined($ENV{'KBUILD_VERBOSE'}) && $ENV{'KBUILD_VERBOSE'} =~ '1') {
> >  if (defined($ENV{'KCFLAGS'})) {
> >  	my $kcflags = "$ENV{'KCFLAGS'}";
> >  
> > -	if ($kcflags =~ /(?<=^|\s)-Werror(?=$|\s)/) {
> > +	if ($kcflags =~ /(?<=^|)(\s)-Werror(?=$|)(\s)/) {
> >  		$Werror = 1;
> >  	}
> >  }
> 
> Thanks,
> 
> jon

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-30  9:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-28 18:22 [PATCH] scripts/kernel-doc: fix make htmldoc warning Swarup Laxman Kotiaklapudi
2023-10-29 18:06 ` Jonathan Corbet
2023-10-30  0:02   ` Akira Yokosawa
2023-10-30  5:37     ` Yujie Liu
2023-10-30  9:18   ` Yujie Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox