checkpatch: Fix newline detection in error_setg() & friends
authorMarkus Armbruster <armbru@redhat.com>
Wed, 3 Aug 2016 11:37:52 +0000 (13:37 +0200)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 8 Aug 2016 07:01:08 +0000 (09:01 +0200)
Commit 5d596c2's regexp assumes the error message string is the first
argument.  Correct for error_report(), wrong for all the others.
Relax the regexp to match newline in anywhere.  This might cause
additional false positives.

While there, update the list of error_reporting functions.

Cc: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1470224274-31522-3-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
scripts/checkpatch.pl

index b7cb4ab4787d0b2d97050eae6470f88a4ea50d4d..92970872129988b71c798eb80c4d8bf502c22750 100755 (executable)
@@ -2514,11 +2514,14 @@ sub process {
        my $qemu_error_funcs = qr{error_setg|
                                error_setg_errno|
                                error_setg_win32|
+                               error_setg_file_open|
                                error_set|
+                               error_prepend|
+                               error_reportf_err|
                                error_vreport|
                                error_report}x;
 
-       if ($rawline =~ /\b(?:$qemu_error_funcs)\s*\(\s*\".*\\n/) {
+       if ($rawline =~ /\b(?:$qemu_error_funcs)\s*\(.*\".*\\n/) {
                WARN("Error messages should not contain newlines\n" . $herecurr);
        }