From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751312AbdK0GIb (ORCPT ); Mon, 27 Nov 2017 01:08:31 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:13413 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750773AbdK0GIa (ORCPT ); Mon, 27 Nov 2017 01:08:30 -0500 X-IronPort-AV: E=Sophos;i="5.44,463,1505772000"; d="scan'208";a="302580287" Date: Mon, 27 Nov 2017 07:08:28 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Joe Perches cc: Logan Gunthorpe , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Andy Whitcroft Subject: Re: [PATCH v2] checkpatch: Add a warning for log messages that don't end in a new line In-Reply-To: <1511745165.20482.34.camel@perches.com> Message-ID: References: <20171126054037.9743-1-logang@deltatee.com> <1511676085.20482.18.camel@perches.com> <5c0a2778-8e8f-9fbb-b13f-1d880acb949b@deltatee.com> <1511735382.20482.27.camel@perches.com> <1511745165.20482.34.camel@perches.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) 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 On Sun, 26 Nov 2017, Joe Perches wrote: > On Sun, 2017-11-26 at 23:44 +0100, Julia Lawall wrote: > > My semantic patch and results are below. The semantic patch has some > > features that may or may not be desired: > > > > 1. It goes beyond printk, pr_xxx, dev_xxx, and netdev_xxx, by finding > > functions that are sometimes used with a format string ending with a > > newline. To reduce false positives, such a function is ignored if it is > > sometimes used with a string that ends in a space. This could lead to > > false positives where actually one of the calls has a \n that it should > > not have. > > > > 2. Coccinelle puts multipart strings on a single line. So the rule goes > > a little further and eliminates the multipartness. Basically "xxx " "yyy" > > becomes "xxx yyy" regardless of the length of the result. > > What about the semi-common string concatenation "foo" #var "bar" ? I don't think this is an issue. There is no " " pattern in this. It's true that if the pieces were on separate lines, Coccinelle will now put them on a single line. I'm not sure I want to bother with this. > > 3. Some prints appear not to end with a newline because they end with \n. > > where .\n was likely intended. Instead of creating \n.\n, the semantic > > patch just moves the .to the left of the . And if there was .\n. it just > > drops the final period. > > That may be a problem if the sentence is "something...\n" I think I was not clear. The sentence ends in ".\n.". > There seem to be many false positives in here too. Could you point to something specifically? I saw a lot of cases with prints followed by returns and gotos. I guess those are not likely false positives. julia