qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2] checkpatch: Detect newlines in error_report


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v2] checkpatch: Detect newlines in error_report and other error functions
Date: Mon, 11 Jan 2016 22:37:54 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

"Jason J. Herne" <address@hidden> 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 <address@hidden>
> ---
>  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);
> +     }
[...]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]