Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2598124rdh; Mon, 30 Oct 2023 01:59:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGsx84HcXyO8pofWBuvNJLiGKqjFwj1DdBpRULX5lGJHaJE+SU+MvT4KNqAkDsykv+s+xAP X-Received: by 2002:a17:90b:2348:b0:27d:75f2:a3ee with SMTP id ms8-20020a17090b234800b0027d75f2a3eemr5975999pjb.10.1698656344654; Mon, 30 Oct 2023 01:59:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698656344; cv=none; d=google.com; s=arc-20160816; b=gS+auIy/egziQxFyR/bAmVyjCWhVzziieVFjNqfVqFw19evUQMt2cSSj3Zjtgtuh24 WpCeCbDMvP7jrGI2oJZ/iwBybjq57B4RFtN/vqSRYtsanKRPQ8DyNew5dCBWpYr7GzMX y0B/CPhe7k4Ro8Hl4tBaS4SHU+ZlTKTRxTevM1W/2xI80TT6nhju2YmKZSYVFb3fo5wT WWc0J5/VHAfMQECmJ4uuQIGU9ZKxeoWxVFEFFeGyyTkHTU7JiGAcI86lgX3HCARWek0J tnZjvcKg2ZZRoKs8C+1mSTxarSLETydPuYU56g7HOJanXgos+xLLQNZIO22qQBPgWQ+T A1kQ== 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:subject:cc:to:from:dkim-signature; bh=tDGMXIWgklOiUSWDzG3kHzBK7om/ceHJgJDmuHMIp8Y=; fh=0aXEZc5OystviI4g2/CFMt22M8eB1PqsASCFlLu5MLQ=; b=JUEX+JAT6kxBxVYU7VHTCEzKZm/ihIBAxlO9mOL9T1++ahSPd/mZCl0RmmhDSqpNo7 pT1zBeoqDoBdWx2rTTGBLL9EaI37V2miT7Ue4Gk5Ry5XaVd0rUmRu56v5HofxtCyl+hl ZrKWHrxfJ+2TbLNPxkeWFp7jJGE6stbXe3r0xQyqzCQ16z3hQDOEMEgEKjJP8aGM3tXM PZAl6eEQNn6DCsU7YFWdfLsG79UVgxU5v60mhZVh8IFNQOd0JnNKeQgvMRlsCWox+T8d UxrMIxUN0Fi07ZNxG7y81VFvnBlkuSQlCvjNxW7lzJqkkoUlzdOLlatZnYTGMOctTaSZ g4NA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AKTMWcoo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id r9-20020a17090aad0900b002808736e2b3si164906pjq.142.2023.10.30.01.59.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 01:59:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AKTMWcoo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 668FC80A7776; Mon, 30 Oct 2023 01:59:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232321AbjJ3I6v (ORCPT + 99 others); Mon, 30 Oct 2023 04:58:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231467AbjJ3I6t (ORCPT ); Mon, 30 Oct 2023 04:58:49 -0400 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 372F794; Mon, 30 Oct 2023 01:58:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698656328; x=1730192328; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=iWVbjdypmwEuC8THWSop88+8PL4MTuv4dODLuKVqSkc=; b=AKTMWcoozSVUEg8Jd6C1dS5QAoVi8kibqBfpBXhOG9iRMjn6Q/WAUO16 gGNxy4HyzRzrLu/NdqoC3sUF67esdIyXQrjBEPR5YX+QZzRNaCR5fmM1G S5lKI5IoaHvtPjgykWnljkaW9BCYeoC75nfZZrSFI933vVMZPlI6jy47O G8ezhUZQmsRHMFNFgY5YYpTo0UYbT5l1nj5yIkzlewyL7jl2rS0C6qmgw 3XBMx4nuYRMcRW7maHW/rwHz3xrjSsuzPuvAfEMbUrzyAdUGbmVUhdPF9 CpOFr/6IBeJ1TAtu044e0XTWVM4z/4ocgzwZY/S7RadmaQB7uxBtBa+TS w==; X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="6670971" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="6670971" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 01:58:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10878"; a="736681128" X-IronPort-AV: E=Sophos;i="6.03,263,1694761200"; d="scan'208";a="736681128" Received: from yujie-x299.sh.intel.com ([10.239.159.77]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2023 01:58:45 -0700 From: Yujie Liu To: linux-doc@vger.kernel.org, Jonathan Corbet Cc: linux-kernel@vger.kernel.org, Swarup Laxman Kotiaklapudi , Akira Yokosawa Subject: [PATCH] scripts/kernel-doc: Fix the regex for matching -Werror flag Date: Mon, 30 Oct 2023 16:54:04 +0800 Message-Id: <20231030085404.3343403-1-yujie.liu@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 30 Oct 2023 01:59:02 -0700 (PDT) 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; } } -- 2.34.1