Skip to content

Commit bed4ed3

Browse files
Laurent PinchartJonathan Corbet
authored andcommitted
scripts/kernel-doc: Override -Werror from KCFLAGS with KDOC_WERROR
Since commit 2c12c81 ("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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jonathan Corbet <[email protected]>
1 parent 4f3791c commit bed4ed3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/kernel-doc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,6 @@ if (defined($ENV{'KBUILD_VERBOSE'})) {
329329
$verbose = "$ENV{'KBUILD_VERBOSE'}";
330330
}
331331

332-
if (defined($ENV{'KDOC_WERROR'})) {
333-
$Werror = "$ENV{'KDOC_WERROR'}";
334-
}
335-
336332
if (defined($ENV{'KCFLAGS'})) {
337333
my $kcflags = "$ENV{'KCFLAGS'}";
338334

@@ -341,6 +337,10 @@ if (defined($ENV{'KCFLAGS'})) {
341337
}
342338
}
343339

340+
if (defined($ENV{'KDOC_WERROR'})) {
341+
$Werror = "$ENV{'KDOC_WERROR'}";
342+
}
343+
344344
# Generated docbook code is inserted in a template at a point where
345345
# docbook v3.1 requires a non-zero sequence of RefEntry's; see:
346346
# https://www.oasis-open.org/docbook/documentation/reference/html/refentry.html

0 commit comments

Comments
 (0)