From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E687C56202 for ; Tue, 17 Nov 2020 15:58:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD48224655 for ; Tue, 17 Nov 2020 15:58:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726743AbgKQP6X (ORCPT ); Tue, 17 Nov 2020 10:58:23 -0500 Received: from smtprelay0003.hostedemail.com ([216.40.44.3]:36376 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725767AbgKQP6X (ORCPT ); Tue, 17 Nov 2020 10:58:23 -0500 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id 56C59182CF66C; Tue, 17 Nov 2020 15:58:22 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: push88_2a0d62927332 X-Filterd-Recvd-Size: 1813 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf12.hostedemail.com (Postfix) with ESMTPA; Tue, 17 Nov 2020 15:58:21 +0000 (UTC) Message-ID: <756a22eddf82cbbdcdfe5bef1735154d123cd081.camel@perches.com> Subject: Re: [PATCH v2] checkpatch: add fix option for ASSIGNMENT_CONTINUATIONS From: Joe Perches To: Aditya Srivastava Cc: linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org, lukas.bulwahn@gmail.com Date: Tue, 17 Nov 2020 07:58:20 -0800 In-Reply-To: <20201117105237.757-1-yashsri421@gmail.com> References: <20201117105237.757-1-yashsri421@gmail.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-11-17 at 16:22 +0530, Aditya Srivastava wrote: > Currently, checkpatch warns us if an assignment operator is placed > at the start of a line and not at the end of previous line. [] > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -3542,8 +3542,14 @@ sub process { >   > >  # check for assignments on the start of a line >   if ($sline =~ /^\+\s+($Assignment)[^=]/) { > - CHK("ASSIGNMENT_CONTINUATIONS", > - "Assignment operator '$1' should be on the previous line\n" . $hereprev); > + my $operator = $1; > + if (CHK("ASSIGNMENT_CONTINUATIONS", > + "Assignment operator '$1' should be on the previous line\n" . $hereprev) && > + $fix && $prevrawline =~ /^\+/) { > + # add assignment operator to the previous line, remove from current line > + $fixed[$fixlinenr - 1] .= " $operator"; > + $fixed[$fixlinenr] =~ s/$operator\s*//; As $operator could be a division, I believe it needs to be quoted.