Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp227036pxb; Fri, 5 Mar 2021 20:52:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzKaAgPv+J014y09EDgpCH08NH2AW/Xz4xi4cJppaYEHv3jdWQ+zdelgzRzgQBjlaVLKp+H X-Received: by 2002:aa7:c403:: with SMTP id j3mr12306617edq.137.1615006355157; Fri, 05 Mar 2021 20:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615006355; cv=none; d=google.com; s=arc-20160816; b=a7n23/sTWhghBzoMB1cZt9/pcYUuPqDhUARx8x+mbG1JEdwWQ8+qnH1RA1G/lugUct YC8t3vZMJ5boPTipJ5uoRr2Qy6oHyYMTOQLw/0Yfiu8SEHgHfHMCjv7311PCTxq+dyXw qD2cCARewZFIa/k7XnfljLcnRb9kCmqBOVUqJKNqbifD1XA0gwXCrc99tmMnr7GsbF4J FOH75rq12ovrmEbQ+OWebzOlBkWzNTio6Ql3Lh01CICpO4+fiJ7xp1Vfj5YG6zKQTK+d wDMcd5rYrQisRRFpKmjQx4odenq65W0inKTaSdlhSNkOS0rzqIImbG2v6/c6XD2Nz50x xFyQ== 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; bh=SfZrZCdEKGy0y/GWdwSAxBccTFEmSrH7Ci7vQIzOxzs=; b=JNEst+Ny0GrgqClO1Rh6Dc0+icYhg9DShSBc9a3FshlJvW3OxYJDGfmwLRDxVmsvc0 OrUIdkcVKtzFTLLxRThuWE8w/GLurcaHiw21JPWSJiRacyouvQwf86kktlLFjrSVywid UixdUzmkuvVLRCdDIIVWhYJ4R1KPb4toogpcg5pc7SBX9T7i3ta6W8WBNhpoGwGUWOyM gQHaxODYdPuz2/aCt8Po4F15O8PQOXnqIPq6cY9j5AHty1iAMnA4MFlMp5WSSLylI/QK /Grk9RFt6rPzfy5zfZS3y8SJIcYahaHzJ8NU8+zcezqymvE1EjOk7N5RWy5hbe1A+9Zy xkKg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d19si2686943edt.189.2021.03.05.20.52.05; Fri, 05 Mar 2021 20:52:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229701AbhCFEsi (ORCPT + 99 others); Fri, 5 Mar 2021 23:48:38 -0500 Received: from smtp08.smtpout.orange.fr ([80.12.242.130]:29193 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbhCFEsh (ORCPT ); Fri, 5 Mar 2021 23:48:37 -0500 Received: from localhost.localdomain ([153.202.107.157]) by mwinf5d16 with ME id csoL2400H3PnFJp03soXCj; Sat, 06 Mar 2021 05:48:34 +0100 X-ME-Helo: localhost.localdomain X-ME-Auth: bWFpbGhvbC52aW5jZW50QHdhbmFkb28uZnI= X-ME-Date: Sat, 06 Mar 2021 05:48:34 +0100 X-ME-IP: 153.202.107.157 From: Vincent Mailhol To: Andy Whitcroft , Joe Perches , linux-kernel@vger.kernel.org Cc: Vincent Mailhol Subject: [PATCH v1] checkpatch: exclude four preprocessor sub-expressions from MACRO_ARG_REUSE Date: Sat, 6 Mar 2021 13:48:13 +0900 Message-Id: <20210306044813.68510-1-mailhol.vincent@wanadoo.fr> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __must_be_array, offsetof, sizeof_field and __stringify are all preprocessor macros and do not evaluate their arguments. As such, it is safe not to warn when arguments are being reused in those four sub-expressions. Exclude those so that they can pass checkpatch. Signed-off-by: Vincent Mailhol --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index df8b23dc1eb0..25ee4fd5b118 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -5736,7 +5736,7 @@ sub process { next if ($arg =~ /\.\.\./); next if ($arg =~ /^type$/i); my $tmp_stmt = $define_stmt; - $tmp_stmt =~ s/\b(sizeof|typeof|__typeof__|__builtin\w+|typecheck\s*\(\s*$Type\s*,|\#+)\s*\(*\s*$arg\s*\)*\b//g; + $tmp_stmt =~ s/\b(__must_be_array|offsetof|sizeof|sizeof_field|__stringify|typeof|__typeof__|__builtin\w+|typecheck\s*\(\s*$Type\s*,|\#+)\s*\(*\s*$arg\s*\)*\b//g; $tmp_stmt =~ s/\#+\s*$arg\b//g; $tmp_stmt =~ s/\b$arg\s*\#\#//g; my $use_cnt = () = $tmp_stmt =~ /\b$arg\b/g; -- 2.26.2