From nobody Fri Nov 7 09:09:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547819313133488.8079736746637; Fri, 18 Jan 2019 05:48:33 -0800 (PST) Received: from localhost ([127.0.0.1]:39646 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkUVc-0007y6-4Q for importer@patchew.org; Fri, 18 Jan 2019 08:48:32 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46175) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkUBg-0006cF-6d for qemu-devel@nongnu.org; Fri, 18 Jan 2019 08:27:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gkUBf-0008L6-E7 for qemu-devel@nongnu.org; Fri, 18 Jan 2019 08:27:56 -0500 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:46591) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gkUBe-0008IB-DL for qemu-devel@nongnu.org; Fri, 18 Jan 2019 08:27:55 -0500 Received: by mail-wr1-x444.google.com with SMTP id l9so14988284wrt.13 for ; Fri, 18 Jan 2019 05:27:53 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id i192sm45221847wmg.7.2019.01.18.05.27.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Jan 2019 05:27:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Kxrf82mFoHxNyCVRZ1AcosWFhmoTsN+bq0vFWobFvAk=; b=b1bsvk9YM/Tjm1uBOkoarv6UR/yCI7oHdCEQlD6DRNb1nMoZYlhfCu+F+vNU/OPI4V ZEQyJrjs+KLZuNs5QcKwdKVXQlC8NWFDtLH0nrjjDROjzZsVwboWGhIUt9ZmygFIc74Q Gfu/HD+Hsyg5TC67d7nfSEU4dNfuU/4ppQ1gY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Kxrf82mFoHxNyCVRZ1AcosWFhmoTsN+bq0vFWobFvAk=; b=Vpn7VAji6dQqidrxu4iJbQfyTYgznv5NCbEKdEfFjpQHXGyUe7idv3+Ps4rJtPQD2n es6O4mRvP2Qic0R0k1wFrfp1sD1PpWmq9H0hzc7ETC/owXVA7cOyHQxKqnuGbwOpcIL8 EHMJ3nez/XLYsM7V0x6Y30dRdBQQbt3EYwgdtypO4c7eXsI5N+tkkg7lpPJlxX2PFSoW xgMXb4EX9QNzePRrB2GcQ0SoqL36/5+Za26+B4PhmgcW/lxD29bIvApf1edOC2i/Snp8 bZy7VjpmX9oopPSlgZV9aB8WtfM1w1Wbc5tAH4dMGo4Wt3qUqB1AfhtQ3SIDJrbr775x W39g== X-Gm-Message-State: AJcUukc6NjU+i/Br0v+7vYCmYE/TOS0yDxKIc6hrQA8fTp/yzuHI21yp E3uUZ2PSe9AsWsCBhyoDdwmFfnTd2t7diA== X-Google-Smtp-Source: ALg8bN671qdVzz2AuNr0JKriWs9w7R0z4BWKNOrBWcrQ47a9eWSee7aiVVA52UxFDVgzeyyP/dPUCA== X-Received: by 2002:adf:fd03:: with SMTP id e3mr15827372wrr.280.1547818072255; Fri, 18 Jan 2019 05:27:52 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 18 Jan 2019 13:27:50 +0000 Message-Id: <20190118132750.25932-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::444 Subject: [Qemu-devel] [PATCH] checkpatch: Don't spuriously warn about /** comment starters X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Reported-by : Thomas Huth" , patches@linaro.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" In checkpatch we attempt to check for and warn about block comments which start with /* or /** followed by a non-blank. Unfortunately a bug in the regex meant that we would incorrectly warn about comments starting with "/**" with no following text: git show 9813dc6ac3954d58ba16b3920556f106f97e1c67|./scripts/checkpatch.pl= - WARNING: Block comments use a leading /* on a separate line #34: FILE: tests/libqtest.h:233: +/** The sequence "/\*\*?" was intended to match either "/*" or "/**", but Perl's semantics for '?' allow it to backtrack and try the "matches 0 chars" option if the "matches 1 char" choice leads to a failure of the rest of the regex to match. Switch to "/\*\*?+" which uses what perlre(1) calls the "possessive" quantifier form: this means that if it matches the "/**" string it will not later backtrack to matching just the "/*" prefix. Reported-by: Thomas Huth Signed-off-by: Peter Maydell Reviewed-by: Eric Blake --- This comment check is unique to QEMU checkpatch so the bug doesn't exist in the Linux version. --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d10dddf1be4..5f1ec537d21 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -1624,7 +1624,7 @@ sub process { =20 # Block comments use /* on a line of its own if ($rawline !~ m@^\+.*/\*.*\*/[ \t]*$@ && #inline /*...*/ - $rawline =3D~ m@^\+.*/\*\*?[ \t]*.+[ \t]*$@) { # /* or /** non-blank + $rawline =3D~ m@^\+.*/\*\*?+[ \t]*.+[ \t]*$@) { # /* or /** non-blank WARN("Block comments use a leading /* on a separate line\n" . $herecurr= ); } =20 --=20 2.20.1