From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 254C1C0032E for ; Mon, 23 Oct 2023 02:37:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233191AbjJWChM (ORCPT ); Sun, 22 Oct 2023 22:37:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbjJWChK (ORCPT ); Sun, 22 Oct 2023 22:37:10 -0400 Received: from ms.lwn.net (ms.lwn.net [45.79.88.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A42819E; Sun, 22 Oct 2023 19:37:08 -0700 (PDT) Received: from localhost (mdns.lwn.net [45.79.72.68]) (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 07A55490; Mon, 23 Oct 2023 02:37:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 ms.lwn.net 07A55490 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lwn.net; s=20201203; t=1698028628; bh=R5LH3wrNSoDjy8rlap0GjBlZjbGMIoHVxyeW8u44+PA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=q4QzJ/mhX9lwVAK1yEC310AolAe+0f9Lk0E2nzvSO+juDXdxnctSahg72XzJquaOE IUHlbDMey8NOzUOh7LOGWSwpHahF1GR5o1FZ/YIpoq98uv2+nd8HtQc8SIXJsaGGYb SVvk/z/W0URYN57eWJry9T8ncklwZvTvhiJIzMx0ViZ649dBpSGGkuyOas+X8cTkHh cSBLi0gxA6ZHBWZ6EeBkmYeSnZ5N61sAy/M8uGlD9EUaFGG6ZFoZ99mQ7GriaZUJNt dEGzyiaT6m7WM28C7ztt7UwLRvMMKEyg/6p/Z15jjphLMdqyn5nHiwcpPKzXDChFsM HqLWTQv54uPpg== From: Jonathan Corbet To: Yujie Liu , linux-doc@vger.kernel.org Cc: Yujie Liu , linux-kernel@vger.kernel.org, Pierre-Louis Bossart , Randy Dunlap Subject: Re: [PATCH] scripts/kernel-doc: match -Werror flag strictly In-Reply-To: <20231019095637.2471840-1-yujie.liu@intel.com> References: <20231019095637.2471840-1-yujie.liu@intel.com> Date: Sun, 22 Oct 2023 20:37:07 -0600 Message-ID: <87r0lmjc8c.fsf@meer.lwn.net> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Yujie Liu writes: > In our CI testing, we use some commands as below to only turn a specific > type of warnings into errors, but we notice that kernel-doc warnings > are also turned into errors unexpectedly. > > $ make KCFLAGS="-Werror=return-type" W=1 kernel/fork.o > > kernel/fork.c:1406: warning: Function parameter or member 'mm' not described in 'set_mm_exe_file' > kernel/fork.c:1406: warning: Function parameter or member 'new_exe_file' not described in 'set_mm_exe_file' > kernel/fork.c:1441: warning: Function parameter or member 'mm' not described in 'replace_mm_exe_file' > kernel/fork.c:1441: warning: Function parameter or member 'new_exe_file' not described in 'replace_mm_exe_file' > kernel/fork.c:1491: warning: Function parameter or member 'mm' not described in 'get_mm_exe_file' > kernel/fork.c:1510: warning: Function parameter or member 'task' not described in 'get_task_exe_file' > kernel/fork.c:1534: warning: Function parameter or member 'task' not described in 'get_task_mm' > kernel/fork.c:2109: warning: bad line: > kernel/fork.c:2130: warning: Function parameter or member 'ret' not described in '__pidfd_prepare' > kernel/fork.c:2130: warning: Excess function parameter 'pidfd' description in '__pidfd_prepare' > kernel/fork.c:2179: warning: Function parameter or member 'ret' not described in 'pidfd_prepare' > kernel/fork.c:2179: warning: Excess function parameter 'pidfd' description in 'pidfd_prepare' > kernel/fork.c:3195: warning: expecting prototype for clone3(). Prototype was for sys_clone3() instead > 13 warnings as Errors > make[3]: *** [scripts/Makefile.build:243: kernel/fork.o] Error 13 > make[3]: *** Deleting file 'kernel/fork.o' > make[2]: *** [scripts/Makefile.build:480: kernel] Error 2 > make[1]: *** [/root/linux/Makefile:1913: .] Error 2 > make: *** [Makefile:234: __sub-make] Error 2 > > From the git history, commit 2c12c8103d8f ("scripts/kernel-doc: > optionally treat warnings as errors") introduces a new command-line > option to make kernel-doc warnings into errors. It can also read the > KCFLAGS environment variable to decide whether to turn this option on, > but the regex used for matching may not be accurate enough. It can match > both "-Werror" and "-Werror=", so the option is turned > on by mistake in the latter case. > > Fix this by strictly matching the flag "-Werror": there must be a space > or start of string in the front, and a space or end of string at the > end. This can handle all the following cases correctly: > > KCFLAGS="-Werror" make W=1 [MATCH] > KCFLAGS="-Werror=return-type" make W=1 [NO MATCH] > KCFLAGS="-Wcomment -Werror -Wundef" make W=1 [MATCH] > KCFLAGS="-Wcomment -Werror=return-type -Wundef" make W=1 [NO MATCH] > > Fixes: 2c12c8103d8f ("scripts/kernel-doc: optionally treat warnings as errors") > Signed-off-by: Yujie Liu > --- > scripts/kernel-doc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied, thanks, jon