From patchwork Fri Mar 17 14:18:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 664543 Delivered-To: patch@linaro.org Received: by 2002:a5d:5602:0:0:0:0:0 with SMTP id l2csp425591wrv; Fri, 17 Mar 2023 07:19:23 -0700 (PDT) X-Google-Smtp-Source: AK7set81rr3dHAaEYz3p64OaoE/862b+7MlOXa08lhHIDdJJyY5Jw/eruguZ4qnNjFSxPJjATDao X-Received: by 2002:a1f:250b:0:b0:3ea:7af1:9ea4 with SMTP id l11-20020a1f250b000000b003ea7af19ea4mr16418347vkl.12.1679062763507; Fri, 17 Mar 2023 07:19:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679062763; cv=none; d=google.com; s=arc-20160816; b=JA29Ec4thjeJQpJEpbNvk2aMF8Q3yQEBORRTarHog6eESybu/pF1IkJDW+F/TBlJpC nTf77NDwRZaokoNW3yW+loS6O4aFynlQJ+3NehzwB8AT+j8wVjBjV+tA1eLWulHrPK5i UzrU0Tx4NaUECf8/RUV3R9hj/q4/GYL3CpqCy76MYroIXHX1yFwH1XY51mSycxa3WshY faCoRC3xLt33s60Inz3rgrYQQoq+tcxInK3ISXurZENUB+VQ1/eih6HQ/USZavLjothf cDh4A4HeK0JMsGO6n3s2QcIpDGWN278/D1sAtI7mSVoVWd03qPJrS4aTXl9EyAHsbljU 9RPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:ui-outboundreport :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=4urCRIcP+nMdb65sVQ+s2aYjRZM+hLj+TuSiZlvFp38=; b=hAuCbNvTBbmKIIu8agGsDUB1PUXE0R/91gN3DzW/CHceVkvkZoUz0jpJUM9idgdMC3 ZOlaHNDUe87m8Kgg6Nofjt/jnDMW1xMig2PCKGNEtfu7Ogv4ajkcApZzbHry3XpuHuYQ ovYe61BdzgruaYkNF8BLJ1fDBmtq5XxmN2Y5WGiCiYvQiO8ohs8FtnuKQ17oNkj4dSDk fcbrRo1Tctla9yJTtrpNKYwtPKxJjpjqrmp3vOY9QXM8AzuokayJ2ME/z2k+TflOkSEe YSprPm7dinnKZB2kPNYoU2pTC/yNlXVrK4FmAXLFFZRolCqnDEcTjm82dh8nclRg8FMJ nMwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id t206-20020a1f91d7000000b004322b02d1a4si742396vkd.262.2023.03.17.07.19.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 Mar 2023 07:19:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pdAuV-0006Xy-D1; Fri, 17 Mar 2023 10:18:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdAuQ-0006WP-73; Fri, 17 Mar 2023 10:18:18 -0400 Received: from mout.kundenserver.de ([212.227.17.10]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdAuO-0004tn-CU; Fri, 17 Mar 2023 10:18:17 -0400 Received: from quad ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue108 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M3DFj-1peYUI3Uyb-003h35; Fri, 17 Mar 2023 15:18:12 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Peter Maydell , Thomas Huth , Laurent Vivier Subject: [PULL 3/3] docs/sphinx/kerneldoc.py: Honour --enable-werror Date: Fri, 17 Mar 2023 15:18:08 +0100 Message-Id: <20230317141808.826875-4-laurent@vivier.eu> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230317141808.826875-1-laurent@vivier.eu> References: <20230317141808.826875-1-laurent@vivier.eu> MIME-Version: 1.0 X-Provags-ID: V03:K1:48N5l6aiuxH0hdnn0k0TIWGrUEGIgZc5NQqJg76cXXi8XEoV+6I jizUdQQ6quBytLAw7DXT0xR0t5++T54bdMXJ2/I1Fy00AZPJur6EDXGBJ5LTy9bbLqWQJPi fCu4Y7IoUmr6l5chNGVztJ1W9kLRiQpO6CC4IboZXymtTx4oDC8U9guzDfwluIf2A1QoDu6 G1hyBDV4HTzR8MKgrxdWQ== UI-OutboundReport: notjunk:1;M01:P0:kpVQatv5Nr0=;AieoV6LN/5SkR94CDn3ejECo2Uo rnmqJAJOG9glKnlYFJikYzT29ic5bTiyJJjTShlmYqca1YhGwX16dIhNRz5t27hCjwSQ9SBU7 2FyAlJewKNtLAJC8Ao4gQErfaiyeX9P5bx8Wy4LKRuE5n4LXq810v+D4htv2j43aQfEmBUC2s 1O0NzkSc8t761Bceg7vhneutvNcFSyWDCHezHdreQkWvWUNT4aBHPTdERlogwzDuwTs+1rGjZ mxqmsE825Qvn5MlkqOicn9YdCkuHvkLrvHJg8GznLiUZbB2Ing7ZdyIZ4/W2oJH7ERiSh26m6 +Y6h7xe+Qh1dd12Qhpy2uoOZj59fHfbsPuESXdhOOYdAWiJNoHAQzzUxuyYlCZC/YKuVq9yHi FBvINxd62KgoXYXHg3yaJfWCpXlS844bgirA5EkWqL/mAL0dmIouvaK6ho2IgPaa048jzUZ5a +eBCryh5E/bFRsy4LF91NweUAuZQCKUV6WoSNsVAC4seIXxhyEPSQKwVC+/6UyGZ6G3jfvOpv bBXlmL2IBPi+7xzfCs8gyT4mw1N75e6r2oJ6RX7lo0qlVf8gUwjvF8P6LUTrjxcSI6LflaoHJ IpGLKj6UCZFB9eNkX8R07B3UaOoTsbEmqiLsYC6XOpF1cg4K7XovlqZ5oI0tmnq71tSiDoPhU iGUfGDHfpTDii3bguuh7Ka7moaVTmfoL4PIAMfo5cw== Received-SPF: none client-ip=212.227.17.10; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Peter Maydell Currently, the kerneldoc Sphinx plugin doesn't honour the --enable-werror configure option, so its warnings are never fatal. This is because although we do pass sphinx-build the -W switch, the warnings from kerneldoc are produced by the scripts/kernel-doc script directly and don't go through Sphinx's "emit a warning" function. When --enable-werror is in effect, pass sphinx-build an extra argument -Dkerneldoc_werror=1. The kerneldoc plugin can then use this to determine whether it should be passing the kernel-doc script -Werror. We do this because there is no documented mechanism for a Sphinx plugin to determine whether sphinx-build was passed -W or not; if one is provided then we can switch to that at a later date: https://github.com/sphinx-doc/sphinx/issues/11239 Signed-off-by: Peter Maydell Reviewed-by: Thomas Huth Message-Id: <20230314114431.1096972-1-peter.maydell@linaro.org> Signed-off-by: Laurent Vivier --- docs/meson.build | 2 +- docs/sphinx/kerneldoc.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/meson.build b/docs/meson.build index bb72c10ea8c5..f220800e3e59 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -7,7 +7,7 @@ if sphinx_build.found() SPHINX_ARGS = ['env', 'CONFDIR=' + qemu_confdir, sphinx_build, '-q'] # If we're making warnings fatal, apply this to Sphinx runs as well if get_option('werror') - SPHINX_ARGS += [ '-W' ] + SPHINX_ARGS += [ '-W', '-Dkerneldoc_werror=1' ] endif # This is a bit awkward but works: create a trivial document and diff --git a/docs/sphinx/kerneldoc.py b/docs/sphinx/kerneldoc.py index bf442150165f..72c403a73798 100644 --- a/docs/sphinx/kerneldoc.py +++ b/docs/sphinx/kerneldoc.py @@ -74,6 +74,10 @@ def run(self): # Sphinx versions cmd += ['-sphinx-version', sphinx.__version__] + # Pass through the warnings-as-errors flag + if env.config.kerneldoc_werror: + cmd += ['-Werror'] + filename = env.config.kerneldoc_srctree + '/' + self.arguments[0] export_file_patterns = [] @@ -167,6 +171,7 @@ def setup(app): app.add_config_value('kerneldoc_bin', None, 'env') app.add_config_value('kerneldoc_srctree', None, 'env') app.add_config_value('kerneldoc_verbosity', 1, 'env') + app.add_config_value('kerneldoc_werror', 0, 'env') app.add_directive('kernel-doc', KernelDocDirective)