lkml.org 
[lkml]   [2017]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] checkpatch: Add a warning for log messages that don't end in a new line


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

\
 
 \ /
  Last update: 2017-11-27 23:58    [W:0.091 / U:0.820 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site