From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51501) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIkA5-0002ma-Rx for qemu-devel@nongnu.org; Mon, 11 Jan 2016 16:38:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIkA2-0005R1-MS for qemu-devel@nongnu.org; Mon, 11 Jan 2016 16:38:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49163) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIkA2-0005Qv-Ga for qemu-devel@nongnu.org; Mon, 11 Jan 2016 16:37:58 -0500 From: Markus Armbruster References: <1449858642-24267-1-git-send-email-jjherne@linux.vnet.ibm.com> Date: Mon, 11 Jan 2016 22:37:54 +0100 In-Reply-To: <1449858642-24267-1-git-send-email-jjherne@linux.vnet.ibm.com> (Jason J. Herne's message of "Fri, 11 Dec 2015 13:30:42 -0500") Message-ID: <87a8obssp9.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2] checkpatch: Detect newlines in error_report and other error functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Jason J. Herne" Cc: blauwirbel@gmail.com, cornelia.huck@de.ibm.com, qemu-devel@nongnu.org "Jason J. Herne" writes: > We don't want newlines embedded in error messages. This seems to be a common > problem with new code so let's try to catch it with checkpatch. > > This will not catch cases where newlines are inserted into the middle of an > existing multi-line statement. But those cases should be rare. > > Signed-off-by: Jason J. Herne > --- > scripts/checkpatch.pl | 39 +++++++++++++++++++++++++++++++++++++++ > 1 file changed, 39 insertions(+) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index b0f6e11..51ea667 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -2511,6 +2511,45 @@ sub process { > WARN("use QEMU instead of Qemu or QEmu\n" . $herecurr); > } > > +# Qemu error function tests > + > + # Find newlines in error function text > + my $qemu_error_funcs = qr{error_setg| > + error_setg_errno| > + error_setg_win32| > + error_set| The following three... > + error_vprintf| > + error_printf| > + error_printf_unless_qmp| ... may legitimately print newlines. Dropped them in my tree. > + error_vreport| > + error_report}x; > + > + if ($rawline =~ /\b(?:$qemu_error_funcs)\s*\(\s*\".*\\n/) { > + WARN("Error function text should not contain newlines\n" . $herecurr); > + } [...]