Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp792459iog; Mon, 13 Jun 2022 13:06:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vyMb2Py0HG86Ji1ktzAa99ljORgfdV75F7R1Nw7qG6M/84itouaQQaReV3D62qObBaHjtC X-Received: by 2002:a17:902:ea85:b0:167:96cd:b97b with SMTP id x5-20020a170902ea8500b0016796cdb97bmr969801plb.95.1655150796228; Mon, 13 Jun 2022 13:06:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655150796; cv=none; d=google.com; s=arc-20160816; b=XyUnKwl9J0Jd2ODiUc6rCPs5vE+BKav78Nkn5XPhVJMmdpvFDm0H56dqlyIZxVEEpK /GPBtCyGcaT+u932U31G2GMZdB8PNFcSxMaPCPK299s/y6TORGnTY05zmhcmvZhRms5l 0COc+A1iyj5WiZZNAYT2ZbgFeK3sntXexwLdRgVR61bHWAkvJs4CFC33512RlHDFK+Pq q/6j2q3o7SEgpL+/arpU3kBrMUU0KkXC/6qLU6UFzgtSmGHhMvZ9w6gSWA13ZkMbUaVd Xf4uFKXvmvtVht/FDB9Gw0kYF/y0+YW012vqXR9sjunyaDqSUmiFTTzdi5XGXEeGz67h fzbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature:dkim-filter; bh=c6lIsFQ+NWEImD41NwrKBPBx7AxmBW0WsXXocbKtZ3Q=; b=ScJMIK3AOnEpLkdqGpzk+7vjGWOkHKgRsLcec3PDx4DHOau4vt7A7PkbtOGHsUDlr3 xROjT9EjbsJYmDOZveQq17I9i3CLeaUS8sfNGYBXu52bRZL8jj+WLs8kAtImmffYerIS KwC3yOGLop6pAGZyIfeizI+byQNFdSml9MzOPXicwE+GihIoQz0NaYy/tcDzLPDeX7O+ jpwQ0aV6+LxQ4fbTRVYMC/5KZNFpd8eHHf7s9mZ2rm+whAarct4qku9NZHaiL+nlXrC3 ChZ3+mzxWPLLR/da2AwZyZthoEJW0U62GqBnFWXNDKvLE6JD93FMzTGprx0qcwEhyqPg kIeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lwn.net header.s=20201203 header.b=HPiyOJpD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d126-20020a621d84000000b0051b85fb65b9si8740203pfd.244.2022.06.13.13.06.24; Mon, 13 Jun 2022 13:06:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lwn.net header.s=20201203 header.b=HPiyOJpD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349661AbiFMTWq (ORCPT + 99 others); Mon, 13 Jun 2022 15:22:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343931AbiFMTVg (ORCPT ); Mon, 13 Jun 2022 15:21:36 -0400 Received: from ms.lwn.net (ms.lwn.net [IPv6:2600:3c01:e000:3a1::42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C455E110B; Mon, 13 Jun 2022 10:18:08 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:281:8300:73::5f6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id 0A335736; Mon, 13 Jun 2022 17:18:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 ms.lwn.net 0A335736 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lwn.net; s=20201203; t=1655140688; bh=c6lIsFQ+NWEImD41NwrKBPBx7AxmBW0WsXXocbKtZ3Q=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=HPiyOJpDMdEGGeZSyRLvvB0lyI08Vz4LJhuP+R8C6aAeLLjgfB0h/TyvkVu5v1LNL XGicJSLAO9iuy+kEuNncqAVlORTHKxOHXvePMI4oZimAdvcTzuzhPRp9OcwVjs/tm0 H+CprU+qGn9dwV+ZAIgc12wSx6cPwDUpNHh7z09L012UqYilubpMCXmP3m7gcosqUm b9crKXu+FvsgH2vJJHJD1AuTEtCIbfk+j1+HxulpJHI2tH+wALlcVc2/jkxLyYErST +NJbsqqRLtdOq8LNy4shyWHQNXusfw6k2/lIOKeGWL15jMDjRu+aSc402EA0GCyEaD 27PPFWsecTDSQ== From: Jonathan Corbet To: Niklas =?utf-8?Q?S=C3=B6derlund?= , linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, oss-drivers@corigine.com, Niklas =?utf-8?Q?S=C3=B6derlund?= Subject: Re: [PATCH v2] scripts: kernel-doc: Always increment warnings counter In-Reply-To: <20220613090510.3088294-1-niklas.soderlund@corigine.com> References: <20220613090510.3088294-1-niklas.soderlund@corigine.com> Date: Mon, 13 Jun 2022 11:18:07 -0600 Message-ID: <87h74o1nzk.fsf@meer.lwn.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Niklas S=C3=B6derlund 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=C3=B6derlund > --- > * 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