Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2001163imm; Tue, 10 Jul 2018 11:22:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd4oOdFBzump4xrElcey6AKjWN31VRr/InPunNwDxIuQKXNofw31MvflhV+edmDLk/XCrC+ X-Received: by 2002:a63:735d:: with SMTP id d29-v6mr23900218pgn.156.1531246937364; Tue, 10 Jul 2018 11:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531246937; cv=none; d=google.com; s=arc-20160816; b=UvGiYV9dFo9k/9iOEw+nK5jc6mhhlq+oiWyo0W4icrXDK9k8KBEhT5sEb6k4ydek3p wiafmyux5J9O03th4cNxnytcwZXxZRCCDpdF7O4J+Mjz/P1fJ1G+CHaObKClQAkpEUfz Af9mY9ldCwEspqN48UZ26PRwrSL30NrBZ8g/gdNm58TVYAwnFwukyksm0Q7B+a8KH3ua S3BnEophRpztjEYq89WUwbWcZ3EU12nms9yKelTrcBa0zlGVLH71ucSU7z0TQUwq/0UL AB6CL1Yg4gDvnUeF7uhxeVaJzCJ1zEWlOGEfPSvWVfIxcrgvIpTr7Wt7kjbBfd+CUXJU gVcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=B/ig4ZwCh/4DT/RBiXZOzX4q7AgcdnEKukiqfEhUFyg=; b=dfxNdpLJLH7s4D/WMFs706pycHYMyPhZ4Jg37y2wIIFc+hwzZrT94my6v3ri+K8RNu cC4Md7CaSVYc3U0oZFCdq7xl0Gmb/gLswwK3+Gc0N58+FPzWVbvuACaqjVVqSk3LqsuO khjmG1N15X1mz1Pxquci7buc66D6/LRI/bNUZFLPWPRKJ5fNaEgq+wnBXwK9jj3ZsaI9 Sh0Y0iu04mBkcHeqUmBoR//mKWW4O2Sw2bqlZ1BM8N5BEZ2Sejulb9noC82f9FqmkLkb N5sxJnexmtQ0V0lSTFrcnIlhkc3HDsM8/vwQTNdSwM54/b29PkGjbQYpzu0XnNo/0PnP qk0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=CYV6ocda; dkim=pass header.i=@codeaurora.org header.s=default header.b=CYV6ocda; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bb5-v6si882318plb.480.2018.07.10.11.22.02; Tue, 10 Jul 2018 11:22:17 -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=@codeaurora.org header.s=default header.b=CYV6ocda; dkim=pass header.i=@codeaurora.org header.s=default header.b=CYV6ocda; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732551AbeGJSUZ (ORCPT + 99 others); Tue, 10 Jul 2018 14:20:25 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:41490 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732335AbeGJSUY (ORCPT ); Tue, 10 Jul 2018 14:20:24 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id CA51860B28; Tue, 10 Jul 2018 17:42:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1531244551; bh=HWR1R+yfWHRtD9g2TH4xqUg0jf9wc1D642tkpmTJReY=; h=From:To:Cc:Subject:Date:From; b=CYV6ocdanqmgXr71aARB9/ehi6/gXD3Zh1zEcSwKweObysOxWBH0i89T5R77Yq/HG QN+4s2c21uLvCdwJmmVyqOsjifZf+I1PA+qE/wOR1fKpzqVCroUZXUJ77weL6Orbt6 G5czMAqFpvqoQmP4qhkN49T3hC6L3he3gWq6/8NE= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from pheragu-linux.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: pheragu@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id EFBE260791; Tue, 10 Jul 2018 17:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1531244551; bh=HWR1R+yfWHRtD9g2TH4xqUg0jf9wc1D642tkpmTJReY=; h=From:To:Cc:Subject:Date:From; b=CYV6ocdanqmgXr71aARB9/ehi6/gXD3Zh1zEcSwKweObysOxWBH0i89T5R77Yq/HG QN+4s2c21uLvCdwJmmVyqOsjifZf+I1PA+qE/wOR1fKpzqVCroUZXUJ77weL6Orbt6 G5czMAqFpvqoQmP4qhkN49T3hC6L3he3gWq6/8NE= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org EFBE260791 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=pheragu@codeaurora.org From: Prakruthi Deepak Heragu To: apw@canonical.com, joe@perches.com Cc: linux-kernel@vger.kernel.org, tsoni@codeaurora.org, ckadabi@codeaurora.org, bryanh@codeaurora.org, Prakruthi Deepak Heragu Subject: [PATCH] checkpatch: Handle long multi-line macros better Date: Tue, 10 Jul 2018 10:42:04 -0700 Message-Id: <1531244524-16003-1-git-send-email-pheragu@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the checkpatch throws an error on long macro expressions which is more than one line i.e the opening and the closing bracket pair not being on the same line. This patch gives the dangling backslash the benefit of doubt and allows it to consider the closing paranthesis on the next line as part of the macro expression and doesn't throw an error. Signed-off-by: Prakruthi Deepak Heragu --- scripts/checkpatch.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 599ae61..158c96d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -5038,7 +5038,7 @@ sub process { if ($realfile !~ m@/vmlinux.lds.h$@ && $line =~ /^.\s*\#\s*define\s*$Ident(\()?/) { my $ln = $linenr; - my $cnt = $realcnt; + my $cnt = $realcnt - 1; my ($off, $dstat, $dcond, $rest); my $ctx = ''; my $has_flow_statement = 0; @@ -5075,6 +5075,11 @@ sub process { { } + # Extremely long macros may fall off the end of the + # available context without closing. Give a dangling + # backslash the benefit of the doubt and allow it + # to gobble any hanging close-parens. + $dstat =~ s/\(.+\\$/1/; # Flatten any obvious string concatentation. while ($dstat =~ s/($String)\s*$Ident/$1/ || $dstat =~ s/$Ident\s*($String)/$1/) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project