Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2993044AbbEEOJH (ORCPT ); Tue, 5 May 2015 10:09:07 -0400 Received: from hofr.at ([212.69.189.236]:48319 "EHLO mail.hofr.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752915AbbEEOI6 (ORCPT ); Tue, 5 May 2015 10:08:58 -0400 Date: Tue, 5 May 2015 16:08:57 +0200 From: Nicholas Mc Guire To: Andy Whitcroft Cc: Nicholas Mc Guire , Joe Perches , linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC] checkpatch: flag split arithmetic operations with CHECK Message-ID: <20150505140857.GA20288@opentech.at> References: <1430816016-24427-1-git-send-email-hofrat@osadl.org> <20150505094109.GA3654@bark> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150505094109.GA3654@bark> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2182 Lines: 47 On Tue, 05 May 2015, Andy Whitcroft wrote: > On Tue, May 05, 2015 at 10:53:36AM +0200, Nicholas Mc Guire wrote: > > Simple arithmetic operations should be on one line, if they can be fit, > > rather than splitting at the operator. As this is not in the CodingStyle it > > is limited to --strict use of checkpatch.pl and emits a CHECK only. > > > > Signed-off-by: Nicholas Mc Guire > > --- > > > > Patches by people like me splitting arithmetic operations, e.g.: > > hdw->encoder_run_timer.expires = jiffies + > > msecs_to_jiffies(TIME_MSEC_ENCODER_OK); > > were flagged by Joe Perches but checkpatch.pl was not fussing, not even > > with --strict. This extension should flag such lines as CHECK only, as > > this is not mandated by the CodingStyle and in some cases they are > > justified (e.g. kernel/sched/fair.c:760 and a few other examples in that > > file) > > > > Limitation: this is for + and - only still have to figure out some false > > positives for the * and /, % ($Arithmetic) case. > > I assume that these relate to being able to confirm the variant of the > operator, unary/binary etc. If you look for "annotate_values", after > that is run there is additional information for each character of the > current line, tracking the type of the operator. This is used when > determining spacing for + etc later as unary ones are typically tight > bound and binary ones spaced out. You might find that useful, if that > is your issue. And indeed you might find it useful for determining if > the +/- you find at line end is indeed unary. Running with --debug > values=1 should dump out the variants information for those. > thanks - looks like a useful (somewhat cryptic) starting point 15 > . x = y - x 15 > EEEVVNNVVNNTTT 15 > ________B____ will give it a try to generalize it for all basic binary operators. thx! hofrat -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/