linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Corbet <corbet@lwn.net>
To: "Niklas Söderlund" <niklas.soderlund@corigine.com>,
	linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, oss-drivers@corigine.com,
	"Niklas Söderlund" <niklas.soderlund@corigine.com>
Subject: Re: [PATCH v2] scripts: kernel-doc: Always increment warnings counter
Date: Mon, 13 Jun 2022 11:18:07 -0600	[thread overview]
Message-ID: <87h74o1nzk.fsf@meer.lwn.net> (raw)
In-Reply-To: <20220613090510.3088294-1-niklas.soderlund@corigine.com>

Niklas Söderlund <niklas.soderlund@corigine.com> writes:

> Some warnings do not increment the warnings counter making the behavior
> of running kernel-doc with -Werror unlogical as some warnings will be
> generated but not treated as errors.
>
> Fix this by creating a helper function that always incrementing the
> warnings counter every time a warning is emitted. There is one location
> in get_sphinx_version() where a warning is not touched as it concerns
> the execution environment of the kernel-doc and not the documentation
> being processed.
>
> Incrementing the counter only have effect when running kernel-doc in
> either verbose mode (-v or environment variable KBUILD_VERBOSE) or when
> treating warnings as errors (-Werror or environment variable
> KDOC_WERROR). In both cases the number of warnings printed is printed to
> stderr and for the later the exit code of kernel-doc is non-zero if
> warnings where encountered.
>
> Simple test case to demo one of the warnings,
>
>     $ cat test.c
>     /**
>      * foo() - Description
>      */
>     int bar();
>
>     # Without this change
>     $ ./scripts/kernel-doc -Werror -none test.c
>     test.c:4: warning: expecting prototype for foo(). Prototype was for
>     bar() instead
>
>     # With this change
>     $ ./scripts/kernel-doc -Werror -none test.c
>     test.c:4: warning: expecting prototype for foo(). Prototype was for
>     bar() instead
>     1 warnings as Errors
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> ---
> * Changes since v1
> - Added a helper emit_warning() to print the message and increment the
>   counter instead of adding statements to increment the counter where it
>   was missing.

Thanks for making this change.  Anything that rationalizes this horrific
script even a little bit is more than welcome.

I've applied the patch, thanks.

jon

      reply	other threads:[~2022-06-13 19:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13  9:05 [PATCH v2] scripts: kernel-doc: Always increment warnings counter Niklas Söderlund
2022-06-13 17:18 ` Jonathan Corbet [this message]

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=87h74o1nzk.fsf@meer.lwn.net \
    --to=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=niklas.soderlund@corigine.com \
    --cc=oss-drivers@corigine.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;
as well as URLs for NNTP newsgroup(s).