Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2867768rdh; Mon, 30 Oct 2023 09:53:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE7fzBGunry1WVaQT4vDve0x4j335QeZnt2BNh2IjnNCUSkrwbNnGDX9eoObRlMNvo3iWaK X-Received: by 2002:a17:90a:9c6:b0:278:f907:719d with SMTP id 64-20020a17090a09c600b00278f907719dmr6117197pjo.48.1698684810112; Mon, 30 Oct 2023 09:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698684810; cv=none; d=google.com; s=arc-20160816; b=i7HwbKXRhs/MuSoXMzd+5eteLdVxIZQP2HqZQ+04/asVEt//hpYO5waep9LTobr16c UWWp5m3eHpgrFC0zvmBc3fEZIiEFlb11eFKOyWrw7wJ8/3BdYGOJSjS2nYtRE7JYhKTc pUkKFO44fLln0fFUep57MQCfDqV0jay5m4LYWqAVDH0yaUnYKAvRvbrxUMLT+aoL59WY f/33ePblC2yWw923AKNmv8jRzrq/+VI/vLC+p+vK1GGogLvEvngMDjwV89/3Y0r3EC2s Z0HpBvy6rm1jNvd2p3ah7DdLClodpoFyKmc9tdYubKiwMiqEg5HzAyPuxmUExIjWzPIn SymQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature:dkim-filter; bh=QRgAQrH62j72CYNaUq0Va4PHddd9yeJq/c0nZSGCl18=; fh=rO5I1WEn4PsEvLfSG8az5u5hqr/mf6lhqJa4iw4PeTk=; b=vtFfHE6LHR8EQ2CQ5GrIG7jwh5I3RCKMKxKjMJc4J/RDMYTE8CLHBguyMC0n16z41L OkyopKJlA8D+QYJnlT8HC82YEPH/GrElSaIvzK6KyKn7wu1ZBlX52joRgVnM9XHD30Nx GbCMe1/GF5OWWNHzf4LwX++4dpXYElsDqPYpUItBVkSdIoxY6nQgvvDc42Zn+6aFezOf HWJ1WqfwZWGgnVFFmqSSo3KHE80A4wK5BEkHTu2E285FwwnzAXdPKKk53O25lekWTC4u 6p/diPN84b0T5mih+WDxtfVB/pTyAvtpNM6yb9/z+OUMGfHFv8ZtFqZavN04EA2Ah2jX UhJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lwn.net header.s=20201203 header.b=VlIQ4m6G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id h21-20020a17090ac39500b002800b0fa4f2si4114615pjt.104.2023.10.30.09.53.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 09:53:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@lwn.net header.s=20201203 header.b=VlIQ4m6G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 66C3E8065CB9; Mon, 30 Oct 2023 09:53:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233249AbjJ3QxT (ORCPT + 99 others); Mon, 30 Oct 2023 12:53:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231919AbjJ3QxS (ORCPT ); Mon, 30 Oct 2023 12:53:18 -0400 Received: from ms.lwn.net (ms.lwn.net [IPv6:2600:3c01:e000:3a1::42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29ADCF1; Mon, 30 Oct 2023 09:53:13 -0700 (PDT) Received: from localhost (unknown [IPv6:2601:281:8300:73::646]) (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 57AED377; Mon, 30 Oct 2023 16:53:13 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 ms.lwn.net 57AED377 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lwn.net; s=20201203; t=1698684793; bh=QRgAQrH62j72CYNaUq0Va4PHddd9yeJq/c0nZSGCl18=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=VlIQ4m6GMC9A9wm4x6Q4yiBb10yt7WmKGqvrkrY1o4P2bNUPfhCGd73CEBEuJd6+j ObpQyw5M9JoNTKJ2hxSqf3QVFCFq4RpPwVMJH4D7yAkFChgZyCcwB52/JqexxsND4r K+Mp6tpToHsOpq61JtByWWHxEWbt7u/d9IpMV7M+Iw20H9LYzhh15dJljifbpmXRvw 2fGUo+fSPNqwwG1LN5bjmaSGIYRJbswJzND4XFqTezBzXuJpyfHYEnhy/AzfPqL4tV BrO//5IZl6SG/B9VVtgVn8oH6GV32Hma/ay/js1HCN6OgawbWEMcgbz7gKjEvjWJL8 X4FT/P5MR5QXA== From: Jonathan Corbet To: Yujie Liu , linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Swarup Laxman Kotiaklapudi , Akira Yokosawa Subject: Re: [PATCH] scripts/kernel-doc: Fix the regex for matching -Werror flag In-Reply-To: <20231030085404.3343403-1-yujie.liu@intel.com> References: <20231030085404.3343403-1-yujie.liu@intel.com> Date: Mon, 30 Oct 2023 10:53:12 -0600 Message-ID: <87il6o3vd3.fsf@meer.lwn.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 30 Oct 2023 09:53:27 -0700 (PDT) Yujie Liu writes: > Swarup reported a "make htmldocs" warning: > > Variable length lookbehind is experimental in regex; > marked by <-- HERE in m/(?<=^|\s)-Werror(?=$|\s) > <-- HERE / at ./scripts/kernel-doc line 188. > > Akira managed to reproduce it by perl v5.34.0. > > On second thought, it is not necessary to have the complicated > "lookahead and lookbehind" things, and the regex can be simplified. > > Generally, the kernel-doc warnings should be considered as errors only > when "-Werror" flag is set in KCFLAGS, but not when > "-Werror=" is set, which means there needs to be a > space or start of string before "-Werror", and a space or end of string > after "-Werror". > > The following cases have been tested to work as expected: > > * kernel-doc warnings are considered as errors: > > $ KCFLAGS="-Werror" make W=1 > $ KCFLAGS="-Wcomment -Werror" make W=1 > $ KCFLAGS="-Werror -Wundef" make W=1 > $ KCFLAGS="-Wcomment -Werror -Wundef" make W=1 > > * kernel-doc warnings remain as warnings: > > $ KCFLAGS="-Werror=return-type" make W=1 > $ KCFLAGS="-Wcomment -Werror=return-type" make W=1 > $ KCFLAGS="-Werror=return-type -Wundef" make W=1 > $ KCFLAGS="-Wcomment -Werror=return-type -Wundef" make W=1 > > The "Variable length lookbehind is experimental in regex" warning is > also resolved by this patch. > > Fixes: 91f950e8b9d8 ("scripts/kernel-doc: match -Werror flag strictly") > Reported-by: Swarup Laxman Kotiaklapudi > Cc: Akira Yokosawa > Signed-off-by: Yujie Liu > --- > scripts/kernel-doc | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/kernel-doc b/scripts/kernel-doc > index d660e1f4b483..08a3e603db19 100755 > --- a/scripts/kernel-doc > +++ b/scripts/kernel-doc > @@ -185,7 +185,7 @@ if (defined($ENV{'KBUILD_VERBOSE'}) && $ENV{'KBUILD_VERBOSE'} =~ '1') { > if (defined($ENV{'KCFLAGS'})) { > my $kcflags = "$ENV{'KCFLAGS'}"; > > - if ($kcflags =~ /(?<=^|\s)-Werror(?=$|\s)/) { > + if ($kcflags =~ /(\s|^)-Werror(\s|$)/) { > $Werror = 1; OK, I've applied this one and will sneak it into the 6.7 pull request, thanks. jon