LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] scripts/kernel-doc: Override -Werror from KCFLAGS with KDOC_WERROR
@ 2021-07-30 22:54 Laurent Pinchart
  2021-08-12 15:07 ` Jonathan Corbet
  0 siblings, 1 reply; 2+ messages in thread
From: Laurent Pinchart @ 2021-07-30 22:54 UTC (permalink / raw)
  To: linux-doc
  Cc: linux-renesas-soc, linux-kernel, Randy Dunlap,
	Pierre-Louis Bossart, Jonathan Corbet

Since commit 2c12c8103d8f ("scripts/kernel-doc: optionally treat
warnings as errors"), the kernel-doc script will treat warnings as
errors when one of the following conditions is true:

- The KDOC_WERROR environment variable is non-zero
- The KCFLAGS environment variable contains -Werror
- The -Werror parameter is passed to kernel-doc

Checking KCFLAGS for -Werror allows piggy-backing on the C compiler
error handling. However, unlike the C compiler, kernel-doc has no
provision for -Wno-error. This makes compiling the kernel with -Werror
(to catch regressions) and W=1 (to enable more checks) always fail,
without the same possibility as offered by the C compiler to treating
some selected warnings as warnings despite the global -Werror setting.

To fix this, evaluate KDOC_WERROR after KCFLAGS, which allows disabling
the warnings-as-errors behaviour of kernel-doc selectively by setting
KDOC_WERROR=0.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 scripts/kernel-doc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 7c4a6a507ac4..cfcb60737957 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -329,10 +329,6 @@ if (defined($ENV{'KBUILD_VERBOSE'})) {
 	$verbose = "$ENV{'KBUILD_VERBOSE'}";
 }
 
-if (defined($ENV{'KDOC_WERROR'})) {
-	$Werror = "$ENV{'KDOC_WERROR'}";
-}
-
 if (defined($ENV{'KCFLAGS'})) {
 	my $kcflags = "$ENV{'KCFLAGS'}";
 
@@ -341,6 +337,10 @@ if (defined($ENV{'KCFLAGS'})) {
 	}
 }
 
+if (defined($ENV{'KDOC_WERROR'})) {
+	$Werror = "$ENV{'KDOC_WERROR'}";
+}
+
 # Generated docbook code is inserted in a template at a point where
 # docbook v3.1 requires a non-zero sequence of RefEntry's; see:
 # https://www.oasis-open.org/docbook/documentation/reference/html/refentry.html
-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH] scripts/kernel-doc: Override -Werror from KCFLAGS with KDOC_WERROR
  2021-07-30 22:54 [PATCH] scripts/kernel-doc: Override -Werror from KCFLAGS with KDOC_WERROR Laurent Pinchart
@ 2021-08-12 15:07 ` Jonathan Corbet
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Corbet @ 2021-08-12 15:07 UTC (permalink / raw)
  To: Laurent Pinchart, linux-doc
  Cc: linux-renesas-soc, linux-kernel, Randy Dunlap, Pierre-Louis Bossart

Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> writes:

> Since commit 2c12c8103d8f ("scripts/kernel-doc: optionally treat
> warnings as errors"), the kernel-doc script will treat warnings as
> errors when one of the following conditions is true:
>
> - The KDOC_WERROR environment variable is non-zero
> - The KCFLAGS environment variable contains -Werror
> - The -Werror parameter is passed to kernel-doc
>
> Checking KCFLAGS for -Werror allows piggy-backing on the C compiler
> error handling. However, unlike the C compiler, kernel-doc has no
> provision for -Wno-error. This makes compiling the kernel with -Werror
> (to catch regressions) and W=1 (to enable more checks) always fail,
> without the same possibility as offered by the C compiler to treating
> some selected warnings as warnings despite the global -Werror setting.
>
> To fix this, evaluate KDOC_WERROR after KCFLAGS, which allows disabling
> the warnings-as-errors behaviour of kernel-doc selectively by setting
> KDOC_WERROR=0.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>  scripts/kernel-doc | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

jon

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

end of thread, other threads:[~2021-08-12 15:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-30 22:54 [PATCH] scripts/kernel-doc: Override -Werror from KCFLAGS with KDOC_WERROR Laurent Pinchart
2021-08-12 15:07 ` Jonathan Corbet

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).