Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4996065yba; Wed, 8 May 2019 06:23:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVRiO+NJOHxDTlOnWyhxouY6SV+Awdl2glnKLRL8C8VmjSKYNKYJXPPPROHjkYzhJFomKP X-Received: by 2002:a63:d908:: with SMTP id r8mr47263326pgg.268.1557321803723; Wed, 08 May 2019 06:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557321803; cv=none; d=google.com; s=arc-20160816; b=PMVsZxd55srwnhH8YssiDNSMdUzZLBNEvzdlHw005teQwi40ArN8KZb9wpPv17D1+1 tz7AcvCDOwr1zIkL23cNU0OMMQTeOWPC1PvHPS5wRWdbZlrR2GfBLe+IAa9SRDAdz/yh 3sVQOhjyJUxG26rl1feCbZejuwDg52yZn5mr3UgIPlNVboVxrkJ9wghWOFGPu83dsTr5 ffQMa7iaD4v28+V1KaUHGguzOaNs+wIj738cQtLnEQgp+2PJI9YDoJkw04IJX0YvxKav lHY4xGGy30OQVuwqusFN4nXE/PCyV/+5ytCFFbI+kUmEMLnM6QULSV/FH1zwp7dpT2lw II3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=jRwIoLbrgaDyISJQ98nmN4m412SakVoeJ2YGFQFGJt4=; b=J4jqrqMBh06GwiBo6Ooxnr2xaHwO5quj47dlObQjiNJOVIx/Nua5EoOjby5lVjMugr 4InrplZZo45OGh4QkZkA+2mwc+8FpFgEyVv/fV0Thouf5hCmsuAtBBm8XjsapQx5TOvP ZG9NQJ2ZlYtVa10TCXr++cF4GCiH6bdH84dZ09Kkl7SFedHSzsz30EIS5NuoNi4ZL09v pjz9J3BCfAvSn305rOowRW/2uZX+TTIOrycAjWKENy5W4QZqNx7UNeKpI5tiN5fhUdrN wS1perUEnXXi8EA1CzZkVxNZ5n65QHSHwfTPtbx1Wk5JtNOyHOlJC+lqWfVLyfud0PMf CySA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YWKUGvcA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u63si23498347pfu.88.2019.05.08.06.23.06; Wed, 08 May 2019 06:23:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=YWKUGvcA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728535AbfEHM1g (ORCPT + 99 others); Wed, 8 May 2019 08:27:36 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:55947 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727575AbfEHM1g (ORCPT ); Wed, 8 May 2019 08:27:36 -0400 Received: by mail-wm1-f66.google.com with SMTP id y2so3020072wmi.5 for ; Wed, 08 May 2019 05:27:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jRwIoLbrgaDyISJQ98nmN4m412SakVoeJ2YGFQFGJt4=; b=YWKUGvcARHmGtsDe2IWIy61tBAYUIlR0q/ANHxzU6qjDl15roJ6/YwNTeUX+l7Q7q3 PmSeV/Akcczpov3+tiMh1P5FzRQCplb+OGeMlK2SvPwAD92aCBR7jAUlpQL7Gyohs4EC dxrlhbn+sarCAXqzN9bb5/DbTfjpvmZH9r/vckPyz/J/fJOolo0kL/jdnbdVcoUK4dB1 FaUhpyDXSuvUBt+MFGR4MFs894FJgYPlkjfZyalCvAOQ7E/9ot8MnLpkjtHewTe+0DAk MJtxnQV0GTFred3OY8w98mXS5BbUy+uLgwzlZkSiJUO0Gg3F2MIAGGfbDP49k8TP8sqW 6LfA== 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=jRwIoLbrgaDyISJQ98nmN4m412SakVoeJ2YGFQFGJt4=; b=PNGVD9vHN8ucWoYHcKA7BmiYDiBjHDx49Rfa7ZbOUrLdRZynhsV/g78VC209kLt0Hf 5qaSAragOHzLhlolKoZfbvyYFr+yb+sFqiR/d0yoOPLpMccAOma6RnWaF76IEsKfjBmi Et8oXvEbv+3xP2qumtk/rAfJaZ6OLdhXCx4BOhpWcLoiI53i4hhvzqByKCdvtxE4Wq7v lxAJn6X7f1Fu1xsQ/opTXzWKKTansZTv7m1NM2daBtpULQ4EiU+Z2VtMfrLesW07qL2r BL5mJFPdZp4jcqXYSAZUEK832+WZIgH+J3uD0KRPTnPNewnCmB3b37OgVpyMKvGL9Gkd ni0A== X-Gm-Message-State: APjAAAUdSefmU2j8dzcF9ww4muSoZDPZNgHbFKdTjsVt1exLMejIfn1r vebRq6SdDfqrQu8ZxZIFkhw= X-Received: by 2002:a1c:f311:: with SMTP id q17mr2970183wmq.144.1557318454378; Wed, 08 May 2019 05:27:34 -0700 (PDT) Received: from localhost.localdomain ([2a01:e34:edb8:72e0:1074:1d8f:2a88:25e6]) by smtp.gmail.com with ESMTPSA id s124sm3217737wmf.42.2019.05.08.05.27.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 May 2019 05:27:32 -0700 (PDT) From: Antonio Borneo To: Joe Perches , Andy Whitcroft Cc: linux-kernel@vger.kernel.org Subject: [PATCH 1/4] checkpatch: fix multiple const * types Date: Wed, 8 May 2019 14:27:18 +0200 Message-Id: <20190508122721.7513-1-borneo.antonio@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 1574a29f8e76 ("checkpatch: allow multiple const * types") claims to support repetition of pattern "const *", but it actually allows only one extra instance. Check the following lines int a(char const * const x[]); int b(char const * const *x); int c(char const * const * const x[]); int d(char const * const * const *x); with command ./scripts/checkpatch.pl --show-types -f filename to find that only the first line passes the test, while a warning is triggered by the other 3 lines: WARNING:FUNCTION_ARGUMENTS: function definition argument 'char const * const' should also have an identifier name The reason is that the pattern match halts at the second asterisk in the line, thus the remaining text starting with asterisk fails to match a valid name for a variable. Fixed by replacing "?" (Match 1 or 0 times) with "*" (Match 0 or more times) in the regular expression. Fix also the similar test for types in unusual order. Signed-off-by: Antonio Borneo Fixes: 1574a29f8e76 ("checkpatch: allow multiple const * types") --- scripts/checkpatch.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a09333fd7cef..f40d4bb2fbb9 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -802,12 +802,12 @@ sub build_types { }x; $Type = qr{ $NonptrType - (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*\s*(?:const\s*)?|\[\])+|(?:\s*\[\s*\])+)? + (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*\s*(?:const\s*)?|\[\])+|(?:\s*\[\s*\])+)* (?:\s+$Inline|\s+$Modifier)* }x; $TypeMisordered = qr{ $NonptrTypeMisordered - (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*\s*(?:const\s*)?|\[\])+|(?:\s*\[\s*\])+)? + (?:(?:\s|\*|\[\])+\s*const|(?:\s|\*\s*(?:const\s*)?|\[\])+|(?:\s*\[\s*\])+)* (?:\s+$Inline|\s+$Modifier)* }x; $Declare = qr{(?:$Storage\s+(?:$Inline\s+)?)?$Type}; -- 2.21.0