[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAQ87U202fgqkd5T9G82h4F6sNOMW2=vH1HmgAoVA48CMw@mail.gmail.com>
Date: Mon, 5 Jun 2023 09:36:30 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: linux-kernel@...r.kernel.org, linux-kbuild@...r.kernel.org,
linux-doc@...r.kernel.org, Johannes Berg <johannes.berg@...el.com>
Subject: Re: [PATCH 1/2] kernel-doc: don't let V=1 change outcome
On Sat, Jun 3, 2023 at 6:00 AM Johannes Berg <johannes@...solutions.net> wrote:
>
> From: Johannes Berg <johannes.berg@...el.com>
>
> The kernel-doc script currently reports a number of issues
> only in "verbose" mode, but that's initialized from V=1
> (via KBUILD_VERBOSE), so if you use KDOC_WERROR=1 then
> adding V=1 might actually break the build. This is rather
> unexpected.
Agree.
>
> Change kernel-doc to not change its behaviour wrt. errors
> (or warnings) when verbose mode is enabled, but rather add
> separate warning flags (and -Wall) for it.
>
> Signed-off-by: Johannes Berg <johannes.berg@...el.com>
> ---
> scripts/kernel-doc | 41 ++++++++++++++++++++++++++++++++++++-----
> 1 file changed, 36 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/kernel-doc b/scripts/kernel-doc
> index 2486689ffc7b..1eb1819fbe13 100755
> --- a/scripts/kernel-doc
> +++ b/scripts/kernel-doc
> @@ -23,7 +23,7 @@ kernel-doc - Print formatted kernel documentation to stdout
>
> =head1 SYNOPSIS
>
> - kernel-doc [-h] [-v] [-Werror]
> + kernel-doc [-h] [-v] [-Werror] [-Wreturn] [-Wshort-description] [-Wcontents-before-sections] [-Wall]
> [ -man |
> -rst [-sphinx-version VERSION] [-enable-lineno] |
> -none
> @@ -133,6 +133,9 @@ my $dohighlight = "";
>
> my $verbose = 0;
> my $Werror = 0;
> +my $Wreturn = 0;
> +my $Wshort_desc = 0;
> +my $Wcontents_before_sections = 0;
> my $output_mode = "rst";
> my $output_preformatted = 0;
> my $no_doc_sections = 0;
> @@ -191,6 +194,24 @@ if (defined($ENV{'KDOC_WERROR'})) {
> $Werror = "$ENV{'KDOC_WERROR'}";
> }
>
> +if (defined($ENV{'KDOC_WRETURN'})) {
> + $Wreturn = "$ENV{'KDOC_WRETURN'}";
> +}
> +
> +if (defined($ENV{'KDOC_WSHORT_DESC'})) {
> + $Wshort_desc = "$ENV{'KDOC_WSHORT_DESC'}";
> +}
> +
> +if (defined($ENV{'KDOC_WCONTENTS_BEFORE_SECTION'})) {
> + $Wcontents_before_sections = "$ENV{'KDOC_WCONTENTS_BEFORE_SECTION'}";
> +}
> +
> +if (defined($ENV{'KDOC_WALL'})) {
> + $Wreturn = "$ENV{'KDOC_WALL'}";
> + $Wshort_desc = "$ENV{'KDOC_WALL'}";
> + $Wcontents_before_sections = "$ENV{'KDOC_WALL'}";
> +}
Adding an environment variable to each of them is tedious.
If you enable -Wall via the command line option,
these lines are unneeded?
For example,
ifneq ($(KBUILD_EXTRA_WARN),)
cmd_checkdoc = $(srctree)/scripts/kernel-doc -none \
$(if $(findstring 2, $(KBUILD_EXTRA_WARN)), -Wall) $<
endif
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists