On Tue, Dec 29, 2015 at 9:32 AM, Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxx> 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.) > 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@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html