Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753256AbbL2KTj (ORCPT ); Tue, 29 Dec 2015 05:19:39 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:36969 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753125AbbL2KTf (ORCPT ); Tue, 29 Dec 2015 05:19:35 -0500 X-IronPort-AV: E=Sophos;i="5.20,494,1444687200"; d="scan'208";a="194874593" Date: Tue, 29 Dec 2015 11:19:26 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Andrey Utkin cc: Mauro Carvalho Chehab , Greg KH , "linux-kernel@vger.kernel.org" , kernel-janitors , "kernel-mentors@selenic.com" , Linux Media , devel@driverdev.osuosl.org, andrey.od.utkin@gmail.com, Andy Whitcroft , Joe Perches Subject: Re: On Lindent shortcomings and massive style fixing In-Reply-To: Message-ID: References: <20151228153332.GA6159@kroah.com> <20151229053235.1d2ccb9c@recife.lan> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3900 Lines: 86 On Tue, 29 Dec 2015, Andrey Utkin wrote: > On Tue, Dec 29, 2015 at 9:32 AM, Mauro Carvalho Chehab > wrote: > > IMHO, there are two problems by letting indent breaking long > > lines: > > > > 1) indent would break strings on printks. This is something that we don't > > want to break strings on multiple lines in the Kernel; > > Yeah, GNU indent does its work badly (although I believe it could be > taught to respect long literals), this makes me want to have a better > tool for clean "relayouting" C code. > I believe that'd require at last a proper syntax parser. With such > tool, it would be straightforward to rewrite source code automatically > to please any demanding reviewer of code style, except for issues of > higher level of thought (like naming or nesting limitations). > > > 2) It doesn't actually solve the problem of having too complex loops, > > with is why the 80 columns warning is meant to warn. Worse than that, > > if a piece of code is inside more than 4 or 5 indentation levels, the > > resulting code of using indent for 80-cols line break is a total crap. > > Then I'd propose to enforce nesting limitation explicitly, because > Documentation/CodingStyle appreciates low nesting, just doesn't give > exact numbers. > It's better this way, because the programmer could pay attention to N > places of excessive nesting and fix it manually, and then carelessly > reformat NNN places of "80 chars" issues automatically, comparing to > reviewing all NNN places, to figure out if there's excessive nesting, > or not. > (CCed checkpatch.pl maintainers.) Personally, I prefer to see only 80 characters per line, as long as it doesn't require contorting the code in some other way. So perhaps not everyone would agree that the issue is only the amount of nesting. julia > > That's said, on a quick look at the driver, it seems that the 80-cols > > violations are mostly (if not all) on the comments, like: > > > > int i_poc_lsb = (frame_seqno_in_gop << 1); /* why multiplied by two? TODO try without multiplication */ > > > > and > > > > #define TW5864_UNDEF_REG_0x0224 0x0224 /* Undeclared in spec (or not yet added to tw5864-reg.h) but used */ > > #define TW5864_UNDEF_REG_0x4014 0x4014 /* Undeclared in spec (or not yet added to tw5864-reg.h) but used */ > > #define TW5864_UNDEF_REG_0xA800 0xA800 /* Undeclared in spec (or not yet added to tw5864-reg.h) but used */ > > > > Btw, the content of tw5864-reg-undefined.h is weird... Why not just > > add the stuff there at tw5864-reg.h and remove the comments for all > > defines there? > > tw5864-reg-undefined.h will be edited for sure (maybe dropped), of > course it won't stay as it is now. > It was generated by script during reverse-engineering that bastard > chip from hell. > > > Also, Lindent already did some crappy 80-cols like breaks, like: > > > > static int pci_i2c_multi_read(struct tw5864_dev *dev, u8 devid, u8 devfn, u8 *buf, > > u32 count) > > > > (count is misaligned with the open parenthesis) > > I just added "static " after indenting. > Actually, Documentation/CodingStyle says nothing about alignment of > function declaration tail on open parenthesis. > Also I'd like to mention that I hate such alignment, because it > requires intermixing of tabs and spaces. I am not aware if this is K&R > thing or not. If it is, then please don't kill me. > > Thanks for kind replies, gentlemen. > -- > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- 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/