From nobody Sat Sep 28 22:38:34 2024 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 (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1548701607894785.8358101998457; Mon, 28 Jan 2019 10:53:27 -0800 (PST) Received: from localhost ([127.0.0.1]:37005 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goC25-0002r0-UF for importer@patchew.org; Mon, 28 Jan 2019 13:53:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:41147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goBNc-00038Y-NV for qemu-devel@nongnu.org; Mon, 28 Jan 2019 13:11:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goBNb-0000WU-QI for qemu-devel@nongnu.org; Mon, 28 Jan 2019 13:11:32 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:44061) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1goBNU-0000DJ-FQ for qemu-devel@nongnu.org; Mon, 28 Jan 2019 13:11:26 -0500 Received: by mail-wr1-x433.google.com with SMTP id z5so19119715wrt.11 for ; Mon, 28 Jan 2019 10:11:11 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id b18sm97910681wrw.83.2019.01.28.10.11.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Jan 2019 10:11:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=hWVJfr9it5CUSBlRCnYp1LsmFwKpFh4z3yZ8aj5auJQ=; b=DeDavezT+C6gXDHDtTEtGqHAqJsoWDgulY3lQAFO12I1sHGGmtLCXgzJsZg2DGhMsk BJqCDNqhC5GJhUaxE5twGG/b2VoIDhaISNQz8Gf+n8SLeWSTcIOdUEJvpwMRJJPoRbRx 9OfWYVqV8tdz/HpZB/alJIXPzTTEYuaCvpCK8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hWVJfr9it5CUSBlRCnYp1LsmFwKpFh4z3yZ8aj5auJQ=; b=N/suZxdZwKyzaQ9JxzS4RjcZ26mIlLPtI4PmoNfWzSENYdPd2Eqzv7xe7tg2wZjhCJ Tm3WM0/2KiIa70j4JfrUsGxS9qYwdUXl13sL0CftvCv/X5m2lhvI1ru3hOE8qIOFBw/h b642tVFr3MN7BDKD3vz16lm28MJNgvWfPcwKNow8KkrD5OAQq84b2rPuDrqdDAWTQBSI M/vl62aqBX4og0tNKh7QpKB+/prJAB4LeSly8ZNq5BTYGaRcEIQivXbrdcpXhG1+6HAR HEVb9hv810oqY0FE63Khrk3wGKYBBviBFQkr+irb/SGXuZDPZvmYe0zYubFw8t+D8SqD dKSg== X-Gm-Message-State: AJcUukc7T8gDOIUDMqEr7OvkT8E1ucg4ApQ7huzldPPg3saPbAFVC2Va iFOKLLmqEuUzoPEWtadr+O6eclPt6zFXjw== X-Google-Smtp-Source: ALg8bN6yVMqMEVtMnj7w/H8MuWPEhNggiFXADIJUzYoMWGGpQPX2Fzry20Xd7NXBywgbUW9Sk2GPvA== X-Received: by 2002:a5d:4d87:: with SMTP id b7mr21573375wru.316.1548699070334; Mon, 28 Jan 2019 10:11:10 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 28 Jan 2019 18:10:37 +0000 Message-Id: <20190128181047.20781-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128181047.20781-1-peter.maydell@linaro.org> References: <20190128181047.20781-1-peter.maydell@linaro.org> 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::433 Subject: [Qemu-devel] [PULL 16/26] checkpatch: Don't emit spurious warnings about block comments 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: , 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. The other end of the regex is also wrong: it is attempting to check for "/* or /** followed by something that isn't just whitespace", but [ \t]*.+[ \t]* will match on pure whitespace. This is less significant but means that a line with just a comment-starter followed by trailing whitespace will generate an incorrect warning about block comment style as well as the correct error about trailing whitespace which a different checkpatch test emits. Fixes: 8c06fbdf36bf4d ("scripts/checkpatch.pl: Enforce multiline comment sy= ntax") Reported-by: Thomas Huth Reported-by: Eric Blake Signed-off-by: Peter Maydell Reviewed-by: Eric Blake Message-id: 20190118165050.22270-1-peter.maydell@linaro.org --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index d10dddf1be4..88682cb0a9f 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