Re: [PATCH v2] checkpatch: Add a warning for log messages that don't end in a new line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 27/11/17 01:49 PM, Julia Lawall wrote:
Perhaps if there is a possible flow from one print to another within a
single function and in both cases the format string is at least say 25
characters (completely random value), then it is pretty likely that a
newline is intended.

This is on the edge of what I think could be done with checkpatch. I did a quick look through some of the cases I've noticed and haven't found any that this wouldn't pass. I'm not sure how you'd pick an appropriate threshold though. I do think it's quite clever, though.

Alternatively, if the first format string doesn't end in a space and the
second one doesn't begin with a space, then a newline is also likely
intended.

This makes more sense to me but I don't expect it to be 100% accurate either. See, for example, drivers/char/dtlk.c:640 which has no space in either printk. You could maybe expand the rule to include ':' and '(' as the last character.

Logan
--
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



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux