mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: Yujie Liu <yujie.liu@intel.com>,
	linux-doc@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>
Cc: linux-kernel@vger.kernel.org,
	Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com>,
	Akira Yokosawa <akiyks@gmail.com>
Subject: Re: [PATCH] scripts/kernel-doc: Fix the regex for matching -Werror flag
Date: Mon, 30 Oct 2023 18:51:40 +0900	[thread overview]
Message-ID: <27286396-645d-4f16-8b66-f437e16f5bc4@gmail.com> (raw)
In-Reply-To: <20231030085404.3343403-1-yujie.liu@intel.com>

Hi,

On 2023/10/30 17:54, Yujie Liu wrote:
> Swarup reported a "make htmldocs" warning:
> 
>   Variable length lookbehind is experimental in regex;
>   marked by <-- HERE in m/(?<=^|\s)-Werror(?=$|\s)
>   <-- HERE / at ./scripts/kernel-doc line 188.
> 
> Akira managed to reproduce it by perl v5.34.0.
> 
> On second thought, it is not necessary to have the complicated
> "lookahead and lookbehind" things, and the regex can be simplified.

Nice!

As a matter of fact, that experimental "Variable length lookbehind"
support was new to perl v5.30.  So your previous change didn't work on
systems such as Debian buster, RHEL 8, and the like.

Thank you for the quick fix.

Let me add a couple of tags.

> 
> Generally, the kernel-doc warnings should be considered as errors only
> when "-Werror" flag is set in KCFLAGS, but not when
> "-Werror=<diagnostic-type>" is set, which means there needs to be a
> space or start of string before "-Werror", and a space or end of string
> after "-Werror".
> 
> The following cases have been tested to work as expected:
> 
> * kernel-doc warnings are considered as errors:
> 
>   $ KCFLAGS="-Werror" make W=1
>   $ KCFLAGS="-Wcomment -Werror" make W=1
>   $ KCFLAGS="-Werror -Wundef" make W=1
>   $ KCFLAGS="-Wcomment -Werror -Wundef" make W=1
> 
> * kernel-doc warnings remain as warnings:
> 
>   $ KCFLAGS="-Werror=return-type" make W=1
>   $ KCFLAGS="-Wcomment -Werror=return-type" make W=1
>   $ KCFLAGS="-Werror=return-type -Wundef" make W=1
>   $ KCFLAGS="-Wcomment -Werror=return-type -Wundef" make W=1
> 
> The "Variable length lookbehind is experimental in regex" warning is
> also resolved by this patch.
> 
> Fixes: 91f950e8b9d8 ("scripts/kernel-doc: match -Werror flag strictly")
> Reported-by: Swarup Laxman Kotiaklapudi <swarupkotikalapudi@gmail.com>
Closes: https://lore.kernel.org/r/20231028182231.123996-1-swarupkotikalapudi@gmail.com/

> Cc: Akira Yokosawa <akiyks@gmail.com>
Reviewed-by: Akira Yokosawa <akiyks@gmail.com>

> Signed-off-by: Yujie Liu <yujie.liu@intel.com>
> ---
>  scripts/kernel-doc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index d660e1f4b483..08a3e603db19 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|$)/) {

Simpler is better.  I can read this ;-)

        Thanks, Akira

>  		$Werror = 1;
>  	}
>  }

  reply	other threads:[~2023-10-30  9:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-30  8:54 Yujie Liu
2023-10-30  9:51 ` Akira Yokosawa [this message]
2023-10-30 16:53 ` Jonathan Corbet

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=27286396-645d-4f16-8b66-f437e16f5bc4@gmail.com \
    --to=akiyks@gmail.com \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swarupkotikalapudi@gmail.com \
    --cc=yujie.liu@intel.com \
    /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

all inboxes | Powered by JetHome®